ThePEG  1.8.0
LHAPDF.h
1 // -*- C++ -*-
2 //
3 // LHAPDF.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef THEPEG_LHAPDF_H
10 #define THEPEG_LHAPDF_H
11 //
12 // This is the declaration of the LHAPDF class.
13 //
14 
15 #include "ThePEG/PDF/PDFBase.h"
16 
17 namespace ThePEG {
18 
33 class LHAPDF: public PDFBase {
34 
35 public:
36 
38  enum PType { nucleonType = 1,
39  pionType = 2,
40  photonType = 3
41  };
42 
43 public:
44 
50  LHAPDF();
51 
55  LHAPDF(const LHAPDF &);
57 
58 public:
59 
66  virtual bool canHandleParticle(tcPDPtr particle) const;
67 
72  virtual cPDVector partons(tcPDPtr particle) const;
73 
80  virtual double xfx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
81  double x, double eps = 0.0,
82  Energy2 particleScale = ZERO) const;
83 
92  virtual double xfvl(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
93  double l, Energy2 particleScale = ZERO) const;
94 
103  virtual double xfvx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
104  double x, double eps = 0.0,
105  Energy2 particleScale = ZERO) const;
106 
116  virtual double xfsx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
117  double x, double eps = 0.0,
118  Energy2 particleScale = ZERO) const;
120 
121 
129  PType ptype() const { return thePType; }
130 
135  const string & PDFName() const { return thePDFName; }
136 
140  int member() const { return theMember; }
141 
147  int maxFlav() const { return theMaxFlav; }
149 
150 protected:
151 
157  bool indexLine(istream & is, int & set, int & mem, string & file,
158  int & pdftyp, int & pdfgup, int & pdfsup,
159  double & xmin, double & xmax,
160  double & q2min, double & q2max) const;
161 
165  void initpdfsetm() const;
166 
170  void initpdfm() const;
171 
175  void lastReset() const;
176 
180  void setnset() const;
181 
185  int getMaxMember() const;
186 
190  int getMaxFlav() const;
191 
196  void checkInit() const;
197 
202  void checkUpdate(double x, Energy2 Q2, Energy2 P2) const;
203 
210  void setMaxNSet(int);
211 
216  int getMaxNSet() const;
217 
222  void setMinMax();
223 
227  void setPDFNumber(int n);
228 
233  int getPDFNumber() const;
234 
239  void setPDFLIBNumbers(int group, int num);
240 
245  string setPDFLIBNumbers(string);
246 
251  pair<int,int> getPDFLIBNumbers() const;
252 
256  void setPDFName(string name);
257 
261  void setPDFMember(int n);
262 
266  static std::string getIndexPath();
267 
271  static bool openLHAIndex(ifstream & is);
272 
276  string doTest(string input);
278 
279 public:
280 
287  void persistentOutput(PersistentOStream & os) const;
288 
294  void persistentInput(PersistentIStream & is, int version);
296 
303  static void Init();
304 
305 protected:
306 
313  virtual IBPtr clone() const;
314 
319  virtual IBPtr fullclone() const;
321 
322 public:
323 
326  class NotInstalled: public Exception {};
327 
329  static void throwNotInstalled();
330 
333 // If needed, insert declarations of virtual function defined in the
334 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
335 
336 protected:
337 
345  virtual void doinit();
346 
351  virtual void doinitrun();
352 
357  virtual void dofinish();
359 
360 private:
361 
368 
373  string thePDFName;
374 
379 
385 
390 
395 
402 
407  mutable int nset;
408 
412  mutable Energy2 lastQ2;
413 
417  mutable double lastX;
418 
423  mutable Energy2 lastP2;
424 
428  mutable vector<double> lastXF;
429 
436  static int MaxNSet;
437 
441  static int lastNSet;
442 
446  static vector<string> lastNames;
447 
451  static vector<int> lastMem;
452 
456  double xMin;
457 
461  double xMax;
462 
466  Energy2 Q2Min;
467 
471  Energy2 Q2Max;
472 
473 private:
474 
480 
485  LHAPDF & operator=(const LHAPDF &);
486 
487 };
488 
489 }
490 
491 #include "ThePEG/Utilities/ClassTraits.h"
492 
493 namespace ThePEG {
494 
499 template <>
500 struct BaseClassTrait<LHAPDF,1> {
502  typedef PDFBase NthBase;
503 };
504 
507 template <>
508 struct ClassTraits<LHAPDF>
509  : public ClassTraitsBase<LHAPDF> {
511  static string className() { return "ThePEG::LHAPDF"; }
515  static string library() { return "ThePEGLHAPDF.so"; }
516 };
517 
520 }
521 
522 #endif /* THEPEG_LHAPDF_H */