Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:32:15

0001 #ifndef PHASIC_Process_MCATNLO_Process_H
0002 #define PHASIC_Process_MCATNLO_Process_H
0003 
0004 #include "ATOOLS/Phys/Variations.H"
0005 
0006 #include "PHASIC++/Process/Process_Base.H"
0007 
0008 #include <memory>
0009 
0010 namespace ATOOLS { class Cluster_Amplitude; }
0011 
0012 namespace PDF {
0013   class Cluster_Definitions_Base;
0014 }
0015 
0016 namespace MODEL { class Running_AlphaS; }
0017 
0018 namespace PHASIC {
0019 
0020   class ME_Generators;
0021   class Jet_Finder;
0022 
0023   //! This class manages all processes contributing to an MC@@NLO calculation
0024   class MCatNLO_Process : public Process_Base {
0025   private:
0026 
0027     //! Reference to the matrix element generators
0028     ME_Generators &m_gens;
0029 
0030     //! Pointers to the contributing processes
0031     Process_Base     *p_bviproc, *p_rsproc, *p_bproc, *p_rproc, *p_ddproc;
0032     //! Pointer to the MC@@NLO shower
0033     PDF::NLOMC_Base  *p_nlomc;
0034 
0035     //! Book-keeping variables for last RS, B, VI contributions
0036     double m_lastrs, m_lastb, m_lastvi;
0037     //! Switches for the behaviour of this class
0038     int    m_fomode, m_psmode, m_hpsmode, m_kfacmode;
0039     //! Book-keeping to track whether event was S or H
0040     bool   m_wassevent;
0041     //! Separate scale for RS events
0042     std::string m_rsscale;
0043     
0044     //! Map of integrated dipoles
0045     ATOOLS::StringIDipSet_Map m_iinfo;
0046     //! Map of differential dipoles
0047     ATOOLS::StringDDipSet_Map m_dinfo;
0048 
0049     //! Cluster amplitude for interface with MC@@NLO shower
0050     ATOOLS::Cluster_Amplitude *p_ampl;
0051 
0052     void RegisterDefaults() const;
0053 
0054     /*!
0055      * @param pi Process_Info Process information object
0056      * @param nlotype nlo_type::code NLO type of process
0057      * @param real bool Whether this is a real correction or not
0058      * @return Pointer to the initialised process
0059      *
0060      * This method initialises all needed processes.
0061      */
0062     Process_Base *InitProcess(const Process_Info &pi,
0063                   const ATOOLS::nlo_type::code nlotype,
0064                   const int real);
0065 
0066     /*!
0067      * @param ampl Cluster_Amplitude Cluster amplitude for which the process is
0068      *   needed
0069      * @param type NLO type of process needed
0070      * @param error bool Exit when not found or not
0071      * @return Pointer to the initialised process
0072      *
0073      * This method retrieves processes from the global process map.
0074      */
0075     Process_Base *FindProcess(const ATOOLS::Cluster_Amplitude *ampl,
0076                               const ATOOLS::nlo_type::code type
0077                                     =ATOOLS::nlo_type::lo,
0078                   const bool error=true) const;
0079 
0080     /*!
0081      * @param sub NLO_subevt NLO subevent for which the cluster amplitude
0082      *                       should be constructed
0083      * @return Pointer to cluster amplitude constructed
0084      *
0085      * This method constructs a cluster amplitude for the given NLO subevent
0086      */
0087     ATOOLS::Cluster_Amplitude *CreateAmplitude
0088     (const ATOOLS::NLO_subevt *sub) const;
0089 
0090     /*!
0091      * @param wmode int Mode (not used)
0092      * @return additional S-Event weights (i.e. weights from the MC@@NLO
0093      * shower), or zero
0094      *
0095      * This method generates one S-event
0096      */
0097     ATOOLS::Weights_Map OneSEvent(const int wmode);
0098     /*!
0099      * @param wmode int Mode (not used)
0100      * @return additional H-Event weight (one or zero)
0101      *
0102      * This method generates one H-event
0103      */
0104     ATOOLS::Weights_Map OneHEvent(const int wmode);
0105 
0106     struct LocalKFactorInfo {
0107       double s {0.0};
0108       double h {0.0};
0109     };
0110     /*!
0111      * @param bvi  double Differential XS for BVI
0112      * @param b    double Differential XS for B
0113      * @param rs   double Differential XS for RS
0114      * @param r    double Differential XS for R
0115      * @return S and H values corresponding to m_kfacmode
0116      *
0117      * This method calculates S and H values needed to calculate the local
0118      * Kfactor for MENLOPS for given differential XS values
0119      */
0120     LocalKFactorInfo
0121     CalculateLocalKFactorInfo(double bvi, double b, double rs, double r);
0122 
0123     struct HEventVeto_Args {
0124       Jet_Finder *p_jf;
0125       double m_jcv;
0126       HEventVeto_Args(Jet_Finder *const jf,const double &jcv):
0127     p_jf(jf), m_jcv(jcv) {}
0128     };
0129 
0130   public:
0131 
0132     /*!
0133      * @param gens ME_Generators Matrix element generators
0134      * @param pmap NLOTypeStringProcessMap_Map global process map
0135      *
0136      * Constructor
0137      */
0138     MCatNLO_Process(ME_Generators &gens,NLOTypeStringProcessMap_Map *pmap);
0139 
0140     /*!
0141      * Destructor
0142      */
0143     ~MCatNLO_Process();
0144 
0145     /*!
0146      * @param pi Process_Info Process information on the desired process
0147      * @param beam Beam_Spectra_Handler Beam spectra handler
0148      * @param isr ISR_Handler ISR Handler
0149      * @param mode int Mode (not used)
0150      *
0151      * This method initialises the MC@@NLO process and all contributions
0152      */
0153     void Init(const Process_Info &pi,
0154               BEAM::Beam_Spectra_Handler *const beam,
0155               PDF::ISR_Handler *const isr, YFS::YFS_Handler *const yfs,
0156               const int mode=0) override;
0157     /*!
0158      * @return Returns true
0159      *
0160      * This method initialises m_iinfo and m_dinfo
0161      */
0162     bool InitSubtermInfo();
0163 
0164     /*!
0165      * @return Returns true
0166      *
0167      * Inherited from Process_Base, returns whether this process has subprocesses
0168      */
0169     bool IsGroup() const override;
0170     /*!
0171      * @return Returns 2
0172      *
0173      * Inherited from Process_Base, returns the number of subprocesses
0174      */
0175     size_t Size() const override;
0176     /*!
0177      * @param i size_t Index
0178      * @return Returns true
0179      *
0180      * Inherited from Process_Base, returns p_bviproc (i=0) or p_rsproc (i=1)
0181      */
0182     Process_Base *operator[](const size_t &i) override;
0183 
0184     /*!
0185      * @param wmode int Passed on to methods called
0186      * @param varmode Variations_Mode Specifies which weights to calculate
0187      * @param mode int Passed on to methods called
0188      * @return Returns weight information object
0189      *
0190      * Inherited from Process_Base, generates one event
0191      */
0192     ATOOLS::Weight_Info *OneEvent(
0193         const int wmode,
0194         ATOOLS::Variations_Mode varmode=ATOOLS::Variations_Mode::all,
0195         const int mode=0) override;
0196 
0197     /*!
0198      * @param p Four momenta
0199      * @param varmode Specifies which weights to calculate (all,
0200      * nominal-only, ...)
0201      * @return Returns weight of given momentum configuration
0202      *
0203      * Inherited from Process_Base, calculates the weight of given configuration
0204      */
0205     ATOOLS::Weights_Map Differential(const ATOOLS::Vec4D_Vector &,
0206                                      ATOOLS::Variations_Mode) override;
0207 
0208     /*!
0209      * @param resultpath string Path where to store the results
0210      * @param create bool Whether to create the results file or not
0211      * @return Returns weight information object
0212      *
0213      * Inherited from Process_Base, asks subprocesses to integrate themselves
0214      */
0215     bool CalculateTotalXSec(const std::string &resultpath,
0216                             const bool create=false) override;
0217     /*!
0218      * @param lookup bool Whether results can be looked up
0219      *
0220      * Inherited from Process_Base, set whether mapped processes lookup their
0221      * result or calculate anew, sets it for all subprocesses
0222      */
0223     void SetLookUp(const bool lookup) override;
0224     /*!
0225      * Inherited from Process_Base, calls InitScale for all subprocesses
0226      */
0227     bool InitScale() override;
0228     /*!
0229      * @param scale Scale_Setter_Arguments Scale setter arguments
0230      *
0231      * Inherited from Process_Base, calls SetScale for all subprocesses
0232      */
0233     void SetScale(const Scale_Setter_Arguments &scale) override;
0234     /*!
0235      * @param args KFactor_Setter_Arguments KFactor setter arguments
0236      *
0237      * Inherited from Process_Base, calls SetKFactor for all subprocesses
0238      */
0239     void SetKFactor(const KFactor_Setter_Arguments &args) override;
0240     /*!
0241      * @param mode Variations_Mode
0242      *
0243      * Inherited from Process_Base, calls InitializeTheReweighting for all
0244      * subprocess
0245      */
0246     void InitializeTheReweighting(ATOOLS::Variations_Mode) override;
0247     /*!
0248      * @param s vector<double> Fixed scales
0249      *
0250      * Inherited from Process_Base, calls SetFixedScale for all subprocesses
0251      */
0252     void SetFixedScale(const std::vector<double> &s) override;
0253     /*!
0254      * @param key Selector_Key Selector key
0255      *
0256      * Inherited from Process_Base, calls SetSelector for all subprocesses
0257      */
0258     void SetSelector(const Selector_Key &key) override;
0259     /*!
0260      * @param ps Shower_Base Parton shower
0261      *
0262      * Inherited from Process_Base, calls SetShower for all subprocesses
0263      */
0264     void SetShower(PDF::Shower_Base *const ps) override;
0265     void SetNLOMC(PDF::NLOMC_Base *const mc) override;
0266 
0267     /*!
0268      * @param ampl Cluster_Amplitude Cluster amplitude (might be updated)
0269      * @return Local KFactor
0270      *
0271      * This method calculates the local Kfactor for MENLOPS for given config
0272      */
0273     ATOOLS::Weights_Map LocalKFactor(ATOOLS::Cluster_Amplitude& ampl);
0274 
0275     /*!
0276      * @return Cluster amplitude p_ampl
0277      *
0278      * This method return p_ampl
0279      */
0280     ATOOLS::Cluster_Amplitude *GetAmplitude();
0281 
0282     /*!
0283      * @param maxerror double Error target
0284      * @param eobs string Enhance observable
0285      * @param efunc string Enhance function
0286      *
0287      * Inherited from Process_Base, calls InitPSHandler for all subprocesses
0288      */
0289     void InitPSHandler(const double &maxerror,
0290                const std::string eobs,
0291                const std::string efunc) override;
0292 
0293     /*!
0294      * @param mc NLOMC_Base MC@@NLO shower
0295      *
0296      * This method sets the MC@@NLO shower
0297      */
0298     inline void SetMCatNLO(PDF::NLOMC_Base *const mc) { p_nlomc=mc; }
0299 
0300     /*!
0301      * @return Whether event last generated was S-Event or not
0302      *
0303      * This method returns whether last generated event was S-Event or not
0304      */
0305     bool WasSEvent() const { return m_wassevent; }
0306     Process_Base* BVIProc() { return p_bviproc; }
0307 
0308   };// end of class MCatNLO_Process
0309 
0310 }// end of namespace PHASIC
0311 
0312 #endif