CMS 3D CMS Logo

DatabasePDG.cc
Go to the documentation of this file.
1 /*
2  Copyright : The FASTMC and SPHMC Collaboration
3  Author : Ionut Cristian Arsene
4  Affiliation : Oslo University, Norway & Institute for Space Sciences, Bucharest, Romania
5  e-mail : i.c.arsene@fys.uio.no
6  Date : 2007/05/30
7 
8  This class is using the particle and decay lists provided by the
9  THERMINATOR (Computer Physics Communications 174 669 (2006)) and
10  SHARE (Computer Physics Communications 167 229 (2005)) collaborations.
11 */
12 
13 #ifndef DATABASE_PDG
15 #endif
16 
17 #include <cstring>
18 #include <iostream>
19 #include <string>
20 #include <fstream>
21 
22 using namespace std;
23 using namespace edm;
24 
25 const char *particlesDATAstr;
26 const char *tableDECAYstr;
27 
29  fNParticles = 0;
30 
31  std::string file1 = "GeneratorInterface/Hydjet2Interface/data/particles.data";
33  particlesDATAstr = ((f1.fullPath()).c_str());
34 
35  std::string file2 = "GeneratorInterface/Hydjet2Interface/data/tabledecay.txt";
37  tableDECAYstr = ((f2.fullPath()).c_str());
38 
39  strcpy(fParticleFilename, particlesDATAstr);
40  strcpy(fDecayFilename, tableDECAYstr);
41  for (int i = 0; i < kMaxParticles; i++) {
42  fParticles[i] = new ParticlePDG();
43  fStatus[i] = kFALSE;
44  }
45  fUseCharmParticles = kTRUE;
46  fMinimumWidth = 0.;
47  fMaximumWidth = 10.;
48  fMinimumMass = 0.;
49  fMaximumMass = 200.;
50 }
51 
53  for (int i = 0; i < kMaxParticles; i++)
54  delete fParticles[i];
55 }
56 
57 void DatabasePDG::SetParticleFilename(char *filename) { strcpy(fParticleFilename, filename); }
58 
59 void DatabasePDG::SetDecayFilename(char *filename) { strcpy(fDecayFilename, filename); }
60 
61 bool DatabasePDG::LoadData() { return (LoadParticles() && LoadDecays()); }
62 
64  ifstream particleFile;
65  particleFile.open(fParticleFilename);
66  if (!particleFile) {
67  edm::LogError("DatabasePDG") << "The ASCII file containing the PDG particle list " << fParticleFilename
68  << " was not found";
69  return kFALSE;
70  }
71 
72  char name[9];
73  double mass, width, spin, isospin, isospinZ, q, s, aq, as, c, ac;
74  int pdg;
75  int goodStatusParticles = 0;
76 
77  edm::LogInfo("DatabasePDG") << "Start loading particles with the following criteria:" << endl
78  << " Use particles containing charm quarks (1:yes;0:no) : " << fUseCharmParticles
79  << endl
80  << " Mass range : (" << fMinimumMass << "; "
81  << fMaximumMass << ")" << endl
82  << " Width range : (" << fMinimumWidth
83  << "; " << fMaximumWidth << ")";
84 
85  particleFile.exceptions(ios::failbit);
86  while (!particleFile.eof()) {
87  try {
88  particleFile >> name >> mass >> width >> spin >> isospin >> isospinZ >> q >> s >> aq >> as >> c >> ac >> pdg;
89  } catch (ios::failure const &problem) {
90  LogDebug("DatabasePDG") << " ios:failure in particle file " << problem.what();
91  break;
92  }
93 
94  fParticles[fNParticles]->SetName(name);
95  fParticles[fNParticles]->SetPDG(pdg);
96  fParticles[fNParticles]->SetMass(mass);
97  fParticles[fNParticles]->SetWidth(width);
98  fParticles[fNParticles]->SetSpin(spin);
99  fParticles[fNParticles]->SetIsospin(isospin);
100  fParticles[fNParticles]->SetIsospinZ(isospinZ);
101  fParticles[fNParticles]->SetLightQNumber(q);
102  fParticles[fNParticles]->SetStrangeQNumber(s);
103  fParticles[fNParticles]->SetLightAQNumber(aq);
104  fParticles[fNParticles]->SetStrangeAQNumber(as);
105  fParticles[fNParticles]->SetCharmQNumber(c);
106  fParticles[fNParticles]->SetCharmAQNumber(ac);
107  goodStatusParticles++;
108  fStatus[fNParticles] = kTRUE;
109  // check if we want charmed particles
110  if (!fUseCharmParticles && (c > 0 || ac > 0)) {
111  fStatus[fNParticles] = kFALSE;
112  goodStatusParticles--;
113  }
114  // check that the particle mass is inside accepted limits
115  if (!(fMinimumMass <= mass && mass <= fMaximumMass)) {
116  fStatus[fNParticles] = kFALSE;
117  goodStatusParticles--;
118  }
119  // check that the particle width is inside accepted limits
120  if (!(fMinimumWidth <= width && width <= fMaximumWidth)) {
121  fStatus[fNParticles] = kFALSE;
122  goodStatusParticles--;
123  }
124 
125  fNParticles++;
126  }
127  particleFile.close();
128  if (fNParticles == 0) {
129  LogWarning("DatabasePDG") << " No particles were found in the file specified!!";
130  return kFALSE;
131  }
132  SortParticles();
133  edm::LogInfo("DatabasePDG") << " Particle definitions found: " << fNParticles
134  << ". Good status particles: " << goodStatusParticles;
135  return kTRUE;
136 }
137 
139  ifstream decayFile;
140  decayFile.open(fDecayFilename);
141  if (!decayFile) {
142  edm::LogError("DatabasePDG") << "The ASCII file containing the decays list " << fDecayFilename << " was not found";
143  return kFALSE;
144  }
145 
146  int mother_pdg, daughter_pdg[3];
147  double branching;
148 
149  decayFile.exceptions(ios::failbit);
150  while (!decayFile.eof()) {
151  mother_pdg = 0;
152  for (int i = 0; i < 3; i++)
153  daughter_pdg[i] = 0;
154  branching = -1.0;
155  try {
156  decayFile >> mother_pdg;
157  for (int i = 0; i < 3; i++)
158  decayFile >> daughter_pdg[i];
159  decayFile >> branching;
160  } catch (ios::failure const &problem) {
161  LogDebug("DatabasePDG") << " ios:failure in decay file " << problem.what();
162  break;
163  }
164  if ((mother_pdg != 0) && (daughter_pdg[0] != 0) && (branching >= 0)) {
165  int nDaughters = 0;
166  for (int i = 0; i < 3; i++)
167  if (daughter_pdg[i] != 0)
168  nDaughters++;
169  ParticlePDG *particle = GetPDGParticle(mother_pdg);
170  if (!particle) {
171  LogWarning("DatabasePDG") << " Mother particle PDG (" << mother_pdg
172  << ") not found in the particle definition list:" << mother_pdg << " >>> ";
173  for (int kk = 0; kk < nDaughters; kk++)
174  LogWarning("DatabasePDG") << daughter_pdg[kk] << " ";
175  return kFALSE;
176  }
177  for (int kk = 0; kk < nDaughters; kk++) {
178  if (!GetPDGParticle(daughter_pdg[kk])) {
179  LogWarning("DatabasePDG") << "Daughter particle PDG (" << daughter_pdg[kk]
180  << ") not found in the particle definition list: " << mother_pdg << ">>> ";
181  for (int kkk = 0; kkk < nDaughters; kkk++)
182  LogWarning("DatabasePDG") << daughter_pdg[kkk] << " ";
183  }
184  }
185  DecayChannel decay(mother_pdg, branching, nDaughters, daughter_pdg);
186  particle->AddChannel(decay);
187  }
188  }
189  decayFile.close();
190  int nDecayChannels = 0;
191  for (int i = 0; i < fNParticles; i++) {
192  nDecayChannels += fParticles[i]->GetNDecayChannels();
193  }
194  edm::LogInfo("DatabasePDG") << "Number of decays found in the database is " << nDecayChannels;
195  return kTRUE;
196 }
197 
199  if (index < 0 || index > fNParticles) {
200  edm::LogWarning("DatabasePDG") << "Particle index is negative or too big !!" << endl
201  << " It must be inside this range: (0, " << fNParticles - 1 << ")" << endl
202  << " Returning null pointer!!";
203  return nullptr;
204  }
205  return fParticles[index];
206 }
207 
209  if (index < 0 || index > fNParticles) {
210  edm::LogWarning("DatabasePDG") << "Particle index is negative or too big !!" << endl
211  << " It must be inside this range: (0, " << fNParticles - 1 << ")" << endl
212  << " Returning null pointer!!";
213  return kFALSE;
214  }
215  return fStatus[index];
216 }
217 
219  int nFindings = 0;
220  int firstTimeIndex = 0;
221  for (int i = 0; i < fNParticles; i++) {
222  if (pdg == fParticles[i]->GetPDG()) {
223  if (nFindings == 0)
224  firstTimeIndex = i;
225  nFindings++;
226  }
227  }
228  if (nFindings == 1)
229  return fParticles[firstTimeIndex];
230  if (nFindings == 0) {
231  edm::LogWarning("DatabasePDG") << "The particle required with PDG: " << pdg << " was not found in the database!!";
232  return nullptr;
233  }
234  if (nFindings >= 2) {
235  edm::LogWarning("DatabasePDG") << "The particle required with PDG: " << pdg << " was found with " << nFindings
236  << " entries in the database. Check it out !!" << endl
237  << "Returning the first instance found";
238  return fParticles[firstTimeIndex];
239  }
240  return nullptr;
241 }
242 
244  int nFindings = 0;
245  int firstTimeIndex = 0;
246  for (int i = 0; i < fNParticles; i++) {
247  if (pdg == fParticles[i]->GetPDG()) {
248  if (nFindings == 0)
249  firstTimeIndex = i;
250  nFindings++;
251  }
252  }
253  if (nFindings == 1)
254  return fStatus[firstTimeIndex];
255  if (nFindings == 0) {
256  edm::LogWarning("DatabasePDG") << "The particle required with PDG: " << pdg << " was not found in the database!!";
257  return kFALSE;
258  }
259  if (nFindings >= 2) {
260  edm::LogWarning("DatabasePDG") << "The particle status required for PDG: " << pdg << " was found with " << nFindings
261  << " entries in the database. Check it out !!" << endl
262  << "Returning the status of first instance found";
263  return fStatus[firstTimeIndex];
264  }
265  return kFALSE;
266 }
267 
269  int nFindings = 0;
270  int firstTimeIndex = 0;
271  for (int i = 0; i < fNParticles; i++) {
272  if (!strcmp(name, fParticles[i]->GetName())) {
273  if (nFindings == 0)
274  firstTimeIndex = i;
275  nFindings++;
276  }
277  }
278  if (nFindings == 1)
279  return fParticles[firstTimeIndex];
280  if (nFindings == 0) {
281  edm::LogWarning("DatabasePDG") << "The particle required with name (" << name
282  << ") was not found in the database!!";
283  return nullptr;
284  }
285  if (nFindings >= 2) {
286  edm::LogWarning("DatabasePDG") << "The particle required with name (" << name << ") was found with " << nFindings
287  << " entries in the database. Check it out !!" << endl
288  << "Returning the first instance found";
289  return fParticles[firstTimeIndex];
290  }
291  return nullptr;
292 }
293 
295  int nFindings = 0;
296  int firstTimeIndex = 0;
297  for (int i = 0; i < fNParticles; i++) {
298  if (!strcmp(name, fParticles[i]->GetName())) {
299  if (nFindings == 0)
300  firstTimeIndex = i;
301  nFindings++;
302  }
303  }
304  if (nFindings == 1)
305  return fStatus[firstTimeIndex];
306  if (nFindings == 0) {
307  edm::LogWarning("DatabasePDG") << "The particle required with name (" << name
308  << ") was not found in the database!!";
309  return kFALSE;
310  }
311  if (nFindings >= 2) {
312  edm::LogWarning("DatabasePDG") << "The particle status required for name (" << name << ") was found with "
313  << nFindings << " entries in the database. Check it out !!" << endl
314  << "Returning the first instance found";
315  return fStatus[firstTimeIndex];
316  }
317  return kFALSE;
318 }
319 
320 void DatabasePDG::DumpData(bool dumpAll) {
321  cout << "***********************************************************************************************************"
322  << endl;
323  cout << "Dumping all the information contained in the database..." << endl;
324  int nDecays = 0;
325  int nGoodStatusDecays = 0;
326  int nGoodStatusParticles = 0;
327  for (int currPart = 0; currPart < fNParticles; currPart++) {
328  nGoodStatusParticles += (fStatus[currPart] ? 1 : 0);
329  nGoodStatusDecays += (fStatus[currPart] ? fParticles[currPart]->GetNDecayChannels() : 0);
330  nDecays += fParticles[currPart]->GetNDecayChannels();
331  if (!(dumpAll || (!dumpAll && fStatus[currPart])))
332  continue;
333  cout << "###### Particle: " << fParticles[currPart]->GetName() << " with PDG code "
334  << fParticles[currPart]->GetPDG() << endl;
335  cout << " status = " << fStatus[currPart] << endl;
336  cout << " mass = " << fParticles[currPart]->GetMass() << " GeV" << endl;
337  cout << " width = " << fParticles[currPart]->GetWidth() << " GeV" << endl;
338  cout << " 2*spin = " << int(2. * fParticles[currPart]->GetSpin()) << endl;
339  cout << " 2*isospin = " << int(2. * fParticles[currPart]->GetIsospin()) << endl;
340  cout << " 2*isospin3 = " << int(2. * fParticles[currPart]->GetIsospinZ()) << endl;
341  cout << " u,d quarks = " << int(fParticles[currPart]->GetLightQNumber()) << endl;
342  cout << " s quarks = " << int(fParticles[currPart]->GetStrangeQNumber()) << endl;
343  cout << " c quarks = " << int(fParticles[currPart]->GetCharmQNumber()) << endl;
344  cout << " anti u,d quarks = " << int(fParticles[currPart]->GetLightAQNumber()) << endl;
345  cout << " anti s quarks = " << int(fParticles[currPart]->GetStrangeAQNumber()) << endl;
346  cout << " anti c quarks = " << int(fParticles[currPart]->GetCharmAQNumber()) << endl;
347  cout << " baryon number = " << int(fParticles[currPart]->GetBaryonNumber()) << endl;
348  cout << " strangeness = " << int(fParticles[currPart]->GetStrangeness()) << endl;
349  cout << " charmness = " << int(fParticles[currPart]->GetCharmness()) << endl;
350  cout << " electric charge = " << int(fParticles[currPart]->GetElectricCharge()) << endl;
351  cout << " full branching = " << fParticles[currPart]->GetFullBranching() << endl;
352  cout << " decay modes = " << fParticles[currPart]->GetNDecayChannels() << endl;
353  for (int currChannel = 0; currChannel < fParticles[currPart]->GetNDecayChannels(); currChannel++) {
354  cout << " channel " << currChannel + 1 << " with branching "
355  << fParticles[currPart]->GetDecayChannel(currChannel)->GetBranching() << endl;
356  cout << " daughters PDG codes: ";
357  double daughtersMass = 0.0;
358  for (int currDaughter = 0; currDaughter < fParticles[currPart]->GetDecayChannel(currChannel)->GetNDaughters();
359  currDaughter++) {
360  cout << fParticles[currPart]->GetDecayChannel(currChannel)->GetDaughterPDG(currDaughter) << "\t";
361  ParticlePDG *daughter =
362  GetPDGParticle(fParticles[currPart]->GetDecayChannel(currChannel)->GetDaughterPDG(currDaughter));
363  daughtersMass += daughter->GetMass();
364  }
365  cout << endl;
366  cout << " daughters sum mass = " << daughtersMass << endl;
367  }
368  }
369  if (dumpAll) {
370  cout << "Finished dumping information for " << fNParticles << " particles with " << nDecays
371  << " decay channels in total." << endl;
372  cout << "**********************************************************************************************************"
373  "***"
374  << endl;
375  } else {
376  cout << "Finished dumping information for " << nGoodStatusParticles << "(" << fNParticles << ")"
377  << " particles with " << nGoodStatusDecays << "(" << nDecays << ")"
378  << " decay channels in total." << endl;
379  cout << "**********************************************************************************************************"
380  "***"
381  << endl;
382  }
383 }
384 
386  // Check the database for impossible decays
387  int nImpossibleDecays = 0;
388  for (int currPart = 0; currPart < fNParticles; currPart++) {
389  if (!fStatus[currPart])
390  continue;
391  int allChannels = fParticles[currPart]->GetNDecayChannels();
392  int allowedChannels = GetNAllowedChannels(fParticles[currPart], fParticles[currPart]->GetMass());
393  if (dump) {
394  cout << "Particle " << fParticles[currPart]->GetPDG() << " has " << allChannels
395  << " decay channels specified in the database" << endl;
396  cout << " Allowed channels assuming table mass = " << allowedChannels << endl;
397  }
398  if (dump && allChannels > 0 && allowedChannels == 0) {
399  cout << "**********************************************************************" << endl;
400  cout << " All channels for this particles are not allowed" << endl;
401  cout << "**********************************************************************" << endl;
402  }
403  if (dump && fParticles[currPart]->GetWidth() > 0. && allChannels == 0) {
404  cout << "**********************************************************************" << endl;
405  cout << " Particle has finite width but no decay channels specified" << endl;
406  cout << "**********************************************************************" << endl;
407  }
408  for (int currChannel = 0; currChannel < fParticles[currPart]->GetNDecayChannels(); currChannel++) {
409  double motherMass = fParticles[currPart]->GetMass();
410  double daughtersSumMass = 0.;
411  for (int currDaughter = 0; currDaughter < fParticles[currPart]->GetDecayChannel(currChannel)->GetNDaughters();
412  currDaughter++) {
413  ParticlePDG *daughter =
414  GetPDGParticle(fParticles[currPart]->GetDecayChannel(currChannel)->GetDaughterPDG(currDaughter));
415  daughtersSumMass += daughter->GetMass();
416  }
417  if (daughtersSumMass >= motherMass) {
418  nImpossibleDecays++;
419  if (dump) {
420  cout << "Imposible decay for particle " << fParticles[currPart]->GetPDG() << endl;
421  cout << " Channel: " << fParticles[currPart]->GetPDG() << " --> ";
422  for (int currDaughter = 0; currDaughter < fParticles[currPart]->GetDecayChannel(currChannel)->GetNDaughters();
423  currDaughter++) {
424  ParticlePDG *daughter =
425  GetPDGParticle(fParticles[currPart]->GetDecayChannel(currChannel)->GetDaughterPDG(currDaughter));
426  cout << daughter->GetPDG() << " ";
427  }
428  cout << endl;
429  cout << " Mother particle mass = " << motherMass << endl;
430  cout << " Daughters sum mass = " << daughtersSumMass << endl;
431  }
432  }
433  }
434  }
435  return nImpossibleDecays;
436 }
437 
439  if (fNParticles > 0) {
440  fUseCharmParticles = flag;
441  for (int i = 0; i < fNParticles; i++) {
442  if (fParticles[i]->GetCharmQNumber() > 0 || fParticles[i]->GetCharmAQNumber())
443  fStatus[i] = flag;
444  }
445  SortParticles();
446  return;
447  } else
448  fUseCharmParticles = flag;
449  return;
450 }
451 
453  if (fNParticles > 0) {
454  fMinimumWidth = value;
455  for (int i = 0; i < fNParticles; i++) {
456  if (fParticles[i]->GetWidth() < fMinimumWidth)
457  fStatus[i] = kFALSE;
458  }
459  SortParticles();
460  return;
461  } else
462  fMinimumWidth = value;
463  return;
464 }
465 
467  if (fNParticles > 0) {
468  fMaximumWidth = value;
469  for (int i = 0; i < fNParticles; i++) {
470  if (fParticles[i]->GetWidth() > fMaximumWidth)
471  fStatus[i] = kFALSE;
472  }
473  SortParticles();
474  return;
475  } else
476  fMaximumWidth = value;
477  return;
478 }
479 
480 void DatabasePDG::SetWidthRange(double min, double max) {
481  if (fNParticles > 0) {
482  fMinimumWidth = min;
483  fMaximumWidth = max;
484  for (int i = 0; i < fNParticles; i++) {
485  if ((fParticles[i]->GetWidth() < fMinimumWidth) || (fParticles[i]->GetWidth() > fMaximumWidth))
486  fStatus[i] = kFALSE;
487  }
488  SortParticles();
489 
490  return;
491  } else {
492  fMinimumWidth = min;
493  fMaximumWidth = max;
494  }
495 
496  return;
497 }
498 
500  if (fNParticles > 0) {
501  fMinimumMass = value;
502  for (int i = 0; i < fNParticles; i++) {
503  if (fParticles[i]->GetMass() < fMinimumMass)
504  fStatus[i] = kFALSE;
505  }
506  SortParticles();
507  return;
508  } else
509  fMinimumMass = value;
510  return;
511 }
512 
514  if (fNParticles > 0) {
515  fMaximumMass = value;
516  for (int i = 0; i < fNParticles; i++) {
517  if (fParticles[i]->GetMass() > fMaximumMass)
518  fStatus[i] = kFALSE;
519  }
520  SortParticles();
521  return;
522  } else
523  fMaximumMass = value;
524  return;
525 }
526 
527 void DatabasePDG::SetMassRange(double min, double max) {
528  if (fNParticles > 0) {
529  fMinimumMass = min;
530  fMaximumMass = max;
531  for (int i = 0; i < fNParticles; i++) {
532  if ((fParticles[i]->GetMass() < fMinimumMass) || (fParticles[i]->GetMass() > fMaximumMass))
533  fStatus[i] = kFALSE;
534  }
535  SortParticles();
536 
537  return;
538  } else {
539  fMinimumMass = min;
540  fMaximumMass = max;
541  }
542 
543  return;
544 }
545 
547  if (fNParticles < 2) {
548  edm::LogWarning("DatabasePDG") << "No particles to sort. Load data first!!";
549  return;
550  }
551 
552  int nGoodStatus = 0;
553  for (int i = 0; i < fNParticles; i++)
554  if (fStatus[i])
555  nGoodStatus++;
556 
557  if (nGoodStatus == fNParticles) // if all particles have good status then there is nothing to do
558  return;
559 
560  if (nGoodStatus == 0) // no good status particles, again nothing to do
561  return;
562 
563  int shifts = 1;
564  while (shifts) {
565  shifts = 0;
566  for (int i = 0; i < fNParticles - 1; i++) {
567  if (!fStatus[i] && fStatus[i + 1]) { // switch if false status is imediately before a true status particle
568  ParticlePDG *temporaryPointer = fParticles[i];
569  fParticles[i] = fParticles[i + 1];
570  fParticles[i + 1] = temporaryPointer;
571  bool temporaryStatus = fStatus[i];
572  fStatus[i] = fStatus[i + 1];
573  fStatus[i + 1] = temporaryStatus;
574  shifts++;
575  }
576  }
577  }
578 
579  return;
580 }
581 
583  if (all)
584  return fNParticles;
585 
586  int nGoodStatus = 0;
587  for (int i = 0; i < fNParticles; i++)
588  if (fStatus[i])
589  nGoodStatus++;
590  return nGoodStatus;
591 }
592 
594  if (fNParticles < 1) {
595  edm::LogError("DatabasePDG") << "You must load the data before calling this function!!";
596  return;
597  }
598 
599  ifstream listFile;
600  listFile.open(filename);
601  if (!listFile) {
602  edm::LogError("DatabasePDG") << "The ASCII file containing the PDG codes list (" << filename
603  << ") was not found !!";
604  return;
605  }
606 
607  bool flaggedIndexes[kMaxParticles];
608  for (int i = 0; i < kMaxParticles; i++)
609  flaggedIndexes[i] = kFALSE;
610  int pdg = 0;
611  listFile.exceptions(ios::failbit);
612  while (!listFile.eof()) {
613  try {
614  listFile >> pdg;
615  } catch (ios::failure const &problem) {
616  LogDebug("DatabasePDG") << "ios:failure in list file" << problem.what();
617  break;
618  }
619  int found = 0;
620  for (int i = 0; i < fNParticles; i++) {
621  if (fParticles[i]->GetPDG() == pdg) {
622  found++;
623  flaggedIndexes[i] = kTRUE;
624  }
625  }
626  if (!found) {
627  edm::LogWarning("DatabasePDG") << "The particle with PDG code " << pdg
628  << " was asked but not found in the database!!";
629  }
630  if (found > 1) {
631  edm::LogWarning("DatabasePDG") << "The particle with PDG code " << pdg
632  << " was found more than once in the database!!";
633  }
634  }
635 
636  if (exclusive) {
637  for (int i = 0; i < kMaxParticles; i++)
638  fStatus[i] = flaggedIndexes[i];
639  } else {
640  for (int i = 0; i < kMaxParticles; i++)
641  fStatus[i] = (fStatus[i] && flaggedIndexes[i]);
642  }
643  SortParticles();
644 
645  return;
646 }
647 
648 bool DatabasePDG::IsChannelAllowed(DecayChannel *channel, double motherMass) {
649  double daughtersSumMass = 0.0;
650  for (int i = 0; i < channel->GetNDaughters(); i++)
651  daughtersSumMass += GetPDGParticle(channel->GetDaughterPDG(i))->GetMass();
652  if (daughtersSumMass <= motherMass)
653  return kTRUE;
654  return kFALSE;
655 }
656 
657 int DatabasePDG::GetNAllowedChannels(ParticlePDG *particle, double motherMass) {
658  int nAllowedChannels = 0;
659  for (int i = 0; i < particle->GetNDecayChannels(); i++)
660  nAllowedChannels += (IsChannelAllowed(particle->GetDecayChannel(i), motherMass) ? 1 : 0);
661  return nAllowedChannels;
662 }
DatabasePDG::UseThisListOfParticles
void UseThisListOfParticles(char *filename, bool exclusive=kTRUE)
Definition: DatabasePDG.cc:593
submitPVValidationJobs.dump
dump
Definition: submitPVValidationJobs.py:55
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
mps_fire.i
i
Definition: mps_fire.py:428
DatabasePDG::SetMinimumWidth
void SetMinimumWidth(double value)
Definition: DatabasePDG.cc:452
tableDECAYstr
const char * tableDECAYstr
Definition: DatabasePDG.cc:26
ParticlePDG::AddChannel
void AddChannel(DecayChannel &channel)
Definition: ParticlePDG.cc:56
ParticlePDG::GetDecayChannel
DecayChannel * GetDecayChannel(int i)
Definition: ParticlePDG.h:92
min
T min(T a, T b)
Definition: MathUtil.h:58
edm
HLT enums.
Definition: AlignableModifier.h:19
DatabasePDG::DatabasePDG
DatabasePDG()
Definition: DatabasePDG.cc:28
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DecayChannel::GetDaughterPDG
int GetDaughterPDG(int i)
Definition: DecayChannel.cc:69
dileptonTrigSettings_cff.pdg
pdg
Definition: dileptonTrigSettings_cff.py:6
DatabasePDG::SetMassRange
void SetMassRange(double min, double max)
Definition: DatabasePDG.cc:527
DatabasePDG::GetNParticles
int GetNParticles(bool all=kFALSE)
Definition: DatabasePDG.cc:582
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
DatabasePDG::~DatabasePDG
~DatabasePDG()
Definition: DatabasePDG.cc:52
edmOneToOneComparison.file2
file2
Definition: edmOneToOneComparison.py:107
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
DatabasePDG::SetUseCharmParticles
void SetUseCharmParticles(bool flag)
Definition: DatabasePDG.cc:438
python.cmstools.all
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
DatabasePDG::CheckImpossibleDecays
int CheckImpossibleDecays(bool dump=kFALSE)
Definition: DatabasePDG.cc:385
edm::FileInPath
Definition: FileInPath.h:61
ParticlePDG::GetNDecayChannels
int GetNDecayChannels()
Definition: ParticlePDG.h:72
DatabasePDG::GetPDGParticleByIndex
ParticlePDG * GetPDGParticleByIndex(int index)
Definition: DatabasePDG.cc:198
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DatabasePDG::GetPDGParticleStatusByIndex
bool GetPDGParticleStatusByIndex(int index)
Definition: DatabasePDG.cc:208
DecayChannel
Definition: DecayChannel.h:22
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
GetRecoTauVFromDQM_MC_cff.kk
kk
Definition: GetRecoTauVFromDQM_MC_cff.py:84
DatabasePDG::SortParticles
void SortParticles()
Definition: DatabasePDG.cc:546
ParticlePDG
Definition: ParticlePDG.h:24
DatabasePDG::GetPDGParticleStatus
bool GetPDGParticleStatus(int pdg)
Definition: DatabasePDG.cc:243
DatabasePDG::SetMaximumMass
void SetMaximumMass(double value)
Definition: DatabasePDG.cc:513
DatabasePDG::SetWidthRange
void SetWidthRange(double min, double max)
Definition: DatabasePDG.cc:480
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
DatabasePDG::SetMinimumMass
void SetMinimumMass(double value)
Definition: DatabasePDG.cc:499
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
DeadROC_duringRun.f2
f2
Definition: DeadROC_duringRun.py:220
DatabasePDG::SetDecayFilename
void SetDecayFilename(char *filename)
Definition: DatabasePDG.cc:59
createfilelist.int
int
Definition: createfilelist.py:10
value
Definition: value.py:1
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
ParticlePDG::GetMass
double GetMass()
Definition: ParticlePDG.h:70
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
DatabasePDG::LoadData
bool LoadData()
Definition: DatabasePDG.cc:61
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
particlesDATAstr
const char * particlesDATAstr
Definition: DatabasePDG.cc:25
DatabasePDG::IsChannelAllowed
bool IsChannelAllowed(DecayChannel *channel, double motherMass)
Definition: DatabasePDG.cc:648
DatabasePDG::DumpData
void DumpData(bool dumpAll=kFALSE)
Definition: DatabasePDG.cc:320
PA_ZEESkim_cff.decay
decay
Definition: PA_ZEESkim_cff.py:26
kMaxParticles
const int kMaxParticles
Definition: DatabasePDG.h:32
std
Definition: JetResolutionObject.h:76
generator_cfi.exclusive
exclusive
Definition: generator_cfi.py:24
timingPdfMaker.file1
file1
Definition: timingPdfMaker.py:78
relativeConstraints.value
value
Definition: relativeConstraints.py:53
DatabasePDG::SetMaximumWidth
void SetMaximumWidth(double value)
Definition: DatabasePDG.cc:466
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
pdg
Definition: pdg_functions.h:28
DatabasePDG::LoadParticles
bool LoadParticles()
Definition: DatabasePDG.cc:63
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
DatabasePDG::SetParticleFilename
void SetParticleFilename(char *filename)
Definition: DatabasePDG.cc:57
DecayChannel::GetNDaughters
int GetNDaughters()
Definition: DecayChannel.h:41
DatabasePDG::LoadDecays
bool LoadDecays()
Definition: DatabasePDG.cc:138
ParticlePDG::GetPDG
int GetPDG()
Definition: ParticlePDG.h:69
DatabasePDG::GetNAllowedChannels
int GetNAllowedChannels(ParticlePDG *particle, double motherMass)
Definition: DatabasePDG.cc:657
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
DatabasePDG::GetPDGParticle
ParticlePDG * GetPDGParticle(int pdg)
Definition: DatabasePDG.cc:218
DeadROC_duringRun.f1
f1
Definition: DeadROC_duringRun.py:219
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117
DatabasePDG.h