LHAPDF C++ wrapper  5.4
LHAPDF.h
1 #ifndef LHAPDF_H
2 #define LHAPDF_H
3 
4 #include "LHAPDF/LHAPDFConfig.h"
5 
6 #include <string>
7 #include <vector>
8 #include <iostream>
9 #include <sstream>
10 
59 // Compatibility preprocessing of deprecated "M" function names
60 #define initPDFSetM initPDFSet
61 #define initPDFSetByNameM initPDFSetByName
62 #define initPDFM initPDF
63 #define initPDFByNameM initPDFByName
64 #define getDescriptionM getDescription
65 #define xfxM xfx
66 #define xfxpM xfxp
67 #define xfxaM xfxa
68 #define xfxphotonM xfxphoton
69 #define numberPDFM numberPDF
70 #define alphasPDFM alphasPDF
71 #define getOrderPDFM getOrderPDF
72 #define getOrderAlphaSM getOrderAlphaS
73 #define getQMassM getQMass
74 #define getThresholdM getThreshold
75 #define getNfM getNf
76 #define getLam4M getLam4
77 #define getLam5M getLam5
78 #define getXminM getXmin
79 #define getXmaxM getXmax
80 #define getQ2minM getQ2min
81 #define getQ2maxM getQ2max
82 
83 
85 namespace LHAPDF {
86 
91  enum Flavour {
92  TBAR= -6, BBAR = -5, CBAR = -4, SBAR = -3, UBAR = -2, DBAR = -1,
93  GLUON = 0,
94  DOWN = 1, UP = 2, STRANGE = 3, CHARM = 4, BOTTOM = 5, TOP= 6,
95  PHOTON = 7
96  };
97 
101  enum SetType {
102  EVOLVE = 0, LHPDF = 0,
103  INTERPOLATE = 1, LHGRID = 1
104  };
105 
107  enum Verbosity { SILENT=0, LOWKEY=1, DEFAULT=2 };
108 
109 
111 
112 
114  std::string getVersion();
115 
117  int getMaxNumSets();
118 
120  void initLHAPDF();
121 
123  void setVerbosity(Verbosity noiselevel);
124 
126  void extrapolate(bool extrapolate=true);
127 
129  void setPDFPath(const std::string& path);
130 
132  void setParameter(const std::string& parm);
133 
135 
136 
138 
139 
141  class PDFSetInfo {
142  public:
143  std::string file;
144  std::string description;
145  int id;
146  int pdflibNType, pdflibNGroup, pdflibNSet;
147  int memberId;
148  double lowx, highx;
149  double lowQ2, highQ2;
150 
152  std::string toString() const {
153  std::ostringstream os;
154  os << "PDF set #" << id
155  << " {"
156  << " file='" << file << "',"
157  << " description='" << description << "',"
158  << " x = [" << lowx << ", " << highx << "],"
159  << " Q2 = [" << lowQ2 << ", " << highQ2 << "]"
160  << " }";
161  return os.str();
162  }
163  };
164 
165 
166  inline std::ostream& operator<<(std::ostream& os, const PDFSetInfo& info) {
167  os << info.toString();
168  return os;
169  }
170 
172  PDFSetInfo getPDFSetInfo(const std::string& filename, int memid);
173 
175  PDFSetInfo getPDFSetInfo(int id);
176 
178  std::vector<PDFSetInfo> getAllPDFSetInfo();
180 
181 
183 
184 
186  std::string prefixPath();
187 
189  std::string pdfsetsPath();
190 
192  std::string pdfsetsIndexPath();
193 
195 
196 
201 
202 
204  void initPDFSet(int setid, int member);
206  void initPDFSet(int nset, int setid, int member); // can't have a default 3rd arg
207 
209  void initPDFSet(const std::string& name, SetType type, int member=0);
211  void initPDFSet(int nset, const std::string& name, SetType type, int member=0);
212 
216  void initPDFSet(const std::string& filename, int member=0);
220  void initPDFSet(int nset, const std::string& filename, int member=0);
221 
224  void usePDFMember(int member);
227  void usePDFMember(int nset, int member);
229 
230 
232 
233 
235  void getDescription();
237  void getDescription(int nset);
238 
240  bool hasPhoton();
241 
243  int numberPDF();
245  int numberPDF(int nset);
246 
248  double alphasPDF(double Q);
250  double alphasPDF(int nset, double Q);
251 
253  int getOrderPDF();
255  int getOrderPDF(int nset);
256 
258  int getOrderAlphaS();
260  int getOrderAlphaS(int nset);
261 
263  double getQMass(int f);
265  double getQMass(int nset, int f);
266 
268  double getThreshold(int f);
270  double getThreshold(int nset, int f);
271 
273  int getNf();
275  int getNf(int nset);
276 
278  double getLam4(int m);
280  double getLam4(int nset, int m);
281 
283  double getLam5(int m);
285  double getLam5(int nset, int m);
286 
288  double getXmin(int m);
290  double getXmin(int nset, int m);
291 
293  double getXmax(int m);
295  double getXmax(int nset, int m);
296 
298  double getQ2min(int m);
300  double getQ2min(int nset, int m);
301 
303  double getQ2max(int m);
305  double getQ2max(int nset, int m);
307 
308 
312 
313 
318  std::vector<double> xfx(double x, double Q);
323  std::vector<double> xfx(int nset, double x, double Q);
324 
330  void xfx(double x, double Q, double* results);
336  void xfx(int nset, double x, double Q, double* results);
337 
338 
344  double xfx(double x, double Q, int fl);
350  double xfx(int nset, double x, double Q, int fl);
352 
353 
355 
356 
363  std::vector<double> xfxp(double x, double Q, double P2, int ip);
370  std::vector<double> xfxp(int nset, double x, double Q, double P2, int ip);
371 
379  void xfxp(double x, double Q, double P2, int ip, double* results);
387  void xfxp(int nset, double x, double Q, double P2, int ip, double* results);
388 
389 
397  double xfxp(double x, double Q, double P2, int ip, int fl);
405  double xfxp(int nset, double x, double Q, double P2, int ip, int fl);
407 
408 
410 
411 
418  std::vector<double> xfxa(double x, double Q, double a);
425  std::vector<double> xfxa(int nset, double x, double Q, double a);
426 
434  void xfxa(double x, double Q, double a, double* results);
442  void xfxa(int nset, double x, double Q, double a, double* results);
443 
451  double xfxa(double x, double Q, double a, int fl);
459  double xfxa(int nset, double x, double Q, double a, int fl);
461 
462 
466 
467 
475  std::vector<double> xfxphoton(double x, double Q);
481  std::vector<double> xfxphoton(int nset, double x, double Q);
482 
483 
492  void xfxphoton(double x, double Q, double* results);
501  void xfxphoton(int nset, double x, double Q, double* results);
502 
503 
512  double xfxphoton(double x, double Q, int fl);
519  double xfxphoton(int nset, double x, double Q, int fl);
521 
522 
528 
529 
531  //void initPDFSet(const std::string& path);
533  //void initPDFSet(int nset, const std::string& path);
534 
536  void initPDFSetByName(const std::string& name, SetType type);
538  void initPDFSetByName(int nset, const std::string& name, SetType type);
539 
541  void initPDFSetByName(const std::string& filename);
543  void initPDFSetByName(int nset, const std::string& filename);
544 
546  void initPDF(int memset);
548  void initPDF(int nset, int memset);
549 
555  void initPDFByName(const std::string& name, SetType type, int memset);
556 
563  void initPDFByName(int nset, const std::string& name, SetType type, int memset);
564 
569  void initPDFByName(const std::string& filename, int memset);
575  void initPDFByName(int nset, const std::string& filename, int memset);
577 
578 
579 }
580 
581 #endif
std::string getVersion()
Get LHAPDF version string.
double getQMass(int f)
Quark mass used for flavour f.
SetType
Distinction between evolution or interpolation PDF sets. Enum to choose whether evolution (i...
Definition: LHAPDF.h:101
double getQ2min(int m)
Minimum value considered valid for this set, as specified by the set authors.
void initLHAPDF()
Global initialisation.
void setPDFPath(const std::string &path)
Set the LHAPATH variable (the location of the PDF sets directory).
void usePDFMember(int member)
Use member in current PDF set. This operation is computationally cheap.
double getThreshold(int f)
Threshold for flavour f.
std::vector< double > xfxphoton(double x, double Q)
int getMaxNumSets()
Get max allowed number of concurrent sets.
std::vector< double > xfxp(double x, double Q, double P2, int ip)
void setVerbosity(Verbosity noiselevel)
Choose level of noisiness.
double getLam5(int m)
Value of QCD for member m.
PDFSetInfo getPDFSetInfo(const std::string &filename, int memid)
Get a PDF set info object by filename and member number.
std::string toString() const
Render a standard representation of a PDF set&#39;s metadata.
Definition: LHAPDF.h:152
double alphasPDF(double Q)
used by the current PDF.
void extrapolate(bool extrapolate=true)
Extrapolate beyond grid edges.
std::string pdfsetsPath()
Get path to LHAPDF PDF sets directory.
void initPDFSet(int setid, int member)
Initialise member in PDF set setid.
Flavour
Enum of flavours which map to LHAPDF integer codes. Useful for improving readability of client code...
Definition: LHAPDF.h:91
void setParameter(const std::string &parm)
Set a steering parameter (direct map to Fortran setlhaparm(parm) function).
std::string prefixPath()
Get path to LHAPDF installation (the "prefix" path).
void initPDFByName(const std::string &name, SetType type, int memset)
Convenient initializer with PDF set name, set type type and member memset.
std::vector< PDFSetInfo > getAllPDFSetInfo()
Get a vector of PDF set info objects for all known sets.
bool hasPhoton()
Does the current set have a photon member?
Verbosity
Level of noisiness.
Definition: LHAPDF.h:107
Namespace containing all the LHAPDF wrapper functions.
Definition: LHAPDF.h:85
int getOrderPDF()
Get order at which the PDF was fitted.
void initPDFSetByName(const std::string &name, SetType type)
The PDF set by file path, see subdir PDFsets of LHAPDF for choices.
void getDescription()
Prints a brief description of the current PDF set to stdout.
double getLam4(int m)
Value of QCD for member m.
int getNf()
Number of flavours used in the current PDF set.
std::string pdfsetsIndexPath()
Get path to LHAPDF PDF sets index file.
void initPDF(int memset)
The choice of PDF member out of one distribution.
double getXmax(int m)
Maximum value considered valid for this set, as specified by the set authors.
double getXmin(int m)
Minimum value considered valid for this set, as specified by the set authors.
int numberPDF()
Number of members available in the current set.
double getQ2max(int m)
Maximum value considered valid for this set, as specified by the set authors.
std::vector< double > xfx(double x, double Q)
std::vector< double > xfxa(double x, double Q, double a)
Structure containing metadata about a PDF set.
Definition: LHAPDF.h:141
int getOrderAlphaS()
Perturbative order of parton evolution and respectively.