GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | List of all members
genie::LHAPDF5 Class Reference

LHAPDF5 library interface. Concrete implementation of the PDFModelI interface. More...

#include <LHAPDF5.h>

Inheritance diagram for genie::LHAPDF5:
Inheritance graph
[legend]
Collaboration diagram for genie::LHAPDF5:
Collaboration graph
[legend]

Public Member Functions

 LHAPDF5 ()
 
 LHAPDF5 (string config)
 
virtual ~LHAPDF5 ()
 
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)
 
void Configure (string config)
 
- Public Member Functions inherited from genie::PDFModelI
virtual ~PDFModelI ()
 
- Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
 
virtual void FindConfig (void)
 
virtual const RegistryGetConfig (void) const
 
RegistryGetOwnedConfig (void)
 
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

- Static Public Member Functions inherited from genie::Algorithm
static string BuildParamVectKey (const std::string &comm_name, unsigned int i)
 
static string BuildParamVectSizeKey (const std::string &comm_name)
 
static string BuildParamMatKey (const std::string &comm_name, unsigned int i, unsigned int j)
 
static string BuildParamMatRowSizeKey (const std::string &comm_name)
 
static string BuildParamMatColSizeKey (const std::string &comm_name)
 
- 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)
 
RegistryExtractLocalConfig (const Registry &in) const
 
RegistryExtractLowerConfig (const Registry &in, const string &alg_key) const
 Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key. More...
 
template<class T >
bool GetParam (const RgKey &name, T &p, bool is_top_call=true) const
 
template<class T >
bool GetParamDef (const RgKey &name, T &p, const T &def) const
 
template<class T >
int GetParamVect (const std::string &comm_name, std::vector< T > &v, bool is_top_call=true) const
 Handle to load vectors of parameters. More...
 
int GetParamVectKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
 
template<class T >
int GetParamMat (const std::string &comm_name, TMatrixT< T > &mat, bool is_top_call=true) const
 Handle to load matrix of parameters. More...
 
template<class T >
int GetParamMatSym (const std::string &comm_name, TMatrixTSym< T > &mat, bool is_top_call=true) const
 
int GetParamMatKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
 
int AddTopRegistry (Registry *rp, bool owns=true)
 add registry with top priority, also update ownership More...
 
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership More...
 
int MergeTopRegistry (const Registry &r)
 
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships. More...
 
- Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
 
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...) More...
 
AlgId fID
 algorithm name and configuration set More...
 
vector< Registry * > fConfVect
 
vector< bool > fOwnerships
 ownership for every registry in fConfVect More...
 
AlgStatus_t fStatus
 algorithm execution status More...
 
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool) More...
 

Detailed Description

LHAPDF5 library interface. Concrete implementation of the PDFModelI interface.

Author
Costas Andreopoulos <c.andreopoulos cern.ch> University of Liverpool
Created:
June 06, 2004
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 28 of file LHAPDF5.h.

Constructor & Destructor Documentation

LHAPDF5::LHAPDF5 ( )

Definition at line 27 of file LHAPDF5.cxx.

References Initialize().

27  :
28 PDFModelI("genie::LHAPDF5")
29 {
30  this->Initialize();
31 }
void Initialize(void) const
Definition: LHAPDF5.cxx:46
LHAPDF5::LHAPDF5 ( string  config)

Definition at line 33 of file LHAPDF5.cxx.

References genie::Algorithm::GetConfig(), Initialize(), LOG, and pDEBUG.

33  :
34 PDFModelI("genie::LHAPDF5", config)
35 {
36  LOG("LHAPDF5", pDEBUG) << "LHAPDF5 configuration:\n " << this->GetConfig();
37 
38  this->Initialize();
39 }
void Initialize(void) const
Definition: LHAPDF5.cxx:46
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:246
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pDEBUG
Definition: Messenger.h:63
LHAPDF5::~LHAPDF5 ( )
virtual

Definition at line 41 of file LHAPDF5.cxx.

42 {
43 
44 }

Member Function Documentation

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

Implements genie::PDFModelI.

