CMS 3D CMS Logo

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
19 pdg::mass(int pdgID, HepPDT::ParticleDataTable const* theTable) {
20  auto info = theTable->particle(HepPDT::ParticleID(pdgID));
21  if(info) {
22  return info->mass().value();
23  }
24  return kInvalidMass;
25 }
26 
27 double
28 pdg::cTau(int pdgID, HepPDT::ParticleDataTable const* theTable) {
29  auto info = theTable->particle(HepPDT::ParticleID(pdgID));
30  double ct = kInvalidCtau;
31  if (info) {
32  // The lifetime is 0. in the Pythia Particle Data Table !
33  // ct=tab->theTable()->particle(ParticleID(myId))->lifetime().value();
34 
35  // Get it from the width (apparently Gamma/c!)
36  double w = info->totalWidth().value();
37  if ( w != 0. && pdgID != 1000022 ) {
38  ct = 6.582119e-25 / w / 10.; // ctau in cm
39  } else {
40  // Temporary fix of a bug in the particle data table
41  unsigned amyId = abs(pdgID);
42  if ( amyId != 22 && // photon
43  amyId != 11 && // e+/-
44  amyId != 10 && // nu_e
45  amyId != 12 && // nu_mu
46  amyId != 14 && // nu_tau
47  amyId != 1000022 && // Neutralino
48  amyId != 1000039 && // Gravitino
49  amyId != 2112 && // neutron/anti-neutron
50  amyId != 2212 && // proton/anti-proton
51  amyId != 101 && // Deutreron etc..
52  amyId != 102 && // Deutreron etc..
53  amyId != 103 && // Deutreron etc..
54  amyId != 104 ) { // Deutreron etc..
55  ct = 0.;
56  /* */
57  }
58  }
59  }
60 
61  /*
62  std::cout << setw(20) << setprecision(18)
63  << "myId/ctau/width = " << myId << " "
64  << ct << " " << w << endl;
65  */
66  return ct;
67 }
68 
static double kInvalidCtau
Definition: pdg_functions.h:33
static const TGPicture * info(bool iBackgroundIsBlack)
double cTau(int pdgID, const HepPDT::ParticleDataTable *pdt)
const double w
Definition: UKUtility.cc:23
HepPDT::ParticleDataTable ParticleDataTable
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static double kInvalidMass
Definition: pdg_functions.h:30
double mass(int pdgID, const HepPDT::ParticleDataTable *pdt)