#include "METOOLS/Explicit/Current.H" #include "METOOLS/Currents/C_Scalar.H" /*! @file S_C.C @brief Implements the class CS. */ namespace METOOLS { template class CS: public Current, public Current_Contractor { public: typedef std::complex SComplex; typedef std::vector SComplex_Vector; typedef CScalar CScalarType; typedef std::vector CScalarType_Vector; protected: /// @brief squared mass of the propagator SComplex m_cmass2; /// @brief returns the label for the graph output std::string CLabel() const; public: /// @brief constructor using Current_Key key CS(const Current_Key &key); /// @brief constructs current void ConstructJ(const ATOOLS::Vec4D &p,const int ch, const int cr,const int ca,const int mode); /// @brief sets the gauge vector void SetGauge(const ATOOLS::Vec4D &k); /// @brief adds the propagator to the current void AddPropagator(); /// @brief contracts a current void SContract (const Current &c,const Int_Vector &pols, SComplex_Vector &ress,const size_t &offset) const; /// @brief formats the current into a string std::string Format(const CObject *c) const; /// @brief returns the current type char Type() const; };// end of class CS /*! @class CS @brief This class represents a scalar current. This class represents a scalar current. */ }// end of namespace METOOLS #include "METOOLS/Explicit/Vertex.H" #include "METOOLS/Explicit/Dipole_Kinematics.H" #include "ATOOLS/Org/Message.H" #include "ATOOLS/Org/Exception.H" #include "ATOOLS/Org/STL_Tools.H" #include "ATOOLS/Org/MyStrStream.H" #define M_I SComplex(0.0,1.0) using namespace METOOLS; using namespace ATOOLS; template CS::CS(const Current_Key &key): Current(key) { m_cmass2=SComplex(sqr(this->m_mass),-this->m_mass*this->m_width); } template void CS::ConstructJ(const ATOOLS::Vec4D &p,const int ch, const int cr,const int ca,const int mode) { this->m_p=p; this->ResetJ(); if (ch==0) { CScalarType *j(CScalarType::New(CScalarType(1.0,cr,ca,0,0))); #ifdef DEBUG__BG msg_Debugging()<m_id<<" "<<*j <<" "<m_fl<<", m = "< void CS::SetGauge(const ATOOLS::Vec4D &k) { } template void CS::AddPropagator() { // add propagator for off-shell leg SComplex prop(M_I/(SType(this->m_p.Abs2())-m_cmass2)); if (this->m_osd) prop=SComplex(M_I); #ifdef DEBUG__BG msg_Debugging()<<"propagator: "<()); for (typename CScalarType_Vector::iterator jit(j->begin());jit!=j->end();++jit) **jit*=prop; } } template void CS::SContract (const Current &c,const Int_Vector &pols, SComplex_Vector &ress,const size_t &offset) const { #ifdef DEBUG__BG msg_Debugging()< *pm(NULL); if (p_sub) { Vertex *v(p_sub->Sub()->In().front()); if (v->Info()->Mode()==1) { phase=v->Kin()->Phase(offset==1?0:1); pm=&v->Kin()->PM(); } } if (c.Type()!='S') THROW(fatal_error,"Invalid current type."); size_t i(0); for (typename CObject_Matrix::const_iterator ajit1(m_j.begin());ajit1!=m_j.end();++ajit1) { const CScalarType_Vector *j(ajit1->Get()); for (typename CObject_Matrix::const_iterator ajit2(c.J().begin());ajit2!=c.J().end();++ajit2,++i) { // if (!pols[i]) continue; const CScalarType_Vector *cj(ajit2->Get()); for (typename CScalarType_Vector::const_iterator jit2(cj->begin());jit2!=cj->end();++jit2) for (typename CScalarType_Vector::const_iterator jit1(j->begin());jit1!=j->end();++jit1) if ((**jit1)(0)==(**jit2)(1) && (**jit1)(1)==(**jit2)(0) && (*jit1)->S()==offset && (*jit2)->S()==offset) { #ifdef DEBUG__BG msg_Debugging()<<"Add ("< std::string CS::Format(const CObject *c) const { return ToString(*(CScalarType*)c,6); } template char CS::Type() const { return 'S'; } template std::string CS::CLabel() const { return "dashes,label.side=right,label=$"+ (this->m_out.empty()?this->m_fl.Bar():this->m_fl).TexName()+"$"; } DECLARE_GETTER(CS,"DS",Current,Current_Key); Current *ATOOLS::Getter >:: operator()(const Current_Key &key) const { if (key.m_fl.IsScalar()) return new CS(key); return NULL; } void ATOOLS::Getter >:: PrintInfo(std::ostream &str,const size_t width) const { str<<"scalar current (double)"; }