Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef PDF_Main_PDF_Base_H
0002 #define PDF_Main_PDF_Base_H
0003 
0004 #include "ATOOLS/Org/CXXFLAGS.H"
0005 #include "ATOOLS/Phys/Flavour.H"
0006 #include "ATOOLS/Org/Getter_Function.H"
0007 #include "ATOOLS/Org/Settings.H"
0008 
0009 namespace PDF {
0010 
0011   struct PDF_Defaults {
0012     std::map<kf_code,std::string> m_deflib, m_defset;
0013 
0014     PDF_Defaults();
0015 
0016     inline std::string DefaultPDFLibrary(kf_code kf) { return m_deflib[kf]; }
0017     inline std::string DefaultPDFSet(kf_code kf)     { return m_defset[kf]; }
0018   };
0019 
0020   extern PDF_Defaults * pdfdefs;
0021 
0022   struct PDF_Arguments {
0023     ATOOLS::Flavour       m_bunch;
0024     int m_ibeam;
0025     std::string m_set;
0026     int m_member;
0027     int m_order, m_scheme;
0028     PDF_Arguments(const ATOOLS::Flavour &bunch,
0029                   int ibeam,
0030                   std::string set,
0031                   int member,
0032                   int order=-1,
0033                   int scheme=-1):
0034       m_bunch(bunch),
0035       m_ibeam(ibeam),
0036       m_set(set),
0037       m_member(member),
0038       m_order(order),
0039       m_scheme(scheme)
0040     {}
0041   };
0042 
0043   struct PDF_Flavour: public ATOOLS::Flavour {
0044     double m_mass, m_thres;
0045     PDF_Flavour(const kf_code &kf=kf_none,const bool anti=false):
0046       Flavour(kf,anti), m_mass(0.0), m_thres(0.0) {}
0047   };
0048 
0049   struct PDF_AS_Info {
0050     int m_order,m_nf;
0051     double m_asmz,m_mz2;
0052     std::vector<PDF_Flavour> m_flavs;
0053     inline PDF_AS_Info(): m_order(-1), m_nf(-1), m_asmz(0.0), m_mz2(0.0) {}
0054   };
0055 
0056   std::ostream &operator<<(std::ostream &ostr,const PDF_AS_Info &asi);
0057 
0058   class PDF_Base {
0059   public:
0060     typedef ATOOLS::Getter_Function<PDF_Base, PDF_Arguments>
0061             PDF_Getter_Function;
0062 
0063   protected:
0064 
0065     std::vector<PDF_Base*> m_copies;
0066 
0067     ATOOLS::Flavour_Set m_partons;
0068     ATOOLS::Flavour     m_bunch;
0069 
0070     std::string m_type, m_set;
0071     int m_member, m_lhef_number, m_nf;
0072 
0073     double m_exponent, m_rescale;
0074     double m_xmin, m_xmax, m_q2min, m_q2max;
0075     bool   m_rescX;
0076 
0077     PDF_AS_Info m_asinfo;
0078 
0079     virtual void CalculateSpec(const double& x,const double& Q2) = 0;
0080   private:
0081     double m_rq2min, m_rq2max;
0082 
0083     static void RegisterDefaults() ;
0084 
0085   public:
0086     PDF_Base();
0087     virtual ~PDF_Base();
0088 
0089     void   Calculate(double x,double Q2);
0090     virtual double GetXPDF(const ATOOLS::Flavour& flavour) = 0;
0091     virtual double GetXPDF(const kf_code& kf, bool anti) = 0;
0092     virtual double AlphaSPDF(const double &q2);
0093     inline  double GetXPDF(const int& id) { return GetXPDF(abs(id),id<0); }
0094 
0095     virtual PDF_Base *GetCopy() = 0;
0096     virtual PDF_Base *GetBasicPDF();
0097 
0098     void SetBounds();
0099 
0100     virtual void SetAlphaSInfo();
0101     virtual void SetPDFMember();
0102     virtual double GetDefaultAlpha();
0103     virtual double GetDefaultScale();
0104     virtual int GetFlavourScheme();
0105 
0106     static void ShowSyntax(size_t i);
0107 
0108     inline const std::string& Type() const { return m_type; }
0109     inline std::string Set() const                    { return m_set; }
0110     inline ATOOLS::Flavour      Bunch() const   { return m_bunch;   }
0111     inline const ATOOLS::Flavour_Set &Partons() const { return m_partons; }
0112     inline bool Contains(const ATOOLS::Flavour & flav) const {
0113       if (m_partons.find(flav) != m_partons.end()) return true;
0114       for (size_t i(0); i < flav.Size(); ++i)
0115         if (m_partons.find(flav[i]) == m_partons.end()) return false;
0116       return true;
0117     }
0118     inline int Member() const         { return m_member; }
0119     inline int LHEFNumber() const     { return m_lhef_number; }
0120     inline PDF_Base *operator->()     { return GetBasicPDF(); }
0121     inline PDF_AS_Info ASInfo() const { return m_asinfo; }
0122     inline double Exponent() const    { return m_exponent; }
0123     inline double XMin() const        { return m_xmin;  }
0124     inline double XMax() const        { return m_xmax;  }
0125     inline double Q2Min() const       { return m_rq2min; }
0126     inline double Q2Max() const       { return m_rq2max; }
0127     inline void SetRescaleFactor(const double & fac) { m_rescale = fac; }
0128     inline void ResetRescaleFactor()                 { m_rescale = 1.; }
0129     inline void SetRescaling(const bool & resc=true) { m_rescX   = resc; }
0130     inline double RescaleFactor() const              { return m_rescale; }
0131   };
0132 
0133   /*!
0134     \class PDF_Base
0135     \brief is the base class for parton distributions and structure functions.
0136 
0137     This class is the base class for both parton distributions and structure
0138     functions (e.g. of leptons). It hosts some information about both the
0139     incoming bunch particle and the partons that constitute it. Furthermore, the
0140     corresponding weights for given energy fractions and scales are calculated
0141     and made available through this class.
0142   */
0143   /*!
0144     \var std::vector<ATOOLS::Flavour> PDF_Base::m_partons
0145     The vector listing the constituents. for protons this list has usually
0146     eleven members, one gluon and the five lightest quarks and anti-quarks. For
0147     leptons, due to the very nature of the structure function, only the lepton
0148     in question is included as legitimate parton.
0149   */
0150   /*!
0151     \var ATOOLS::Flavour PDF_Base::m_bunch
0152     The incoming particle.
0153   */
0154   /*!
0155     \var std::string PDF_Base::m_type
0156     The type of the PDF_Base. It is given by PDF_flavourname.
0157   */
0158   /*!
0159     \fn virtual PDF_Base * PDF_Base::GetCopy()
0160     A method to initialize another PDF as exact copy of the current one.
0161     This is needed for the initial state shower of APACIC.
0162   */
0163   /*!
0164     \fn void PDF_Base::Calculate(const double, const double)
0165     This calculates all parton densities inside a hadron or the structure
0166     function depending on the energy fraction \f$x\f$ and the scale squared
0167     \f$Q^2\f$. It should be noted that the result will be given - as usual - as
0168     \f$x\f$ times the function.
0169   */
0170   /*!
0171     \fn double PDF_Base::GetXPDF(const ATOOLS::Flavour &)
0172     This returns x times one specific pdf out of the set of all calculated ones
0173     - it checks whether the flavour passed over as argument is included in the
0174     list of legitimate constituents, PDF_Base::m_partons and selects the
0175     appropriate one.
0176   */
0177 }
0178 
0179 #define DECLARE_PDF_GETTER(NAME)                    \
0180                                     \
0181   class NAME: public ATOOLS::Getter_Function                \
0182   <PDF::PDF_Base,PDF::PDF_Arguments,std::less<std::string> > {          \
0183   protected:                                \
0184     std::string m_key;                          \
0185     void PrintInfo(std::ostream &str,const size_t width) const;     \
0186     Object_Type *                           \
0187       operator()(const Parameter_Type &parameters) const;       \
0188   public:                               \
0189     NAME(const std::string &name):                  \
0190       ATOOLS::Getter_Function<PDF_Base,PDF_Arguments,           \
0191       std::less<std::string> >(name), m_key(name) {}            \
0192   }
0193 
0194 #endif