GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
gMakePhotonStrucFunc.cxx File Reference
#include "Framework/Messenger/Messenger.h"
#include "Framework/Conventions/Constants.h"
#include "Framework/ParticleData/PDGCodes.h"
#include "Framework/ParticleData/PDGUtils.h"
#include <TSystem.h>
#include <TMath.h>
#include <Math/IFunction.h>
#include <Math/Integrator.h>
#include <string>
#include <iostream>
#include <fstream>
#include "LHAPDF/LHAPDF.h"
Include dependency graph for gMakePhotonStrucFunc.cxx:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Variables

int fNucPdg = 0
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 111 of file gMakePhotonStrucFunc.cxx.

References e, fNucPdg, genie::pdg::IsAntiNuE(), genie::pdg::IsAntiNuMu(), genie::pdg::IsAntiNuTau(), genie::pdg::IsNeutron(), genie::pdg::IsNuE(), genie::pdg::IsNuMu(), genie::pdg::IsNuTau(), genie::pdg::IsProton(), genie::constants::kGF, genie::constants::kMw, genie::kPdgAntiNuE, genie::kPdgAntiNuMu, genie::kPdgAntiNuTau, genie::kPdgNeutron, genie::kPdgNuE, genie::kPdgNuMu, genie::kPdgNuTau, genie::kPdgProton, LOG, genie::units::mb, pERROR, pFATAL, pINFO, pWARN, and xPDFmin.