Definition at line 136 of file LHAPDF5.cxx.

References genie::utils::kinematics::Q2().

Referenced by Bottom(), Charm(), DownSea(), DownValence(), Gluon(), Strange(), Top(), UpSea(), and UpValence().

143 {
144  PDF_t pdf;
145 
146 #ifdef __GENIE_LHAPDF5_ENABLED__
147  // QCD scale
148  double Q = TMath::Sqrt( TMath::Abs(Q2) );
149 
150  vector<double> pdfs = LHAPDF::xfx(x, Q);
151  pdf.uval = pdfs[8] - pdfs[4];
152  pdf.dval = pdfs[7] - pdfs[5];
153  pdf.usea = pdfs[4];
154  pdf.dsea = pdfs[5];
155  pdf.str = pdfs[9];
156  pdf.chm = pdfs[10];
157  pdf.bot = pdfs[11];
158  pdf.top = pdfs[12];
159  pdf.gl = pdfs[6];;
160 #endif
161 
162  return pdf;
163 }
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
A struct to hold PDF set data.
double LHAPDF5::Bottom ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 121 of file LHAPDF5.cxx.

References AllPDFs().

122 {
123  return AllPDFs(x,Q2).bot;
124 }
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
PDF_t AllPDFs(double x, double Q2) const
Definition: LHAPDF5.cxx:136
double LHAPDF5::Charm ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 116 of file LHAPDF5.cxx.

References AllPDFs().

117 {
118  return AllPDFs(x,Q2).chm;
119 }
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
PDF_t AllPDFs(double x, double Q2) const
Definition: LHAPDF5.cxx:136
void LHAPDF5::Configure ( const Registry config)
virtual

Configure the algorithm with an external registry The registry is merged with the top level registry if it is owned, Otherwise a copy of it is added with the highest priority

Reimplemented from genie::Algorithm.

Definition at line 165 of file LHAPDF5.cxx.

References genie::Algorithm::Configure(), genie::Algorithm::fAllowReconfig, Initialize(), and SetPDFSetFromConfig().

166 {
167  Algorithm::Configure(config);
168 
169  this->Initialize();
170  this->SetPDFSetFromConfig();
171 
172  fAllowReconfig=false;
173 }
void Initialize(void) const
Definition: LHAPDF5.cxx:46
void SetPDFSetFromConfig(void) const
Definition: LHAPDF5.cxx:70
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void LHAPDF5::Configure ( string  config)
virtual

Configure the algorithm from the AlgoConfigPool based on param_set string given in input An algorithm contains a vector of registries coming from different xml configuration files, which are loaded according a very precise prioriy This methods will load a number registries in order of priority: 1) "Tunable" parameter set from CommonParametes. This is loaded with the highest prioriry and it is designed to be used for tuning procedure Usage not expected from the user. 2) For every string defined in "CommonParame" the corresponding parameter set will be loaded from CommonParameter.xml 3) parameter set specified by the config string and defined in the xml file of the algorithm 4) if config is not "Default" also the Default parameter set from the same xml file will be loaded Effectively this avoids the repetion of a parameter when it is not changed in the requested configuration

Reimplemented from genie::Algorithm.

Definition at line 175 of file LHAPDF5.cxx.

References genie::Algorithm::Configure(), genie::Algorithm::fAllowReconfig, Initialize(), and SetPDFSetFromConfig().

176 {
177  Algorithm::Configure(config);
178 
179  this->Initialize();
180  this->SetPDFSetFromConfig();
181 
182  fAllowReconfig=false;
183 }
void Initialize(void) const
Definition: LHAPDF5.cxx:46
void SetPDFSetFromConfig(void) const
Definition: LHAPDF5.cxx:70
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
double LHAPDF5::DownSea ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 106 of file LHAPDF5.cxx.

References AllPDFs().

107 {
108  return AllPDFs(x,Q2).dsea;
109 }
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
PDF_t AllPDFs(double x, double Q2) const
Definition: LHAPDF5.cxx:136
double LHAPDF5::DownValence ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 96 of file LHAPDF5.cxx.

