17 : fParticles(), PDGtoID(), IDtoPDG(), NumberOfParticles(0) {
22 if (InputFile.size() < 4)
return;
23 if (InputFile.substr(InputFile.size() - 4) ==
".txt")
41 if (ind != startind &&
fParticles[ind].ResonanceBR.size() > 0
43 .ResonanceBR[
fParticles[ind].ResonanceBR.size() - 1]
48 }
else if (ind != startind)
49 fParticles[ind].ResonanceBR.push_back(make_pair(BR, startind));
51 for (
unsigned int i = 0;
i <
fParticles[ind].fDecays.size(); ++
i)
52 for (
unsigned int j = 0; j <
fParticles[ind].fDecays[
i].fDaughters.size();
63 ifstream fin(InputFile.c_str());
67 string decayprefix =
"";
68 for (
int i = InputFile.size() - 1;
i >= 0; --
i)
69 if (InputFile[
i] ==
'\\' || InputFile[
i] ==
'/') {
70 decayprefix = InputFile.substr(0,
i + 1);
74 int stable, pdgid, spin, stat, str, bary, chg;
75 double mass, width, threshold, abss;
76 string name, decayname;
77 while (fin >> stable) {
78 fin >> name >> pdgid >> spin >> stat >> mass >> str >> bary >> chg >> abss
79 >> width >> threshold;
80 if (fin.peek() !=
'\n') fin >> decayname;
99 if (!(bary == 0 && chg == 0 && str == 0) || name.substr(0, 3) ==
"K0S"
100 || name.substr(0, 3) ==
"K0L") {
101 if (bary == 0 && name[name.size() - 1] ==
'+')
102 name[name.size() - 1] =
'-';
103 else if (bary == 0 && name[name.size() - 1] ==
'-')
104 name[name.size() - 1] =
'+';
106 name += string(
"bar");
143 std::vector<std::string>&
144 split(
const std::string& s,
char delim, std::vector<std::string>& elems) {
145 std::stringstream ss(s);
147 while (std::getline(ss, item, delim)) {
148 elems.push_back(item);
154 std::vector<std::string>
split(
const std::string& s,
char delim) {
155 std::vector<std::string> elems;
156 split(s, delim, elems);
161 vector<vector<ParticleDecay>> decays(0);
162 vector<int> pdgids(0);
163 map<int, int> decaymap;
169 string decayprefix =
"";
171 for (
int i = InputFile.size() - 1;
i >= 0; --
i)
172 if (InputFile[
i] ==
'\\' || InputFile[
i] ==
'/') {
173 decayprefix = InputFile.substr(0,
i + 1);
177 ifstream fin((decayprefix +
"decays.dat").c_str());
179 int decaypartnumber = 0;
180 fin >> decaypartnumber;
181 decays.reserve(decaypartnumber);
182 pdgids.reserve(decaypartnumber);
184 for (
unsigned int i = 0; i < static_cast<unsigned int>(decaypartnumber);
186 int pdgid, decaysnumber, tmpid, daughters;
188 fin >> pdgid >> decaysnumber;
190 decays.push_back(vector<ParticleDecay>(0));
191 pdgids.push_back(pdgid);
192 for (
unsigned int j = 0; j < static_cast<unsigned int>(decaysnumber);
199 for (
unsigned int k = 0; k < static_cast<unsigned int>(daughters);
204 decays[
i].push_back(decay);
211 ifstream fin2(InputFile.c_str());
212 if (fin2.is_open()) {
215 fin2.getline(tmpc, 500);
218 vector<string> fields =
split(tmp,
';');
219 if (fields.size() < 14)
break;
220 int stable, pdgid, spin, stat, str, bary, chg, charm;
221 double mass, width, threshold, abss, absc, radius = 0.5;
222 string name, decayname =
"";
223 stable = atoi(fields[0].c_str());
225 pdgid = atoi(fields[2].c_str());
226 spin = atoi(fields[3].c_str());
227 stat = atoi(fields[4].c_str());
228 mass = atof(fields[5].c_str());
229 str = atoi(fields[6].c_str());
230 bary = atoi(fields[7].c_str());
231 chg = atoi(fields[8].c_str());
232 charm = atoi(fields[9].c_str());
233 abss = atof(fields[10].c_str());
234 absc = atof(fields[11].c_str());
235 width = atof(fields[12].c_str());
236 threshold = atof(fields[13].c_str());
237 if (fields.size() >= 15) radius = atof(fields[14].c_str());
238 if (fields.size() == 16) decayname = fields[15];
260 if (decaymap.count(pdgid) != 0)
263 if (!(bary == 0 && chg == 0 && str == 0 && charm == 0)
264 || name.substr(0, 3) ==
"K0S" || name.substr(0, 3) ==
"K0L") {
265 if (bary == 0 && name[name.size() - 1] ==
'+')
266 name[name.size() - 1] =
'-';
267 else if (bary == 0 && name[name.size() - 1] ==
'-')
268 name[name.size() - 1] =
'+';
270 name += string(
"bar");
291 fin2.getline(tmpc, 500);
318 return string(
"???");