Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef PDF_Main_ISR_Handler_H
0002 #define PDF_Main_ISR_Handler_H
0003 
0004 #include "ATOOLS/Math/Vector.H"
0005 #include "ATOOLS/Math/Poincare.H"
0006 #include "ATOOLS/Org/Info_Key.H"
0007 #include "PDF/Main/ISR_Base.H"
0008 
0009 namespace ATOOLS   { class Blob_Data_Base; }
0010 namespace BEAM     { class Beam_Base;      }
0011 namespace REMNANTS { class Remnant_Base;   }
0012 
0013 namespace PDF {
0014   struct isr {
0015     enum id {
0016       none            =  0,
0017       hard_process    =  1,
0018       hard_subprocess =  2,
0019       bunch_rescatter =  3,
0020       unknown         = 99
0021     };
0022   };
0023 
0024   struct isrmode {
0025     enum code {
0026       none           = 0,
0027       hadron_hadron  = 1,
0028       lepton_hadron  = 2,
0029       hadron_lepton  = 3,
0030       lepton_lepton  = 4,
0031       unknown        = 99
0032     };
0033   };
0034   std::ostream& operator<<(std::ostream&,isrmode::code mode);
0035 
0036 
0037   class ISR_Handler;
0038   typedef std::map<isr::id,PDF::ISR_Handler*> ISR_Handler_Map;
0039   typedef std::vector<double> Double_Vector;
0040 
0041   class ISR_Handler {
0042 
0043   protected:
0044     ISR_Base *p_isrbase[2];
0045 
0046     isr::id       m_id;
0047     std::string   m_name;
0048     isrmode::code m_type;
0049 
0050     int m_mode, m_rmode, m_swap;
0051 
0052     std::array<double, 2> m_mass2, m_exponent, m_x, m_mu2;
0053     ATOOLS::Info_Key m_sprimekey, m_ykey, m_xkey;
0054     double m_splimits[3],m_ylimits[2];
0055     double m_fixed_smin, m_fixed_smax;
0056 
0057     ATOOLS::Poincare m_cmsboost;
0058 
0059     std::vector<double> m_info_lab, m_info_cms;
0060 
0061     BEAM::Beam_Base        * p_beam[2];
0062     REMNANTS::Remnant_Base * p_remnants[2];
0063 
0064     double m_xf1, m_xf2;
0065 
0066     bool m_freezePDFforLowQ;
0067 
0068     void FixType();
0069 
0070   public:
0071     ISR_Handler(std::array<ISR_Base *, 2> isrbase,const isr::id & id=isr::hard_process);
0072     ~ISR_Handler();
0073 
0074     void Init();
0075 
0076     bool CheckConsistency(ATOOLS::Flavour *bunches,ATOOLS::Flavour *partons);
0077     bool CheckConsistency(ATOOLS::Flavour *partons);
0078     void SetPartonMasses(const ATOOLS::Flavour_Vector &fl);
0079     void SetMasses(const ATOOLS::Flavour_Vector &fl);
0080     bool CheckMasses();
0081 
0082     bool MakeISR(const double &sp,const double &y,
0083          ATOOLS::Vec4D_Vector& p,const ATOOLS::Flavour_Vector &flavs);
0084     bool GenerateSwap(const ATOOLS::Flavour &f1,const ATOOLS::Flavour &f2);
0085     bool AllowSwap(const ATOOLS::Flavour &f1,const ATOOLS::Flavour &f2) const;
0086 
0087     double PDFWeight(int mode,
0088                      ATOOLS::Vec4D p1,ATOOLS::Vec4D p2,double Q12,double Q22,
0089                      ATOOLS::Flavour fl1,ATOOLS::Flavour fl2,int warn=1);
0090     static double Flux(const ATOOLS::Vec4D& p1);
0091     static double Flux(const ATOOLS::Vec4D& p1, const ATOOLS::Vec4D& p2);
0092     double CalcX(ATOOLS::Vec4D p);
0093 
0094     bool BoostInCMS(ATOOLS::Vec4D *p,size_t n);
0095     bool BoostInLab(ATOOLS::Vec4D *p,size_t n);
0096     ATOOLS::Poincare* GetCMSBoost() { return &m_cmsboost; }
0097 
0098     void AssignKeys(ATOOLS::Integration_Info *info);
0099     void SetLimits(double beamy = 0.);
0100     void Reset();
0101     void Reset(size_t i) const;
0102 
0103     REMNANTS::Remnant_Base* GetRemnant(const size_t beam) const;
0104     ATOOLS::Blob_Data_Base* Info(int frame) const;
0105 
0106     inline void SetSprimeMin(const double spmin) { m_splimits[0]=ATOOLS::Max(m_fixed_smin,spmin); }
0107     inline void SetSprimeMax(const double spmax) { m_splimits[1]=ATOOLS::Min(m_fixed_smax,spmax); }
0108     inline void SetFixedSprimeMin(const double spmin) { m_fixed_smin = m_splimits[0] = spmin; }
0109     inline void SetFixedSprimeMax(const double spmax) { m_fixed_smax = m_splimits[1] = spmax; }
0110     inline void SetPole(const double pole)      { m_splimits[2] = pole; }
0111     inline void SetYMin(const double ymin)      { m_ylimits[0]  = ymin; }
0112     inline void SetYMax(const double ymax)      { m_ylimits[1]  = ymax; }
0113     inline void SetName(const std::string& name) { m_name = name;        }
0114     inline std::string Name() const             { return m_name; }
0115     inline isrtype::code Type(const int & i=-1) const { return p_isrbase[i]->Type(); }
0116     inline isr::id Id() const                   { return m_id; }
0117     inline const isrmode::code & Mode() const   { return m_type; }
0118     inline int    On() const                    { return m_mode;    }
0119     inline double * SprimeRange()               { return m_splimits;    }
0120     inline double * YRange()                    { return m_ylimits;     }
0121     inline double  Exponent(const int i) const  { return m_exponent[i]; }
0122     inline double SprimeMin() const             { return m_splimits[0]; }
0123     inline double SprimeMax() const             { return m_splimits[1]; }
0124     inline double Pole() const                  { return m_splimits[2]; }
0125     inline double YMin() const                  { return m_ylimits[0];  }
0126     inline double YMax() const                  { return m_ylimits[1];  }
0127     inline double Upper1() const                { return p_isrbase[0]->XMax(); }
0128     inline double Upper2() const                { return p_isrbase[1]->XMax(); }
0129     inline double X1() const                    { return m_x[0]; }
0130     inline double X2() const                    { return m_x[1]; }
0131     inline double MuF2(int beam) const          { return m_mu2[beam]; }
0132     inline void   SetMuF2(double mu2, int beam) { m_mu2[beam]=mu2; }
0133     inline double XF1() const                   { return m_xf1; }
0134     inline double XF2() const                   { return m_xf2; }
0135     inline void   SetXF1(double xf)             { m_xf1 = xf; }
0136     inline void   SetXF2(double xf)             { m_xf2 = xf; }
0137     inline int Swap() const                     { return m_swap; }
0138 
0139     inline void SetPDF(PDF_Base *pdf) {
0140       SetPDF(pdf, 0); SetPDF(pdf, 1);
0141     }
0142     inline void SetPDF(PDF_Base *pdf, const size_t beam) {
0143       if (beam<2) p_isrbase[beam]->SetPDF(pdf);
0144     }
0145     inline PDF_Base * PDF(const size_t beam) {
0146       return (beam<2?p_isrbase[beam]->PDF():nullptr);
0147     }
0148     inline void SetPDFMember() const {
0149       for (auto isr : p_isrbase)
0150     if (isr->On()) isr->PDF()->SetPDFMember();
0151     }
0152 
0153     inline ATOOLS::Flavour  Flav(const size_t beam) {
0154       return p_isrbase[beam]->Flavour();
0155     }
0156     inline void SetRemnant(REMNANTS::Remnant_Base * remnant,const size_t beam) {
0157       if (beam<2) p_remnants[beam] = remnant;
0158     }
0159     inline void SetRescaleFactor(const double & rescale,const size_t beam) {
0160       p_isrbase[beam]->SetRescaleFactor(rescale);
0161     }
0162     inline void ResetRescaleFactor(const size_t beam) { SetRescaleFactor(1.,beam); }
0163     inline void SetBeam(BEAM::Beam_Base *const beambase,const size_t beam) {
0164       if (beam<2) p_beam[beam]=beambase;
0165     }
0166     inline BEAM::Beam_Base * GetBeam(const size_t beam) const {
0167       return beam<2?p_beam[beam]:nullptr;
0168     }
0169     inline void SetRunMode(const int &rmode) { m_rmode=rmode; }
0170 
0171     void Output();
0172   };// end of class ISR_Handler
0173 
0174   /*!
0175     \namespace PDF
0176     The namespace PDF houses all classes that are employed to generate
0177     parton spectra. In the framework of both the SHERPA package and of the
0178     program AMEGIC the following nomenclature is assumed :
0179     - There are incoming beams at a certain energy, the nominal energy of the
0180       beam in the collider, which then result in bunches of interacting
0181       particles which have an energy distribution, and, maybe, a \f$k_\perp\f$
0182       distribution of transverse momenta w.r.t.the beam axis.
0183     - The bunch particles then can have a substructure, i.e. they might consist of
0184       partons, which then interact in a hard subprocess.
0185 
0186     As an illustrative example, consider the case of DIS of an electron on a photon.
0187     The incoming electron beam emits bunches of photons that might or might not
0188     resolved into partons during the interaction with the proton. In the PDF namespace,
0189     the parton distribution funcitons of both the photon and the proton are handled.
0190   */
0191   /*!
0192     \class ISR_Handler
0193     \brief Manager of all Initial State Radiation that can be identifeid as parton
0194            distributions.
0195     This class manages all initial state radiation (ISR) according to the parton
0196     distribution functions (PDFs) that are handed over. The ISR_Handler is initialized from
0197     the SHERPA package or from Amegic. Before coming into full effect during integration
0198     or event generation, it initalises suitable ISR treatment through ISR_Bases that will
0199     contain the PDFs for each of the bunches.
0200   */
0201   /*!
0202     \var ISR_Base ** ISR_Handler::p_isrbase
0203     Pointers to the two ISR bases, one for each bunch.
0204 
0205     \sa ISR_Base
0206   */
0207   /*!
0208      \var int ISR_Handler::m_mode
0209      The m_mode flag indicates what kind of ISR treatment is to be considered:
0210      - 0 no ISR for both bunchs
0211      - 1 only bunch 1 experiences ISR
0212      - 2 only bunch 2 experiences ISR
0213      - 3 both bunches experience ISR.
0214   */
0215   /*!
0216     \var ATOOLS::Poincare ISR_Handler::m_cmsboost
0217     A boost from the c.m. system of the incoming bunches to the c.m. system of the
0218     outgoing partons, which form the initial state of the hard interaction.
0219   */
0220   /*!
0221     \var double ISR_Handler::m_exponent[2]
0222     Characteristic exponents used for the integration.
0223   */
0224   /*!
0225     \var double ISR_Handler::m_splimits[3]
0226     \f$s'\f$-limits and characteristics:
0227     m_splimits[0,1] = \f$s'_{\rm min, max}\f$
0228     and
0229     m_splimits[2] = \f$s_{\rm beams}\f$.
0230   */
0231   /*!
0232     \var ISR_Handler::m_ylimits[2]
0233     The rapidity region covered. It is per default set to the range \f$y \in [-10,10]\f$. In fact
0234     this range should be calculated from the range of the BeamBases.
0235     \todo Rapidity range from BeamBases.
0236   */
0237   /*!
0238     \var double ISR_Handler::m_mass2
0239     Squares of the masses of the incoming particles.
0240   */
0241   /*!
0242     \var double ISR_Handler::m_x
0243     The energy fractions each outgoing bunch has w.r.t. the corresponding
0244     incoming beams.
0245   */
0246   /*!
0247     var std::string ISR_Handler::m_name
0248     Name of the ISR_Handler.
0249   */
0250   /*!
0251     var std::string ISR_Handler::m_type
0252     Type of the ISR_Handler, it consists of the types of the BeamBases.
0253   */
0254   /*!
0255     \fn bool ISR_Handler::CheckConsistency(ATOOLS::Flavour *,ATOOLS::Flavour *)
0256     This checks whether the two sets of flavours match the flavours of the incoming
0257     and outgonig particles of the two p_isrbases. If this is the case, true is returned.
0258     This method is largely similar to the corresponding one in the BEAM::Beam_Spectra_Handler.
0259   */
0260   /*!
0261     \fn bool ISR_Handler::CheckConsistency(ATOOLS::Flavour *)
0262     This checks whether the flavours are allowed to be used as outgonig flavours in the
0263     two p_isrbases. If this is the case, true is returned. This method is largely similar to
0264     the corresponding one in the BEAM::Beam_Spectra_Handler.
0265   */
0266   /*!
0267     \fn void ISR_Handler::SetPartonMasses(ATOOLS::Flavour * _fl)
0268     This sets the masses squared and the vectors such that they fit to the masses of the
0269     flavours.
0270   */
0271   /*!
0272     \fn bool ISR_Handler::MakeISR(ATOOLS::Vec4D *,double,double);
0273     Depending on the \f$s'\f$-value handed over as arguments, two matching vectors for the
0274     outgoing partons in their c.m. frame (out) are constructed. Then the energy fractions in the
0275     c.m. system (in) of the incoming bunches are determined with help of the other argument, the
0276     rapidity \f$y\f$ according to
0277     \f[
0278     \hat E^{(in)}_{1,2} = \exp\left(\pm y\right)
0279     \f]
0280     and the boost linking the two frames, CMBoost is initialized. This boost is then used
0281     to bring the c.m. vectors into the correct frame, i.e. the c.m. frame
0282     of the bunches, i.e.
0283     \f[
0284     p^{(out)}_{1,2} \Longrightarrow p^{(in)}_{1,2}\,.
0285     \f]
0286     This method is largely similar to the corresponding one in the
0287     BEAM::Beam_Spectra_Handler.
0288   */
0289 }
0290 
0291 #endif