CMS 3D CMS Logo

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