Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:09:45

0001 #ifndef AMEGIC_Amplitude_Zfunc_H
0002 #define AMEGIC_Amplitude_Zfunc_H
0003 
0004 #include "AMEGIC++/Amplitude/Zfunctions/Basic_Func.H"
0005 #include "AMEGIC++/Amplitude/Pfunc.H"
0006 
0007 #include <memory>
0008 
0009 namespace AMEGIC {
0010   class Zfunc_Calc;
0011 
0012   class Pair {
0013   public:
0014     int pold,pnew;
0015     
0016     Pair(int _pold,int _pnew) : pold(_pold), pnew(_pnew) {}
0017   };
0018 
0019   struct SpinorDirection {
0020     int from,to;
0021     SpinorDirection* Next;
0022   };
0023 
0024   class CValue {
0025   public:
0026     int     * p_args;
0027     ATOOLS::Kabbala   m_value;
0028     CValue() { p_args=0; }
0029     CValue(int * _args, const ATOOLS::Kabbala _value) : p_args(_args) , m_value(_value) {} 
0030     inline bool Compare(int* args, int n){
0031       for(int i=0;i<n;++i) if (args[i]!=p_args[i]) return false;
0032       return true;
0033     }
0034   };
0035   typedef std::vector<CValue> Calc_List;
0036   typedef Calc_List::iterator CL_Iterator;
0037 
0038   class Zfunc {
0039   public:
0040 
0041     std::string m_type;
0042     int       m_narg,m_ncoupl;
0043     int*      p_arguments;
0044     Complex*  p_couplings;
0045     // propagators
0046     int       m_nprop;
0047     Argument* p_propagators;
0048     //Lorentzfunction sign
0049     int       m_sign;
0050     std::string m_str;
0051     Calc_List m_calclist;
0052     
0053     Zfunc* p_equal;
0054     std::shared_ptr<Zfunc_Calc> p_calculator;
0055 
0056     Zfunc();
0057     Zfunc(const Zfunc& z);
0058     virtual ~Zfunc();
0059         
0060     Zfunc& operator=(const Zfunc& z);
0061     //virtual part
0062     virtual void ClearCalcList();
0063     virtual void KillZList() {}
0064     virtual void ReplaceProp(std::vector<Pair>*);
0065 
0066     virtual Zfunc* operator[](const int i) {return this;} 
0067 
0068     virtual void Print();
0069     virtual int  GetSize() {return 1;}
0070     virtual char GetOp() {return 0;}
0071 
0072     virtual void SetSign(const int,const int) 
0073     { std::cerr<<"Called virtual function Zfunc::SetSign()!!!"<<std::endl; }
0074     virtual int  GetSign(const int i) {   
0075       std::cerr<<"Called virtual function Zfunc::GetSign()!!!"<<std::endl;
0076       return 1;
0077     }
0078     virtual int  GetSumIndex() {   
0079       std::cerr<<"Called virtual function Zfunc::GetSumIndex()!!!"<<std::endl;
0080       return 0;
0081     }
0082   };
0083 
0084   class Zfunc_Group: public Zfunc {
0085     int  m_sumindex;
0086     char m_op;
0087   public:
0088     std::vector<Zfunc*> m_zlist;
0089     std::vector<int>    m_zsigns;
0090 
0091     Zfunc_Group() : Zfunc() {}
0092     Zfunc_Group(const Zfunc& z);
0093     Zfunc_Group(Zfunc& z1,Zfunc& z2,int si,Pfunc_List* pl);
0094     
0095     Zfunc* operator[](const int i) { return m_zlist[i]; } 
0096     void Print();
0097     int  GetSize() { return m_zlist.size(); }
0098     char GetOp() { return m_op; } 
0099    
0100     void SetSign(const int pos,const int _sign) { m_zsigns[pos] = _sign; }
0101     int  GetSign(const int i)                   { return m_zsigns[i]; }
0102     int  GetSumIndex() { if (m_op=='*') return m_sumindex; else return -1; }
0103 
0104 
0105     void ClearCalcList();
0106     void KillZList();
0107     void ReplaceProp(std::vector<Pair>*);  
0108   };
0109 
0110   typedef std::vector<Zfunc*> Zfunc_List;
0111   typedef Zfunc_List::iterator Zfunc_Iterator;
0112 
0113   /*!
0114     \class CValue
0115     \brief Element for Zfunc::m_calclist
0116     
0117     This class contains a list of arguments and a ATOOLS::Kabbala result of a Z-function, 
0118     to keep track for what sets of arguments a Z function was already calculated.
0119   */
0120   /*!
0121     \fn CValue::Compare(int* args, int n)
0122     Returns true, if args contains the same arguments as the member p_args, otherwise false.
0123   */
0124   /*!
0125     \class Zfunc
0126     \brief Container for a single Z function
0127     
0128     This class contains everything neccessary for the calculation of a single Z function and
0129     keeps track over already calculated values.
0130 
0131     A Z function is part of an amplitude, usually a vertex or a group of connected vertices
0132     including the external legs in terms of spinors or polarization vectors. It is described
0133     by a type and a list of arguments, usually referring to the legs.
0134   */
0135   /*!
0136     \var int Zfunc::m_type
0137     Type of the building block to calculate this Z function.
0138     For a list of all available types see class zl.
0139   */
0140   /*!
0141     \var int Zfunc::m_ncoupl
0142     The number of coupling constants.
0143   */
0144   /*!
0145     \var int Zfunc::m_narg
0146     The number of arguments.
0147   */
0148   /*!
0149     \var int* Zfunc::p_arguments
0150     Pointer to an array of arguments. 
0151     
0152     Possible arguments:
0153     - external particles (0-9)
0154     - a propagator in the numbering scheme of the corresponding amplitude:
0155       -# fermion propagators (101-199)
0156       -# boson propagators (>201)
0157     - 99 as a dummy to indicate explicit polarization vectors
0158 
0159     Arguments come always in pairs (except dummy arguments for scalars).
0160     One pair can contain:
0161     - two fermion arguments from a fermion line
0162     - for the old external boson treatment, the two spinor arguments to construct the polarization vector
0163     - one boson argument and 99, that indicates that there are explicit polarization for the boson
0164     - two times the same argument for a spin-2 particle
0165 
0166     A dummy argument for a scalar is set for Z-functions, describing a vertex with scalars,
0167     but where the building block to calculate the Z-function does 
0168     not depend on the scalars momentum. These arguments are always at the end of the array.
0169     With the dummys, the whole information about the connection between vertices of an 
0170     amplitude is contained in the argument structure of Z-functions. This allows a more 
0171     efficient algorithm to build Super_Amplitude's.
0172   */
0173   /*!
0174     \var Complex* Zfunc::p_couplings;
0175     Pointer to an array of complex coupling constants.
0176   */
0177   /*!
0178     \var int Zfunc::m_nprop
0179     Number of propagators in the array Zfunc::p_propagators.
0180   */
0181   /*!
0182     \var Argument* Zfunc::p_propagators
0183     A pointer to an array of propagators, needed for calculation of the Z function.
0184     (Usually internal propagators of the building block)
0185   */
0186   /*!
0187     \var int Zfunc::m_sign
0188     An extra sign for the Z function, occuringfrom permutations in the legs of it's vertices 
0189     (see Lorentz_Function::GetSign).
0190   */
0191   /*!
0192     \var std::string Zfunc::m_str
0193     A unique string for the Z function within all Z functions of the process.
0194     Used to identify equal Z function in different amplitudes to construct a Super_Amplitude.
0195   */
0196   /*!
0197     \var Calc_List Zfunc::m_calclist
0198     Vector of CValue, to keep track over all sets of arguments, 
0199     for which the Z function was calculated.
0200   */
0201   /*!
0202     \var Zfunc* Zfunc::p_equal
0203     A pointer to an identical Zfunc (possibly from a different amplitude).
0204     It may be set to this.
0205 
0206     p_equal allows to use Zfunc::m_calclist of identical Zfuncs together.
0207   */
0208   /*!
0209     \var Zfunc_Calc* Zfunc::p_calculator
0210     A pointer to the corresponding calculator class.
0211   */
0212 
0213   /*!
0214     \fn Zfunc::Zfunc()
0215     Constructs an empty object.
0216   */
0217   /*!
0218     \fn Zfunc::Zfunc(const Zfunc& z);
0219     Copy constructor.
0220   */
0221   /*!
0222      \fn Zfunc& Zfunc::operator=(const Zfunc& z);
0223      Copies a Zfunc including all elements of the Zfunc::p_arguments,
0224      Zfunc::p_couplings and Zfunc::p_propagators.
0225   */
0226   /*!
0227     \fn Zfunc::ClearCalcList();
0228     Deletes all entries in Zfunc::m_calclist.
0229   */
0230   /*!
0231     \fn Zfunc::ReplaceProp(std::vector<Pair>*);
0232     Changes the labels of propagators (Zfunc::p_propagators) and 
0233     arguments (Zfunc::p_arguments) from Pair::pold to Pair::new.
0234   */
0235   /*!
0236     \fn virtual Zfunc* Zfunc::operator[](const int i) 
0237     Returns the pointer this.
0238   */
0239   /*!
0240     \fn virtual void Zfunc::Print()
0241     Prints the Zfunc with type, arguments and coupling constants.
0242   */
0243   /*!
0244     \class Zfunc_Group
0245     \brief Contains a list a Zfunc, connected by an operation + or *.
0246     
0247     This class is derived from Zfunc and contains a list of Z functions.
0248     When an Single_Amplitude or Super_Amplitude is calculated in Single_Amplitude_Base,
0249     it's Zfunc structure is transformed into a recursive structure of Zfunc_Group's, 
0250     connected by the operations + and *.
0251     
0252     - '+' arrise when several amplitudes, containing identical parts are merged together to
0253     a Super_Amplitude. 
0254     The '+'-group can have two or more sub Z functions, that all have 
0255     the same argument list (up to the sequence).
0256     - '*' combines two Z functions (or groups) that are connected by a propagator. The 
0257     sub Z functions have only the argument referring to this propagator common. The 
0258     '*'-operation here goes along with the summation over spinor/antispinor modes for
0259     fermion propagators or polarization vectors for boson propagators.
0260 
0261     Zfunc_Group has no defined type and calculator. The calculation is done 
0262     in Single_Amplitude_Base::SingleZGoupValue by 
0263     performing the operator and the calculators of the sub Z functions.
0264   */
0265   /*!
0266     \var int  Zfunc_Group::m_sumindex
0267     For a Zfunc_Group with operation '*':
0268     Label of the connecting propagator to perform the sum over all propagating modes.
0269   */
0270   /*!
0271     \var char Zfunc_Group::m_op
0272     Operation to be performed to combine the sub Z functions.
0273     Possible values are '+' or '*'.
0274   */
0275   /*!
0276     \var std::vector<Zfunc*> Zfunc_Group::m_zlist;
0277     A vector of all the sub Z functions.
0278   */
0279   /*!
0280     \var std::vector<int>    Zfunc_Group::m_zsigns
0281     For a Zfunc_Group with operation '+':
0282     A sign for each sub Z function.
0283   */
0284   /*!
0285     \fn Zfunc_Group::Zfunc_Group()
0286     Constructs an empty object.
0287   */
0288   /*!
0289     \fn Zfunc_Group::Zfunc_Group(const Zfunc& z)
0290     Constructor for a group with operation '+'.
0291 
0292     Copies the argument list of the Zfunc z to the group. 
0293     This can be done with any Z function of the latter group, since they must
0294     have identical arguments.
0295 
0296     Zfunc_Group::m_zlist must be filled separatly.
0297   */
0298   /*!
0299     \fn Zfunc_Group::Zfunc_Group(Zfunc& z1,Zfunc& z2,int si,Pfunc_List* pl);
0300      Constructor for a group with operation '*'.
0301      
0302      The new array of arguments contains both arrays of the sub Z functions, except
0303      the label for the connecting propagator. This is now becoming an internal 
0304      argument, to be kept in Zfunc_Group::m_sumindex.
0305 
0306      Both propagator arrays are copied into the group array and are removed from 
0307      the sub Z functions.
0308 
0309      All coupling constants are copied to the group.
0310   */
0311   /*!
0312     \fn Zfunc* Zfunc_Group::operator[](const int i)
0313     Returns the Zfunc \#i from Zfunc_Group::m_zlist.
0314   */
0315   /*!
0316     \fn void Zfunc_Group::Print()
0317     Prints the Zfunc_Group with its arguments and sub Z functions.
0318   */
0319   /*!
0320     \fn int  Zfunc_Group::GetSize()
0321     Returns the number of cointained sub Z functions.
0322   */
0323   /*!
0324     \fn char Zfunc_Group::GetOp()
0325     Returns the operator, + or *.
0326   */
0327   /*!
0328     \fn void Zfunc_Group::SetSign(const int pos,const int _sign)
0329     Set the sign for sub Z function at position pos. (only '+'-groups)
0330   */
0331   /*!
0332     \fn int  Zfunc_Group::GetSign(const int i)
0333     Returns the sign for the sub Z function at position i. (only '+'-groups)
0334   */
0335   /*!
0336     \fn int  Zfunc_Group::GetSumIndex()
0337     Returns the index of the connecting propagator of two Z functions for '*'-groups.
0338 
0339   */
0340   /*!
0341     \fn void Zfunc_Group::ClearCalcList()
0342     Deletes all entries in m_calclist including all lists of its sub Z functions.
0343     
0344    */
0345   /*!
0346     \fn void Zfunc_Group::ReplaceProp(std::vector<Pair>*)
0347     See Zfunc::ReplaceProp.
0348   */ 
0349 }
0350 
0351 #endif