Public Member Functions | Private Member Functions | List of all members
genie::PDFLIB Class Reference

LHAPDF/PDFLIB library interface. Concrete implementation of the PDFModelI interface. More...

#include <PDFLIB.h>

Inheritance diagram for genie::PDFLIB:
genie::PDFModelI genie::Algorithm

Public Member Functions

 PDFLIB ()
 
 PDFLIB (string config)
 
virtual ~PDFLIB ()
 
double UpValence (double x, double Q2) const
 
double DownValence (double x, double Q2) const
 
double UpSea (double x, double Q2) const
 
double DownSea (double x, double Q2) const
 
double Strange (double x, double Q2) const
 
double Charm (double x, double Q2) const
 
double Bottom (double x, double Q2) const
 
double Top (double x, double Q2) const
 
double Gluon (double x, double Q2) const
 
PDF_t AllPDFs (double x, double Q2) const
 
void Configure (const Registry &config)
 Configure the algorithm. More...
 
void Configure (string config)
 Configure the algorithm. More...
 
- Public Member Functions inherited from genie::PDFModelI
virtual ~PDFModelI ()
 
- Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
 
virtual void FindConfig (void)
 Lookup configuration from the config pool. More...
 
virtual const RegistryGetConfig (void) const
 Get configuration registry. More...
 
RegistryGetOwnedConfig (void)
 Get a writeable version of an owned configuration Registry. More...
 
virtual const AlgIdId (void) const
 Get algorithm ID. More...
 
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status. More...
 
virtual bool AllowReconfig (void) const
 
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm. More...
 
virtual void SetId (const AlgId &id)
 Set algorithm ID. More...
 
virtual void SetId (string name, string config)
 
const AlgorithmSubAlg (const RgKey &registry_key) const
 
void AdoptConfig (void)
 
void AdoptSubstructure (void)
 
virtual void Print (ostream &stream) const
 Print algorithm info. More...
 

Private Member Functions

void Initialize (void) const
 
void SetPDFSetFromConfig (void) const
 

Additional Inherited Members

- Protected Member Functions inherited from genie::PDFModelI
 PDFModelI ()
 
 PDFModelI (string name)
 
 PDFModelI (string name, string config)
 
- Protected Member Functions inherited from genie::Algorithm
 Algorithm ()
 
 Algorithm (string name)
 
 Algorithm (string name, string config)
 
void Initialize (void)
 
void DeleteConfig (void)
 
void DeleteSubstructure (void)
 
- Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
 
bool fOwnsConfig
 true if it owns its config. registry More...
 
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...) More...
 
AlgId fID
 algorithm name and configuration set More...
 
RegistryfConfig
 config. (either owned or pointing to config pool) More...
 
AlgStatus_t fStatus
 algorithm execution status More...
 
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool) More...
 

Detailed Description

LHAPDF/PDFLIB library interface. Concrete implementation of the PDFModelI interface.

Author
Costas Andreopoulos <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

June 06, 2004

Copyright (c) 2003-2017, GENIE Neutrino MC Generator Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 27 of file PDFLIB.h.

Constructor & Destructor Documentation

PDFLIB::PDFLIB ( )

Definition at line 44 of file PDFLIB.cxx.

44  :
45 PDFModelI("genie::PDFLIB")
46 {
47  this->Initialize();
48 }
void Initialize(void) const
Definition: PDFLIB.cxx:63
PDFLIB::PDFLIB ( string  config)

Definition at line 50 of file PDFLIB.cxx.

