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