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 };
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289 }
0290
0291 #endif