50  :
51 PDFModelI("genie::PDFLIB", config)
52 {
53  LOG("PDF", pDEBUG) << "PDFLIB configuration:\n " << *fConfig;
54 
55  this->Initialize();
56 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:87
Registry * fConfig
config. (either owned or pointing to config pool)
Definition: Algorithm.h:122
void Initialize(void) const
Definition: PDFLIB.cxx:63
#define pDEBUG
Definition: Messenger.h:54
PDFLIB::~PDFLIB ( )
virtual

Definition at line 58 of file PDFLIB.cxx.

59 {
60 
61 }

Member Function Documentation

PDF_t PDFLIB::AllPDFs ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 197 of file PDFLIB.cxx.

198 {
199  PDF_t pdf;
200 
201 #ifdef __GENIE_LHAPDF_ENABLED__
202  //
203  // LHAPDF
204  //
205 
206  // QCD scale
207  double Q = TMath::Sqrt( TMath::Abs(Q2) );
208 
209  vector<double> pdfs = LHAPDF::xfx(x, Q);
210  pdf.uval = pdfs[8] - pdfs[4];
211  pdf.dval = pdfs[7] - pdfs[5];
212  pdf.usea = pdfs[4];
213  pdf.dsea = pdfs[5];
214  pdf.str = pdfs[9];
215  pdf.chm = pdfs[10];
216  pdf.bot = pdfs[11];
217  pdf.top = pdfs[12];
218  pdf.gl = pdfs[6];;
219 
220 /*
221 #else
222  //
223  // PDFLIB
224  //
225 
226  double uval, dval, usea, dsea, str, chm, bot, top, gl;
227 
228  // call structm from the fortran PDFLIB library
229  structm_(&x, &q, &uval, &dval, &usea, &dsea, &str, &chm, &bot, &top, &gl);
230 
231  pdf.uval = uval;
232  pdf.dval = dval;
233  pdf.usea = usea;
234  pdf.dsea = dsea;
235  pdf.str = str;
236  pdf.chm = chm;
237  pdf.bot = bot;
238  pdf.top = top;
239  pdf.gl = gl;
240 */
241 
242 #endif
243 
244  return pdf;
245 }
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:642
A struct to hold PDF set data.
double PDFLIB::Bottom ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 182 of file PDFLIB.cxx.

183 {
184  return AllPDFs(x,Q2).bot;
185 }
PDF_t AllPDFs(double x, double Q2) const
Definition: PDFLIB.cxx:197
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:642
double PDFLIB::Charm ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 177 of file PDFLIB.cxx.

178 {
179  return AllPDFs(x,Q2).chm;
180 }
PDF_t AllPDFs(double x, double Q2) const
Definition: PDFLIB.cxx:197
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:642
void PDFLIB::Configure ( const Registry config)
virtual

Configure the algorithm.

Reimplemented from genie::Algorithm.

Definition at line 247 of file PDFLIB.cxx.

248 {
249  Algorithm::Configure(config);
250 
251  this->Initialize();
252  this->SetPDFSetFromConfig();
253 
254  fAllowReconfig=false;
255 }
void SetPDFSetFromConfig(void) const
Definition: PDFLIB.cxx:101
virtual void Configure(const Registry &config)
Configure the algorithm.
Definition: Algorithm.cxx:70
void Initialize(void) const
Definition: PDFLIB.cxx:63
void PDFLIB::Configure ( string  config)
virtual

Configure the algorithm.

Reimplemented from genie::Algorithm.

Definition at line 257 of file PDFLIB.cxx.

258 {
260 
261  this->Initialize();
262  this->SetPDFSetFromConfig();
263 
264  fAllowReconfig=false;
265 }
void SetPDFSetFromConfig(void) const
Definition: PDFLIB.cxx:101
virtual void Configure(const Registry &config)
Configure the algorithm.
Definition: Algorithm.cxx:70
void Initialize(void) const
Definition: PDFLIB.cxx:63
double PDFLIB::DownSea ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 167 of file PDFLIB.cxx.

168 {
169  return AllPDFs(x,Q2).dsea;
170 }
PDF_t AllPDFs(double x, double Q2) const
Definition: PDFLIB.cxx:197
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:642
double PDFLIB::DownValence ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 157 of file PDFLIB.cxx.

158 {
159  return AllPDFs(x,Q2).dval;
160 }
PDF_t AllPDFs(double x, double Q2) const
Definition: PDFLIB.cxx:197
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:642
double PDFLIB::Gluon ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 192 of file PDFLIB.cxx.

193 {
194  return AllPDFs(x,Q2).gl;
195 }
PDF_t AllPDFs(double x, double Q2) const
Definition: PDFLIB.cxx:197
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:642
void PDFLIB::Initialize ( void  ) const
private

Definition at line 63 of file PDFLIB.cxx.

64 {
65 #ifdef __GENIE_LHAPDF_ENABLED__
66  //
67  // LHAPDF
68  //
69  bool lhapath_ok = true;
70  const char * lhapath = gSystem->Getenv("LHAPATH");
71  if(!lhapath) lhapath_ok = false;
72  else {
73  void *dirp = gSystem->OpenDirectory(lhapath);
74  if (dirp) gSystem->FreeDirectory(dirp);
75  else lhapath_ok = false;
76  }
77  if(!lhapath_ok) {
78  LOG("PDF", pFATAL)
79  << "\n"
80  << "** LHAPDF won't be able to read-in the PDF data. \n"
81  << "** The LHAPATH env. variable is not properly (or at all) defined. \n"
82  << "** Please, set LHAPATH to <lhapdf_top_dir>/PDFsets/ \n"
83  << "** See http://projects.hepforge.org/lhapdf/ for more details. \n\n";
84  gAbortingInErr = true;
85  exit(1);
86  }
87 
88 /*
89 #else
90  //
91  // PDFLIB
92  //
93  char param[20][20];
94  double val[20];
95  strcpy(param[0], "Init0");
96  pdfset_(param, val); // call pdfset from the fortran PDFLIB library
97 */
98 #endif
99 }
#define pFATAL
Definition: Messenger.h:47
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:87
bool gAbortingInErr
Definition: Messenger.cxx:56
void PDFLIB::SetPDFSetFromConfig ( void  ) const
private

Definition at line 101 of file PDFLIB.cxx.

102 {
103 // Get PDF spec (particle type, pdf group/set) from configuration registry.
104 // For definitions, have a look at PDFLIB and LHAPDF manuals
105 
106 #ifdef __GENIE_LHAPDF_ENABLED__
107  //
108  // LHAPDF
109  //
110  string name = "";
111  int type = 0;
112  int memset = 0;
113 
114  fConfig->Get("name_lhapdf", name);
115  fConfig->Get("type_lhapdf", type);
116  fConfig->Get("memset_lhapdf", memset);
117 
118  LHAPDF::SetType stype = (type==0) ? LHAPDF::LHPDF : LHAPDF::LHGRID;
119 
120  LHAPDF::initPDFByName(name, stype, memset);
121  LHAPDF::extrapolate(false);
122 
123 /*
124 #else
125  //
126  // PDFLIB
127  //
128  int nptype = -1; // particle type
129  int ngroup = -1; // PDF author group
130  int nset = -1; // PDF set --within PDF author group--
131 
132  fConfig->Get("nptype_pdflib", nptype);
133  fConfig->Get("ngroup_pdflib", ngroup);
134  fConfig->Get("nset_pdflib", nset );
135 
136  char param[20][20];
137  double val[20];
138 
139  strcpy(param[0],"Nptype");
140  val[0] = nptype;
141  strcpy(param[1],"Ngroup");
142  val[1] = ngroup;
143  strcpy(param[2],"Nset");
144  val[2] = nset;
145 
146  pdfset_(param, val);
147 */
148 
149 #endif
150 }
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:339
Registry * fConfig
config. (either owned or pointing to config pool)
Definition: Algorithm.h:122
double PDFLIB::Strange ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 172 of file PDFLIB.cxx.

173 {
174  return AllPDFs(x,Q2).str;
175 }
PDF_t AllPDFs(double x, double Q2) const
Definition: PDFLIB.cxx:197
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:642
double PDFLIB::Top ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 187 of file PDFLIB.cxx.

188 {
189  return AllPDFs(x,Q2).top;
190 }
PDF_t AllPDFs(double x, double Q2) const
Definition: PDFLIB.cxx:197
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:642
double PDFLIB::UpSea ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 162 of file PDFLIB.cxx.

163 {
164  return AllPDFs(x,Q2).usea;
165 }
PDF_t AllPDFs(double x, double Q2) const
Definition: PDFLIB.cxx:197
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:642
double PDFLIB::UpValence ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 152 of file PDFLIB.cxx.

153 {
154  return AllPDFs(x,Q2).uval;
155 }
PDF_t AllPDFs(double x, double Q2) const
Definition: PDFLIB.cxx:197
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:642

The documentation for this class was generated from the following files: