File indexing completed on 2025-04-19 09:10:06
0001 #ifndef METOOLS_Explicit_Color_Calculator_H
0002 #define METOOLS_Explicit_Color_Calculator_H
0003
0004 #include "METOOLS/Explicit/Vertex_Key.H"
0005 #include "METOOLS/Explicit/C_Object.H"
0006 #include "ATOOLS/Math/MyComplex.H"
0007 #include "ATOOLS/Org/Getter_Function.H"
0008
0009 namespace METOOLS {
0010
0011 class Vertex;
0012 class Current;
0013
0014 class Color_Calculator {
0015 public:
0016
0017 struct CInfo {
0018 int m_cr, m_ca;
0019 Complex m_s;
0020 inline CInfo(const int cr,const int ca,
0021 const Complex &s=Complex(1.0)):
0022 m_cr(cr), m_ca(ca), m_s(s) {}
0023 inline int &operator()(const int i)
0024 { return i?m_ca:m_cr; }
0025 inline const int &operator()(const int i) const
0026 { return i?m_ca:m_cr; }
0027 };
0028
0029 protected:
0030
0031 Vertex *p_v;
0032 Complex m_cpl;
0033
0034 std::vector<CInfo> m_c;
0035
0036 static size_t s_cimin, s_cimax;
0037
0038 public:
0039
0040
0041 inline Color_Calculator(const Vertex_Key &key):
0042 p_v(key.p_v), m_cpl(1.0) {}
0043
0044
0045 virtual ~Color_Calculator();
0046
0047 virtual void AddJ(CObject *const j);
0048
0049
0050 virtual std::string Label() const = 0;
0051
0052 virtual bool Evaluate(const CObject_Vector &j);
0053
0054 inline static void SetCIMin(const size_t &cimin) { s_cimin=cimin; }
0055 inline static void SetCIMax(const size_t &cimax) { s_cimax=cimax; }
0056
0057 inline static size_t CIMin() { return s_cimin; }
0058 inline static size_t CIMax() { return s_cimax; }
0059
0060 inline Complex Coupling() const { return m_cpl; }
0061
0062 inline int Stat() const { return m_c.size(); }
0063
0064 };
0065
0066 std::ostream &operator<<(std::ostream &s,const Color_Calculator::CInfo &i);
0067
0068 typedef std::vector<Color_Calculator*> CC_Vector;
0069
0070 typedef ATOOLS::Getter_Function<Color_Calculator,Vertex_Key,
0071 std::less<std::string> > CC_Getter;
0072
0073 }
0074
0075 #endif