8 #ifndef Pythia8_LHAPDF5_H 9 #define Pythia8_LHAPDF5_H 11 #include "Pythia8/PartonDistributions.h" 12 #include "Pythia8/Plugins.h" 28 extern void initpdfsetbynamem_(
int&,
const char*,
int);
30 extern void initpdfm_(
int&,
int&);
32 extern void evolvepdfm_(
int&,
double&,
double&,
double*);
34 extern void evolvepdfpm_(
int&,
double&,
double&,
double&,
double&,
double*);
36 extern void evolvepdfphotonm_(
int&,
double&,
double&,
double*,
double&);
38 extern void setlhaparm_(
const char*,
int);
40 extern void getxminm_(
int &,
int &,
double &);
42 extern void getxmaxm_(
int &,
int &,
double &);
44 extern void getq2minm_(
int &,
int &,
double &);
46 extern void getq2maxm_(
int &,
int &,
double &);
54 namespace LHAPDF5Interface {
58 const char* cName = name.c_str();
int lenName = name.length();
64 const char* cName = name.c_str();
int lenName = name.length();
65 initpdfsetbynamem_( nSet, cName, lenName);
70 initpdfm_(nSet, member);
74 void evolvePDFM(
int& nSet,
double x,
double Q,
double* xfArray) {
75 evolvepdfm_( nSet, x, Q, xfArray);
79 void evolvePDFpM(
int& nSet,
double x,
double Q,
double P2,
double IP2,
81 evolvepdfpm_( nSet, x, Q, P2, IP2, xfArray);
87 evolvepdfphotonm_( nSet, x, Q, xfArray, xPhoton);
92 const char* cName = name.c_str();
int lenName = name.length();
93 setlhaparm_( cName, lenName);
109 for (map<int, LHAPDFInfo>::const_iterator i = initializedSets.begin();
110 i != initializedSets.end(); ++i) {
112 string iName = i->second.name;
113 int iMember = i->second.member;
114 if (iName == setName && iMember == member)
return iSet;
121 for (
int iSet = 1; iSet <= int(initializedSets.size()); ++iSet) {
122 if (initializedSets.find(iSet) == initializedSets.end())
125 return initializedSets.size() + 1;
144 PDF(), doExtraPol(false) {
145 if (settingsPtr ==
nullptr)
return;
146 sSymmetric(settingsPtr->
flag(
"LHAPDF:sSymmetric"));
147 cSymmetric(settingsPtr->
flag(
"LHAPDF:cSymmetric"));
148 bSymmetric(settingsPtr->
flag(
"LHAPDF:bSymmetric"));
152 bool init(
int idBeamIn,
string setName,
int member,
Logger* loggerPtr)
156 void setExtrapolate(
bool extrapol);
161 void xfUpdate(
int ,
double x,
double Q2);
167 bool hasPhoton, isPhoton;
179 idBeamAbs = abs(idBeamIn);
180 isPhoton = idBeamIn == 22;
187 string initializedSetName = initializedInfo.name;
188 int initializedMember = initializedInfo.member;
189 hasPhoton = initializedInfo.photon;
190 if (setName == initializedSetName && member == initializedMember)
209 hasPhoton = xPhoton != 0;
212 initializedInfo.name = setName;
213 initializedInfo.member = member;
214 initializedInfo.photon = hasPhoton;
226 doExtraPol = extrapol;
235 void LHAPDF5::xfUpdate(
int,
double x,
double Q2) {
239 double xMin, xMax, q2Min, q2Max;
240 getxminm_( nSet, member, xMin);
241 getxmaxm_( nSet, member, xMax);
242 getq2minm_(nSet, member, q2Min);
243 getq2maxm_(nSet, member, q2Max);
244 if (x < xMin && !doExtraPol) x = xMin;
245 if (x > xMax) x = xMax;
246 if (Q2 < q2Min) Q2 = q2Min;
247 if (Q2 > q2Max) Q2 = q2Max;
248 double Q = sqrt( max( 0., Q2));
275 xsbar = sSymmetricSave ? xs : xfArray[3];
276 xcbar = cSymmetricSave ? xc : xfArray[2];
277 xbbar = bSymmetricSave ? xb : xfArray[1];
289 PYTHIA8_PLUGIN_CLASS(
PDF,
LHAPDF5,
false,
false,
false)
290 PYTHIA8_PLUGIN_VERSIONS(PYTHIA_VERSION_INTEGER)
bool flag(string keyIn)
Give back current value, with check that key exists.
Definition: Settings.cc:1478
Plugin interface to the LHAPDF5 library.
Definition: LHAPDF5.h:138
void initPDFsetByNameM(int &nSet, string name)
Initialize set with simple name, allowing multiple sets.
Definition: LHAPDF5.h:63
void initPDFsetM(int &nSet, string name)
Initialize set with full pathname, allowing multiple sets.
Definition: LHAPDF5.h:57
map< int, LHAPDFInfo > initializedSets
Global tracking of opened PDF sets.
Definition: LHAPDF5.h:104
void initPDFM(int &nSet, int member)
Initialize member of set.
Definition: LHAPDF5.h:69
void evolvePDFPHOTONM(int &nSet, double x, double Q, double *xfArray, double &xPhoton)
Evaluate x f_i(x, Q) including photon.
Definition: LHAPDF5.h:85
bool init(int idBeamIn, string setName, int member, Logger *loggerPtr) override
Initialization of PDF set.
Definition: LHAPDF5.h:176
int freeNSet()
Method to return the lowest non-occupied nSet number.
Definition: LHAPDF5.h:120
void setExtrapolate(bool extrapol)
Allow extrapolation beyond boundaries. This is optional.
Definition: LHAPDF5.h:224
void evolvePDFM(int &nSet, double x, double Q, double *xfArray)
Evaluate x f_i(x, Q).
Definition: LHAPDF5.h:74
void setPDFparm(string name)
Extrapolate PDF set beyond boundaries, or freeze them there.
Definition: LHAPDF5.h:91
void initpdfsetm_(int &, const char *, int)
Interfaces to to make the C++ calls similar to f77.
Base class for parton distribution functions.
Definition: PartonDistributions.h:49
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
The Pythia class contains the top-level routines to generate an event.
Definition: Pythia.h:71
Simple structure to hold LHAPDF set information.
Definition: LHAPDF5.h:97
LHAPDF5(Pythia *, Settings *settingsPtr, Logger *)
Constructor.
Definition: LHAPDF5.h:143
int findNSet(string setName, int member)
Definition: LHAPDF5.h:108
void evolvePDFpM(int &nSet, double x, double Q, double P2, double IP2, double *xfArray)
Evaluate x f_i(x, Q) for photon beams.
Definition: LHAPDF5.h:79
Definition: Settings.h:195