CMS 3D CMS Logo

CustomPDGParser.cc
Go to the documentation of this file.
2 //#include<iostream>
3 #include <cstdlib>
4 
5 /*CustomPDGParser::CustomPDGParser(int pdgCode) : m_pdgCode(pdgCode)
6 {
7 
8 }*/
9 
10 // check for R-hadron with gluino content
12  int pdgAbs = abs(pdg);
13  return ((pdgAbs % 100000 / 10000 == 9) || (pdgAbs % 10000 / 1000 == 9) || s_isRGlueball(pdg));
14 }
15 
17  int pdgAbs = abs(pdg);
18  return ((pdgAbs % 10000 / 1000 == 6) || (pdgAbs % 1000 / 100 == 6));
19 }
20 
22  int pdgAbs = abs(pdg);
23  return ((pdgAbs % 10000 / 1000 == 5) || (pdgAbs % 10000 / 100 == 5));
24 }
25 
27  int pdgAbs = abs(pdg);
28  return (pdgAbs / 100 % 10000 == 0 && pdgAbs / 10 % 10 == 1);
29 }
30 
32  int pdgAbs = abs(pdg);
33  return (pdgAbs % 100000 / 10000 == 9);
34 }
35 
37  int pdgAbs = abs(pdg);
38  return (pdgAbs % 100000 / 10 == 99);
39 }
40 
42  int pdgAbs = abs(pdg);
43  return (pdgAbs == 1072000) || (pdgAbs == 1023);
44 }
45 
47  int pdgAbs = abs(pdg);
48  return (pdgAbs % 10000 / 1000 == 9);
49 }
50 
52  int pdgAbs = abs(pdg);
53  return ((pdgAbs % 10000 / 100 == 6) || (pdgAbs % 10000 / 100 == 5));
54 }
55 
57  int pdgAbs = abs(pdg);
58  return ((pdgAbs % 10000 / 1000 == 6) || (pdgAbs % 10000 / 1000 == 5));
59 }
60 
62  int pdgAbs = abs(pdg);
63  return (pdgAbs == 1000024);
64 }
65 
67  float charge = 0, sign = 1;
68  int pdgAbs = abs(pdg);
69  if (pdg < 0)
70  sign = -1;
71 
72  if (s_isSLepton(pdg)) //Sleptons
73  {
74  if (pdgAbs % 2 == 0)
75  return 0;
76  else
77  return -sign;
78  }
79 
80  if (s_isDphoton(pdg)) {
81  return charge;
82  }
83  if (s_isChargino(pdg)) {
84  return sign;
85  }
86  if (s_isRMeson(pdg)) {
87  std::vector<int> quarks = s_containedQuarks(pdg);
88  if ((quarks[1] % 2 == 0 && quarks[0] % 2 == 1) || (quarks[1] % 2 == 1 && quarks[0] % 2 == 0))
89  charge = 1;
90  charge *= sign;
91  return charge;
92  }
93 
94  if (s_isRBaryon(pdg)) {
95  int baryon = s_containedQuarksCode(pdg);
96  for (int q = 1; q < 1000; q *= 10) {
97  if (baryon / q % 2 == 0)
98  charge += 2;
99  else
100  charge -= 1;
101  }
102  charge /= 3;
103  charge *= sign;
104  return charge;
105  }
106 
107  if (s_isMesonino(pdg)) {
108  int quark = s_containedQuarks(pdg)[0];
109  int squark = abs(pdg / 100 % 10);
110  if (squark % 2 == 0 && quark % 2 == 1)
111  charge = 1;
112  if (squark % 2 == 1 && quark % 2 == 0)
113  charge = 1;
114  charge *= sign;
115  if (s_issbottomHadron(pdg))
116  charge *= -1;
117  return charge;
118  }
119 
120  if (s_isSbaryon(pdg)) {
121  int baryon = s_containedQuarksCode(pdg) + 100 * (abs(pdg / 1000 % 10)); //Adding the squark back on
122  for (int q = 1; q < 1000; q *= 10) {
123  if (baryon / q % 2 == 0)
124  charge += 2;
125  else
126  charge -= 1;
127  }
128  charge /= 3;
129  charge *= sign;
130  if (s_issbottomHadron(pdg))
131  charge *= -1;
132  return charge;
133  }
134 
135  return 0;
136 }
137 
139  // The PDG numbering is described in the Review of Particle Physics:
140  // "3. In composite quark systems (diquarks, mesons, and baryons) ...
141  // the rightmost digit nJ = 2J + 1 gives the system's spin."
142  // Since this does not apply to SUSY / exotic particles,
143  // if the spin is important for the simulation
144  // it should be hard-coded based on PDG ID in this function.
145  int pdgAbs = abs(pdg);
146  return pdgAbs % 10;
147 }
148 
150  std::vector<int> quarks;
151  for (int i = s_containedQuarksCode(pdg); i > 0; i /= 10) {
152  quarks.push_back(i % 10);
153  }
154  return quarks;
155 }
156 
158  int pdgAbs = abs(pdg);
159  if (s_isRBaryon(pdg))
160  return pdgAbs / 10 % 1000;
161 
162  if (s_isRMeson(pdg))
163  return pdgAbs / 10 % 100;
164 
165  if (s_isMesonino(pdg))
166  return pdgAbs / 10 % 1000 % 10;
167 
168  if (s_isSbaryon(pdg))
169  return pdgAbs / 10 % 1000 % 100;
170 
171  return 0;
172 }
static int s_containedQuarksCode(int pdg)
static bool s_isRGlueball(int pdg)
static bool s_isDphoton(int pdg)
static double s_charge(int pdg)
static bool s_isSbaryon(int pdg)
static bool s_isgluinoHadron(int pdg)
static bool s_isRMeson(int pdg)
static bool s_isMesonino(int pdg)
static bool s_isSLepton(int pdg)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static double s_spin(int pdg)
static bool s_isChargino(int pdg)
static bool s_isRBaryon(int pdg)
static std::vector< int > s_containedQuarks(int pdg)
static bool s_issbottomHadron(int pdg)
static bool s_isstopHadron(int pdg)