GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PhotonStrucFunc.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2024, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Alfonso Garcia <aagarciasoto \at km3net.de>
7  IFIC & Harvard University
8 */
9 //____________________________________________________________________________
10 
14 
15 #include "TSystem.h"
16 
17 using namespace genie;
18 
19 //_________________________________________________________________________
21 //_________________________________________________________________________
23 {
24 
25  string basedir = "";
26  if ( gSystem->Getenv("PHOTON_SF_DATA_PATH")==NULL ) basedir = string(gSystem->Getenv("GENIE")) + "/data/evgen/photon-sf";
27  else basedir = string(gSystem->Getenv("PHOTON_SF_DATA_PATH"));
28  LOG("PhotonStrucFunc", pWARN) << "Base diretory: " << basedir;
29 
30  int nucs[2] = { kPdgProton, kPdgNeutron };
32 
33  for (int k=0; k<2; k++) {
34  for(int j=0; j<6; j++) {
35  string SFname = basedir + "/PhotonSF_hitnuc"+std::to_string(nucs[k])+"_hitlep"+std::to_string(pdgs[j])+".dat";
36  if ( gSystem->AccessPathName( SFname.c_str(), kReadPermission ) ) {
37  LOG("PhotonStrucFunc", pFATAL) << "File doesnt exist or you dont have read permission.";
38  LOG("PhotonStrucFunc", pFATAL) << "Remember!!!";
39  LOG("PhotonStrucFunc", pFATAL) << "Path to base directory is defined with the enviroment variable PHOTON_SF_DATA_PATH.";
40  LOG("PhotonStrucFunc", pFATAL) << "If not defined, default location is $GENIE/data/evgen/photon-sf";
41  LOG("PhotonStrucFunc", pFATAL) << "Photon SF tables must be computed with gmkglressf.";
42  assert(0);
43  }
44  fSFTables[nucs[k]].Table[pdgs[j]] = new genie::Spline();
45  fSFTables[nucs[k]].Table[pdgs[j]]->LoadFromAsciiFile(SFname);
46  }
47  }
48 
49  fgInstance = 0;
50 
51 }
52 //_________________________________________________________________________
54 {
55 
56 }
57 //_________________________________________________________________________
59 {
60  if(fgInstance == 0) {
61  LOG("PhotonStrucFunc", pINFO) << "Late initialization";
62  static PhotonStrucFunc::Cleaner cleaner;
65  }
66  return fgInstance;
67 }
map< int, PhotonStrucFuncTable > fSFTables
const int kPdgNuE
Definition: PDGCodes.h:28
const int kPdgAntiNuE
Definition: PDGCodes.h:29
A numeric analysis tool class for interpolating 1-D functions.
Definition: Spline.h:58
#define pFATAL
Definition: Messenger.h:56
const int kPdgNuMu
Definition: PDGCodes.h:30
Structure function using photon PDFs of nucleons.
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
static PhotonStrucFunc * Instance(void)
const int kPdgAntiNuTau
Definition: PDGCodes.h:33
const int kPdgAntiNuMu
Definition: PDGCodes.h:31
#define pWARN
Definition: Messenger.h:60
const int kPdgNuTau
Definition: PDGCodes.h:32
static PhotonStrucFunc * fgInstance
const int kPdgProton
Definition: PDGCodes.h:81
const int kPdgNeutron
Definition: PDGCodes.h:83
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...