ATLAS Offline Software
AtlasPID.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef TRUTHUTILS_ATLASPID_H
5 #define TRUTHUTILS_ATLASPID_H
6 #include <vector>
7 #include <cmath>
8 #include <algorithm>
9 #include <array>
10 #include <cstdlib>
16 class DecodedPID: public std::pair<int,std::vector<int>> {
17 public:
18  inline DecodedPID(const int& p){
19  this->first=p;
20  this->second.reserve(10);
21  int ap = std::abs(p);
22  for(; ap; ap/=10) this->second.push_back( ap%10 );
23  std::reverse(this->second.begin(), this->second.end());
24  }
25  inline DecodedPID shift(const size_t n) const { return DecodedPID(this->first%int(std::pow(10,ndigits()-n)));}
26  inline const int& operator()(const size_t n) const { return this->second.at(n);}
27  inline const int& last() const { return this->second.back();}
28  inline const int& pid() const { return this->first;}
29  inline int max_digit(const int m,const int n) const { return *std::max_element(second.rbegin() + m, second.rbegin() + n);}
30  inline int min_digit(const int m,const int n) const { return *std::min_element(second.rbegin() + m, second.rbegin() + n);}
31  inline size_t ndigits() const { return this->second.size();}
32 };
33 
34 static const int TABLESIZE = 100;
35 static const std::array<int,TABLESIZE> triple_charge = {
36  +0, -1, +2, -1, +2, -1, +2, -1, +2, +0,
37  +0, -3, +0, -3, +0, -3, +0, -3, +0, +0,
38  +0, +0, +0, +0, +3, +0, +0, +0, +0, +0,
39  +0, +0, +0, +0, +3, +0, +0, +3, +6, +0,
40  +0, +0, -1, +0, +0, +0, +0, +0, +0, +0,
41  +0, +0, +0, +0, +0, +0, +0, +0, +0, +0,
42  +0, +0, +0, +0, +0, +0, +0, +0, +0, +0,
43  +0, +0, +0, +0, +0, +0, +0, +0, +0, +0,
44  +0, +0, +0, +0, +0, +0, +0, +0, +0, +0,
45  +0, +0, +0, +0, +0, +0, +0, +0, +0, +0
46 };
47 static const std::array<int,TABLESIZE> double_spin = {
48  +0, +1, +1, +1, +1, +1, +1, +1, +1, +0,
49  +0, +1, +1, +1, +1, +1, +1, +1, +1, +0,
50  +2, +2, +2, +2, +2, +0, +0, +0, +0, +0,
51  +0, +0, +2, +2, +2, +0, +0, +0, +0, +4,
52  +0, +0, -1, +0, +0, +0, +0, +0, +0, +0,
53  +0, +0, +1, +2, +0, +2, +0, +0, +0, +0,
54  +0, +0, +0, +0, +0, +0, +0, +0, +0, +0,
55  +0, +0, +0, +0, +0, +0, +0, +0, +0, +0,
56  +0, +0, +0, +0, +0, +0, +0, +0, +0, +0,
57  +0, +0, +0, +0, +0, +0, +0, +0, +0, +0
58 };
59 
60 
61 static const int DQUARK = 1;
62 static const int UQUARK = 2;
63 static const int SQUARK = 3;
64 static const int CQUARK = 4;
65 static const int BQUARK = 5;
66 static const int TQUARK = 6;
67 
68 static const int ELECTRON = 11;
69 static const int POSITRON = -ELECTRON;
70 static const int NU_E = 12;
71 static const int MUON = 13;
72 static const int NU_MU = 14;
73 static const int TAU = 15;
74 static const int NU_TAU = 16;
75 
76 static const int GLUON = 21;
77 // APID: 9 rather than 21 is used to denote a gluon/gluino in composite states. (From PDG 11g)
78 static const int COMPOSITEGLUON = 9;
79 static const int PHOTON = 22;
80 static const int Z0BOSON = 23;
81 static const int WPLUSBOSON = 24;
82 static const int HIGGSBOSON = 25;
83 static const int ZPRIME = 32; // Z′/Z^0_2
84 static const int ZDBLPRIME = 33; // Z′′/Z^0_3
85 static const int WPLUSPRIME = 34; // W ′/W^+_2
86 static const int HIGGS2 = 35; // H^0/H^0_2 FIXME Any better ideas?
87 static const int HIGGS3 = 36; // A^0/H^0_3 FIXME Any better ideas?
88 static const int HIGGSPLUS = 37; // H^+
89 static const int HIGGSPLUSPLUS = 38; // H^++
90 static const int GRAVITON = 39;
91 static const int HIGGS4 = 40; // a^0/H^0_4 FIXME Any better ideas?
92 static const int LEPTOQUARK = 42;
93 
98 static const int DARKPHOTON = 60000;
99 static const int MAVTOP = 60001;
100 
101 static const int PIPLUS = 211;
102 static const int PIMINUS = -PIPLUS;
103 static const int PI0 = 111;
104 static const int K0L = 130;
105 
106 static const int K0S = 310;
107 static const int K0 = 311;
108 static const int KPLUS = 321;
109 static const int DPLUS = 411;
110 static const int DSTAR = 413;
111 static const int D0 = 421;
112 static const int DSPLUS = 431;
113 static const int JPSI = 443;
114 static const int B0 = 511;
115 static const int BCPLUS = 541;
116 static const int PROTON = 2212;
117 static const int NEUTRON = 2112;
118 static const int LAMBDA0 = 3122;
119 static const int LAMBDACPLUS = 4122;
120 static const int LAMBDAB0 = 5122;
121 static const int PSI2S = 20443;
122 
128 static const int RH_NU_E = 9900012;
129 static const int RH_NU_MU = 9900014;
130 static const int RH_NU_TAU = 9900016;
131 static const int WBOSON_LRSM = 9900024;
132 
133 static const int LEAD = 1000822080;
134 static const int OXYGEN = 1000080160;
135 static const int NEON = 1000100200;
136 static const int HELIUM = 1000020040;
137 
141 static const int POMERON = 990;
142 static const int ODDERON = 9990;
143 static const int REGGEON = 110;
144 
150 static const int GEANTINOPLUS = 998;
151 static const int GEANTINO0 = 999;
152 
153 
159 template<class T> inline bool isQuark(const T& p) {return isQuark(p->pdg_id());}
160 template<> inline bool isQuark(const int& p) { return p != 0 && (std::abs(p) <= 8 || std::abs(p) == MAVTOP);}
161 template<> inline bool isQuark(const DecodedPID& p){ return isQuark(p.pid()); }
162 
163 template<class T> inline bool isSMQuark(const T& p) {return isSMQuark(p->pdg_id());}
164 template<> inline bool isSMQuark(const int& p) { return p != 0 && std::abs(p) <= TQUARK;}
165 template<> inline bool isSMQuark(const DecodedPID& p){ return isSMQuark(p.pid()); }
166 
167 template<class T> inline bool isStrange(const T& p) {return isStrange(p->pdg_id());}
168 template<> inline bool isStrange(const int& p){ return std::abs(p) == 3;}
169 
170 template<class T> inline bool isCharm(const T& p){return isCharm(p->pdg_id());}
171 template<> inline bool isCharm(const int& p){ return std::abs(p) == 4;}
172 
173 template<class T> inline bool isBottom(const T& p){return isBottom(p->pdg_id());}
174 template<> inline bool isBottom(const int& p){ return std::abs(p) == 5;}
175 
176 template<class T> inline bool isTop(const T& p){return isTop(p->pdg_id());}
177 template<> inline bool isTop(const int& p){ return std::abs(p) == 6;}
178 
180 template<class T> inline bool isLepton(const T& p){return isLepton(p->pdg_id());}
181 template<> inline bool isLepton(const int& p){ auto sp = std::abs(p); return sp >= 11 && sp <= 18; }
182 template<> inline bool isLepton(const DecodedPID& p){ return isLepton(p.pid()); }
183 
184 template<class T> inline bool isSMLepton(const T& p){return isSMLepton(p->pdg_id());}
185 template<> inline bool isSMLepton(const int& p){ auto sp = std::abs(p); return sp >= 11 && sp <= 16; }
186 template<> inline bool isSMLepton(const DecodedPID& p){ return isSMLepton(p.pid()); }
187 
189 template<class T> inline bool isChLepton(const T& p){return isChLepton(p->pdg_id());}
190 template<> inline bool isChLepton(const int& p){ auto sp = std::abs(p); return sp >= 11 && sp <= 18 && sp%2 == 1; }
191 
192 template<class T> inline bool isElectron(const T& p){return isElectron(p->pdg_id());}
193 template<> inline bool isElectron(const int& p){ return std::abs(p) == ELECTRON;}
194 
195 template<class T> inline bool isMuon(const T& p){return isMuon(p->pdg_id());}
196 template<> inline bool isMuon(const int& p){ return std::abs(p) == MUON;}
197 
198 template<class T> inline bool isTau(const T& p){return isTau(p->pdg_id());}
199 template<> inline bool isTau(const int& p){ return std::abs(p) == TAU;}
200 
202 template<class T> inline bool isNeutrino(const T& p){return isNeutrino(p->pdg_id());}
203 template<> inline bool isNeutrino(const int& p){ auto sp = std::abs(p); return sp == NU_E || sp == NU_MU || sp == NU_TAU || sp == 18; }
204 
205 template<class T> inline bool isSMNeutrino(const T& p){return isSMNeutrino(p->pdg_id());}
206 template<> inline bool isSMNeutrino(const int& p){ auto sp = std::abs(p); return sp == NU_E || sp == NU_MU || sp == NU_TAU; }
207 
211 template<class T> inline bool isDiquark(const T& p){return isDiquark(p->pdg_id());}
212 template<> inline bool isDiquark(const DecodedPID& p){
213  if ( p.ndigits() == 4 && p(0) >= p(1) && p(2) == 0 && p.last() % 2 == 1
214  && p.max_digit(2,4) <= TQUARK
215  ) return true;
216  return false;
217 }
218 template<> inline bool isDiquark(const int& p){ auto value_digits = DecodedPID(p); return isDiquark(value_digits);}
219 
227 template<class T> inline bool isMeson(const T& p){return isMeson(p->pdg_id());}
228 template<> inline bool isMeson(const DecodedPID& p){
229  if (p.ndigits() < 3 ) return false;
230  if (p.ndigits() == 7 && (p(0) == 1 || p(0) == 2)) return false; // APID don't match SUSY particles
231  if (std::abs(p.pid()) == K0S) return true;
232  if (std::abs(p.pid()) == K0L) return true;
233  if (std::abs(p.pid()) == K0) return true;
234  if (p.last() % 2 != 1 ) return false;
235  if (p.max_digit(1,3) >= 6 ) return false;
236  if (p.max_digit(1,3) == 0 ) return false;
237  if (p.ndigits() > 3 && *(p.second.rbegin() + 3) != 0 ) return false;
238 
239  if (p.ndigits() == 3 && p(0) == p(1) && p.pid() < 0 ) return false;
240  if (p.ndigits() == 5 && p(2) == p(3) && p.pid() < 0 ) return false;
241  if (p.ndigits() == 7 && p(4) == p(5) && p.pid() < 0 ) return false;
242 
243 
244  if (p.ndigits() == 3 && p(0) >= p(1) && p(1) != 0 ) return true;
245  if (p.ndigits() == 5 && p(2) >= p(3) && p(3) != 0 && p(0) == 1 && p(1) == 0) return true;
246  if (p.ndigits() == 5 && p(2) >= p(3) && p(3) != 0 && p(0) == 2 && p(1) == 0 && p.last() > 1 ) return true;
247  if (p.ndigits() == 5 && p(2) >= p(3) && p(3) != 0 && p(0) == 3 && p(1) == 0 && p.last() > 1 ) return true;
248 
249  if (p.ndigits() == 6 && p(3) >= p(4) && p(4) != 0 && p.last() % 2 == 1 ) return true;
250 
251  if (p.ndigits() == 7 && p(0) == 9 && p(1) == 0 && p(4) >= p(5) && p(5) != 0) return true;
252 
253  return false;
254 }
255 template<> inline bool isMeson(const int& p){ auto value_digits = DecodedPID(p); return isMeson(value_digits);}
256 
258 template<class T> inline bool isBaryon(const T& p){return isBaryon(p->pdg_id());}
259 template<> inline bool isBaryon(const DecodedPID& p){
260  if (p.ndigits() < 4 ) return false;
261  if (p.max_digit(1,4) >= 6 ) return false;
262  if (p.min_digit(1,4) == 0) return false;
263  if (p.ndigits() == 4 && (p.last() == 2 || p.last() == 4|| p.last() == 6|| p.last() == 8) ) return true;
264 
265  if (p.ndigits() == 5 && p(0) == 1 && (p.last() == 2 || p.last() == 4) ) return true;
266  if (p.ndigits() == 5 && p(0) == 3 && (p.last() == 2 || p.last() == 4) ) return true;
267 
268  if (p.ndigits() == 6 ) {
269  if (p(0) == 1 && p(1) == 0 && p.last() == 2 ) return true;
270  if (p(0) == 1 && p(1) == 1 && p.last() == 2 ) return true;
271  if (p(0) == 1 && p(1) == 2 && p.last() == 4 ) return true;
272 
273  if (p(0) == 2 && p(1) == 0 && p.last() == 2 ) return true;
274  if (p(0) == 2 && p(1) == 0 && p.last() == 4 ) return true;
275  if (p(0) == 2 && p(1) == 1 && p.last() == 2 ) return true;
276 
277  if (p(0) == 1 && p(1) == 0 && p.last() == 4 ) return true;
278  if (p(0) == 1 && p(1) == 0 && p.last() == 6 ) return true;
279  if (p(0) == 2 && p(1) == 0 && p.last() == 6 ) return true;
280  if (p(0) == 2 && p(1) == 0 && p.last() == 8 ) return true;
281  }
282 
283  if (p.ndigits() == 5 ) {
284  if (p(0) == 2 && p.last() == 2 ) return true;
285  if (p(0) == 2 && p.last() == 4 ) return true;
286  if (p(0) == 2 && p.last() == 6 ) return true;
287  if (p(0) == 5 && p.last() == 2 ) return true;
288  if (p(0) == 1 && p.last() == 6 ) return true;
289  if (p(0) == 4 && p.last() == 2 ) return true;
290  }
291  return false;
292 }
293 template<> inline bool isBaryon(const int& p){ auto value_digits = DecodedPID(p); return isBaryon(value_digits);}
294 
301 template<class T> inline bool isTetraquark(const T& p){return isTetraquark(p->pdg_id());}
302 template<> inline bool isTetraquark(const DecodedPID& p){
303  return (p.ndigits() == 9 && p(0) == 1 && p(5) == 0 &&
304  p.max_digit(1,3) <= 6 && p.min_digit(1,3) > 0 &&
305  p.max_digit(1+3,3+3) <= 6 && p.min_digit(1+3,3+3) > 0 &&
306  ( p(3) >= p(4) && p(6) >= p(7) ) && ( ( p(3) > p(6) ) || ( p(3) == p(6) && (p(4) >= p(7))))
307  );
308 }
309 template<> inline bool isTetraquark(const int& p){ auto value_digits = DecodedPID(p); return isTetraquark(value_digits);}
310 
316 template<class T> inline bool isPentaquark(const T& p){return isPentaquark(p->pdg_id());}
317 template<> inline bool isPentaquark(const DecodedPID& p){
318  return (p.ndigits() == 9 && p(0) == 1 &&
319  p.max_digit(1,6) <= 6 && p.min_digit(1,6) > 0 &&
320  ( p(3) >= p(4) && p(4) >= p(5) && p(5) >= p(6)) );
321 }
322 template<> inline bool isPentaquark(const int& p){ auto value_digits = DecodedPID(p); return isPentaquark(value_digits);}
323 
324 // APID Mesons, Baryons, Tetraquarks and Pentaquarks are Hadrons
325 template<class T> inline bool isHadron(const T& p){return isHadron(p->pdg_id());}
326 template<> inline bool isHadron(const DecodedPID& p){ return isMeson(p) || isBaryon(p) || isTetraquark(p) || isPentaquark(p); }
327 template<> inline bool isHadron(const int& p){ auto value_digits = DecodedPID(p); return isHadron(value_digits);}
328 
329 
333 template<class T> inline bool isTrajectory(const T& p){return isTrajectory(p->pdg_id());}
334 template<> inline bool isTrajectory(const int& p){ return std::abs(p) == POMERON || std::abs(p) == ODDERON || std::abs(p) == REGGEON; }
335 
336 
343 template<class T> inline bool isBoson(const T& p){return isBoson(p->pdg_id());}
344 template<> inline bool isBoson(const int& p){ auto sp = std::abs(p); return sp > 20 && sp < 41; }
345 template<> inline bool isBoson(const DecodedPID& p){ return isBoson(p.pid()); }
346 
347 template<class T> inline bool isGluon(const T& p){return isGluon(p->pdg_id());}
348 template<> inline bool isGluon(const int& p){ return p == GLUON; }
349 
350 template<class T> inline bool isPhoton(const T& p){return isPhoton(p->pdg_id());}
351 template<> inline bool isPhoton(const int& p){ return p == PHOTON; }
352 
353 template<class T> inline bool isZ(const T& p){return isZ(p->pdg_id());}
354 template<> inline bool isZ(const int& p){ return p == Z0BOSON; }
355 
356 template<class T> inline bool isW(const T& p){return isW(p->pdg_id());}
357 template<> inline bool isW(const int& p){ return std::abs(p) == WPLUSBOSON; }
358 
360 template<class T> inline bool isHeavyBoson(const T& p){return isHeavyBoson(p->pdg_id());}
361 template<> inline bool isHeavyBoson(const int& p){ return p == ZPRIME || p == ZDBLPRIME || std::abs(p) == WPLUSPRIME; }
362 
364 template<class T> inline bool isHiggs(const T& p){return isHiggs(p->pdg_id());}
365 template<> inline bool isHiggs(const int& p){ return p == HIGGSBOSON; }
366 
368 template<class T> inline bool isMSSMHiggs(const T& p){return isMSSMHiggs(p->pdg_id());}
369 template<> inline bool isMSSMHiggs(const int& p){ return p == HIGGS2 || p == HIGGS3 || std::abs(p) == HIGGSPLUS; }
370 
371 template<class T> inline bool isGraviton(const T& p) {return isGraviton(p->pdg_id());}
372 template<> inline bool isGraviton(const int& p){ return p == GRAVITON; }
373 
374 template<class T> inline bool isResonance(const T& p) { return isZ(p) || isW(p) || isHiggs(p) || isTop(p); } // APID: not including t' (pdg_id=8), Z', Z'' and W'+ or BSM Higgs bosons
375 
382 template<class T> inline bool isLeptoQuark(const T& p){return isLeptoQuark(p->pdg_id());}
383 template<> inline bool isLeptoQuark(const int& p){ return std::abs(p) == LEPTOQUARK; }
384 
385 template<class T> inline bool isPythia8Specific(const T& p){return isPythia8Specific(p->pdg_id());}
386 template<> inline bool isPythia8Specific(const DecodedPID& p){ return (p.ndigits() == 7 && p(0) == 9 && p(1) == 9);}
387 template<> inline bool isPythia8Specific(const int& p){ auto value_digits = DecodedPID(p); return isPythia8Specific(value_digits);}
388 
394 template<class T> inline bool isNeutrinoRH(const T& p){return isNeutrinoRH(p->pdg_id());}
395 template<> inline bool isNeutrinoRH(const int& p){ return (std::abs(p) == RH_NU_E || std::abs(p) == RH_NU_MU|| std::abs(p) == RH_NU_TAU);}
396 
399 template<class T> inline bool isGenSpecific(const T& p){return isGenSpecific(p->pdg_id());}
400 template<> inline bool isGenSpecific(const int& p){
401  if (p >= 81 && p <= 100) return true;
402  if (p >= 901 && p <= 930) return true;
403  if (p >= 998 && p <= 999) return true;
404  if (p >= 1901 && p <= 1930) return true;
405  if (p >= 2901 && p <= 2930) return true;
406  if (p >= 3901 && p <= 3930) return true;
407  return false;
408 }
409 
410 template<class T> inline bool isGeantino(const T& p){return isGeantino(p->pdg_id());}
411 template<> inline bool isGeantino(const int& p){ return (std::abs(p) == GEANTINO0 || std::abs(p) == GEANTINOPLUS);}
412 
414 template<class T> inline bool isGlueball(const T& p) { return isGlueball(p->pdg_id()); }
415 template<> inline bool isGlueball(const DecodedPID& p) {
416  if (p.ndigits() > 4) return false; // APID avoid classifying R-Glueballs as SM Glueballs
417  return
418  ( ( p.ndigits() == 3 && p(0) == COMPOSITEGLUON && p(1) == COMPOSITEGLUON && (p(2) == 1 || p(2) == 5) ) ||
419  ( p.ndigits() == 4 && p(0) == COMPOSITEGLUON && p(1) == COMPOSITEGLUON && p(2) == COMPOSITEGLUON && (p(3) == 3 || p(3) == 7) ) );
420 }
421 template<> inline bool isGlueball(const int& p) { auto value_digits = DecodedPID(p); return isGlueball(value_digits); }
422 
423 
429 template<class T> inline bool isSUSY(const T& p){return isSUSY(p->pdg_id());}
430 template<> inline bool isSUSY(const DecodedPID& p){return (p.ndigits() == 7 && (p(0) == 1 || p(0) == 2) && !isGenSpecific(p.shift(2).pid()));}
431 template<> inline bool isSUSY(const int& p){ auto value_digits = DecodedPID(p); return isSUSY(value_digits);}
432 
433 
434 // APID: Super-partners of standard model quarks only
435 template<class T> inline bool isSquark(const T& p) { return isSquark(p->pdg_id()); }
436 template<> inline bool isSquark(const DecodedPID& p){
437  auto pp = p.shift(1); return isSUSY(p) && isSMQuark(pp);
438 }
439 template<> inline bool isSquark(const int& p){ auto value_digits = DecodedPID(p); return isSquark(value_digits);}
440 
441 
442 // APID: Super-partners of left-handed standard model quarks only
443 template<class T> inline bool isSquarkLH(const T& p) { return isSquarkLH(p->pdg_id()); }
444 template<> inline bool isSquarkLH(const DecodedPID& p){
445  return isSquark(p) && (p(0) == 1);
446 }
447 template<> inline bool isSquarkLH(const int& p){ auto value_digits = DecodedPID(p); return isSquarkLH(value_digits);}
448 
449 
450 // APID: Super-partners of right-handed standard model quarks only
451 template<class T> inline bool isSquarkRH(const T& p) { return isSquarkRH(p->pdg_id()); }
452 template<> inline bool isSquarkRH(const DecodedPID& p){
453  return isSquark(p) && (p(0) == 2);
454 }
455 template<> inline bool isSquarkRH(const int& p){ auto value_digits = DecodedPID(p); return isSquarkRH(value_digits);}
456 
457 
458 template<class T> inline bool hasSquark(const T& p, const int& q) { return hasSquark(p->pdg_id(), q); }
459 template<> inline bool hasSquark(const DecodedPID& p, const int& q){
460  auto pp = p.shift(1); return isSUSY(p) && pp.ndigits() != 2 && pp(0) == q; // skip lepton and boson super-partners by vetoing ndigits==2
461 }
462 template<> inline bool hasSquark(const int& p, const int& q){ auto value_digits = DecodedPID(p); return hasSquark(value_digits, q);}
463 
464 
465 // APID: Super-partners of standard model leptons only
466 template<class T> inline bool isSlepton(const T& p) { return isSlepton(p->pdg_id()); }
467 template<> inline bool isSlepton(const DecodedPID& p){ auto pp = p.shift(1); return isSUSY(p) && isSMLepton(pp);}
468 template<> inline bool isSlepton(const int& p){ auto value_digits = DecodedPID(p); return isSlepton(value_digits);}
469 
470 
471 // APID: Super-partners of left-handed standard model leptons only
472 template<class T> inline bool isSleptonLH(const T& p) { return isSleptonLH(p->pdg_id()); }
473 template<> inline bool isSleptonLH(const DecodedPID& p){ return isSlepton(p) && (p(0) == 1); }
474 template<> inline bool isSleptonLH(const int& p){ auto value_digits = DecodedPID(p); return isSleptonLH(value_digits);}
475 
476 
477 // APID: Super-partners of right-handed standard model leptons only
478 template<class T> inline bool isSleptonRH(const T& p) { return isSleptonRH(p->pdg_id()); }
479 template<> inline bool isSleptonRH(const DecodedPID& p){ return isSlepton(p) && (p(0) == 2); }
480 template<> inline bool isSleptonRH(const int& p){ auto value_digits = DecodedPID(p); return isSleptonRH(value_digits);}
481 
482 
483 // APID: Super-partners of gauge bosons including gravitons
484 template<class T> inline bool isGaugino(const T& p) { return isGaugino(p->pdg_id()); }
485 template<> inline bool isGaugino(const DecodedPID& p){
486  auto pp = p.shift(1); return isSUSY(p) && isBoson(pp.pid());
487 }
488 template<> inline bool isGaugino(const int& p){ auto value_digits = DecodedPID(p); return isGaugino(value_digits);}
489 
495 template<class T> inline bool isTechnicolor(const T& p){return isTechnicolor(p->pdg_id());}
496 template <>
497 inline bool isTechnicolor(const DecodedPID& p) {
498  const auto& pp = (p.ndigits() == 7) ? p.shift(2) : DecodedPID(0);
499  return (p.ndigits() == 7 && p(0) == 3 && (p(1) == 0 || p(0) == 1) &&
500  (isQuark(pp) || isLepton(pp) || isBoson(pp) || isGlueball(pp) ||
501  isDiquark(pp) || isHadron(pp)));
502 }
503 template<> inline bool isTechnicolor(const int& p){ auto value_digits = DecodedPID(p); return isTechnicolor(value_digits);}
504 
507 template<class T> inline bool isExcited(const T& p){return isExcited(p->pdg_id());}
508 template <>
509 inline bool isExcited(const DecodedPID& p) {
510  const auto& pp = (p.ndigits() == 7) ? p.shift(2) : DecodedPID(0);
511  return (p.ndigits() == 7 && (p(0) == 4 && p(1) == 0) &&
512  (isLepton(pp) || isQuark(pp)));
513 }
514 template<> inline bool isExcited(const int& p){ auto value_digits = DecodedPID(p); return isExcited(value_digits);}
515 
528 
533 template<class T> inline bool isRGlueball(const T& p) { return isRGlueball(p->pdg_id()); }
534 template<> inline bool isRGlueball(const DecodedPID& p) {
535  if (p.ndigits() != 7 || p(0) != 1) return false;
536  auto pp = p.shift(1);
537  return
538  ( ( pp.ndigits() == 3 && pp(0) == COMPOSITEGLUON && pp(1) == COMPOSITEGLUON && (pp(2) == 1 || pp(2) == 3) ) ||
539  ( pp.ndigits() == 4 && pp(0) == COMPOSITEGLUON && pp(1) == COMPOSITEGLUON && pp(2) == COMPOSITEGLUON && (pp(3) == 1 || pp(3) == 5) ) );
540 }
541 template<> inline bool isRGlueball(const int& p) { auto value_digits = DecodedPID(p); return isRGlueball(value_digits); }
542 
543 // APID Define R-Mesons as gluino-quark-antiquark and squark-antiquark bound states (ignore 4th generation squarks/quarks)
544 // NB Current models only allow gluino-quark-antiquark, stop-antiquark and sbottom-antiquark states
545 template<class T> inline bool isRMeson(const T& p) { return isRMeson(p->pdg_id()); }
546 template<> inline bool isRMeson(const DecodedPID& p) {
547  if (!(p.ndigits() == 7 && (p(0) == 1 || p(0) == 2))) return false;
548  auto pp = p.shift(1);
549  return (
550  // Handle ~gluino-quark-antiquark states
551  (pp.ndigits() == 4 && pp(0) == COMPOSITEGLUON && pp.max_digit(1,3) < COMPOSITEGLUON && pp(2) <= pp(1) && isSMQuark(pp(1)) && isSMQuark(pp(2)) && (pp.last() == 1 || pp.last() == 3)) ||
552  // Handle squark-antiquark states (previously called Smeson/mesoninos)
553  (pp.ndigits() == 3 && pp.max_digit(1,3) < COMPOSITEGLUON && pp(1) <= pp(0) && isSMQuark(pp(0)) && isSMQuark(pp(1)) && pp.last() == 2)
554  );
555 }
556 template<> inline bool isRMeson(const int& p) { auto value_digits = DecodedPID(p); return isRMeson(value_digits); }
557 
558 // APID Define R-Baryons as gluino-quark-quark-quark and squark-quark-quark bound states (ignore 4th generation squarks/quarks)
559 // NB Current models only allow gluino-quark-quark-quark, stop-quark-quark and sbottom-quark-quark states
560 template<class T> inline bool isRBaryon(const T& p) { return isRBaryon(p->pdg_id()); }
561 template<> inline bool isRBaryon(const DecodedPID& p) {
562  if (!(p.ndigits() == 7 && (p(0) == 1 || p(0) == 2))) return false;
563  auto pp = p.shift(1);
564  return (
565  // Handle ~gluino-quark-quark-quark states
566  (pp.ndigits() == 5 && pp(0) == COMPOSITEGLUON && pp.max_digit(1,4) < COMPOSITEGLUON && pp(2) <= pp(1) && pp(3) <= pp(2) && isSMQuark(pp(1)) && isSMQuark(pp(2)) && isSMQuark(pp(3)) && (pp.last() == 2 || pp.last() == 4)) ||
567  // Handle squark-quark-quark states (previously called Sbaryons)
568  (pp.ndigits() == 4 && pp.max_digit(1,4) < COMPOSITEGLUON && pp(1) <= pp(0) && pp(2) <= pp(1) && isSMQuark(pp(0)) && isSMQuark(pp(1)) && isSMQuark(pp(2)) && (pp.last() == 1 || pp.last() == 3))
569  );
570 }
571 template<> inline bool isRBaryon(const int& p) { auto value_digits = DecodedPID(p); return isRBaryon(value_digits); }
572 
580 template<class T> inline bool isKK(const T& p){return isKK(p->pdg_id());}
581 template<> inline bool isKK(const DecodedPID& p){return (p.ndigits() == 7 && (p(0) == 5 || p(0) == 6 ) );}
582 template<> inline bool isKK(const int& p){ auto value_digits = DecodedPID(p); return isKK(value_digits);}
583 
590 template<class T> inline bool isMonopole(const T& p){return isMonopole(p->pdg_id());}
591 template<> inline bool isMonopole(const DecodedPID& p){return (p.ndigits() == 7 && p(0) == 4 && p(1) == 1 && (p(2) == 1 || p(2) == 2 ) && p(6) == 0);}
592 template<> inline bool isMonopole(const int& p){ auto value_digits = DecodedPID(p); return isMonopole(value_digits);}
593 
604 template<class T> inline bool isDM(const T& p){return isDM(p->pdg_id());}
605 template<> inline bool isDM(const int& p){ auto sp = std::abs(p); return (sp >= 51 && sp <= 60) || sp == DARKPHOTON; }
606 
611 template<class T> inline bool isHiddenValley(const T& p){return isHiddenValley(p->pdg_id());}
612 template <>
613 inline bool isHiddenValley(const DecodedPID& p) {
614  const auto& pp = (p.ndigits() == 7) ? p.shift(2) : DecodedPID(0);
615  return (p.ndigits() == 7 && p(0) == 4 && p(1) == 9 &&
616  (isQuark(pp) || isLepton(pp) || isBoson(pp) || isGlueball(pp) ||
617  isDiquark(pp) || isHadron(pp)));
618 }
619 template<> inline bool isHiddenValley(const int& p){ auto value_digits = DecodedPID(p); return isHiddenValley(value_digits);}
620 
627 template<class T> inline bool isGenericMultichargedParticle(const T& p){return isGenericMultichargedParticle(p->pdg_id());}
628 template<> inline bool isGenericMultichargedParticle(const DecodedPID& p){return (p.ndigits() == 8 && (p(0) == 1 || p(0) == 2) && p(1) == 0 && p(2) == 0 && p(7) == 0);}
629 template<> inline bool isGenericMultichargedParticle(const int& p){ auto value_digits = DecodedPID(p); return isGenericMultichargedParticle(value_digits);}
630 
645 template<class T> inline bool isNucleus(const T& p){return isNucleus(p->pdg_id());}
646 template<> inline bool isNucleus(const DecodedPID& p){
647  if (std::abs(p.pid()) == PROTON) return true;
648  return (p.ndigits() == 10 && p(0) == 1 && p(1) == 0 );
649 }
650 template<> inline bool isNucleus(const int& p){ auto value_digits = DecodedPID(p); return isNucleus(value_digits);}
651 
652 
653 template<class T> inline bool hasQuark(const T& p, const int& q);
654 template<> inline bool hasQuark(const DecodedPID& p, const int& q){
655  if (isQuark(p.pid())) { return (std::abs(p.pid()) == q );}
656  if (isMeson(p)) { return *(p.second.rbegin() + 1) == q ||*(p.second.rbegin()+2) ==q;}
657  if (isDiquark(p)) { auto i = std::find(p.second.rbegin() + 2,p.second.rbegin()+4,q); return (i!=p.second.rbegin()+4);}
658  if (isBaryon(p)) { auto i = std::find(p.second.rbegin() + 1,p.second.rbegin()+4,q); return (i!=p.second.rbegin()+4);}
659  if (isTetraquark(p)) { auto i = std::find(p.second.rbegin() + 1,p.second.rbegin()+5,q); return (i!=p.second.rbegin()+5);}
660  if (isPentaquark(p)) { auto i = std::find(p.second.rbegin() + 1,p.second.rbegin()+6,q); return (i!=p.second.rbegin()+6);}
661  if (isNucleus(p) && std::abs(p.pid()) != PROTON) { return (q == 1 || q == 2 || (q==3 && p(2) > 0));}
662  if (isSUSY(p)) { // APID SUSY case
663  auto pp = p.shift(1);
664  if ( pp.ndigits() == 1 ) { return false; } // Handle squarks
665  if ( pp.ndigits() == 3 ) { return (pp(1) == q); } // Handle ~q qbar pairs
666  if ( pp.ndigits() == 4 ) { return (pp(1) == q || pp(2) == q); } // Ignore gluinos and squarks
667  if ( pp.ndigits() == 5 ) { return (pp(1) == q || pp(2) == q || pp(3) == q); } // Ignore gluinos and squarks
668  if ( pp.ndigits() > 5 ) { pp = pp.shift(1); } // Drop gluinos and squarks
669  return hasQuark(pp, q); }
670  return false;
671 }
672 template<> inline bool hasQuark(const int& p, const int& q){ auto value_digits = DecodedPID(p); return hasQuark(value_digits, q);}
673 
674 template<class T> inline bool hasStrange(const T& p) { return hasQuark(p,SQUARK); }
675 template<class T> inline bool hasCharm(const T& p) { return hasQuark(p,CQUARK); }
676 template<class T> inline bool hasBottom(const T& p) { return hasQuark(p,BQUARK); }
677 template<class T> inline bool hasTop(const T& p) { return hasQuark(p,TQUARK); }
678 
679 
680 // APID: The baryon number is defined as:
681 // B = (1/3)*( n_q - n_{qbar} )
682 // where n_q⁠ is the number of quarks, and ⁠n_{qbar} is the number of
683 // antiquarks. By convention, squarks have the same quantum numbers as
684 // the corresponding quarks (modulo spin and R), so have baryon number
685 // 1/3.
686 template<class T> inline int baryonNumber3(const T& p) {return baryonNumber3(p->pdg_id());}
687 template<> inline int baryonNumber3(const DecodedPID& p){
688  if (isQuark(p.pid())) { return (p.pid() > 0) ? 1 : - 1;}
689  if (isDiquark(p)) { return (p.pid() > 0) ? 2 : -2; }
690  if (isMeson(p) || isTetraquark(p)) { return 0; }
691  if (isBaryon(p) || isPentaquark(p)){ return (p.pid() > 0) ? 3 : -3; }
692  if (isNucleus(p)) {
693  const int result = 3*p(8) + 30*p(7) + 300*p(6);
694  return (p.pid() > 0) ? result : -result;
695  }
696  if (isSUSY(p)) {
697  auto pp = p.shift(1);
698  if (pp.ndigits() < 3 ) { return baryonNumber3(pp); } // super-partners of fundamental particles
699  if (pp(0) == COMPOSITEGLUON) {
700  if (pp(1) == COMPOSITEGLUON) { return 0; } // R-Glueballs
701  if ( pp.ndigits() == 4 ) { return 0; } // states with gluino-quark-antiquark
702  if ( pp.ndigits() == 5) { return (p.pid() > 0) ? 3 : -3; } // states with gluino-quark-quark-quark
703  }
704  if (pp.ndigits() == 3) { return 0; } // squark-antiquark
705  if (pp.ndigits() == 4) { return (p.pid() > 0) ? 3 : -3; } // states with squark-quark-quark
706  }
707  return 0;
708 }
709 template<> inline int baryonNumber3(const int& p){ auto value_digits = DecodedPID(p); return baryonNumber3(value_digits);}
710 
711 template<class T> inline double baryonNumber(const T& p) {return baryonNumber(p->pdg_id());}
712 template<> inline double baryonNumber(const DecodedPID& p){ return static_cast<double>(baryonNumber3(p))/3.0;}
713 template<> inline double baryonNumber(const int& p){ auto value_digits = DecodedPID(p); return static_cast<double>(baryonNumber3(value_digits))/3.0;}
714 
715 
716 // APID: The strangeness of a particle is defined as:
717 // S = − ( n_s − n_{sbar} )
718 // where n_s represents the number of strange quarks and n_{sbar}
719 // represents the number of strange antiquarks. By convention, strange
720 // squarks have the same quantum numbers as strange quarks (modulo
721 // spin and R), so have strangeness -1.
722 static const std::array<int,10> is_strange = {
723  +0, +0, +0, -1, +0, +0, +0, +0, +0, +0 };
724 template<class T> inline int strangeness(const T& p) {return strangeness(p->pdg_id());}
725 template<> inline int strangeness(const DecodedPID& p){
726  if (isNucleus(p) && p.ndigits() == 10) { return (p.pid() > 0) ? -p(2) : p(2); }
727  if (isStrange(p.pid())) { return (p.pid() > 0) ? -1 : 1; }
728  if (!hasStrange(p) && !hasSquark(p,SQUARK)) { return 0; }
729  if (std::abs(p.pid()) == K0) { return (p.pid() > 0) ? 1 : -1; }
730  size_t nq = 0;
731  int sign = 1;
732  int signmult = 1;
733  int result=0;
734  bool classified = false;
735  if (!classified && isMeson(p)) { classified = true; nq = 2; if ((*(p.second.rbegin()+2)) == 2||(*(p.second.rbegin()+2)) == 4 ) { sign=-1;} signmult =-1; }
736  if (!classified && isDiquark(p)) {return is_strange.at(p(0))+is_strange.at(p(1)); }
737  if (!classified && isBaryon(p)) { classified = true; nq = 3; }
738  if (!classified && isTetraquark(p)){ return is_strange.at(p(3)) + is_strange.at(p(4)) - is_strange.at(p(6)) - is_strange.at(p(7)); }
739  if (!classified && isPentaquark(p)){ return is_strange.at(p(3)) + is_strange.at(p(4)) + is_strange.at(p(5)) + is_strange.at(p(6)) - is_strange.at(p(7)); }
740  if (!classified && isSUSY(p)) {
741  nq = 0;
742  auto pp = p.shift(1);
743  if (pp.ndigits() < 3 ) { return strangeness(pp); } // super-partners of fundamental particles
744  if (pp(0) == COMPOSITEGLUON) {
745  if (pp(1) == COMPOSITEGLUON) { return 0; } // R-Glueballs
746  if ( pp.ndigits() == 4 || pp.ndigits() == 5) {
747  pp = pp.shift(1); // Remove gluino
748  }
749  }
750  if (pp.ndigits() == 3) { classified = true; nq = 2; if (p.last()%2==0) {sign = -1;} signmult = -1; } // states with quark-antiquark or squark-antiquark
751  if (pp.ndigits() == 4) { classified = true; nq = 3; } // states with quark-quark-quark or squark-quark-quark
752  }
753  for (auto r = p.second.rbegin() + 1; r != p.second.rbegin() + 1 + nq; ++r) {
754  result += is_strange.at(*r)*sign;
755  sign*=signmult;
756  }
757  return p.pid() > 0 ? result : -result;
758 }
759 template<> inline int strangeness(const int& p){ auto value_digits = DecodedPID(p); return strangeness(value_digits);}
760 
761 
762 template<class T> inline int numberOfLambdas(const T& p) {return numberOfLambdas(p->pdg_id());}
763 template<> inline int numberOfLambdas(const DecodedPID& p){
764  if (std::abs(p.pid()) == LAMBDA0) { return (p.pid() > 0) ? 1 : -1; }
765  if (isNucleus(p) && p.ndigits() == 10) { return (p.pid() > 0) ? p(2) : -p(2); }
766  return 0;
767 }
768 template<> inline int numberOfLambdas(const int& p){ auto value_digits = DecodedPID(p); return numberOfLambdas(value_digits);}
769 
770 
771 template<class T> inline int numberOfProtons(const T& p) {return numberOfProtons(p->pdg_id());}
772 template<> inline int numberOfProtons(const DecodedPID& p){
773  if (std::abs(p.pid()) == PROTON) { return (p.pid() > 0) ? 1 : -1; }
774  if (isNucleus(p)) {
775  const int result = p(5) + 10*p(4) + 100*p(3);
776  return (p.pid() > 0) ? result : -result;
777  }
778  return 0;
779 }
780 template<> inline int numberOfProtons(const int& p){ auto value_digits = DecodedPID(p); return numberOfProtons(value_digits);}
781 
782 
784 template<class T> inline bool isBSM(const T& p){return isBSM(p->pdg_id());}
785 template<> inline bool isBSM(const DecodedPID& p){
786  if (p.pid() == GRAVITON || std::abs(p.pid()) == MAVTOP || p.pid() == DARKPHOTON) return true;
787  if (std::abs(p.pid()) > 16 && std::abs(p.pid()) < 19) return true;
788  if (std::abs(p.pid()) > 31 && std::abs(p.pid()) < 39) return true;
789  if (std::abs(p.pid()) > 39 && std::abs(p.pid()) < 81) return true;
790  if (std::abs(p.pid()) > 6 && std::abs(p.pid()) < 9) return true;
791  if (isSUSY(p)) return true;
792  if (isNeutrinoRH(p.pid())) return true;
793  if (isGenericMultichargedParticle(p)) return true;
794  if (isTechnicolor(p)) return true;
795  if (isExcited(p)) return true;
796  if (isKK(p)) return true;
797  if (isHiddenValley(p)) return true;
798  return false;
799 }
800 template<> inline bool isBSM(const int& p){
801  if (p == GRAVITON || std::abs(p) == MAVTOP || p == DARKPHOTON) return true;
802  if (std::abs(p) > 16 && std::abs(p) < 19) return true;
803  if (std::abs(p) > 31 && std::abs(p) < 38) return true;
804  if (std::abs(p) > 39 && std::abs(p) < 81) return true;
805  if (std::abs(p) > 6 && std::abs(p) < 9) return true;
806  auto value_digits = DecodedPID(p); return isBSM(value_digits);
807 }
808 
809 template<class T> inline bool isTransportable(const T& p){return isTransportable(p->pdg_id());}
810 template<> inline bool isTransportable(const DecodedPID& p){ return isPhoton(p.pid()) || isGeantino(p.pid()) || isHadron(p) || isLepton(p.pid()) || p.pid() == DARKPHOTON;}
811 template<> inline bool isTransportable(const int& p){ auto value_digits = DecodedPID(p); return isTransportable(value_digits);}
812 
814 template<class T> inline bool isValid(const T& p){return isValid(p->pdg_id());}
815 template<> inline bool isValid(const DecodedPID& p){
816  return p.pid() !=0 && ( isQuark(p) || isLepton(p) || isBoson(p) || isGlueball(p) ||
817  isTrajectory(p.pid()) || isGenSpecific(p.pid()) || isDiquark(p) ||
818  isBSM(p) || isHadron(p) || isNucleus(p) || isGeantino(p.pid()) ||
819  isPythia8Specific(p) ); }
820 template<> inline bool isValid(const int& p){ if (!p) return false; if (std::abs(p) < 42) return true;
821  if (isGenSpecific(p)) return true;
822  auto value_digits = DecodedPID(p); return isValid(value_digits);
823 }
824 
825 template<class T> inline int leadingQuark(const T& p) {return leadingQuark(p->pdg_id());}
826 template<> inline int leadingQuark(const DecodedPID& p){
827  if (isQuark(p.pid())) { return std::abs(p.pid());}
828  if (isMeson(p)) { return p.max_digit(1,3);}
829  if (isDiquark(p)) { return p.max_digit(2,4);}
830  if (isBaryon(p)) { return p.max_digit(1,4);}
831  if (isTetraquark(p)) { return p.max_digit(1,5);}
832  if (isPentaquark(p)) { return p.max_digit(1,6);}
833  if (isSUSY(p)) { // APID SUSY case
834  auto pp = p.shift(1);
835  if ( pp.ndigits() == 1 ) { return 0; } // Handle squarks
836  if ( pp.ndigits() == 3 ) { pp = DecodedPID(pp(1)); } // Handle ~q qbar pairs
837  if ( pp.ndigits() > 3 ) { pp = pp.shift(1); } // Drop gluinos and squarks
838  return leadingQuark(pp); }
839  return 0;
840 }
841 
842 template<> inline int leadingQuark(const int& p){ auto value_digits = DecodedPID(p); return leadingQuark(value_digits);}
843 
844 template<class T> inline bool isLightHadron(const T& p) { auto lq = leadingQuark(p); return (lq == DQUARK || lq == UQUARK||lq == SQUARK) && isHadron(p); }
845 template<class T> inline bool isHeavyHadron(const T& p) { auto lq = leadingQuark(p); return (lq == CQUARK || lq == BQUARK || lq == TQUARK ) && isHadron(p); }
846 template<class T> inline bool isStrangeHadron(const T& p) { return leadingQuark(p) == SQUARK && isHadron(p); }
847 template<class T> inline bool isCharmHadron(const T& p) { return leadingQuark(p) == CQUARK && isHadron(p); }
848 template<class T> inline bool isBottomHadron(const T& p) { return leadingQuark(p) == BQUARK && isHadron(p); }
849 template<class T> inline bool isTopHadron(const T& p) { return leadingQuark(p) == TQUARK && isHadron(p); }
850 
851 template<class T> inline bool isLightMeson(const T& p) { auto lq = leadingQuark(p); return (lq == DQUARK || lq == UQUARK||lq == SQUARK) && isMeson(p); }
852 template<class T> inline bool isHeavyMeson(const T& p) { auto lq = leadingQuark(p); return (lq == CQUARK || lq == BQUARK || lq == TQUARK) && isMeson(p); }
853 template<class T> inline bool isStrangeMeson(const T& p) { return leadingQuark(p) == SQUARK && isMeson(p); }
854 template<class T> inline bool isCharmMeson(const T& p) { return leadingQuark(p) == CQUARK && isMeson(p); }
855 template<class T> inline bool isBottomMeson(const T& p) { return leadingQuark(p) == BQUARK && isMeson(p); }
856 template<class T> inline bool isTopMeson(const T& p) { return leadingQuark(p) == TQUARK && isMeson(p); }
857 
858 template<class T> inline bool isCCbarMeson(const T& p) { return isCCbarMeson(p->pdg_id());}
859 template<> inline bool isCCbarMeson(const DecodedPID& p) { return leadingQuark(p) == CQUARK && isMeson(p) && (*(p.second.rbegin()+2)) == CQUARK && (*(p.second.rbegin()+1)) == CQUARK; }
860 template<> inline bool isCCbarMeson(const int& p) { return isCCbarMeson(DecodedPID(p)); }
861 
862 template<class T> inline bool isBBbarMeson(const T& p){ return isBBbarMeson(p->pdg_id());}
863 template<> inline bool isBBbarMeson(const DecodedPID& p) { return leadingQuark(p) == BQUARK && isMeson(p) && (*(p.second.rbegin()+2)) == BQUARK && (*(p.second.rbegin()+1)) == BQUARK; }
864 template<> inline bool isBBbarMeson(const int& p) { return isBBbarMeson(DecodedPID(p)); }
865 
866 
867 template<class T> inline bool isLightBaryon(const T& p) { auto lq = leadingQuark(p); return (lq == DQUARK || lq == UQUARK||lq == SQUARK) && isBaryon(p); }
868 template<class T> inline bool isHeavyBaryon(const T& p) { auto lq = leadingQuark(p); return (lq == CQUARK || lq == BQUARK || lq == TQUARK) && isBaryon(p); }
869 template<class T> inline bool isStrangeBaryon(const T& p) { return leadingQuark(p) == SQUARK && isBaryon(p); }
870 template<class T> inline bool isCharmBaryon(const T& p) { return leadingQuark(p) == CQUARK && isBaryon(p); }
871 template<class T> inline bool isBottomBaryon(const T& p) { return leadingQuark(p) == BQUARK && isBaryon(p); }
872 template<class T> inline bool isTopBaryon(const T& p) { return leadingQuark(p) == TQUARK && isBaryon(p); }
873 
874 
875 // APID: This function selects B-Hadrons which predominantly decay weakly. (Commonly used definition in GeneratorFilters package.)
876 // 5[1-4]1 L = J = 0, S = 0
877 // 5[1-5][1-4]2 J = 1/2, n_r = 0, n_L =0
878 template<class T> inline bool isWeaklyDecayingBHadron(const T& p) {return isWeaklyDecayingBHadron(p->pdg_id());}
879 template<> inline bool isWeaklyDecayingBHadron(const int& p) {
880  const int pid = std::abs(p);
881  return ( pid == 511 || // B0
882  pid == 521 || // B+
883  pid == 531 || // B_s0
884  pid == 541 || // B_c+
885  pid == 5122 || // Lambda_b0
886  pid == 5132 || // Xi_b-
887  pid == 5232 || // Xi_b0
888  pid == 5112 || // Sigma_b-
889  pid == 5212 || // Sigma_b0
890  pid == 5222 || // Sigma_b+
891  pid == 5332 || // Omega_b-
892  pid == 5142 || // Xi_bc0
893  pid == 5242 || // Xi_bc+
894  pid == 5412 || // Xi'_bc0
895  pid == 5422 || // Xi'_bc+
896  pid == 5342 || // Omega_bc0
897  pid == 5432 || // Omega'_bc0
898  pid == 5442 || // Omega_bcc+
899  pid == 5512 || // Xi_bb-
900  pid == 5522 || // Xi_bb0
901  pid == 5532 || // Omega_bb-
902  pid == 5542 ); // Omega_bbc0
903 }
904 template<> inline bool isWeaklyDecayingBHadron(const DecodedPID& p){ return isWeaklyDecayingBHadron(p.pid()); }
905 
906 
907 // APID: This function selects C-Hadrons which predominantly decay weakly. (Commonly used definition in GeneratorFilters package.)
908 // 4[1-3]1 L = J = 0, S = 0
909 // 4[1-4][1-3]2 J = 1/2, n_r = 0, n_L =0
910 // NB Omitting pid = 4322 (Xi'_C+) a this undergoes an EM rather than
911 // weak decay. (There was an old version of Herwig that decayed it
912 // weakly, but this was fixed in Herwig 7.)
913 template<class T> inline bool isWeaklyDecayingCHadron(const T& p) {return isWeaklyDecayingCHadron(p->pdg_id());}
914 template<> inline bool isWeaklyDecayingCHadron(const int& p) {
915  const int pid = std::abs(p);
916  return ( pid == 411 || // D+
917  pid == 421 || // D0
918  pid == 431 || // Ds+
919  pid == 4122 || // Lambda_c+
920  pid == 4132 || // Xi_c0
921  pid == 4232 || // Xi_c+
922  pid == 4212 || // Xi_c0
923  pid == 4332 || // Omega_c0
924  pid == 4412 || // Xi_cc+
925  pid == 4422 || // Xi_cc++
926  pid == 4432 ); // Omega_cc+
927 }
928 template<> inline bool isWeaklyDecayingCHadron(const DecodedPID& p){ return isWeaklyDecayingCHadron(p.pid()); }
929 
930 
931 template<class T> inline int charge3( const T& p){return charge3(p->pdg_id());}
932 template<class T> inline double fractionalCharge(const T& p){return fractionalCharge(p->pdg_id());}
933 template<class T> inline double charge( const T& p){
934  if (isGenericMultichargedParticle(p)) // BSM multi-charged particles might have a fractional charge that's not a multiple of 1/3
935  return fractionalCharge(p);
936  else
937  return 1.0*charge3(p)/3.0;
938 }
939 template<class T> inline double threeCharge( const T& p){ return charge3(p);}
940 template<class T> inline bool isCharged( const T& p){ return charge3(p) != 0;}
941 
942 
943 template<> inline int charge3(const DecodedPID& p) {
944  auto ap = std::abs(p.pid());
945  if (ap < TABLESIZE ) return p.pid() > 0 ? triple_charge.at(ap) : -triple_charge.at(ap);
946  if (ap == K0) return 0;
947  if (ap == GEANTINO0) return 0;
948  if (ap == GEANTINOPLUS) return p.pid() > 0 ? 3 : -3;
949  if (ap == MAVTOP) return p.pid() > 0 ? 2 : -2;
950  size_t nq = 0;
951  int sign = 1;
952  int signmult = 1;
953  int result=0;
954  bool classified = false;
955  if (!classified && isMeson(p)) { classified = true; nq = 2; if ((*(p.second.rbegin()+2)) == 2||(*(p.second.rbegin()+2)) == 4 ) { sign=-1;} signmult =-1; }
956  if (!classified && isDiquark(p)) {return triple_charge.at(p(0))+triple_charge.at(p(1)); }
957  if (!classified && isBaryon(p)) { classified = true; nq = 3; }
958  if (!classified && isTetraquark(p)){ return triple_charge.at(p(3)) + triple_charge.at(p(4)) - triple_charge.at(p(6)) - triple_charge.at(p(7)); }
959  if (!classified && isPentaquark(p)){ return triple_charge.at(p(3)) + triple_charge.at(p(4)) + triple_charge.at(p(5)) + triple_charge.at(p(6)) - triple_charge.at(p(7)); }
960  if (!classified && isNucleus(p)) { return 3*numberOfProtons(p);}
961  if (!classified && isSUSY(p)) {
962  nq = 0;
963  auto pp = p.shift(1);
964  if (pp.ndigits() < 3 ) { return charge3(pp); } // super-partners of fundamental particles
965  if (pp(0) == COMPOSITEGLUON) {
966  if (pp(1) == COMPOSITEGLUON) { return 0; } // R-Glueballs
967  if ( pp.ndigits() == 4 || pp.ndigits() == 5) {
968  pp = pp.shift(1); // Remove gluino
969  }
970  }
971  if (pp.ndigits() == 3) { classified = true; nq = 2; if (p.last()%2==0) {sign = -1;} signmult = -1; } // states with squark-antiquark or quark-anti-quark
972  if (pp.ndigits() == 4) { classified = true; nq = 3; } // states with squark-quark-quark or quark-quark-quark
973  }
974  if (!classified && isMonopole(p)) {
977  result = 3*(p(3)*100 + p(4)*10 + p(5));
978  return ( (p.pid() > 0 && p(2) == 1) || (p.pid() < 0 && p(2) == 2) ) ? result : -result;
979  }
980  if (!classified && isGenericMultichargedParticle(p)) {
981  double abs_charge = 0.0;
982  if (p(0) == 1) abs_charge = p(3)*100. + p(4)*10. + p(5)*1 + p(6)*0.1; // multi-charged particle PDG ID is +/-100XXXY0, where the charge is XXX.Y
983  if (p(0) == 2) abs_charge = (p(3)*10. + p(4))/(p(5)*10.0 + p(6)); // multi-charged particle PDG ID is +/-200XXYY0, where the charge is XX/YY
984  int abs_threecharge = static_cast<int>(std::round(abs_charge * 3.)); // the multi-charged particles might have a fractional charge that's not a multiple of 1/3, in that case round to the closest multiple of 1/3 for charge3 and threecharge
985  return p.pid() > 0 ? abs_threecharge : -1 * abs_threecharge;
986  }
987  for (auto r = p.second.rbegin() + 1; r != p.second.rbegin() + 1 + nq; ++r) {
988  result += triple_charge.at(*r)*sign;
989  sign*=signmult;
990  }
991  return p.pid() > 0 ? result : -result;
992 }
993 template<> inline int charge3(const int& p){
994  int ap = std::abs(p);
995  if (ap < TABLESIZE) return p > 0 ? triple_charge.at(ap):-triple_charge.at(ap);
996  auto value_digits = DecodedPID(p);
997  return charge3(value_digits);
998 }
999 
1000 
1001 template<class T> inline bool isNeutral( const T& p){ return p->pdg_id() != 0 && charge3(p) == 0;}
1002 template<> inline bool isNeutral(const DecodedPID& p){ return p.pid() != 0 && charge3(p) == 0;}
1003 template<> inline bool isNeutral(const int& p){ auto value_digits = DecodedPID(p); return isNeutral(value_digits);}
1004 
1005 
1006 template<> inline double fractionalCharge(const DecodedPID& p) {
1007  if(!isGenericMultichargedParticle(p)) return 1.0*charge3(p)/3.0; // this method is written for multi-charged particles, still make sure other cases are handled properly
1008  double abs_charge = 0;
1009  if (p(0) == 1) abs_charge = p(3)*100. + p(4)*10. + p(5)*1 + p(6)*0.1; // multi-charged particle PDG ID is +/-100XXXY0, where the charge is XXX.Y
1010  if (p(0) == 2) abs_charge = (p(3)*10. + p(4))/(p(5)*10.0 + p(6)); // multi-charged particle PDG ID is +/-200XXYY0, where the charge is XX/YY
1011  return p.pid() > 0 ? abs_charge : -1 * abs_charge;
1012 }
1013 template<> inline double fractionalCharge(const int& p){auto value_digits = DecodedPID(p); return fractionalCharge(value_digits);}
1014 
1015 // APID: Including Z' and Z'' as EM interacting.
1016 template<class T> inline bool isEMInteracting(const T& p){return isEMInteracting(p->pdg_id());}
1017 template<> inline bool isEMInteracting(const int& p) {return (isPhoton(p) || isZ(p) || p == ZPRIME || p == ZDBLPRIME || std::abs(charge(p))>std::numeric_limits<double>::epsilon() || isMonopole(p));}
1018 
1019 template<class T> inline bool isParton(const T& p) { return isQuark(p)||isGluon(p);}
1020 
1021 // APID: Intended to return 2J
1022 // Useful for G4ParticleDefinition constructor
1023 template<class T> inline int spin2(const T& p) { return spin2(p->pdg_id()); }
1024 template<> inline int spin2(const DecodedPID& p) {
1025  if (isSUSY(p)) {
1026  auto pp = p.shift(1);
1027  auto ap = std::abs(pp.pid());
1028  if (ap < TABLESIZE ) { return std::abs(double_spin.at(ap)-1); } // sparticles (0->1, 1 -> 0, 2->1, 4->3)
1029  return p.last()-1; // R-Hadrons (p.last() == 2J +1)
1030  }
1031  auto ap = std::abs(p.pid());
1032  if (ap == K0S) { return 0; }
1033  if (ap == K0L) { return 0; }
1034  if (ap == MAVTOP) { return 1; } // TODO check this
1035  if (ap == DARKPHOTON) { return 2; } // TODO check this
1036  if (ap < TABLESIZE ) { return double_spin.at(ap); } // fundamental particles
1037  if (isHadron(p)) { return p.last()-1; } // Hadrons (p.last == 2J+1 - special cases handled above)
1038  if (isMonopole(p)) { return 0; } // PDG 11i - For now no spin information is provided. Also matches the definition in the G4Extensions/Monopole package.
1039  if (isGenericMultichargedParticle(p)) { return 0; } // APID Matches the definition in the G4Extensions/Monopole package.
1040  if (isNucleus(p)) { return 1; } // TODO need to explicitly deal with nuclei
1041  return p.last() > 0 ? 1 : 0; // Anything else - best guess
1042 }
1043 template<> inline int spin2(const int& p){ auto value_digits = DecodedPID(p); return spin2(value_digits);}
1044 
1045 template<class T> inline double spin(const T& p) { return spin(p->pdg_id()); }
1046 template<> inline double spin(const DecodedPID& p) { return 1.0*spin2(p)/2.0; }
1047 template<> inline double spin(const int& p){ auto value_digits = DecodedPID(p); return spin(value_digits);}
1048 
1049 template<class T> inline bool isRHadron(const T& p) { return isRHadron(p->pdg_id()); }
1050 template<> inline bool isRHadron(const DecodedPID& p) {
1051  return (isRBaryon(p) || isRMeson(p) || isRGlueball(p));
1052 }
1053 template<> inline bool isRHadron(const int& p) { auto value_digits = DecodedPID(p); return isRHadron(value_digits); }
1054 
1055 // APID: Returns an unordered list of the quarks contained by the current particle
1056 template<class T> inline std::vector<int> containedQuarks(const T& p) { return containedQuarks(p->pdg_id()); }
1057 template<> inline std::vector<int> containedQuarks(const int& p) {
1058  auto pp = DecodedPID(p);
1059  std::vector<int> quarks;
1060  if (isQuark(pp.pid())) { quarks.push_back(std::abs(pp.pid())); }
1061  else if (isDiquark(pp)) { quarks.push_back(pp(0)); quarks.push_back(pp(1)); }
1062  else if (isMeson(pp)) { quarks.push_back(*(pp.second.rbegin() + 1)); quarks.push_back(*(pp.second.rbegin()+2)); }
1063  else if (isBaryon(pp)) { for (size_t digit = 1; digit < 4; ++digit) { quarks.push_back(*(pp.second.rbegin() + digit)); } }
1064  else if (isTetraquark(pp)) { for (size_t digit = 1; digit < 5; ++digit) { quarks.push_back(*(pp.second.rbegin() + digit)); } }
1065  else if (isPentaquark(pp)) { for (size_t digit = 1; digit < 6; ++digit) { quarks.push_back(*(pp.second.rbegin() + digit)); } }
1066  else if (isNucleus(pp)) { const int A = std::abs(baryonNumber3(pp)/3); const int Z = std::abs(numberOfProtons(pp)); const int L = std::abs(numberOfLambdas(pp));
1067  const int n_uquarks = A + Z; const int n_dquarks = 2*A - Z - L; const int n_squarks = L;
1068  quarks.reserve(3*A); quarks.insert(quarks.end(), n_dquarks, 1); quarks.insert(quarks.end(), n_uquarks, 2); quarks.insert(quarks.end(), n_squarks, 3); }
1069  else if (isSUSY(pp)) { // APID SUSY case
1070  pp = pp.shift(1);
1071  if ( pp.ndigits() > 1 ) { // skip squarks
1072  if ( pp.ndigits() == 3 ) { pp = DecodedPID(pp(1)); } // Handle ~q qbar pairs
1073  if ( pp.ndigits() > 3 ) { pp = pp.shift(1); } // Drop gluinos and squarks
1074  return containedQuarks(pp.pid());
1075  }
1076  }
1077  return quarks;
1078 }
1079 template<> inline std::vector<int> containedQuarks(const DecodedPID& p) { return containedQuarks(p.pid()); }
1080 
1081 template<class T> inline bool isStrongInteracting(const T& p){return isStrongInteracting(p->pdg_id());}
1082 template<> inline bool isStrongInteracting(const int& p) { return (isGluon(p) || isQuark(p) || isDiquark(p) || isGlueball(p) || isLeptoQuark(p) || isHadron(p) || isRHadron(p));} // APID: Glueballs and R-Hadrons are also strong-interacting
1083 
1084 #endif
isStrange
bool isStrange(const T &p)
Definition: AtlasPID.h:167
isStrangeMeson
bool isStrangeMeson(const T &p)
Definition: AtlasPID.h:853
beamspotman.r
def r
Definition: beamspotman.py:676
isGaugino
bool isGaugino(const T &p)
Definition: AtlasPID.h:484
isBottomMeson
bool isBottomMeson(const T &p)
Definition: AtlasPID.h:855
isStrongInteracting
bool isStrongInteracting(const T &p)
Definition: AtlasPID.h:1081
isNucleus
bool isNucleus(const T &p)
PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.
Definition: AtlasPID.h:645
get_generator_info.result
result
Definition: get_generator_info.py:21
isHeavyBoson
bool isHeavyBoson(const T &p)
APID: Additional "Heavy"/"prime" versions of W and Z bosons (Used in MCTruthClassifier)
Definition: AtlasPID.h:360
isHeavyHadron
bool isHeavyHadron(const T &p)
Definition: AtlasPID.h:845
isTetraquark
bool isTetraquark(const T &p)
PDG rule 14 The 9-digit tetra-quark codes are±1nrnLnq1nq20nq3nq4nJ.
Definition: AtlasPID.h:301
isRMeson
bool isRMeson(const T &p)
Definition: AtlasPID.h:545
isBottomBaryon
bool isBottomBaryon(const T &p)
Definition: AtlasPID.h:871
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
isSleptonRH
bool isSleptonRH(const T &p)
Definition: AtlasPID.h:478
isTopBaryon
bool isTopBaryon(const T &p)
Definition: AtlasPID.h:872
hasCharm
bool hasCharm(const T &p)
Definition: AtlasPID.h:675
isBSM
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.
Definition: AtlasPID.h:784
baryonNumber
double baryonNumber(const T &p)
Definition: AtlasPID.h:711
isHiddenValley
bool isHiddenValley(const T &p)
PDG rule 11k Hidden Valley particles have n = 4 and n_r = 9, and trailing numbers in agreement with t...
Definition: AtlasPID.h:611
isBoson
bool isBoson(const T &p)
PDG rule 9: Two-digit numbers in the range 21–30 are provided for the Standard Model gauge and Higgs ...
Definition: AtlasPID.h:343
isGenSpecific
bool isGenSpecific(const T &p)
Main Table for MC internal use 81–100,901–930,998-999,1901–1930,2901–2930, and 3901–3930.
Definition: AtlasPID.h:399
Monitored::Z
@ Z
Definition: HistogramFillerUtils.h:24
DecodedPID::shift
DecodedPID shift(const size_t n) const
Definition: AtlasPID.h:25
isMeson
bool isMeson(const T &p)
Table 43.1 PDG rule 5a: The numbers specifying the meson’s quark content conform to the convention nq...
Definition: AtlasPID.h:227
hasQuark
bool hasQuark(const T &p, const int &q)
isKK
bool isKK(const T &p)
PDG rule 11h A black hole in models with extra dimensions has code 5000040.
Definition: AtlasPID.h:580
isSquarkRH
bool isSquarkRH(const T &p)
Definition: AtlasPID.h:451
threeCharge
double threeCharge(const T &p)
Definition: AtlasPID.h:939
isCharmMeson
bool isCharmMeson(const T &p)
Definition: AtlasPID.h:854
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
isRGlueball
bool isRGlueball(const T &p)
PDG rule 11g: Within several scenarios of new physics, it is possible to have colored particles suffici...
Definition: AtlasPID.h:533
hasBottom
bool hasBottom(const T &p)
Definition: AtlasPID.h:676
numberOfLambdas
int numberOfLambdas(const T &p)
Definition: AtlasPID.h:762
python.SystemOfUnits.second
float second
Definition: SystemOfUnits.py:135
isNeutrino
bool isNeutrino(const T &p)
APID: the fourth generation neutrinos are neutrinos.
Definition: AtlasPID.h:202
isResonance
bool isResonance(const T &p)
Definition: AtlasPID.h:374
isParton
bool isParton(const T &p)
Definition: AtlasPID.h:1019
isSquark
bool isSquark(const T &p)
Definition: AtlasPID.h:435
isSleptonLH
bool isSleptonLH(const T &p)
Definition: AtlasPID.h:472
isHeavyBaryon
bool isHeavyBaryon(const T &p)
Definition: AtlasPID.h:868
isValid
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition: AtlasPID.h:814
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
isLightBaryon
bool isLightBaryon(const T &p)
Definition: AtlasPID.h:867
python.AtlRunQueryParser.ap
ap
Definition: AtlRunQueryParser.py:826
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
isBottomHadron
bool isBottomHadron(const T &p)
Definition: AtlasPID.h:848
isLightMeson
bool isLightMeson(const T &p)
Definition: AtlasPID.h:851
isGenericMultichargedParticle
bool isGenericMultichargedParticle(const T &p)
In addition, there is a need to identify ”Q-ball” and similar very exotic (multi-charged) particles w...
Definition: AtlasPID.h:627
isSMLepton
bool isSMLepton(const T &p)
Definition: AtlasPID.h:184
isSMQuark
bool isSMQuark(const T &p)
Definition: AtlasPID.h:163
isGluon
bool isGluon(const T &p)
Definition: AtlasPID.h:347
DeMoUpdate.reverse
reverse
Definition: DeMoUpdate.py:563
isHiggs
bool isHiggs(const T &p)
APID: HIGGS boson is only one particle.
Definition: AtlasPID.h:364
fractionalCharge
double fractionalCharge(const T &p)
Definition: AtlasPID.h:932
isQuark
bool isQuark(const T &p)
PDG rule 2: Quarks and leptons are numbered consecutively starting from 1 and 11 respectively; to dot...
Definition: AtlasPID.h:159
A
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
isLightHadron
bool isLightHadron(const T &p)
Definition: AtlasPID.h:844
isCCbarMeson
bool isCCbarMeson(const T &p)
Definition: AtlasPID.h:858
strangeness
int strangeness(const T &p)
Definition: AtlasPID.h:724
isBottom
bool isBottom(const T &p)
Definition: AtlasPID.h:173
isTopHadron
bool isTopHadron(const T &p)
Definition: AtlasPID.h:849
lumiFormat.i
int i
Definition: lumiFormat.py:85
leadingQuark
int leadingQuark(const T &p)
Definition: AtlasPID.h:825
isPythia8Specific
bool isPythia8Specific(const T &p)
Definition: AtlasPID.h:385
beamspotman.n
n
Definition: beamspotman.py:731
isMonopole
bool isMonopole(const T &p)
PDG rule 11i Magnetic monopoles and dyons are assumed to have one unit of Dirac monopole charge and a...
Definition: AtlasPID.h:590
isWeaklyDecayingCHadron
bool isWeaklyDecayingCHadron(const T &p)
Definition: AtlasPID.h:913
hasTop
bool hasTop(const T &p)
Definition: AtlasPID.h:677
isZ
bool isZ(const T &p)
Definition: AtlasPID.h:353
DecodedPID::pid
const int & pid() const
Definition: AtlasPID.h:28
isPentaquark
bool isPentaquark(const T &p)
PDG rule 15 The 9-digit penta-quark codes are±1nrnLnq1nq2nq3nq4nq5nJ, sorted such thatnq1≥nq2≥nq3≥nq4...
Definition: AtlasPID.h:316
isCharmBaryon
bool isCharmBaryon(const T &p)
Definition: AtlasPID.h:870
isGlueball
bool isGlueball(const T &p)
APID: Definition of Glueballs: SM glueballs 99X (X=1,5), 999Y (Y=3,7)
Definition: AtlasPID.h:414
DecodedPID::max_digit
int max_digit(const int m, const int n) const
Definition: AtlasPID.h:29
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
isBBbarMeson
bool isBBbarMeson(const T &p)
Definition: AtlasPID.h:862
isNeutral
bool isNeutral(const T &p)
Definition: AtlasPID.h:1001
hasStrange
bool hasStrange(const T &p)
Definition: AtlasPID.h:674
isChLepton
bool isChLepton(const T &p)
APID: the fourth generation leptons are leptons.
Definition: AtlasPID.h:189
isSUSY
bool isSUSY(const T &p)
PDG rule 11d Fundamental supersymmetric particles are identified by adding a nonzero n to the particl...
Definition: AtlasPID.h:429
isTau
bool isTau(const T &p)
Definition: AtlasPID.h:198
isGraviton
bool isGraviton(const T &p)
Definition: AtlasPID.h:371
DecodedPID::DecodedPID
DecodedPID(const int &p)
Definition: AtlasPID.h:18
DecodedPID::min_digit
int min_digit(const int m, const int n) const
Definition: AtlasPID.h:30
isStrangeHadron
bool isStrangeHadron(const T &p)
Definition: AtlasPID.h:846
isDM
bool isDM(const T &p)
PDG rule 11j: The nature of Dark Matter (DM) is not known, and therefore a definitive classificationi...
Definition: AtlasPID.h:604
DecodedPID
Implementation of classification functions according to PDG2022.
Definition: AtlasPID.h:16
isExcited
bool isExcited(const T &p)
PDG rule 11f Excited (composite) quarks and leptons are identified by setting n= 4 and nr= 0.
Definition: AtlasPID.h:507
isTopMeson
bool isTopMeson(const T &p)
Definition: AtlasPID.h:856
isHadron
bool isHadron(const T &p)
Definition: AtlasPID.h:325
isNeutrinoRH
bool isNeutrinoRH(const T &p)
PDG Rule 12: APID: Helper function for right-handed neutrino states These are generator defined PDG I...
Definition: AtlasPID.h:394
charge
double charge(const T &p)
Definition: AtlasPID.h:933
DecodedPID::ndigits
size_t ndigits() const
Definition: AtlasPID.h:31
isBaryon
bool isBaryon(const T &p)
Table 43.2.
Definition: AtlasPID.h:258
isGeantino
bool isGeantino(const T &p)
Definition: AtlasPID.h:410
isSlepton
bool isSlepton(const T &p)
Definition: AtlasPID.h:466
isWeaklyDecayingBHadron
bool isWeaklyDecayingBHadron(const T &p)
Definition: AtlasPID.h:878
spin2
int spin2(const T &p)
Definition: AtlasPID.h:1023
isW
bool isW(const T &p)
Definition: AtlasPID.h:356
isRBaryon
bool isRBaryon(const T &p)
Definition: AtlasPID.h:560
isCharged
bool isCharged(const T &p)
Definition: AtlasPID.h:940
isTop
bool isTop(const T &p)
Definition: AtlasPID.h:176
isTransportable
bool isTransportable(const T &p)
Definition: AtlasPID.h:809
numberOfProtons
int numberOfProtons(const T &p)
Definition: AtlasPID.h:771
DeMoScan.first
bool first
Definition: DeMoScan.py:536
isLepton
bool isLepton(const T &p)
APID: the fourth generation leptons are leptons.
Definition: AtlasPID.h:180
isCharm
bool isCharm(const T &p)
Definition: AtlasPID.h:170
isPhoton
bool isPhoton(const T &p)
Definition: AtlasPID.h:350
charge3
int charge3(const T &p)
Definition: AtlasPID.h:931
hasSquark
bool hasSquark(const T &p, const int &q)
Definition: AtlasPID.h:458
isSquarkLH
bool isSquarkLH(const T &p)
Definition: AtlasPID.h:443
isSMNeutrino
bool isSMNeutrino(const T &p)
Definition: AtlasPID.h:205
isCharmHadron
bool isCharmHadron(const T &p)
Definition: AtlasPID.h:847
isRHadron
bool isRHadron(const T &p)
Definition: AtlasPID.h:1049
extractSporadic.q
list q
Definition: extractSporadic.py:98
isTechnicolor
bool isTechnicolor(const T &p)
PDG rule 11e Technicolor states have n = 3, with technifermions treated like ordinary fermions.
Definition: AtlasPID.h:495
isTrajectory
bool isTrajectory(const T &p)
PDG rule 8: The pomeron and odderon trajectories and a generic reggeon trajectory of states in QCD ar...
Definition: AtlasPID.h:333
isHeavyMeson
bool isHeavyMeson(const T &p)
Definition: AtlasPID.h:852
isStrangeBaryon
bool isStrangeBaryon(const T &p)
Definition: AtlasPID.h:869
DecodedPID::last
const int & last() const
Definition: AtlasPID.h:27
isElectron
bool isElectron(const T &p)
Definition: AtlasPID.h:192
DecodedPID::operator()
const int & operator()(const size_t n) const
Definition: AtlasPID.h:26
isDiquark
bool isDiquark(const T &p)
PDG rule 4 Diquarks have 4-digit numbers with nq1 >= nq2 and nq3 = 0 APID: the diquarks with fourth g...
Definition: AtlasPID.h:211
baryonNumber3
int baryonNumber3(const T &p)
Definition: AtlasPID.h:686
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
isEMInteracting
bool isEMInteracting(const T &p)
Definition: AtlasPID.h:1016
containedQuarks
std::vector< int > containedQuarks(const T &p)
Definition: AtlasPID.h:1056
spin
double spin(const T &p)
Definition: AtlasPID.h:1045
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
isMSSMHiggs
bool isMSSMHiggs(const T &p)
APID: Additional Higgs bosons for MSSM (Used in MCTruthClassifier)
Definition: AtlasPID.h:368
python.SystemOfUnits.m
float m
Definition: SystemOfUnits.py:106
python.SystemOfUnits.L
float L
Definition: SystemOfUnits.py:92
isMuon
bool isMuon(const T &p)
Definition: AtlasPID.h:195
isLeptoQuark
bool isLeptoQuark(const T &p)
PDG rule 11c: “One-of-a-kind” exotic particles are assigned numbers in the range 41–80.
Definition: AtlasPID.h:382