112 {
113 
114  string basedir = "";
115  if ( gSystem->Getenv("PHOTON_SF_DATA_PATH")==NULL ) basedir = string(gSystem->Getenv("GENIE")) + "/data/evgen/photon-sf";
116  else basedir = string(gSystem->Getenv("PHOTON_SF_DATA_PATH"));
117  LOG("gmkphotonsf", pERROR) << "Base directory: " << basedir;
118 
119  if ( gSystem->AccessPathName( basedir.c_str(), kWritePermission ) ) {
120  LOG("gmkphotonsf", pFATAL) << "Base directory doesnt exist or you dont have write permission.";
121  LOG("gmkphotonsf", pFATAL) << "Remember!!!";
122  LOG("gmkphotonsf", pFATAL) << "Path to base directory is defined with the enviroment variable PHOTON_SF_DATA_PATH.";
123  LOG("gmkphotonsf", pFATAL) << "If not defined, default location is $GENIE/data/evgen/photon-sf";
124  assert(0);
125  }
126 
127  const int nx = 1000.;
128 
129  int nucs[2] = { kPdgProton, kPdgNeutron };
131 
132 #ifdef __GENIE_APFEL_ENABLED__
133  for (int k=0; k<2; k++) {
134 
135  fNucPdg = nucs[k];
136 
137  // initialising APFEL framework
138  LOG("gmkphotonsf", pINFO) << "Initialising APFEL..." ;
139  string pdfset;
140  if (pdg::IsProton (fNucPdg) ) pdfset = "NNPDF31_nnlo_as_0118_luxqed";
141  else if (pdg::IsNeutron(fNucPdg) ) pdfset = "NNPDF31_nnlo_as_0118";
142 
143  const LHAPDF::PDFSet set(pdfset);
144  pdf_cache = LHAPDF::mkPDF(pdfset,0);
145 
146  double xPDFmin,QPDFmin,QPDFmax,mc,mb,mt;
147  stringstream( set.get_entry("MCharm") ) >> mc;
148  stringstream( set.get_entry("MBottom") ) >> mb;
149  stringstream( set.get_entry("MTop") ) >> mt;
150  stringstream( set.get_entry("QMin") ) >> QPDFmin;
151  stringstream( set.get_entry("QMax") ) >> QPDFmax;
152  stringstream( set.get_entry("XMin") ) >> xPDFmin;
153  LOG("gmkphotonsf", pINFO) << "xPDFmin = " << xPDFmin;
154  LOG("gmkphotonsf", pINFO) << "QPDFmin = " << QPDFmin;
155  LOG("gmkphotonsf", pINFO) << "QPDFmax = " << QPDFmax;
156  LOG("gmkphotonsf", pINFO) << "mc = " << mc;
157  LOG("gmkphotonsf", pINFO) << "mb = " << mb;
158  LOG("gmkphotonsf", pINFO) << "mt = " << mt;
159 
160  APFEL::CleanUp();
161 
162  APFEL::SetPDFSet(pdfset);
163  APFEL::SetReplica(0);
164  APFEL::SetPerturbativeOrder(2);
165  APFEL::SetQLimits(QPDFmin,QPDFmax);
166  APFEL::SetMaxFlavourPDFs(6);
167  APFEL::SetMaxFlavourAlpha(6);
168  APFEL::SetNumberOfGrids(3);
169  APFEL::SetGridParameters(1,100,5,1e-9);
170  APFEL::SetGridParameters(2,40,3,1e-1);
171  APFEL::SetGridParameters(3,60,3,8e-1);
172  APFEL::SetGFermi(kGF);
173  APFEL::SetPoleMasses(mc,mb,mt);
174  APFEL::SetTheory("QUniD");
175  APFEL::EnableLeptonEvolution(true);
176  APFEL::SetFastEvolution(true);
177  APFEL::SetPDFSet("leptexternal");
178  APFEL::InitializeAPFEL();
179 
180  LOG("gmkphotonsf", pWARN) << "Init EvolveAPFEL";
181  APFEL::EvolveAPFEL(QPDFmin,kMw);
182  LOG("gmkphotonsf", pWARN) << "End EvolveAPFEL";
183 
184  // open file in which SF will be stored
185 
186  double x[nx];
187  for ( int i=0; i<nx; i++ ) x[i] = TMath::Power( 10, TMath::Log10(xPDFmin) + i*(TMath::Log10(1.)-TMath::Log10(xPDFmin))/(1000.-1) );
188 
189  for(int j=0; j<6; j++) {
190 
191  string SFname = basedir + "/PhotonSF_hitnuc"+to_string(fNucPdg)+"_hitlep"+to_string(pdgs[j])+".dat";
192  std::ofstream sf_stream(SFname);
193  for ( int i=0; i<nx; i++ ) {
194  double tmp = 0;
195  if ( pdg::IsNuE (pdgs[j]) ) tmp = APFEL::xLepton( 1,x[i]);
196  else if ( pdg::IsAntiNuE (pdgs[j]) ) tmp = APFEL::xLepton(-1,x[i]);
197  else if ( pdg::IsNuMu (pdgs[j]) ) tmp = APFEL::xLepton( 2,x[i]);
198  else if ( pdg::IsAntiNuMu (pdgs[j]) ) tmp = APFEL::xLepton(-2,x[i]);
199  else if ( pdg::IsNuTau (pdgs[j]) ) tmp = APFEL::xLepton( 3,x[i]);
200  else if ( pdg::IsAntiNuTau(pdgs[j]) ) tmp = APFEL::xLepton(-3,x[i]);
201  LOG("gmkphotonsf", pWARN) << "SF " << pdgs[j] << " [x=" << x[i] << "] = " << tmp;
202  sf_stream << x[i] << " " << tmp << endl;
203  }
204  // Close file in which SF are stored
205  sf_stream.close();
206  }
207 
208  }
209 #endif
210 
211 }
double xPDFmin
bool IsNuTau(int pdgc)
Definition: PDGUtils.cxx:168
const int kPdgNuE
Definition: PDGCodes.h:28
#define pERROR
Definition: Messenger.h:59
int fNucPdg
const int kPdgAntiNuE
Definition: PDGCodes.h:29
#define pFATAL
Definition: Messenger.h:56
const int kPdgNuMu
Definition: PDGCodes.h:30
bool IsAntiNuTau(int pdgc)
Definition: PDGUtils.cxx:183
bool IsNuE(int pdgc)
Definition: PDGUtils.cxx:158
bool IsNeutron(int pdgc)
Definition: PDGUtils.cxx:341
bool IsNuMu(int pdgc)
Definition: PDGUtils.cxx:163
bool IsProton(int pdgc)
Definition: PDGUtils.cxx:336
const double e
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
static constexpr double mb
Definition: Units.h:79
#define pINFO
Definition: Messenger.h:62
const int kPdgAntiNuTau
Definition: PDGCodes.h:33
const int kPdgAntiNuMu
Definition: PDGCodes.h:31
bool IsAntiNuMu(int pdgc)
Definition: PDGUtils.cxx:178
#define pWARN
Definition: Messenger.h:60
const int kPdgNuTau
Definition: PDGCodes.h:32
const int kPdgProton
Definition: PDGCodes.h:81
const int kPdgNeutron
Definition: PDGCodes.h:83
bool IsAntiNuE(int pdgc)
Definition: PDGUtils.cxx:173

Variable Documentation

int fNucPdg = 0

Definition at line 50 of file gMakePhotonStrucFunc.cxx.

Referenced by main().