References AllPDFs().

97 {
98  return AllPDFs(x,Q2).dval;
99 }
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
PDF_t AllPDFs(double x, double Q2) const
Definition: LHAPDF5.cxx:136
double LHAPDF5::Gluon ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 131 of file LHAPDF5.cxx.

References AllPDFs().

132 {
133  return AllPDFs(x,Q2).gl;
134 }
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
PDF_t AllPDFs(double x, double Q2) const
Definition: LHAPDF5.cxx:136
void LHAPDF5::Initialize ( void  ) const
private

Definition at line 46 of file LHAPDF5.cxx.

References genie::gAbortingInErr, LOG, and pFATAL.

Referenced by Configure(), and LHAPDF5().

47 {
48 #ifdef __GENIE_LHAPDF5_ENABLED__
49  bool lhapath_ok = true;
50  const char * lhapath = gSystem->Getenv("LHAPATH");
51  if(!lhapath) lhapath_ok = false;
52  else {
53  void *dirp = gSystem->OpenDirectory(lhapath);
54  if (dirp) gSystem->FreeDirectory(dirp);
55  else lhapath_ok = false;
56  }
57  if(!lhapath_ok) {
58  LOG("LHAPDF5", pFATAL)
59  << "\n"
60  << "** LHAPDF won't be able to read-in the PDF data. \n"
61  << "** The LHAPATH env. variable is not properly (or at all) defined. \n"
62  << "** Please, set LHAPATH to <lhapdf_top_dir>/PDFsets/ \n"
63  << "** See http://projects.hepforge.org/lhapdf/ for more details. \n\n";
64  gAbortingInErr = true;
65  exit(1);
66  }
67 #endif
68 }
#define pFATAL
Definition: Messenger.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool gAbortingInErr
Definition: Messenger.cxx:34
void LHAPDF5::SetPDFSetFromConfig ( void  ) const
private

Definition at line 70 of file LHAPDF5.cxx.

References genie::Algorithm::GetParam().

Referenced by Configure().

71 {
72 // Get PDF spec (particle type, pdf group/set) from configuration registry.
73 // For definitions, have a look at PDFLIB and LHAPDF manuals
74 
75 #ifdef __GENIE_LHAPDF5_ENABLED__
76  string name = "";
77  int type = 0;
78  int memset = 0;
79 
80  this->GetParam("name_lhapdf", name);
81  this->GetParam("type_lhapdf", type);
82  this->GetParam("memset_lhapdf", memset);
83 
84  LHAPDF::SetType stype = (type==0) ? LHAPDF::LHPDF : LHAPDF::LHGRID;
85 
86  LHAPDF::initPDFByName(name, stype, memset);
87  LHAPDF::extrapolate(false);
88 #endif
89 }
const char * name
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
double LHAPDF5::Strange ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 111 of file LHAPDF5.cxx.

References AllPDFs().

112 {
113  return AllPDFs(x,Q2).str;
114 }
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
PDF_t AllPDFs(double x, double Q2) const
Definition: LHAPDF5.cxx:136
double LHAPDF5::Top ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 126 of file LHAPDF5.cxx.

References AllPDFs().

127 {
128  return AllPDFs(x,Q2).top;
129 }
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
PDF_t AllPDFs(double x, double Q2) const
Definition: LHAPDF5.cxx:136
double LHAPDF5::UpSea ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 101 of file LHAPDF5.cxx.

References AllPDFs().

102 {
103  return AllPDFs(x,Q2).usea;
104 }
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
PDF_t AllPDFs(double x, double Q2) const
Definition: LHAPDF5.cxx:136
double LHAPDF5::UpValence ( double  x,
double  Q2 
) const
virtual

Implements genie::PDFModelI.

Definition at line 91 of file LHAPDF5.cxx.

References AllPDFs().

92 {
93  return AllPDFs(x,Q2).uval;
94 }
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1077
PDF_t AllPDFs(double x, double Q2) const
Definition: LHAPDF5.cxx:136

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