26 cout <<
"ERROR in ParticlceProperties::getMe" 27 <<
" Couldn't get ParticlePropertiesList (i.e. myself)" 28 <<
"\n\t This is a serious problem. Will crash." 30 throw "No ParticlePropertiesList";
36 ,
const std::string& what){
37 cout <<
"WARNING in ParticlceProperties::" << where
38 <<
" Got ParticlePropertiesList, but couldn't find " 44 cout <<
"WARNING in ParticlceProperties::" << where
45 <<
" Got ParticlePropertiesList, but couldn't find " 53 printCannotFindWarning(
"mass", name);
61 printCannotFindWarning(
"mass", pid);
69 printCannotFindWarning(
"width", name);
72 return props->
width();
77 printCannotFindWarning(
"width", pid);
80 return props->
width();
85 if(_dirList.empty()) fillDirList();
92 (
char*)0, NamedParameterBase::QUIET);
93 for(
int i=0; i < userDir.
size(); i++){
94 if(
"" != userDir.
getVal(i)){
95 _dirList.push_back(userDir.
getVal(i) +
"/");
103 std::string MintRoot(
".");
105 Mintevn = getenv (
"MINT2");
106 if (NULL != Mintevn){
110 std::string DecFilesRoot(
"UNKNOWN");
112 DecFiles = getenv (
"DECFILESROOT");
113 if (NULL != DecFiles){
114 DecFilesRoot = DecFiles;
117 _dirList.push_back(
"");
118 _dirList.push_back(
"./");
119 _dirList.push_back(MintRoot+
"/share/");
120 _dirList.push_back(DecFilesRoot+
"/MintData/");
129 f = findThisFile(_fname);
130 if(0 == f) findThisFile(
"mass_width.csv");
134 f = findThisFile(_MintDalitzSpecialParticles);
144 for(std::vector<std::string>::const_iterator it = dirList().begin();
145 it != dirList().end();
148 std::string tryThisDir = (*it);
149 std::string fullFname = tryThisDir + fname;
150 if(verbose)cout <<
"INFO in ParticlePropertiesList: trying: " << fullFname << endl;
151 FILE* f=fopen(fullFname.c_str(),
"r");
153 cout <<
"INFO in ParticlePropertiesList: Using this file: " 154 << fullFname << endl;
159 cout <<
"ERROR in ParticlePropertiesList::findFile()" 160 <<
"\n > having trouble finding file" 161 <<
"\n > with name " << fname
162 <<
"\n > in any directory I could guess." 163 <<
"\n > This is hardcoded in ParticleProperties.C." 172 std::cout <<
"ERROR! in ParticleProperties constructor:" 173 <<
" Problem reading file " 174 << _fname << std::endl;
180 bool shoutIfTwice=
true;
182 while(FILE* f = findFiles()){
183 cout <<
"reading " << counter <<
"th file" << endl;
184 if(0==f)
return false;
186 static const int lineLength=800;
187 char line[lineLength]={
'\0'};
189 while(fgets(line, lineLength, f)){
193 theList.push_back(P);
196 theList.push_back(P);
203 for(std::list<ParticleProperties>::iterator it= theList.begin();
204 it != theList.end(); it++){
205 byName[it->name()] = it;
206 if(shoutIfTwice && it->pdg_id() != 0){
207 map<int, list<ParticleProperties>::iterator >::iterator found = byID.find(it->pdg_id());
208 if(found != byID.end()){
209 cout <<
"WARNING in ParticlePropertiesList::readFiles " 210 <<
"pdg_id " << it->pdg_id() <<
" used twice, here: " 211 << (found->second)->name()
212 <<
", and here:\n " << it->name()
214 cout <<
" Important: Note that this is probably not be a MintDalitz error - " 215 <<
"\n some particles (the 'non-established' ones) have the same PDG code." 216 <<
"\n To use those realiably, you'll need to put your own copy of the" 217 <<
"\n mass_width.cvs file, put it into your run-directory, and edit the file" 218 <<
"\n so that your particle has a unique PID code." 219 <<
"\n -----------------------" 223 byID[it->pdg_id()] = it;
230 for(std::list<ParticleProperties>::const_iterator it= theList.begin();
231 it != theList.end(); it++){
238 std::map<std::string, std::list<ParticleProperties>::iterator >::const_iterator it
240 if(it == byName.end())
return 0;
242 return &(*(it->second));
245 std::map<int, std::list<ParticleProperties>::iterator >::const_iterator it
247 if(it == byID.end())
return 0;
249 return &(*(it->second));
static FILE * findThisFile(const std::string &fname)
ParticlePropertiesList(std::string fname_in="mass_width.cvs")
void print(std::ostream &out=std::cout) const
static double width(const std::string &name)
std::ostream & operator<<(std::ostream &out, const ParticlePropertiesList &ppl)
bool hasDistinctAnti() const
static const std::vector< std::string > & dirList()
const ParticleProperties * get(const std::string &name) const
static ParticlePropertiesList * ptr
static std::vector< std::string > _dirList
static void printCannotFindWarning(const std::string &where, const std::string &what)
static const ParticlePropertiesList * getMe()
static std::string _MintDalitzSpecialParticles
static void fillDirList()
static double mass(const std::string &name)
virtual const T & getVal(int i=0) const