ATLAS Offline Software
CustomPDGParser.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "CustomPDGParser.h"
6 #include <cstdlib>
7 
8 /*CustomPDGParser::CustomPDGParser(int pdgCode) : m_pdgCode(pdgCode)
9  {
10 
11  }*/
12 
14 {
15  int pdgAbs=abs(pdg);
16  return ( (pdgAbs % 100000 / 10000 == 9) || (pdgAbs % 10000 / 1000 == 9) || s_isRGlueball(pdg) );
17 }
18 
20 {
21  int pdgAbs=abs(pdg);
22  return ( (pdgAbs % 10000 / 1000 == 6) || (pdgAbs % 10000 / 100 == 6) );
23 }
24 
26 {
27  int pdgAbs=abs(pdg);
28  return ( (pdgAbs % 10000 / 1000 == 5) || (pdgAbs % 10000 / 100 == 5) );
29 }
30 
31 
33 {
34  int pdgAbs=abs(pdg);
35  return (pdgAbs / 100 % 10000 == 0 && pdgAbs / 10 % 10 == 1);
36 }
37 
39 {
40  int pdgAbs=abs(pdg);
41  return (pdgAbs % 100000 / 10000 == 9);
42 
43 }
44 
46 {
47  int pdgAbs=abs(pdg);
48  return (pdgAbs % 100000 / 10 == 99);
49 
50 }
51 
53 {
54  int pdgAbs=abs(pdg);
55  return (pdgAbs % 10000 / 1000 == 9);
56 
57 }
58 
60 {
61  int pdgAbs=abs(pdg);
62  return ((pdgAbs % 10000 / 100 == 6) || (pdgAbs % 10000 / 100 == 5));
63 
64 }
65 
67 {
68  int pdgAbs=abs(pdg);
69  return ((pdgAbs % 10000 / 1000 == 6) || (pdgAbs % 10000 / 1000 == 5));
70 
71 }
72 
73 
75 {
76  float charge=0,sign=1;
77  int pdgAbs=abs(pdg);
78  if(pdg < 0 ) sign=-1;
79 
80  if(s_isSLepton(pdg)) //Sleptons
81  {
82  if(pdgAbs %2 == 0)
83  return 0;
84  else
85  return -sign;
86  }
87 
88  if(s_isRMeson(pdg))
89  {
90  std::vector<int> quarks = s_containedQuarks(pdg);
91  if((quarks[1] % 2 == 0 && quarks[0] % 2 == 1)||(quarks[1] % 2 == 1 && quarks[0] % 2 == 0 )) charge=1;
92  charge*=sign;
93  return charge;
94  }
95 
96  if(s_isRBaryon(pdg))
97  {
98  int baryon = s_containedQuarksCode(pdg);
99  for(int q=1; q< 1000; q*=10)
100  {
101  if(baryon / q % 2 == 0) charge+=2; else charge -=1;
102  }
103  charge/=3;
104  charge*=sign;
105  return charge;
106  }
107 
108  if(s_isMesonino(pdg))
109  {
110  int quark = s_containedQuarks(pdg)[0];
111  int squark = abs(pdg/100%10);
112  if (squark % 2 == 0 && quark % 2 == 1) charge = 1;
113  if (squark % 2 == 1 && quark % 2 == 0) charge = 1;
114  charge *= sign;
115  if(s_issbottomHadron(pdg)) charge*=-1;
116  return charge;
117  }
118 
119  if(s_isSbaryon(pdg))
120  {
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) charge+=2; else charge -=1;
124  charge/=3;
125  charge*=sign;
126  if(s_issbottomHadron(pdg)) charge*=-1;
127  return charge;
128  }
129 
130  return 0;
131 }
132 
133 double CustomPDGParser::s_spin(int pdg)
134 {
135  int pdgAbs=abs(pdg);
136  return pdgAbs % 10;
137 }
138 
139 std::vector<int> CustomPDGParser::s_containedQuarks(int pdg)
140 {
141  std::vector<int> quarks;
142  for(int i=s_containedQuarksCode(pdg); i > 0; i /= 10)
143  quarks.push_back(i % 10);
144 
145  return quarks;
146 }
147 
149 {
150  int pdgAbs=abs(pdg);
151  if(s_isRBaryon(pdg))
152  return pdgAbs / 10 % 1000;
153 
154  if(s_isRMeson(pdg))
155  return pdgAbs / 10 % 100;
156 
157  if(s_isMesonino(pdg))
158  return pdgAbs / 10 % 1000 % 10;
159 
160  if(s_isSbaryon(pdg))
161  return pdgAbs / 10 % 1000 % 100;
162 
163 
164  return 0;
165 }
CustomPDGParser::s_containedQuarksCode
static int s_containedQuarksCode(int pdg)
Definition: CustomPDGParser.cxx:148
CustomPDGParser::s_spin
static double s_spin(int pdg)
Definition: CustomPDGParser.cxx:133
CustomPDGParser::s_isRMeson
static bool s_isRMeson(int pdg)
Definition: CustomPDGParser.cxx:52
CustomPDGParser::s_issbottomHadron
static bool s_issbottomHadron(int pdg)
Definition: CustomPDGParser.cxx:25
CustomPDGParser::s_isstopHadron
static bool s_isstopHadron(int pdg)
Definition: CustomPDGParser.cxx:19
CustomPDGParser::s_charge
static double s_charge(int pdg)
Definition: CustomPDGParser.cxx:74
CustomPDGParser::s_isRBaryon
static bool s_isRBaryon(int pdg)
Definition: CustomPDGParser.cxx:38
CustomPDGParser.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
CustomPDGParser::s_isRHadron
static bool s_isRHadron(int pdg)
Definition: CustomPDGParser.cxx:13
charge
double charge(const T &p)
Definition: AtlasPID.h:538
CustomPDGParser::s_isRGlueball
static bool s_isRGlueball(int pdg)
Definition: CustomPDGParser.cxx:45
CustomPDGParser::s_isMesonino
static bool s_isMesonino(int pdg)
Definition: CustomPDGParser.cxx:59
extractSporadic.q
list q
Definition: extractSporadic.py:98
CustomPDGParser::s_isSbaryon
static bool s_isSbaryon(int pdg)
Definition: CustomPDGParser.cxx:66
DerivationFramework::squark
@ squark
Definition: utilityFunctions.h:11
CustomPDGParser::s_isSLepton
static bool s_isSLepton(int pdg)
Definition: CustomPDGParser.cxx:32
CustomPDGParser::s_containedQuarks
static std::vector< int > s_containedQuarks(int pdg)
Definition: CustomPDGParser.cxx:139