File indexing completed on 2025-04-19 09:10:06
0001 #ifndef METOOLS_Explicit_Current_H
0002 #define METOOLS_Explicit_Current_H
0003
0004 #include "METOOLS/Explicit/C_Object.H"
0005 #include "METOOLS/Main/Polarization_Index.H"
0006 #include "ATOOLS/Math/Vector.H"
0007 #include "ATOOLS/Phys/Flavour.H"
0008 #include "ATOOLS/Org/Getter_Function.H"
0009 #include "MODEL/Main/Model_Base.H"
0010 #include "ATOOLS/Org/Node.H"
0011
0012 #include <vector>
0013
0014 namespace METOOLS {
0015
0016 class Vertex;
0017
0018 typedef std::vector<int> Int_Vector;
0019 typedef std::vector<Int_Vector> Int_Matrix;
0020
0021 typedef std::vector<size_t> SizeT_Vector;
0022
0023 typedef std::vector<std::string> String_Vector;
0024 typedef std::vector<String_Vector> String_Matrix;
0025
0026 typedef ATOOLS::Node<std::string> Graph_Node;
0027
0028 typedef std::vector<Vertex*> Vertex_Vector;
0029
0030 char ParticleType(const ATOOLS::Flavour &fl);
0031
0032 struct Current_Key {
0033 ATOOLS::Flavour m_fl;
0034 MODEL::Model_Base *p_model;
0035 size_t m_n;
0036 inline Current_Key(const ATOOLS::Flavour &fl,
0037 MODEL::Model_Base *const model,
0038 const size_t &n):
0039 m_fl(fl), p_model(model), m_n(n) {}
0040 std::string Type() const;
0041 };
0042
0043 class Current {
0044 protected:
0045
0046 ATOOLS::Flavour m_fl;
0047
0048 Vertex_Vector m_in, m_out;
0049 Int_Vector m_id, m_fid;
0050
0051 ATOOLS::Vec4D m_p;
0052 CObject_Matrix m_j;
0053
0054 Polarization_Index m_h;
0055 SizeT_Vector m_hm;
0056
0057 size_t m_key, m_cid, m_ntc;
0058 char m_type;
0059
0060 std::vector<int> m_order;
0061
0062 double m_mass, m_width;
0063 bool m_msv, m_zero;
0064 int m_dir, m_cut, m_osd;
0065
0066 Current *p_sub;
0067
0068 mutable std::string m_psinfo;
0069
0070 virtual std::string CLabel() const;
0071
0072 void CollectGraphs(Graph_Node *graph,
0073 const std::string &lastv) const;
0074
0075 public:
0076
0077 Current(const Current_Key &key);
0078
0079 virtual ~Current();
0080
0081
0082 void FindPermutations();
0083 void InitPols(const Int_Vector &pols);
0084
0085 void AddJ(CObject *const j);
0086
0087 virtual void ConstructJ(const ATOOLS::Vec4D &p,const int ch,
0088 const int cr,const int ca,const int mode) = 0;
0089 virtual void SetGauge(const ATOOLS::Vec4D &k) = 0;
0090
0091 virtual void AddPropagator() = 0;
0092
0093 template <class SType> inline void
0094 Contract(const Current &c,const Int_Vector &pols,
0095 std::vector<std::complex<SType> > &ress,
0096 const size_t &offset=0) const;
0097
0098 virtual std::string Format(const CObject *c) const = 0;
0099
0100 virtual char Type() const = 0;
0101
0102 void SetId(const Int_Vector &id);
0103
0104 void CollectGraphs(Graph_Node *graph) const;
0105
0106 void DetachOut(Vertex *const v);
0107
0108 std::string PSInfo() const;
0109
0110 void ResetJ();
0111 void ResetZero();
0112 void Evaluate();
0113
0114 void Print() const;
0115
0116
0117 inline const CObject_Matrix &J() const { return m_j; }
0118
0119 inline void SetP(const ATOOLS::Vec4D &p) { m_p=p; }
0120
0121 inline void SetFId(const Int_Vector &fid) { m_fid=fid; }
0122 inline void SetKey(const size_t &key) { m_key=key; }
0123
0124 inline void SetOrder(const std::vector<int> &o) { m_order=o; }
0125 inline void SetNTChannel(const size_t &ntc) { m_ntc=ntc; }
0126
0127 inline void SetDirection(const int &dir) { m_dir=dir; }
0128 inline void SetCut(const int &cut) { m_cut=cut; }
0129 inline void SetOnShell(const int &osd) { m_osd=osd; }
0130
0131 inline void SetSub(Current *const sub) { p_sub=sub; }
0132
0133 inline ATOOLS::Flavour Flav() const { return m_fl; }
0134
0135 inline ATOOLS::Flavour RFlav() const
0136 { return m_fl.IsAnti()?m_fl.Bar():m_fl; }
0137 inline ATOOLS::Flavour AFlav() const
0138 { return m_fl.IsAnti()?m_fl:m_fl.Bar(); }
0139
0140 inline ATOOLS::Vec4D P() const { return m_p; }
0141
0142 inline const Int_Vector &Id() const { return m_id; }
0143 inline const Int_Vector &FId() const { return m_fid; }
0144 inline size_t CId() const { return m_cid; }
0145 inline size_t Key() const { return m_key; }
0146
0147 inline const std::vector<int> &Order() const { return m_order; }
0148 inline int Order(const size_t &id) const { return m_order[id]; }
0149
0150 inline size_t NTChannel() const { return m_ntc; }
0151
0152 inline int Direction() const { return m_dir; }
0153 inline int Cut() const { return m_cut; }
0154 inline int OnShell() const { return m_osd; }
0155
0156 inline Current *Sub() const { return p_sub; }
0157
0158 inline void AttachIn(Vertex *const v) { m_in.push_back(v); }
0159 inline void AttachOut(Vertex *const v) { m_out.push_back(v); }
0160
0161 inline size_t NIn() const { return m_in.size(); }
0162 inline size_t NOut() const { return m_out.size(); }
0163
0164 inline const Vertex_Vector &In() const { return m_in; }
0165 inline const Vertex_Vector &Out() const { return m_out; }
0166
0167 inline bool Dangling() const { return m_out.empty(); }
0168
0169 inline double Mass() const { return m_mass; }
0170 inline double Width() const { return m_width; }
0171
0172 inline bool Zero() const { return m_zero; }
0173
0174 inline const Polarization_Index &H() const { return m_h; }
0175
0176 inline SizeT_Vector &HM() { return m_hm; }
0177
0178 };
0179
0180 template <typename SType>
0181 class Current_Contractor {
0182 public:
0183
0184 virtual ~Current_Contractor() {}
0185
0186
0187 virtual void
0188 SContract(const Current &c,const Int_Vector &pols,
0189 std::vector<std::complex<SType> > &ress,
0190 const size_t &offset=0) const = 0;
0191
0192 };
0193
0194 template <class SType> inline void
0195 Current::Contract(const Current &c,const Int_Vector &pols,
0196 std::vector<std::complex<SType> > &ress,
0197 const size_t &offset) const
0198 { dynamic_cast<const Current_Contractor<SType>*>
0199 (this)->SContract(c,pols,ress,offset); }
0200
0201 typedef ATOOLS::Getter_Function<Current,Current_Key,
0202 std::less<std::string> > Current_Getter;
0203
0204 std::ostream &operator<<(std::ostream &str,const Current &c);
0205
0206 typedef std::vector<Current*> Current_Vector;
0207
0208 }
0209
0210 #endif