NuclearData.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (C) 2003-2015, GENIE Neutrino MC Generator Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6 
7  Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
8 
9  For the class documentation see the corresponding header file.
10 
11  Important revisions after version 2.0.0 :
12  @ Nov 30, 2009 - CA
13  Was first added in v2.5.1
14  @ May 01, 2012 - CA
15  Pick-up data from new location ($GENIE/data/evgen/nucl/)
16 */
17 //____________________________________________________________________________
18 
19 #include <cassert>
20 #include <iostream>
21 
22 #include <TSystem.h>
23 #include <TNtupleD.h>
24 #include <TTree.h>
25 
30 
31 using std::cout;
32 using std::endl;
33 
34 using namespace genie;
35 
36 //____________________________________________________________________________
38 //____________________________________________________________________________
40 {
41  this->Load();
42  fInstance = 0;
43 }
44 //____________________________________________________________________________
46 {
47  if(!gAbortingInErr) {
48  cout << "NuclearData singleton dtor: Deleting inputs... " << endl;
49  }
50 
51  delete fNuclSupprD2;
52 }
53 //____________________________________________________________________________
55 {
56  if(fInstance == 0) {
57  LOG("NuclData", pINFO) << "NuclearData late initialization";
58  static NuclearData::Cleaner cleaner;
60  fInstance = new NuclearData;
61  }
62  return fInstance;
63 }
64 //____________________________________________________________________________
66 {
67  if(Q2 > 0.20) return 1.; // no suppression
68 
69  if(Q2 < 3E-5) { Q2 = 3E-5; }
70 
71  double R = fNuclSupprD2->Evaluate(Q2);
72  return R;
73 }
74 //____________________________________________________________________________
76 {
77  fNuclSupprD2 = 0;
78 
79  string data_dir =
80  string(gSystem->Getenv("GENIE")) +
81  string("/data/evgen/nucl");
82  LOG("NuclData", pINFO)
83  << "Loading nuclear data from: " << data_dir;
84 
85  // Load D2 nuclear suppression factor
86 
87  string nuclsupprd2_file = data_dir + "/D2sup.data";
88  assert( ! gSystem->AccessPathName(nuclsupprd2_file.c_str()) );
89 
90  TTree nuclsupprd2_tree;
91  nuclsupprd2_tree.ReadFile(nuclsupprd2_file.c_str(), "Q2/D:R/D");
92 
93  fNuclSupprD2 = new Spline(&nuclsupprd2_tree, "Q2:R");
94 
95  LOG("NuclData", pINFO) << "Done loading all data";
96 }
97 //____________________________________________________________________________
static NuclearData * Instance(void)
Definition: NuclearData.cxx:54
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:1064
std::string string
Definition: nybbler.cc:12
Spline * fNuclSupprD2
Definition: NuclearData.h:43
A numeric analysis tool class for interpolating 1-D functions.
Definition: Spline.h:46
double Evaluate(double x) const
Definition: Spline.cxx:361
static NuclearData * fInstance
Definition: NuclearData.h:40
#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
double DeuteriumSuppressionFactor(double Q2)
Definition: NuclearData.cxx:65
bool gAbortingInErr
Definition: Messenger.cxx:34
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
QTextStream & endl(QTextStream &s)