Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef EXTAMP_Main_Dipole_Wrapper_Process_H
0002 #define EXTAMP_Main_Dipole_Wrapper_Process_H
0003 
0004 #include "EXTAMP/CS_Dipole.H"
0005 #include "EXTAMP/RS_Process.H"
0006 
0007 #include "PHASIC++/Process/Single_Process.H"
0008 
0009 namespace EXTAMP {
0010 
0011   /**
0012      A wrapper around a EXTAMP::CS_Dipole that basically adds zero
0013      functionality to it, apart from making it look like a
0014      PHASIC::Single_Process with a 'Partonic' method that returns the
0015      value of the dipole. This is necessary in the MC@@NLO
0016      implementation due to AMEGIC's legacy structure of representing
0017      dipole terms by processes.
0018   */
0019   
0020   class Dipole_Wrapper_Process : public PHASIC::Single_Process {
0021 
0022   public:
0023 
0024     Dipole_Wrapper_Process(const RS_Process& rsproc,
0025                EXTAMP::CS_Dipole* dipole,
0026                BEAM::Beam_Spectra_Handler* beam,
0027                PDF::ISR_Handler* isr,
0028                YFS::YFS_Handler* yfs);
0029 
0030     /* Calc dipole kinematics without evaluating dipole. Also perform
0031        trigger and set corresponding flag of NLO_subevt */
0032     void CalcKinematics(const ATOOLS::Vec4D_Vector& p);
0033 
0034     /* After having called CalcKinematics(), evaluate the dipole. */
0035     double Calc(ATOOLS::NLO_subevt* sub);
0036 
0037     void CalculateScale(const ATOOLS::Vec4D_Vector& real_p,
0038             const ATOOLS::Vec4D_Vector& born_p,
0039             ATOOLS::NLO_subevt* const evt);
0040 
0041     /* Inherited from PHASIC::Single_Process. Calls CalcKinematics and
0042        Calc, then returns the result. This is used in by Sherpa's
0043        MC@NLO implementation for calculating DA and DA-DS */
0044     double Partonic(const ATOOLS::Vec4D_Vector&,
0045                     ATOOLS::Variations_Mode varmode,
0046                     int mode);
0047 
0048     /* A sign implementing DA and DA-DS as defined in arXiv:1111.1200 */
0049     int MCModeSign(ATOOLS::NLO_subevt* const evt) const;
0050     double GetMaxKT2ForDA() const;
0051     double GetKT2ofSplitting(const EXTAMP::Dipole_Kinematics& kin) const;
0052 
0053     bool Combinable(const size_t &idi,
0054             const size_t &idj);
0055 
0056     void FillProcessMap(PHASIC::NLOTypeStringProcessMap_Map *apmap);
0057 
0058     const ATOOLS::Flavour_Vector &CombinedFlavour(const size_t &idij);
0059 
0060     /* Set properties of NLO_subevt according to this dipole */
0061     void SetSubEventProperties(ATOOLS::NLO_subevt& sub);
0062 
0063     /* Set a member pointer to the subevent passed */
0064     void AssignSubEvent(ATOOLS::NLO_subevt* sub);
0065 
0066     void SetScaleSetter(PHASIC::Scale_Setter_Base* scl) { p_scale = scl; }
0067 
0068     void SetNLOMC(PDF::NLOMC_Base *const nlomc);
0069 
0070     /* Set p_scale to NULL in order to avoid deleting it in destructor
0071        of PHASIC::Process_Base. It gets deleted in the RS_Process,
0072        which owns it. */
0073     ~Dipole_Wrapper_Process() { p_scale = NULL; }
0074 
0075   private:
0076 
0077     /* Flavours of this process have to be those of real emission
0078        config. NLO_subevts are assigned the born configuration,
0079        however. Store corresponding information in these members: */
0080     std::string m_born_name;
0081     PHASIC::Process_Info m_born_procinfo;
0082     ATOOLS::Flavour_Vector m_born_flavs;
0083     const ATOOLS::Flavour_Vector& BornFlavours() const { return m_born_flavs; }
0084 
0085     static PHASIC::Process_Info ConstructBornProcessInfo(const PHASIC::Process_Info& rsinfo,
0086                              size_t i, size_t j,
0087                              const ATOOLS::Flavour& flav_ij) ;
0088 
0089     /* This pointer (passed in constructor) is assumed to be valid
0090        throughout, associated memory is not managed. */
0091     EXTAMP::CS_Dipole* p_dipole;
0092     EXTAMP::CS_Dipole* Dipole() const { return p_dipole; }
0093 
0094     /* RS_Process is supposed to initialize and manages the
0095        subevent. */
0096     ATOOLS::NLO_subevt* p_subevent;
0097 
0098     /* Real emission momentum configuration with momenta of initial
0099        state particles reversed. This convention is used in
0100        NLO_subevts. */
0101     ATOOLS::Vec4D_Vector m_moms;
0102     const ATOOLS::Vec4D_Vector& Momenta() const { return m_moms; }
0103 
0104     /* Emitter, emitted, spectator index in real emission flavour
0105        vector. Follow Sherpa conventions: i<j */
0106     size_t I() const { return std::min(Dipole()->I(),Dipole()->J()); }
0107     size_t J() const { return std::max(Dipole()->I(),Dipole()->J()); }
0108     size_t K() const { return Dipole()->K(); }
0109 
0110     /* Position of combined flavour ij and spectator k in born
0111        configuration */
0112     size_t BornIJ() const { return m_inversemap[Dipole()->BornIJ()]; }
0113     size_t BornK()  const { return m_inversemap[Dipole()->BornK() ]; }
0114 
0115     /* Same as in EXTAMP::Process */
0116     double m_norm;
0117     const double& NormFac() const { return m_norm; }
0118 
0119     /* Mapping from ordering in p_dipole to ordering in this class
0120        (has to comply with Sherpa ordering conventions):
0121        Flavours[i] == Dipole()->Flavours[m_indexmap[i]] 
0122        Flavours[m_inversemap] == Dipole()->Flavours[i] */
0123     std::vector<size_t> m_indexmap;
0124     std::vector<size_t> m_inversemap;
0125     static std::vector<size_t> ConstructIndexMapping(const ATOOLS::Flavour_Vector& dipole_flavs,
0126                              const ATOOLS::Flavour_Vector& process_flavs,
0127                              size_t nin);
0128     static std::vector<size_t> InvertIndexMapping(const std::vector<size_t>& map);
0129 
0130 
0131     /* ID vector encoding the id's of particles as they are ordered in
0132        the born flavour vector. This is needed for
0133        ATOOLS::NLO_Subevents, which own a pointer to such a vector.
0134        id's are in binary encoding, meaning the i'th particle has id
0135        1<<i and the combined particles i and j have inded
0136        (1<<i|1<<j). */
0137     std::vector<size_t> m_id_vector;
0138     const std::vector<size_t>& IDVector() const {return m_id_vector; }
0139     std::vector<size_t> ConstructIDVector() const;
0140 
0141     std::map<size_t, ATOOLS::Flavour_Vector> m_cluster_flav_map;
0142 
0143   };
0144 
0145 }
0146 
0147 #endif