MINT2
ResonancePropertiesList.cpp
Go to the documentation of this file.
1 // author: Philippe d'Argent (p.dargent@ern.ch)
4 #include "Mint/NamedParameter.h"
6 
7 #include <string>
8 #include <fstream>
9 //#include <sstream>
10 #include <cstdio>
11 #include <stdlib.h>
12 
13 using namespace std;
14 using namespace MINT;
15 
16 //ResonancePropertiesList* ResonancePropertiesList::ptr=0;
17 
18 std::map<std::pair<std::string, const MINT::MinuitParameterSet*>, ResonancePropertiesList*> ResonancePropertiesList::_mapOfLists;
19 
21  //cout << "Hello from ResonancePropertiesList::getMe()" << endl;
23  if(0 == mps) mps = MinuitParameterSet::getDefaultSet();
24  std::pair<std::string, const MINT::MinuitParameterSet*> nameAndSet(namePrefix, mps);
25 
26  // auto it=_mapOfLists.find(nameAndSet);
27  map<pair<string, const MinuitParameterSet*>, ResonancePropertiesList*>::iterator it=_mapOfLists.find(nameAndSet);
28 
29  if(_mapOfLists.end() != it) ptr=it->second;
30  if(0 == ptr){
31  //cout << "ResonancePropertiesList: making myself" << endl;
32  ptr = new ResonancePropertiesList(namePrefix, mps);
33  }
34  if(0 == ptr){
35  cout << "ERROR in ResonanceProperties::getMe( " << namePrefix << " )"
36  << " Couldn't get ResonancePropertiesList (i.e. myself)"
37  << "\n\t This is a serious problem. Will crash."
38  << endl;
39  throw "No ResonancePropertiesList";
40  }
41  _mapOfLists[nameAndSet] = ptr;
42 
43  return ptr;
44 }
45 
46 /*
47 double ParticlePropertiesList::mass(int pid) {
48  const ResonanceProperties* props = getMe()->get(pid);
49  if(0 == props){
50  printCannotFindWarning("mass", pid);
51  return -9999;
52  }
53  return props->mass();
54 }
55 
56 
57 double ParticlePropertiesList::width(int pid) {
58  const ParticleProperties* props = getMe()->get(pid);
59  if(0 == props){
60  printCannotFindWarning("width", pid);
61  return -9999;
62  }
63  return props->width();
64 }
65 */
66 
67 
69  : _mps(mps)
70  , _prefix(namePrefix)
71  , _radius(namePrefix + "BW_radius", 1, 1.5/GeV, 0, 0, 0, mps, NamedParameterBase::QUIET) //, _rp(10323)
72 {
73 
74  /*
75  cout << "Hello from ResonancePropertiesList::ResonancePropertiesList" << endl;
76  cout << "I think I initialised _radius" << endl;
77  cout << "here we go" << endl;
78  cout << _radius << endl;
79  */
80 
81  //fix BW radius to default value if not explicitly initiallised
82  //if(_radius.iFixInit() && _radius== 0) _radius = 1.5/GeV;
83 
84  /*
85  const ParticlePropertiesList* PPL = ParticlePropertiesList::getMe();
86  const std::list<ParticleProperties> theParticleList = PPL->getList();
87  for(std::list<ParticleProperties>::const_iterator it= theParticleList.begin();it != theParticleList.end(); it++){
88  if(it->pdg_id>0)
89  ResonanceProperties* rp= new ResonanceProperties(it->pdg_id());
90  theList.push_back(rp);
91  }
92  */
93 }
95  return _mps;
96 }
98  if(0 == _mps) _mps = MinuitParameterSet::getDefaultSet();
99  return _mps;
100 }
101 
103  //theList.push_back(rp);
104  if(0 != rp) byID[rp->pid()] = rp;
105  return rp;
106 }
107 
109  const ResonanceProperties* rp = this->get(pdg_id);
110  if(0 == rp){
112  this->AddToList(rpnew);
113  rp=rpnew;
114  }
115  return rp;
116 }
117 
118 
120  // assume CPT holds
121  int id = abs(id_in);
122  std::map<int, ResonanceProperties*>::const_iterator it = byID.find(id);
123  if(it == byID.end()) return 0;
124  return it->second;
125 }
126 
127 
128 
129 /*
130 const ParticleProperties* ParticlePropertiesList::get(const std::string& name) const{
131  std::map<std::string, std::list<ParticleProperties>::iterator >::const_iterator it
132  = byName.find(name);
133  if(it == byName.end()) return 0;
134 
135  return &(*(it->second));
136 }
137 const ParticleProperties* ParticlePropertiesList::get(int id) const{
138  std::map<int, std::list<ParticleProperties>::iterator >::const_iterator it
139  = byID.find(id);
140  if(it == byID.end()) return 0;
141 
142  return &(*(it->second));
143 }
144 */
145 
146 
147 //
const std::string & prefix() const
ResonancePropertiesList(const std::string &namePrefix="", MINT::MinuitParameterSet *mps=0)
const ResonanceProperties * get(int i) const
static ResonancePropertiesList * getMe(const std::string &prefix="", MINT::MinuitParameterSet *mps=0)
std::map< int, ResonanceProperties * > byID
MINT::MinuitParameterSet * getMinuitParameterSet()
static const double GeV
MINT::MinuitParameterSet * _mps
const ResonanceProperties * AddToList(ResonanceProperties *rp)
static std::map< std::pair< std::string, const MINT::MinuitParameterSet * >, ResonancePropertiesList * > _mapOfLists
const ResonanceProperties * AddToListIfMissing(int pdg)