Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:10:03

0001 #ifndef HADRONS_Current_Library_Current_Base_H
0002 #define HADRONS_Current_Library_Current_Base_H
0003 
0004 #include <iostream>
0005 #include <string>
0006 #include <iomanip>
0007 #include "ATOOLS/Math/MathTools.H"
0008 #include "ATOOLS/Math/Vector.H"
0009 #include "ATOOLS/Phys/Flavour.H"
0010 #include "ATOOLS/Org/Getter_Function.H"
0011 #include "HADRONS++/Main/Tools.H"
0012 #include "METOOLS/Main/Spin_Structure.H"
0013 
0014 #define DEFINE_CURRENT_GETTER(CLASS,TAG)                \
0015   DECLARE_GETTER(CLASS,TAG,HADRONS::Current_Base,HADRONS::ME_Parameters);           \
0016   Current_Base *ATOOLS::Getter<HADRONS::Current_Base,HADRONS::ME_Parameters,CLASS>::    \
0017   operator()(const ME_Parameters &parameters) const         \
0018   { return new CLASS(parameters.flavs, parameters.indices, TAG); }
0019 
0020 namespace HADRONS {
0021 
0022   /** 
0023    * Represents a vector current in a decay process.
0024    * To store its calculated values for each helicity combination, it inherits
0025    * from METOOLS::Spin_Structure.
0026    * Each class derived from this has to implement the Current_Base::Calc
0027    * method for the actual calculation of the current.
0028    */
0029   class Current_Base : public METOOLS::Spin_Structure<ATOOLS::Vec4C> {
0030   protected:
0031     /// Reference to all flavours involved in the decay.
0032     /// This usually contains more flavours then involved in the current itself
0033     /// and thus needs Current_Base::p_i for a mapping
0034     const ATOOLS::Flavour_Vector& m_flavs;
0035     /// Array of masses of the flavours involved in the current
0036     /// (in the internal ordering)
0037     double          * p_masses;
0038     /// Index mapping from external flavours/momenta to current internal ones
0039     std::vector<int> p_i;
0040 
0041     /// name of the current
0042     std::string       m_name;
0043 
0044   public:
0045     /** 
0046      * Constructor which initialises all fields of the class.
0047      * 
0048      * @param flavs All flavours involved in the decay (in external order).
0049      * @param decayindices Index mapping from external flavours/momenta to
0050      * current internal ones (cf. Current_Base::p_i)
0051      * @param name Name of the current
0052      */
0053     Current_Base(const ATOOLS::Flavour_Vector& flavs,
0054                  const std::vector<int>& decayindices,
0055                  const std::string& name);
0056     virtual ~Current_Base();
0057 
0058     /** 
0059      * Pure virtual function, which requires the implementation of the
0060      * current calculation in all derived classes.
0061      * When implementing such a calculation, one can use Spin_Structure::Insert
0062      * to store the calculated values for all helicities combination.
0063      * 
0064      * @param moms All momenta in the decay in external order
0065      * @param anti Whether to consider the charge conjugated process
0066      */
0067     virtual void Calc(const ATOOLS::Vec4D_Vector& moms, bool anti) = 0;
0068 
0069     /** 
0070      * This method sets the parameters for the decay current.
0071      * Every subclass of Current_Base \b must have this method if it needs
0072      * parameters that are written in the decay channel file.
0073      * Basically, this method gets called after reading the corresponding DC
0074      * file and it is its job to set the parameters in the current class to the
0075      * values written in the DC file.
0076      * 
0077      * @param _md Has to contain the values and names of all parameters
0078      * relevant for the current
0079      */
0080     virtual void SetModelParameters( struct GeneralModel _md ) {};
0081 
0082     //@{
0083     /// Getter/setter method
0084     inline std::string Name() const              { return m_name; }
0085     inline void        SetName(std::string name) { m_name = name; }
0086     inline int         GetN() const              { return p_i.size(); }
0087     inline const std::vector<int>& DecayIndices() const { return p_i; }
0088     //@}
0089 
0090     /** 
0091      * Stream output operator giving the name of the current and its values.
0092      */
0093     friend std::ostream& operator<<(std::ostream& s, const Current_Base& cb);
0094   };
0095   
0096 
0097   typedef ATOOLS::Getter_Function<Current_Base,ME_Parameters>
0098   Current_Getter_Function;
0099 }
0100 
0101 
0102 #endif