Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef MCATNLO_Showers_SF_Coupling_H
0002 #define MCATNLO_Showers_SF_Coupling_H
0003 
0004 #include "MCATNLO/Showers/SF_Key.H"
0005 #include "MCATNLO/Tools/Parton.H"
0006 
0007 #include "ATOOLS/Org/Getter_Function.H"
0008 #include "ATOOLS/Phys/Flavour.H"
0009 
0010 namespace ATOOLS {
0011   class Cluster_Amplitude;
0012 }
0013 
0014 namespace MCATNLO {
0015 
0016   class SF_Lorentz;
0017 
0018   class SF_Coupling {
0019   protected:
0020 
0021     SF_Lorentz *p_lf;
0022 
0023     cstp::code m_type;
0024     double     m_cplfac;
0025 
0026     //! Last unpolarized coupling value
0027     double     m_last;
0028 
0029     int        m_kfmode;
0030 
0031     /**
0032       * m_cplmax[i] = max_{scale} Coupling(scale, i)
0033       */
0034     std::vector<double> m_cplmax;
0035 
0036     static double s_qfac;
0037 
0038   public:
0039 
0040     SF_Coupling(const SF_Key &key);
0041 
0042     virtual ~SF_Coupling();
0043 
0044     virtual bool SetCoupling(MODEL::Model_Base *md,
0045                  const double &k0sqi,const double &k0sqf,
0046                  const double &isfac,const double &fsfac) = 0;
0047 
0048     //! Subclasses can return true if they support alternative couplings to be used (e.g. for reweighting)
0049     virtual bool AllowsAlternativeCouplingUsage() const { return false; }
0050     /*!
0051      * Use an alternative coupling
0052      *
0053      * @param cpl See subclass implementation(s) for the accepted pointer type.
0054      * @param sf An optional scale factor, see subclass implementations for the
0055      * concrete meaning of this argument.
0056      * Passing NULL ends the use of the alternative coupling.
0057      */
0058     virtual void SetAlternativeUnderlyingCoupling(void * cpl, double sf=1.0) {}
0059 
0060     virtual double Coupling(const double &scale,const int pol,
0061                 ATOOLS::Cluster_Amplitude *const sub) = 0;
0062     virtual bool AllowSpec(const ATOOLS::Flavour &fl) = 0;
0063 
0064     //! Last unpolarized coupling value
0065     double Last() const { return m_last; }
0066 
0067     //! Set last unpolarized coupling value
0068     void SetLast(double last) { m_last = last; }
0069 
0070     virtual double CplFac(const double &scale) const;
0071 
0072     virtual void ColorPoint(Parton *const p) const;
0073 
0074     virtual double ColorWeight(const Color_Info &ci) const;
0075 
0076     inline double MaxCoupling(const int mode) const { return s_qfac*m_cplmax[mode]; }
0077 
0078     inline void SetLF(SF_Lorentz *const lf) { p_lf=lf; }
0079 
0080     inline int KFMode() { return m_kfmode; }
0081 
0082     inline void SetKFMode(const int kfmode) { m_kfmode=kfmode; }
0083 
0084     inline static void SetQFac(const double &qfac) { s_qfac=qfac; }
0085 
0086   };
0087 
0088   typedef ATOOLS::Getter_Function<SF_Coupling,SF_Key,
0089                   std::less<std::string> > SFC_Getter;
0090 
0091   // NOTE: SFC_Filler_Key/Getter allow for specifying SF_Coupling Getters
0092   // (SFC_Getter) during run-time; this is triggered via calling
0093   // SVC_Filler_Getter's GetObject in Sudakov::InitSplittingFunctions.
0094   // This usage is highly unintuitive (and should probably be refactored),
0095   // therefore we document it here.
0096 
0097   struct SFC_Filler_Key {
0098     const MODEL::Model_Base *p_md;
0099     std::vector<SFC_Getter*> *p_gets;
0100     inline SFC_Filler_Key(const MODEL::Model_Base *const md,
0101               std::vector<SFC_Getter*> *const gets):
0102       p_md(md), p_gets(gets) {}
0103   };
0104 
0105   typedef ATOOLS::Getter_Function
0106   <void,SFC_Filler_Key,std::less<std::string> > SFC_Filler_Getter;
0107 
0108 }
0109 
0110 #define DECLARE_CPL_GETTER(NAME)                    \
0111                                     \
0112   class NAME: public ATOOLS::Getter_Function                \
0113   <SF_Coupling,SF_Key,std::less<std::string> > {            \
0114   protected:                                \
0115     void PrintInfo(std::ostream &str,const size_t width) const;     \
0116     Object_Type *                           \
0117       operator()(const Parameter_Type &parameters) const;       \
0118   public:                               \
0119     NAME(const std::string &name):                  \
0120       ATOOLS::Getter_Function<SF_Coupling,SF_Key,           \
0121       std::less<std::string> >(name) {}                 \
0122   }
0123 
0124 #endif