26 using namespace genie;
34 LOG(
"NatIsotop",
pERROR) <<
"NaturalIsotopes initialization failed!";
41 cout <<
"NaturalIsotopes singleton dtor: "
42 <<
"Deleting natural isotope data tables" << endl;
44 map<int, vector<NaturalIsotopeElementData*> >::iterator miter;
45 vector<NaturalIsotopeElementData*>::iterator viter;
49 vector<NaturalIsotopeElementData*> vec = miter->second;
50 for(viter = vec.begin(); viter != vec.end(); ++viter) {
66 LOG(
"NatIsotop",
pINFO) <<
"NaturalIsotopes late initialization";
78 map<int, vector<NaturalIsotopeElementData*> >::const_iterator miter;
82 <<
"Table has no elements for natural isotope Z = " << Z;
85 vector<NaturalIsotopeElementData*> vec = miter->second;
92 map<int, vector<NaturalIsotopeElementData*> >::const_iterator miter;
96 <<
"Table has no elements for natural isotope Z = " << Z;
99 vector<NaturalIsotopeElementData*> vec = miter->second;
100 if(ielement >= (
int)vec.size() || ielement < 0) {
102 <<
"Natural isotope Z = " << Z <<
" has " << vec.size() <<
" elements"
103 <<
" (element = " << ielement <<
" was requested)";
106 return vec[ielement];
112 map<int, vector<NaturalIsotopeElementData*> >::const_iterator miter;
116 <<
"Table has no elements for natural isotope Z = " << Z;
120 vector<NaturalIsotopeElementData*> vec = miter->second;
121 for (
int i; i<vec.size(); i++) {
122 if (vec[i]->
PdgCode()==pdgcode)
return vec[i];
126 <<
"Natural isotope Z = " << Z <<
" has " << vec.size() <<
" elements"
127 <<
" (pdgcode = " << pdgcode <<
" was requested)";
135 string filename = string(gSystem->Getenv(
"GENIE")) +
136 string(
"/data/evgen/catalogues/iso/natural-isotopes.data");
139 <<
"Loading natural occurring isotope table from file: " << filename;
141 bool is_accessible = ! (gSystem->AccessPathName( filename.c_str() ));
142 if (!is_accessible) {
143 LOG(
"NatIsotop",
pWARN) <<
"Can not read file: " << filename;
149 std::ifstream input(filename.c_str());
150 if (input.is_open()){
153 for(
int i=0; i<8; i++){
155 getline(input, buffer);
158 int Z = -1, Z_previous = -1, nelements = 0, pdgcode = 0;
159 double atomicmass = 0, abundance = 0;
160 string elementname, subelementname;
162 while( !input.eof() ) {
166 input >> elementname;
169 vector<NaturalIsotopeElementData *> vec;
174 LOG(
"NatIsotop",
pDEBUG) <<
"Reading entry for Z = " << Z;
175 for(
int n=0 ; n < nelements; n++){
176 input >> subelementname;
181 <<
" - Element: " << n <<
", pdg = " << pdgcode
182 <<
", A = " << atomicmass <<
", abundance = " << abundance;
187 map<
int,vector<NaturalIsotopeElementData*> >::value_type(Z,vec));
void DummyMethodAndSilentCompiler()
int PdgCode(Resonance_t res, int Q)
(resonance id, charge) -> PDG code
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
int NElements(int Z) const
static NaturalIsotopes * Instance(void)
map< int, vector< NaturalIsotopeElementData * > > fNaturalIsotopesTable
virtual ~NaturalIsotopes()
static NaturalIsotopes * fInstance
Singleton class to load & serve tables of natural occurring isotopes.
const NaturalIsotopeElementData * ElementData(int Z, int ielement) const
const NaturalIsotopeElementData * ElementDataPdg(int Z, int pdgcode) const