CMS 3D CMS Logo

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