CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pdg_functions.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FastSimulation/Particle
4 // Class : pdg_functions
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Christopher Jones
10 // Created: Mon, 04 Mar 2019 19:53:06 GMT
11 //
12 
13 // system include files
14 
15 // user include files
17 
18 double pdg::mass(int pdgID, HepPDT::ParticleDataTable const* theTable) {
19  auto info = theTable->particle(HepPDT::ParticleID(pdgID));
20  if (info) {
21  return info->mass().value();
22  }
23  return kInvalidMass;
24 }
25 
26 double pdg::cTau(int pdgID, HepPDT::ParticleDataTable const* theTable) {
27  auto info = theTable->particle(HepPDT::ParticleID(pdgID));
28  double ct = kInvalidCtau;
29  if (info) {
30  // The lifetime is 0. in the Pythia Particle Data Table !
31  // ct=tab->theTable()->particle(ParticleID(myId))->lifetime().value();
32 
33  // Get it from the width (apparently Gamma/c!)
34  double w = info->totalWidth().value();
35  if (w != 0. && pdgID != 1000022) {
36  ct = 6.582119e-25 / w / 10.; // ctau in cm
37  } else {
38  // Temporary fix of a bug in the particle data table
39  unsigned amyId = abs(pdgID);
40  if (amyId != 22 && // photon
41  amyId != 11 && // e+/-
42  amyId != 10 && // nu_e
43  amyId != 12 && // nu_mu
44  amyId != 14 && // nu_tau
45  amyId != 1000022 && // Neutralino
46  amyId != 1000039 && // Gravitino
47  amyId != 2112 && // neutron/anti-neutron
48  amyId != 2212 && // proton/anti-proton
49  amyId != 101 && // Deutreron etc..
50  amyId != 102 && // Deutreron etc..
51  amyId != 103 && // Deutreron etc..
52  amyId != 104) { // Deutreron etc..
53  ct = 0.;
54  /* */
55  }
56  }
57  }
58 
59  /*
60  std::cout << setw(20) << setprecision(18)
61  << "myId/ctau/width = " << myId << " "
62  << ct << " " << w << endl;
63  */
64  return ct;
65 }
static const TGPicture * info(bool iBackgroundIsBlack)
double cTau(int pdgID, const HepPDT::ParticleDataTable *pdt)
HepPDT::ParticleDataTable ParticleDataTable
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double mass(int pdgID, const HepPDT::ParticleDataTable *pdt)
T w() const
static constexpr double kInvalidCtau
Definition: pdg_functions.h:32
static constexpr double kInvalidMass
Definition: pdg_functions.h:29