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;
49 vector<NaturalIsotopeElementData*> vec = miter->second;
50 for(viter = vec.begin(); viter != vec.end(); ++viter) {
66 LOG(
"NatIsotop",
pINFO) <<
"NaturalIsotopes late initialization";
82 <<
"Table has no elements for natural isotope Z = " <<
Z;
85 vector<NaturalIsotopeElementData*> vec = miter->second;
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];
113 string(
"/data/evgen/catalogues/iso/natural-isotopes.data");
116 <<
"Loading natural occurring isotope table from file: " <<
filename;
118 bool is_accessible = ! (gSystem->AccessPathName( filename.c_str() ));
119 if (!is_accessible) {
126 std::ifstream
input(filename.c_str());
127 if (
input.is_open()){
130 for(
int i=0; i<8; i++){
132 getline(
input, buffer);
135 int Z = -1, Z_previous = -1, nelements = 0,
pdgcode = 0;
136 double atomicmass = 0, abundance = 0;
137 string elementname, subelementname;
139 while( !
input.eof() ) {
143 input >> elementname;
146 vector<NaturalIsotopeElementData *> vec;
151 LOG(
"NatIsotop",
pDEBUG) <<
"Reading entry for Z = " <<
Z;
152 for(
int n=0 ;
n < nelements;
n++){
153 input >> subelementname;
158 <<
" - Element: " <<
n <<
", pdg = " << pdgcode
159 <<
", A = " << atomicmass <<
", abundance = " << abundance;
164 map<
int,vector<NaturalIsotopeElementData*> >::value_type(Z,vec));
THE MAIN GENIE PROJECT NAMESPACE
void DummyMethodAndSilentCompiler()
#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
QTextStream & endl(QTextStream &s)