ATLAS Offline Software
AtlasPID.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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, +0, +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, +0, +0, +0, +0, +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 UQUARK = 1;
62 static const int DQUARK = 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 GRAVITON = 39;
84 static const int LEPTOQUARK = 42;
85 
90 static const int DARKPHOTON = 60000;
91 static const int MAVTOP = 60001;
92 
93 static const int PIPLUS = 211;
94 static const int PIMINUS = -PIPLUS;
95 static const int PI0 = 111;
96 static const int K0L = 130;
97 
98 static const int K0S = 310;
99 static const int K0 = 311;
100 static const int KPLUS = 321;
101 static const int DPLUS = 411;
102 static const int DSTAR = 413;
103 static const int D0 = 421;
104 static const int DSPLUS = 431;
105 static const int JPSI = 443;
106 static const int B0 = 511;
107 static const int BCPLUS = 541;
108 static const int PROTON = 2212;
109 static const int NEUTRON = 2112;
110 static const int LAMBDA0 = 3122;
111 static const int LAMBDACPLUS = 4122;
112 static const int LAMBDAB0 = 5122;
113 static const int PSI2S = 20443;
114 
115 static const int LEAD = 1000822080;
116 static const int OXYGEN = 1000080160;
117 static const int NEON = 1000100200;
118 
122 static const int POMERON = 990;
123 static const int ODDERON = 9990;
124 static const int REGGEON = 110;
125 
131 static const int GEANTINOPLUS = 998;
132 static const int GEANTINO0 = 999;
133 
134 
140 template<class T> inline bool isQuark(const T& p) {return isQuark(p->pdg_id());}
141 template<> inline bool isQuark(const int& p) { return p != 0 && (std::abs(p) <= 8 || std::abs(p) == MAVTOP);}
142 template<> inline bool isQuark(const DecodedPID& p){ return isQuark(p.pid()); }
143 
144 template<class T> inline bool isSMQuark(const T& p) {return isSMQuark(p->pdg_id());}
145 template<> inline bool isSMQuark(const int& p) { return p != 0 && std::abs(p) <= TQUARK;}
146 template<> inline bool isSMQuark(const DecodedPID& p){ return isSMQuark(p.pid()); }
147 
148 template<class T> inline bool isStrange(const T& p) {return isStrange(p->pdg_id());}
149 template<> inline bool isStrange(const int& p){ return std::abs(p) == 3;}
150 
151 template<class T> inline bool isCharm(const T& p){return isCharm(p->pdg_id());}
152 template<> inline bool isCharm(const int& p){ return std::abs(p) == 4;}
153 
154 template<class T> inline bool isBottom(const T& p){return isBottom(p->pdg_id());}
155 template<> inline bool isBottom(const int& p){ return std::abs(p) == 5;}
156 
157 template<class T> inline bool isTop(const T& p){return isTop(p->pdg_id());}
158 template<> inline bool isTop(const int& p){ return std::abs(p) == 6;}
159 
161 template<class T> inline bool isLepton(const T& p){return isLepton(p->pdg_id());}
162 template<> inline bool isLepton(const int& p){ auto sp = std::abs(p); return sp >= 11 && sp <= 18; }
163 template<> inline bool isLepton(const DecodedPID& p){ return isLepton(p.pid()); }
164 
165 template<class T> inline bool isSMLepton(const T& p){return isSMLepton(p->pdg_id());}
166 template<> inline bool isSMLepton(const int& p){ auto sp = std::abs(p); return sp >= 11 && sp <= 16; }
167 template<> inline bool isSMLepton(const DecodedPID& p){ return isSMLepton(p.pid()); }
168 
170 template<class T> inline bool isChLepton(const T& p){return isChLepton(p->pdg_id());}
171 template<> inline bool isChLepton(const int& p){ auto sp = std::abs(p); return sp >= 11 && sp <= 18 && sp%2 == 1; }
172 
173 template<class T> inline bool isElectron(const T& p){return isElectron(p->pdg_id());}
174 template<> inline bool isElectron(const int& p){ return std::abs(p) == ELECTRON;}
175 
176 template<class T> inline bool isMuon(const T& p){return isMuon(p->pdg_id());}
177 template<> inline bool isMuon(const int& p){ return std::abs(p) == MUON;}
178 
179 template<class T> inline bool isTau(const T& p){return isTau(p->pdg_id());}
180 template<> inline bool isTau(const int& p){ return std::abs(p) == TAU;}
181 
183 template<class T> inline bool isNeutrino(const T& p){return isNeutrino(p->pdg_id());}
184 template<> inline bool isNeutrino(const int& p){ auto sp = std::abs(p); return sp == NU_E || sp == NU_MU || sp == NU_TAU || sp == 18; }
185 
186 template<class T> inline bool isSMNeutrino(const T& p){return isSMNeutrino(p->pdg_id());}
187 template<> inline bool isSMNeutrino(const int& p){ auto sp = std::abs(p); return sp == NU_E || sp == NU_MU || sp == NU_TAU; }
188 
192 template<class T> inline bool isDiquark(const T& p){return isDiquark(p->pdg_id());}
193 template<> inline bool isDiquark(const DecodedPID& p){
194  if ( p.ndigits() == 4 && p(0) >= p(1) && p(2) == 0 && p.last() % 2 == 1
195  && p.max_digit(2,4) <= TQUARK
196  ) return true;
197  return false;
198 }
199 template<> inline bool isDiquark(const int& p){ auto value_digits = DecodedPID(p); return isDiquark(value_digits);}
200 
208 template<class T> inline bool isMeson(const T& p){return isMeson(p->pdg_id());}
209 template<> inline bool isMeson(const DecodedPID& p){
210  if (p.ndigits() < 3 ) return false;
211  if (p.ndigits() == 7 && (p(0) == 1 || p(0) == 2)) return false; // APID don't match SUSY particles
212  if (std::abs(p.pid()) == K0S) return true;
213  if (std::abs(p.pid()) == K0L) return true;
214  if (std::abs(p.pid()) == K0) return true;
215  if (p.last() % 2 != 1 ) return false;
216  if (p.max_digit(1,3) >= 6 ) return false;
217  if (p.max_digit(1,3) == 0 ) return false;
218  if (p.ndigits() > 3 && *(p.second.rbegin() + 3) != 0 ) return false;
219 
220  if (p.ndigits() == 3 && p(0) == p(1) && p.pid() < 0 ) return false;
221  if (p.ndigits() == 5 && p(2) == p(3) && p.pid() < 0 ) return false;
222  if (p.ndigits() == 7 && p(4) == p(5) && p.pid() < 0 ) return false;
223 
224 
225  if (p.ndigits() == 3 && p(0) >= p(1) && p(1) != 0 ) return true;
226  if (p.ndigits() == 5 && p(2) >= p(3) && p(3) != 0 && p(0) == 1 && p(1) == 0) return true;
227  if (p.ndigits() == 5 && p(2) >= p(3) && p(3) != 0 && p(0) == 2 && p(1) == 0 && p.last() > 1 ) return true;
228  if (p.ndigits() == 5 && p(2) >= p(3) && p(3) != 0 && p(0) == 3 && p(1) == 0 && p.last() > 1 ) return true;
229 
230  if (p.ndigits() == 6 && p(3) >= p(4) && p(4) != 0 && p.last() % 2 == 1 ) return true;
231 
232  if (p.ndigits() == 7 && p(0) == 9 && p(1) == 0 && p(4) >= p(5) && p(5) != 0) return true;
233 
234  return false;
235 }
236 template<> inline bool isMeson(const int& p){ auto value_digits = DecodedPID(p); return isMeson(value_digits);}
237 
239 template<class T> inline bool isBaryon(const T& p){return isBaryon(p->pdg_id());}
240 template<> inline bool isBaryon(const DecodedPID& p){
241  if (p.ndigits() < 4 ) return false;
242  if (p.max_digit(1,4) >= 6 ) return false;
243  if (p.min_digit(1,4) == 0) return false;
244  if (p.ndigits() == 4 && (p.last() == 2 || p.last() == 4|| p.last() == 6|| p.last() == 8) ) return true;
245 
246  if (p.ndigits() == 5 && p(0) == 1 && (p.last() == 2 || p.last() == 4) ) return true;
247  if (p.ndigits() == 5 && p(0) == 3 && (p.last() == 2 || p.last() == 4) ) return true;
248 
249  if (p.ndigits() == 6 ) {
250  if (p(0) == 1 && p(1) == 0 && p.last() == 2 ) return true;
251  if (p(0) == 1 && p(1) == 1 && p.last() == 2 ) return true;
252  if (p(0) == 1 && p(1) == 2 && p.last() == 4 ) return true;
253 
254  if (p(0) == 2 && p(1) == 0 && p.last() == 2 ) return true;
255  if (p(0) == 2 && p(1) == 0 && p.last() == 4 ) return true;
256  if (p(0) == 2 && p(1) == 1 && p.last() == 2 ) return true;
257 
258  if (p(0) == 1 && p(1) == 0 && p.last() == 4 ) return true;
259  if (p(0) == 1 && p(1) == 0 && p.last() == 6 ) return true;
260  if (p(0) == 2 && p(1) == 0 && p.last() == 6 ) return true;
261  if (p(0) == 2 && p(1) == 0 && p.last() == 8 ) return true;
262  }
263 
264  if (p.ndigits() == 5 ) {
265  if (p(0) == 2 && p.last() == 2 ) return true;
266  if (p(0) == 2 && p.last() == 4 ) return true;
267  if (p(0) == 2 && p.last() == 6 ) return true;
268  if (p(0) == 5 && p.last() == 2 ) return true;
269  if (p(0) == 1 && p.last() == 6 ) return true;
270  if (p(0) == 4 && p.last() == 2 ) return true;
271  }
272  return false;
273 }
274 template<> inline bool isBaryon(const int& p){ auto value_digits = DecodedPID(p); return isBaryon(value_digits);}
275 
282 template<class T> inline bool isTetraquark(const T& p){return isTetraquark(p->pdg_id());}
283 template<> inline bool isTetraquark(const DecodedPID& p){
284  return (p.ndigits() == 9 && p(0) == 1 && p(5) == 0 &&
285  p.max_digit(1,3) <= 6 && p.min_digit(1,3) > 0 &&
286  p.max_digit(1+3,3+3) <= 6 && p.min_digit(1+3,3+3) > 0 &&
287  ( p(3) >= p(4) && p(6) >= p(7) ) && ( ( p(3) > p(6) ) || ( p(3) == p(6) && (p(4) >= p(7))))
288  );
289 }
290 template<> inline bool isTetraquark(const int& p){ auto value_digits = DecodedPID(p); return isTetraquark(value_digits);}
291 
297 template<class T> inline bool isPentaquark(const T& p){return isPentaquark(p->pdg_id());}
298 template<> inline bool isPentaquark(const DecodedPID& p){
299  return (p.ndigits() == 9 && p(0) == 1 &&
300  p.max_digit(1,6) <= 6 && p.min_digit(1,6) > 0 &&
301  ( p(3) >= p(4) && p(4) >= p(5) && p(5) >= p(6)) );
302 }
303 template<> inline bool isPentaquark(const int& p){ auto value_digits = DecodedPID(p); return isPentaquark(value_digits);}
304 
305 // APID Mesons, Baryons, Tetraquarks and Pentaquarks are Hadrons
306 template<class T> inline bool isHadron(const T& p){return isHadron(p->pdg_id());}
307 template<> inline bool isHadron(const DecodedPID& p){ return isMeson(p) || isBaryon(p) || isTetraquark(p) || isPentaquark(p); }
308 template<> inline bool isHadron(const int& p){ auto value_digits = DecodedPID(p); return isHadron(value_digits);}
309 
310 
314 template<class T> inline bool isTrajectory(const T& p){return isTrajectory(p->pdg_id());}
315 template<> inline bool isTrajectory(const int& p){ return std::abs(p) == POMERON || std::abs(p) == ODDERON || std::abs(p) == REGGEON; }
316 
317 
324 template<class T> inline bool isBoson(const T& p){return isBoson(p->pdg_id());}
325 template<> inline bool isBoson(const int& p){ auto sp = std::abs(p); return sp > 20 && sp < 41; }
326 template<> inline bool isBoson(const DecodedPID& p){ return isBoson(p.pid()); }
327 
328 template<class T> inline bool isGluon(const T& p){return isGluon(p->pdg_id());}
329 template<> inline bool isGluon(const int& p){ return p == GLUON; }
330 
331 template<class T> inline bool isPhoton(const T& p){return isPhoton(p->pdg_id());}
332 template<> inline bool isPhoton(const int& p){ return p == PHOTON; }
333 
334 template<class T> inline bool isZ(const T& p){return isZ(p->pdg_id());}
335 template<> inline bool isZ(const int& p){ return p == Z0BOSON; }
336 
337 template<class T> inline bool isW(const T& p){return isW(p->pdg_id());}
338 template<> inline bool isW(const int& p){ return std::abs(p) == WPLUSBOSON; }
339 
341 template<class T> inline bool isHiggs(const T& p){return isHiggs(p->pdg_id());}
342 template<> inline bool isHiggs(const int& p){ return p == HIGGSBOSON; }
343 
344 template<class T> inline bool isGraviton(const T& p) {return isGraviton(p->pdg_id());}
345 template<> inline bool isGraviton(const int& p){ return p == GRAVITON; }
346 
347 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)
348 
355 template<class T> inline bool isLeptoQuark(const T& p){return isLeptoQuark(p->pdg_id());}
356 template<> inline bool isLeptoQuark(const int& p){ return std::abs(p) == LEPTOQUARK; }
357 
358 template<class T> inline bool isPythia8Specific(const T& p){return isPythia8Specific(p->pdg_id());}
359 template<> inline bool isPythia8Specific(const DecodedPID& p){ return (p.ndigits() == 7 && p(0) == 9 && p(1) == 9);}
360 template<> inline bool isPythia8Specific(const int& p){ auto value_digits = DecodedPID(p); return isPythia8Specific(value_digits);}
361 
364 template<class T> inline bool isGenSpecific(const T& p){return isGenSpecific(p->pdg_id());}
365 template<> inline bool isGenSpecific(const int& p){
366  if (p >= 81 && p <= 100) return true;
367  if (p >= 901 && p <= 930) return true;
368  if (p >= 998 && p <= 999) return true;
369  if (p >= 1901 && p <= 1930) return true;
370  if (p >= 2901 && p <= 2930) return true;
371  if (p >= 3901 && p <= 3930) return true;
372  return false;
373 }
374 
375 template<class T> inline bool isGeantino(const T& p){return isGeantino(p->pdg_id());}
376 template<> inline bool isGeantino(const int& p){ return (std::abs(p) == GEANTINO0 || std::abs(p) == GEANTINOPLUS);}
377 
379 template<class T> inline bool isGlueball(const T& p) { return isGlueball(p->pdg_id()); }
380 template<> inline bool isGlueball(const DecodedPID& p) {
381  if (p.ndigits() > 4) return false; // APID avoid classifying R-Glueballs as SM Glueballs
382  return
383  ( ( p.ndigits() == 3 && p(0) == COMPOSITEGLUON && p(1) == COMPOSITEGLUON && (p(2) == 1 || p(2) == 5) ) ||
384  ( p.ndigits() == 4 && p(0) == COMPOSITEGLUON && p(1) == COMPOSITEGLUON && p(2) == COMPOSITEGLUON && (p(3) == 3 || p(3) == 7) ) );
385 }
386 template<> inline bool isGlueball(const int& p) { auto value_digits = DecodedPID(p); return isGlueball(value_digits); }
387 
388 
394 template<class T> inline bool isSUSY(const T& p){return isSUSY(p->pdg_id());}
395 template<> inline bool isSUSY(const DecodedPID& p){return (p.ndigits() == 7 && (p(0) == 1 || p(0) == 2) && !isGenSpecific(p.shift(2).pid()));}
396 template<> inline bool isSUSY(const int& p){ auto value_digits = DecodedPID(p); return isSUSY(value_digits);}
397 
398 
399 // APID: Super-partners of standard model quarks only
400 template<class T> inline bool isSquark(const T& p) { return isSquark(p->pdg_id()); }
401 template<> inline bool isSquark(const DecodedPID& p){
402  auto pp = p.shift(1); return isSUSY(p) && isSMQuark(pp);
403 }
404 template<> inline bool isSquark(const int& p){ auto value_digits = DecodedPID(p); return isSquark(value_digits);}
405 
406 
407 // APID: Super-partners of left-handed standard model quarks only
408 template<class T> inline bool isSquarkLH(const T& p) { return isSquarkLH(p->pdg_id()); }
409 template<> inline bool isSquarkLH(const DecodedPID& p){
410  return isSquark(p) && (p(0) == 1);
411 }
412 template<> inline bool isSquarkLH(const int& p){ auto value_digits = DecodedPID(p); return isSquarkLH(value_digits);}
413 
414 
415 // APID: Super-partners of right-handed standard model quarks only
416 template<class T> inline bool isSquarkRH(const T& p) { return isSquarkRH(p->pdg_id()); }
417 template<> inline bool isSquarkRH(const DecodedPID& p){
418  return isSquark(p) && (p(0) == 2);
419 }
420 template<> inline bool isSquarkRH(const int& p){ auto value_digits = DecodedPID(p); return isSquarkRH(value_digits);}
421 
422 
423 template<class T> inline bool hasSquark(const T& p, const int& q) { return hasSquark(p->pdg_id(), q); }
424 template<> inline bool hasSquark(const DecodedPID& p, const int& q){
425  auto pp = p.shift(1); return isSUSY(p) && pp.ndigits() != 2 && pp(0) == q; // skip lepton and boson super-partners by vetoing ndigits==2
426 }
427 template<> inline bool hasSquark(const int& p, const int& q){ auto value_digits = DecodedPID(p); return hasSquark(value_digits, q);}
428 
429 
430 // APID: Super-partners of standard model leptons only
431 template<class T> inline bool isSlepton(const T& p) { return isSlepton(p->pdg_id()); }
432 template<> inline bool isSlepton(const DecodedPID& p){ auto pp = p.shift(1); return isSUSY(p) && isSMLepton(pp);}
433 template<> inline bool isSlepton(const int& p){ auto value_digits = DecodedPID(p); return isSlepton(value_digits);}
434 
435 
436 // APID: Super-partners of left-handed standard model leptons only
437 template<class T> inline bool isSleptonLH(const T& p) { return isSleptonLH(p->pdg_id()); }
438 template<> inline bool isSleptonLH(const DecodedPID& p){ return isSlepton(p) && (p(0) == 1); }
439 template<> inline bool isSleptonLH(const int& p){ auto value_digits = DecodedPID(p); return isSleptonLH(value_digits);}
440 
441 
442 // APID: Super-partners of right-handed standard model leptons only
443 template<class T> inline bool isSleptonRH(const T& p) { return isSleptonRH(p->pdg_id()); }
444 template<> inline bool isSleptonRH(const DecodedPID& p){ return isSlepton(p) && (p(0) == 2); }
445 template<> inline bool isSleptonRH(const int& p){ auto value_digits = DecodedPID(p); return isSleptonRH(value_digits);}
446 
447 
448 // APID: Super-partners of gauge bosons including gravitons
449 template<class T> inline bool isGaugino(const T& p) { return isGaugino(p->pdg_id()); }
450 template<> inline bool isGaugino(const DecodedPID& p){
451  auto pp = p.shift(1); return isSUSY(p) && isBoson(pp.pid());
452 }
453 template<> inline bool isGaugino(const int& p){ auto value_digits = DecodedPID(p); return isGaugino(value_digits);}
454 
460 template<class T> inline bool isTechnicolor(const T& p){return isTechnicolor(p->pdg_id());}
461 template <>
462 inline bool isTechnicolor(const DecodedPID& p) {
463  const auto& pp = (p.ndigits() == 7) ? p.shift(2) : DecodedPID(0);
464  return (p.ndigits() == 7 && p(0) == 3 && (p(1) == 0 || p(0) == 1) &&
465  (isQuark(pp) || isLepton(pp) || isBoson(pp) || isGlueball(pp) ||
466  isDiquark(pp) || isHadron(pp)));
467 }
468 template<> inline bool isTechnicolor(const int& p){ auto value_digits = DecodedPID(p); return isTechnicolor(value_digits);}
469 
472 template<class T> inline bool isExcited(const T& p){return isExcited(p->pdg_id());}
473 template <>
474 inline bool isExcited(const DecodedPID& p) {
475  const auto& pp = (p.ndigits() == 7) ? p.shift(2) : DecodedPID(0);
476  return (p.ndigits() == 7 && (p(0) == 4 && p(1) == 0) &&
477  (isLepton(pp) || isQuark(pp)));
478 }
479 template<> inline bool isExcited(const int& p){ auto value_digits = DecodedPID(p); return isExcited(value_digits);}
480 
493 
498 template<class T> inline bool isRGlueball(const T& p) { return isRGlueball(p->pdg_id()); }
499 template<> inline bool isRGlueball(const DecodedPID& p) {
500  if (p.ndigits() != 7 || p(0) != 1) return false;
501  auto pp = p.shift(1);
502  return
503  ( ( pp.ndigits() == 3 && pp(0) == COMPOSITEGLUON && pp(1) == COMPOSITEGLUON && (pp(2) == 1 || pp(2) == 3) ) ||
504  ( pp.ndigits() == 4 && pp(0) == COMPOSITEGLUON && pp(1) == COMPOSITEGLUON && pp(2) == COMPOSITEGLUON && (pp(3) == 1 || pp(3) == 5) ) );
505 }
506 template<> inline bool isRGlueball(const int& p) { auto value_digits = DecodedPID(p); return isRGlueball(value_digits); }
507 
508 // APID Define R-Mesons as gluino-quark-antiquark and squark-antiquark bound states (ignore 4th generation squarks/quarks)
509 // NB Current models only allow gluino-quark-antiquark, stop-antiquark and sbottom-antiquark states
510 template<class T> inline bool isRMeson(const T& p) { return isRMeson(p->pdg_id()); }
511 template<> inline bool isRMeson(const DecodedPID& p) {
512  if (!(p.ndigits() == 7 && (p(0) == 1 || p(0) == 2))) return false;
513  auto pp = p.shift(1);
514  return (
515  // Handle ~gluino-quark-antiquark states
516  (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)) ||
517  // Handle squark-antiquark states (previously called Smeson/mesoninos)
518  (pp.ndigits() == 3 && pp.max_digit(1,3) < COMPOSITEGLUON && pp(1) <= pp(0) && isSMQuark(pp(0)) && isSMQuark(pp(1)) && pp.last() == 2)
519  );
520 }
521 template<> inline bool isRMeson(const int& p) { auto value_digits = DecodedPID(p); return isRMeson(value_digits); }
522 
523 // APID Define R-Baryons as gluino-quark-quark-quark and squark-quark-quark bound states (ignore 4th generation squarks/quarks)
524 // NB Current models only allow gluino-quark-quark-quark, stop-quark-quark and sbottom-quark-quark states
525 template<class T> inline bool isRBaryon(const T& p) { return isRBaryon(p->pdg_id()); }
526 template<> inline bool isRBaryon(const DecodedPID& p) {
527  if (!(p.ndigits() == 7 && (p(0) == 1 || p(0) == 2))) return false;
528  auto pp = p.shift(1);
529  return (
530  // Handle ~gluino-quark-quark-quark states
531  (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)) ||
532  // Handle squark-quark-quark states (previously called Sbaryons)
533  (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))
534  );
535 }
536 template<> inline bool isRBaryon(const int& p) { auto value_digits = DecodedPID(p); return isRBaryon(value_digits); }
537 
545 template<class T> inline bool isKK(const T& p){return isKK(p->pdg_id());}
546 template<> inline bool isKK(const DecodedPID& p){return (p.ndigits() == 7 && (p(0) == 5 || p(0) == 6 ) );}
547 template<> inline bool isKK(const int& p){ auto value_digits = DecodedPID(p); return isKK(value_digits);}
548 
555 template<class T> inline bool isMonopole(const T& p){return isMonopole(p->pdg_id());}
556 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);}
557 template<> inline bool isMonopole(const int& p){ auto value_digits = DecodedPID(p); return isMonopole(value_digits);}
558 
569 template<class T> inline bool isDM(const T& p){return isDM(p->pdg_id());}
570 template<> inline bool isDM(const int& p){ auto sp = std::abs(p); return (sp >= 51 && sp <= 60) || sp == DARKPHOTON; }
571 
576 template<class T> inline bool isHiddenValley(const T& p){return isHiddenValley(p->pdg_id());}
577 template <>
578 inline bool isHiddenValley(const DecodedPID& p) {
579  const auto& pp = (p.ndigits() == 7) ? p.shift(2) : DecodedPID(0);
580  return (p.ndigits() == 7 && p(0) == 4 && p(1) == 9 &&
581  (isQuark(pp) || isLepton(pp) || isBoson(pp) || isGlueball(pp) ||
582  isDiquark(pp) || isHadron(pp)));
583 }
584 template<> inline bool isHiddenValley(const int& p){ auto value_digits = DecodedPID(p); return isHiddenValley(value_digits);}
585 
592 template<class T> inline bool isGenericMultichargedParticle(const T& p){return isGenericMultichargedParticle(p->pdg_id());}
593 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);}
594 template<> inline bool isGenericMultichargedParticle(const int& p){ auto value_digits = DecodedPID(p); return isGenericMultichargedParticle(value_digits);}
595 
610 template<class T> inline bool isNucleus(const T& p){return isNucleus(p->pdg_id());}
611 template<> inline bool isNucleus(const DecodedPID& p){
612  if (std::abs(p.pid()) == PROTON) return true;
613  return (p.ndigits() == 10 && p(0) == 1 && p(1) == 0 );
614 }
615 template<> inline bool isNucleus(const int& p){ auto value_digits = DecodedPID(p); return isNucleus(value_digits);}
616 
617 
618 template<class T> inline bool hasQuark(const T& p, const int& q);
619 template<> inline bool hasQuark(const DecodedPID& p, const int& q){
620  if (isQuark(p.pid())) { return (std::abs(p.pid()) == q );}
621  if (isMeson(p)) { return *(p.second.rbegin() + 1) == q ||*(p.second.rbegin()+2) ==q;}
622  if (isDiquark(p)) { auto i = std::find(p.second.rbegin() + 2,p.second.rbegin()+4,q); return (i!=p.second.rbegin()+4);}
623  if (isBaryon(p)) { auto i = std::find(p.second.rbegin() + 1,p.second.rbegin()+4,q); return (i!=p.second.rbegin()+4);}
624  if (isTetraquark(p)) { auto i = std::find(p.second.rbegin() + 1,p.second.rbegin()+5,q); return (i!=p.second.rbegin()+5);}
625  if (isPentaquark(p)) { auto i = std::find(p.second.rbegin() + 1,p.second.rbegin()+6,q); return (i!=p.second.rbegin()+6);}
626  if (isNucleus(p) && std::abs(p.pid()) != PROTON) { return (q == 1 || q == 2 || (q==3 && p(2) > 0));}
627  if (isSUSY(p)) { // APID SUSY case
628  auto pp = p.shift(1);
629  if ( pp.ndigits() == 1 ) { return false; } // Handle squarks
630  if ( pp.ndigits() == 3 ) { return (pp(1) == q); } // Handle ~q qbar pairs
631  if ( pp.ndigits() == 4 ) { return (pp(1) == q || pp(2) == q); } // Ignore gluinos and squarks
632  if ( pp.ndigits() == 5 ) { return (pp(1) == q || pp(2) == q || pp(3) == q); } // Ignore gluinos and squarks
633  if ( pp.ndigits() > 5 ) { pp = pp.shift(1); } // Drop gluinos and squarks
634  return hasQuark(pp, q); }
635  return false;
636 }
637 template<> inline bool hasQuark(const int& p, const int& q){ auto value_digits = DecodedPID(p); return hasQuark(value_digits, q);}
638 
639 template<class T> inline bool hasStrange(const T& p) { return hasQuark(p,SQUARK); }
640 template<class T> inline bool hasCharm(const T& p) { return hasQuark(p,CQUARK); }
641 template<class T> inline bool hasBottom(const T& p) { return hasQuark(p,BQUARK); }
642 template<class T> inline bool hasTop(const T& p) { return hasQuark(p,TQUARK); }
643 
644 
645 // APID: The baryon number is defined as:
646 // B = (1/3)*( n_q - n_{qbar} )
647 // where n_q⁠ is the number of quarks, and ⁠n_{qbar} is the number of
648 // antiquarks. By convention, squarks have the same quantum numbers as
649 // the corresponding quarks (modulo spin and R), so have baryon number
650 // 1/3.
651 template<class T> inline int baryonNumber3(const T& p) {return baryonNumber3(p->pdg_id());}
652 template<> inline int baryonNumber3(const DecodedPID& p){
653  if (isQuark(p.pid())) { return (p.pid() > 0) ? 1 : - 1;}
654  if (isDiquark(p)) { return (p.pid() > 0) ? 2 : -2; }
655  if (isMeson(p) || isTetraquark(p)) { return 0; }
656  if (isBaryon(p) || isPentaquark(p)){ return (p.pid() > 0) ? 3 : -3; }
657  if (isNucleus(p)) {
658  const int result = 3*p(8) + 30*p(7) + 300*p(6);
659  return (p.pid() > 0) ? result : -result;
660  }
661  if (isSUSY(p)) {
662  auto pp = p.shift(1);
663  if (pp.ndigits() < 3 ) { return baryonNumber3(pp); } // super-partners of fundamental particles
664  if (pp(0) == COMPOSITEGLUON) {
665  if (pp(1) == COMPOSITEGLUON) { return 0; } // R-Glueballs
666  if ( pp.ndigits() == 4 ) { return 0; } // states with gluino-quark-antiquark
667  if ( pp.ndigits() == 5) { return (p.pid() > 0) ? 3 : -3; } // states with gluino-quark-quark-quark
668  }
669  if (pp.ndigits() == 3) { return 0; } // squark-antiquark
670  if (pp.ndigits() == 4) { return (p.pid() > 0) ? 3 : -3; } // states with squark-quark-quark
671  }
672  return 0;
673 }
674 template<> inline int baryonNumber3(const int& p){ auto value_digits = DecodedPID(p); return baryonNumber3(value_digits);}
675 
676 template<class T> inline double baryonNumber(const T& p) {return baryonNumber(p->pdg_id());}
677 template<> inline double baryonNumber(const DecodedPID& p){ return static_cast<double>(baryonNumber3(p))/3.0;}
678 template<> inline double baryonNumber(const int& p){ auto value_digits = DecodedPID(p); return static_cast<double>(baryonNumber3(value_digits))/3.0;}
679 
680 
681 // APID: The strangeness of a particle is defined as:
682 // S = − ( n_s − n_{sbar} )
683 // where n_s represents the number of strange quarks and n_{sbar}
684 // represents the number of strange antiquarks. By convention, strange
685 // squarks have the same quantum numbers as strange quarks (modulo
686 // spin and R), so have strangeness -1.
687 static const std::array<int,10> is_strange = {
688  +0, +0, +0, -1, +0, +0, +0, +0, +0, +0 };
689 template<class T> inline int strangeness(const T& p) {return strangeness(p->pdg_id());}
690 template<> inline int strangeness(const DecodedPID& p){
691  if (isNucleus(p) && p.ndigits() == 10) { return (p.pid() > 0) ? -p(2) : p(2); }
692  if (isStrange(p.pid())) { return (p.pid() > 0) ? -1 : 1; }
693  if (!hasStrange(p) && !hasSquark(p,SQUARK)) { return 0; }
694  if (std::abs(p.pid()) == K0) { return (p.pid() > 0) ? 1 : -1; }
695  size_t nq = 0;
696  int sign = 1;
697  int signmult = 1;
698  int result=0;
699  bool classified = false;
700  if (!classified && isMeson(p)) { classified = true; nq = 2; if ((*(p.second.rbegin()+2)) == 2||(*(p.second.rbegin()+2)) == 4 ) { sign=-1;} signmult =-1; }
701  if (!classified && isDiquark(p)) {return is_strange.at(p(0))+is_strange.at(p(1)); }
702  if (!classified && isBaryon(p)) { classified = true; nq = 3; }
703  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)); }
704  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)); }
705  if (!classified && isSUSY(p)) {
706  nq = 0;
707  auto pp = p.shift(1);
708  if (pp.ndigits() < 3 ) { return strangeness(pp); } // super-partners of fundamental particles
709  if (pp(0) == COMPOSITEGLUON) {
710  if (pp(1) == COMPOSITEGLUON) { return 0; } // R-Glueballs
711  if ( pp.ndigits() == 4 || pp.ndigits() == 5) {
712  pp = pp.shift(1); // Remove gluino
713  }
714  }
715  if (pp.ndigits() == 3) { classified = true; nq = 2; if (p.last()%2==0) {sign = -1;} signmult = -1; } // states with quark-antiquark or squark-antiquark
716  if (pp.ndigits() == 4) { classified = true; nq = 3; } // states with quark-quark-quark or squark-quark-quark
717  }
718  for (auto r = p.second.rbegin() + 1; r != p.second.rbegin() + 1 + nq; ++r) {
719  result += is_strange.at(*r)*sign;
720  sign*=signmult;
721  }
722  return p.pid() > 0 ? result : -result;
723 }
724 template<> inline int strangeness(const int& p){ auto value_digits = DecodedPID(p); return strangeness(value_digits);}
725 
726 
727 template<class T> inline int numberOfLambdas(const T& p) {return numberOfLambdas(p->pdg_id());}
728 template<> inline int numberOfLambdas(const DecodedPID& p){
729  if (std::abs(p.pid()) == LAMBDA0) { return (p.pid() > 0) ? 1 : -1; }
730  if (isNucleus(p) && p.ndigits() == 10) { return (p.pid() > 0) ? p(2) : -p(2); }
731  return 0;
732 }
733 template<> inline int numberOfLambdas(const int& p){ auto value_digits = DecodedPID(p); return numberOfLambdas(value_digits);}
734 
735 
736 template<class T> inline int numberOfProtons(const T& p) {return numberOfProtons(p->pdg_id());}
737 template<> inline int numberOfProtons(const DecodedPID& p){
738  if (std::abs(p.pid()) == PROTON) { return (p.pid() > 0) ? 1 : -1; }
739  if (isNucleus(p)) {
740  const int result = p(5) + 10*p(4) + 100*p(3);
741  return (p.pid() > 0) ? result : -result;
742  }
743  return 0;
744 }
745 template<> inline int numberOfProtons(const int& p){ auto value_digits = DecodedPID(p); return numberOfProtons(value_digits);}
746 
747 
749 template<class T> inline bool isBSM(const T& p){return isBSM(p->pdg_id());}
750 template<> inline bool isBSM(const DecodedPID& p){
751  if (p.pid() == GRAVITON || std::abs(p.pid()) == MAVTOP || p.pid() == DARKPHOTON) return true;
752  if (std::abs(p.pid()) > 16 && std::abs(p.pid()) < 19) return true;
753  if (std::abs(p.pid()) > 31 && std::abs(p.pid()) < 38) return true;
754  if (std::abs(p.pid()) > 39 && std::abs(p.pid()) < 81) return true;
755  if (std::abs(p.pid()) > 6 && std::abs(p.pid()) < 9) return true;
756  if (isSUSY(p)) return true;
757  if (isGenericMultichargedParticle(p)) return true;
758  if (isTechnicolor(p)) return true;
759  if (isExcited(p)) return true;
760  if (isKK(p)) return true;
761  if (isHiddenValley(p)) return true;
762  return false;
763 }
764 template<> inline bool isBSM(const int& p){
765  if (p == GRAVITON || std::abs(p) == MAVTOP || p == DARKPHOTON) return true;
766  if (std::abs(p) > 16 && std::abs(p) < 19) return true;
767  if (std::abs(p) > 31 && std::abs(p) < 38) return true;
768  if (std::abs(p) > 39 && std::abs(p) < 81) return true;
769  if (std::abs(p) > 6 && std::abs(p) < 9) return true;
770  auto value_digits = DecodedPID(p); return isBSM(value_digits);
771 }
772 
773 template<class T> inline bool isTransportable(const T& p){return isTransportable(p->pdg_id());}
774 template<> inline bool isTransportable(const DecodedPID& p){ return isPhoton(p.pid()) || isGeantino(p.pid()) || isHadron(p) || isLepton(p.pid()) || p.pid() == DARKPHOTON;}
775 template<> inline bool isTransportable(const int& p){ auto value_digits = DecodedPID(p); return isTransportable(value_digits);}
776 
778 template<class T> inline bool isValid(const T& p){return isValid(p->pdg_id());}
779 template<> inline bool isValid(const DecodedPID& p){
780  return p.pid() !=0 && ( isQuark(p) || isLepton(p) || isBoson(p) || isGlueball(p) ||
781  isTrajectory(p.pid()) || isGenSpecific(p.pid()) || isDiquark(p) ||
782  isBSM(p) || isHadron(p) || isNucleus(p) || isGeantino(p.pid()) ||
783  isPythia8Specific(p) ); }
784 template<> inline bool isValid(const int& p){ if (!p) return false; if (std::abs(p) < 42) return true;
785  if (isGenSpecific(p)) return true;
786  auto value_digits = DecodedPID(p); return isValid(value_digits);
787 }
788 
789 template<class T> inline int leadingQuark(const T& p) {return leadingQuark(p->pdg_id());}
790 template<> inline int leadingQuark(const DecodedPID& p){
791  if (isQuark(p.pid())) { return std::abs(p.pid());}
792  if (isMeson(p)) { return p.max_digit(1,3);}
793  if (isDiquark(p)) { return p.max_digit(2,4);}
794  if (isBaryon(p)) { return p.max_digit(1,4);}
795  if (isTetraquark(p)) { return p.max_digit(1,5);}
796  if (isPentaquark(p)) { return p.max_digit(1,6);}
797  if (isSUSY(p)) { // APID SUSY case
798  auto pp = p.shift(1);
799  if ( pp.ndigits() == 1 ) { return 0; } // Handle squarks
800  if ( pp.ndigits() == 3 ) { pp = DecodedPID(pp(1)); } // Handle ~q qbar pairs
801  if ( pp.ndigits() > 3 ) { pp = pp.shift(1); } // Drop gluinos and squarks
802  return leadingQuark(pp); }
803  return 0;
804 }
805 
806 template<> inline int leadingQuark(const int& p){ auto value_digits = DecodedPID(p); return leadingQuark(value_digits);}
807 
808 template<class T> inline bool isLightHadron(const T& p) { auto lq = leadingQuark(p); return (lq == DQUARK || lq == UQUARK||lq == SQUARK) && isHadron(p); }
809 template<class T> inline bool isHeavyHadron(const T& p) { auto lq = leadingQuark(p); return (lq == CQUARK || lq == BQUARK || lq == TQUARK ) && isHadron(p); }
810 template<class T> inline bool isStrangeHadron(const T& p) { return leadingQuark(p) == SQUARK && isHadron(p); }
811 template<class T> inline bool isCharmHadron(const T& p) { return leadingQuark(p) == CQUARK && isHadron(p); }
812 template<class T> inline bool isBottomHadron(const T& p) { return leadingQuark(p) == BQUARK && isHadron(p); }
813 template<class T> inline bool isTopHadron(const T& p) { return leadingQuark(p) == TQUARK && isHadron(p); }
814 
815 template<class T> inline bool isLightMeson(const T& p) { auto lq = leadingQuark(p); return (lq == DQUARK || lq == UQUARK||lq == SQUARK) && isMeson(p); }
816 template<class T> inline bool isHeavyMeson(const T& p) { auto lq = leadingQuark(p); return (lq == CQUARK || lq == BQUARK || lq == TQUARK) && isMeson(p); }
817 template<class T> inline bool isStrangeMeson(const T& p) { return leadingQuark(p) == SQUARK && isMeson(p); }
818 template<class T> inline bool isCharmMeson(const T& p) { return leadingQuark(p) == CQUARK && isMeson(p); }
819 template<class T> inline bool isBottomMeson(const T& p) { return leadingQuark(p) == BQUARK && isMeson(p); }
820 template<class T> inline bool isTopMeson(const T& p) { return leadingQuark(p) == TQUARK && isMeson(p); }
821 
822 template<class T> inline bool isCCbarMeson(const T& p) { return isCCbarMeson(p->pdg_id());}
823 template<> inline bool isCCbarMeson(const DecodedPID& p) { return leadingQuark(p) == CQUARK && isMeson(p) && (*(p.second.rbegin()+2)) == CQUARK && (*(p.second.rbegin()+1)) == CQUARK; }
824 template<> inline bool isCCbarMeson(const int& p) { return isCCbarMeson(DecodedPID(p)); }
825 
826 template<class T> inline bool isBBbarMeson(const T& p){ return isBBbarMeson(p->pdg_id());}
827 template<> inline bool isBBbarMeson(const DecodedPID& p) { return leadingQuark(p) == BQUARK && isMeson(p) && (*(p.second.rbegin()+2)) == BQUARK && (*(p.second.rbegin()+1)) == BQUARK; }
828 template<> inline bool isBBbarMeson(const int& p) { return isBBbarMeson(DecodedPID(p)); }
829 
830 
831 template<class T> inline bool isLightBaryon(const T& p) { auto lq = leadingQuark(p); return (lq == DQUARK || lq == UQUARK||lq == SQUARK) && isBaryon(p); }
832 template<class T> inline bool isHeavyBaryon(const T& p) { auto lq = leadingQuark(p); return (lq == CQUARK || lq == BQUARK || lq == TQUARK) && isBaryon(p); }
833 template<class T> inline bool isStrangeBaryon(const T& p) { return leadingQuark(p) == SQUARK && isBaryon(p); }
834 template<class T> inline bool isCharmBaryon(const T& p) { return leadingQuark(p) == CQUARK && isBaryon(p); }
835 template<class T> inline bool isBottomBaryon(const T& p) { return leadingQuark(p) == BQUARK && isBaryon(p); }
836 template<class T> inline bool isTopBaryon(const T& p) { return leadingQuark(p) == TQUARK && isBaryon(p); }
837 
838 
839 // APID: This function selects B-Hadrons which predominantly decay weakly. (Commonly used definition in GeneratorFilters package.)
840 // 5[1-4]1 L = J = 0, S = 0
841 // 5[1-5][1-4]2 J = 1/2, n_r = 0, n_L =0
842 template<class T> inline bool isWeaklyDecayingBHadron(const T& p) {return isWeaklyDecayingBHadron(p->pdg_id());}
843 template<> inline bool isWeaklyDecayingBHadron(const int& p) {
844  const int pid = std::abs(p);
845  return ( pid == 511 || // B0
846  pid == 521 || // B+
847  pid == 531 || // B_s0
848  pid == 541 || // B_c+
849  pid == 5122 || // Lambda_b0
850  pid == 5132 || // Xi_b-
851  pid == 5232 || // Xi_b0
852  pid == 5112 || // Sigma_b-
853  pid == 5212 || // Sigma_b0
854  pid == 5222 || // Sigma_b+
855  pid == 5332 || // Omega_b-
856  pid == 5142 || // Xi_bc0
857  pid == 5242 || // Xi_bc+
858  pid == 5412 || // Xi'_bc0
859  pid == 5422 || // Xi'_bc+
860  pid == 5342 || // Omega_bc0
861  pid == 5432 || // Omega'_bc0
862  pid == 5442 || // Omega_bcc+
863  pid == 5512 || // Xi_bb-
864  pid == 5522 || // Xi_bb0
865  pid == 5532 || // Omega_bb-
866  pid == 5542 ); // Omega_bbc0
867 }
868 template<> inline bool isWeaklyDecayingBHadron(const DecodedPID& p){ return isWeaklyDecayingBHadron(p.pid()); }
869 
870 
871 // APID: This function selects C-Hadrons which predominantly decay weakly. (Commonly used definition in GeneratorFilters package.)
872 // 4[1-3]1 L = J = 0, S = 0
873 // 4[1-4][1-3]2 J = 1/2, n_r = 0, n_L =0
874 // NB Omitting pid = 4322 (Xi'_C+) a this undergoes an EM rather than
875 // weak decay. (There was an old version of Herwig that decayed it
876 // weakly, but this was fixed in Herwig 7.)
877 template<class T> inline bool isWeaklyDecayingCHadron(const T& p) {return isWeaklyDecayingCHadron(p->pdg_id());}
878 template<> inline bool isWeaklyDecayingCHadron(const int& p) {
879  const int pid = std::abs(p);
880  return ( pid == 411 || // D+
881  pid == 421 || // D0
882  pid == 431 || // Ds+
883  pid == 4122 || // Lambda_c+
884  pid == 4132 || // Xi_c0
885  pid == 4232 || // Xi_c+
886  pid == 4212 || // Xi_c0
887  pid == 4332 || // Omega_c0
888  pid == 4412 || // Xi_cc+
889  pid == 4422 || // Xi_cc++
890  pid == 4432 ); // Omega_cc+
891 }
892 template<> inline bool isWeaklyDecayingCHadron(const DecodedPID& p){ return isWeaklyDecayingCHadron(p.pid()); }
893 
894 
895 template<class T> inline int charge3( const T& p){return charge3(p->pdg_id());}
896 template<class T> inline double fractionalCharge(const T& p){return fractionalCharge(p->pdg_id());}
897 template<class T> inline double charge( const T& p){
898  if (isGenericMultichargedParticle(p)) // BSM multi-charged particles might have a fractional charge that's not a multiple of 1/3
899  return fractionalCharge(p);
900  else
901  return 1.0*charge3(p)/3.0;
902 }
903 template<class T> inline double threeCharge( const T& p){ return charge3(p);}
904 template<class T> inline bool isCharged( const T& p){ return charge3(p) != 0;}
905 
906 
907 template<> inline int charge3(const DecodedPID& p) {
908  auto ap = std::abs(p.pid());
909  if (ap < TABLESIZE ) return p.pid() > 0 ? triple_charge.at(ap) : -triple_charge.at(ap);
910  if (ap == K0) return 0;
911  if (ap == GEANTINO0) return 0;
912  if (ap == GEANTINOPLUS) return p.pid() > 0 ? 3 : -3;
913  if (ap == MAVTOP) return p.pid() > 0 ? 2 : -2;
914  size_t nq = 0;
915  int sign = 1;
916  int signmult = 1;
917  int result=0;
918  bool classified = false;
919  if (!classified && isMeson(p)) { classified = true; nq = 2; if ((*(p.second.rbegin()+2)) == 2||(*(p.second.rbegin()+2)) == 4 ) { sign=-1;} signmult =-1; }
920  if (!classified && isDiquark(p)) {return triple_charge.at(p(0))+triple_charge.at(p(1)); }
921  if (!classified && isBaryon(p)) { classified = true; nq = 3; }
922  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)); }
923  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)); }
924  if (!classified && isNucleus(p)) { return 3*numberOfProtons(p);}
925  if (!classified && isSUSY(p)) {
926  nq = 0;
927  auto pp = p.shift(1);
928  if (pp.ndigits() < 3 ) { return charge3(pp); } // super-partners of fundamental particles
929  if (pp(0) == COMPOSITEGLUON) {
930  if (pp(1) == COMPOSITEGLUON) { return 0; } // R-Glueballs
931  if ( pp.ndigits() == 4 || pp.ndigits() == 5) {
932  pp = pp.shift(1); // Remove gluino
933  }
934  }
935  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
936  if (pp.ndigits() == 4) { classified = true; nq = 3; } // states with squark-quark-quark or quark-quark-quark
937  }
938  if (!classified && isMonopole(p)) {
941  result = 3*(p(3)*100 + p(4)*10 + p(5));
942  return ( (p.pid() > 0 && p(2) == 1) || (p.pid() < 0 && p(2) == 2) ) ? result : -result;
943  }
944  if (!classified && isGenericMultichargedParticle(p)) {
945  double abs_charge = 0.0;
946  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
947  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
948  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
949  return p.pid() > 0 ? abs_threecharge : -1 * abs_threecharge;
950  }
951  for (auto r = p.second.rbegin() + 1; r != p.second.rbegin() + 1 + nq; ++r) {
952  result += triple_charge.at(*r)*sign;
953  sign*=signmult;
954  }
955  return p.pid() > 0 ? result : -result;
956 }
957 template<> inline int charge3(const int& p){
958  int ap = std::abs(p);
959  if (ap < TABLESIZE) return p > 0 ? triple_charge.at(ap):-triple_charge.at(ap);
960  auto value_digits = DecodedPID(p);
961  return charge3(value_digits);
962 }
963 
964 
965 template<class T> inline bool isNeutral( const T& p){ return p->pdg_id() != 0 && charge3(p) == 0;}
966 template<> inline bool isNeutral(const DecodedPID& p){ return p.pid() != 0 && charge3(p) == 0;}
967 template<> inline bool isNeutral(const int& p){ auto value_digits = DecodedPID(p); return isNeutral(value_digits);}
968 
969 
970 template<> inline double fractionalCharge(const DecodedPID& p) {
971  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
972  double abs_charge = 0;
973  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
974  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
975  return p.pid() > 0 ? abs_charge : -1 * abs_charge;
976 }
977 template<> inline double fractionalCharge(const int& p){auto value_digits = DecodedPID(p); return fractionalCharge(value_digits);}
978 
979 template<class T> inline bool isEMInteracting(const T& p){return isEMInteracting(p->pdg_id());}
980 template<> inline bool isEMInteracting(const int& p) {return (isPhoton(p) || isZ(p) || std::abs(charge(p))>std::numeric_limits<double>::epsilon() || isMonopole(p));}
981 
982 template<class T> inline bool isParton(const T& p) { return isQuark(p)||isGluon(p);}
983 
984 // APID: Intended to return 2J
985 // Useful for G4ParticleDefinition constructor
986 template<class T> inline int spin2(const T& p) { return spin2(p->pdg_id()); }
987 template<> inline int spin2(const DecodedPID& p) {
988  if (isSUSY(p)) {
989  auto pp = p.shift(1);
990  auto ap = std::abs(pp.pid());
991  if (ap < TABLESIZE ) { return std::abs(double_spin.at(ap)-1); } // sparticles (0->1, 1 -> 0, 2->1, 4->3)
992  return p.last()-1; // R-Hadrons (p.last() == 2J +1)
993  }
994  auto ap = std::abs(p.pid());
995  if (ap == K0S) { return 0; }
996  if (ap == K0L) { return 0; }
997  if (ap == MAVTOP) { return 1; } // TODO check this
998  if (ap == DARKPHOTON) { return 2; } // TODO check this
999  if (ap < TABLESIZE ) { return double_spin.at(ap); } // fundamental particles
1000  if (isHadron(p)) { return p.last()-1; } // Hadrons (p.last == 2J+1 - special cases handled above)
1001  if (isMonopole(p)) { return 0; } // PDG 11i - For now no spin information is provided. Also matches the definition in the G4Extensions/Monopole package.
1002  if (isGenericMultichargedParticle(p)) { return 0; } // APID Matches the definition in the G4Extensions/Monopole package.
1003  if (isNucleus(p)) { return 1; } // TODO need to explicitly deal with nuclei
1004  return p.last() > 0 ? 1 : 0; // Anything else - best guess
1005 }
1006 template<> inline int spin2(const int& p){ auto value_digits = DecodedPID(p); return spin2(value_digits);}
1007 
1008 template<class T> inline double spin(const T& p) { return spin(p->pdg_id()); }
1009 template<> inline double spin(const DecodedPID& p) { return 1.0*spin2(p)/2.0; }
1010 template<> inline double spin(const int& p){ auto value_digits = DecodedPID(p); return spin(value_digits);}
1011 
1012 template<class T> inline bool isRHadron(const T& p) { return isRHadron(p->pdg_id()); }
1013 template<> inline bool isRHadron(const DecodedPID& p) {
1014  return (isRBaryon(p) || isRMeson(p) || isRGlueball(p));
1015 }
1016 template<> inline bool isRHadron(const int& p) { auto value_digits = DecodedPID(p); return isRHadron(value_digits); }
1017 
1018 // APID: Returns an unordered list of the quarks contained by the current particle
1019 template<class T> inline std::vector<int> containedQuarks(const T& p) { return containedQuarks(p->pdg_id()); }
1020 template<> inline std::vector<int> containedQuarks(const int& p) {
1021  auto pp = DecodedPID(p);
1022  std::vector<int> quarks;
1023  if (isQuark(pp.pid())) { quarks.push_back(std::abs(pp.pid())); }
1024  else if (isDiquark(pp)) { quarks.push_back(pp(0)); quarks.push_back(pp(1)); }
1025  else if (isMeson(pp)) { quarks.push_back(*(pp.second.rbegin() + 1)); quarks.push_back(*(pp.second.rbegin()+2)); }
1026  else if (isBaryon(pp)) { for (size_t digit = 1; digit < 4; ++digit) { quarks.push_back(*(pp.second.rbegin() + digit)); } }
1027  else if (isTetraquark(pp)) { for (size_t digit = 1; digit < 5; ++digit) { quarks.push_back(*(pp.second.rbegin() + digit)); } }
1028  else if (isPentaquark(pp)) { for (size_t digit = 1; digit < 6; ++digit) { quarks.push_back(*(pp.second.rbegin() + digit)); } }
1029  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));
1030  const int n_uquarks = A + Z; const int n_dquarks = 2*A - Z - L; const int n_squarks = L;
1031  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); }
1032  else if (isSUSY(pp)) { // APID SUSY case
1033  pp = pp.shift(1);
1034  if ( pp.ndigits() > 1 ) { // skip squarks
1035  if ( pp.ndigits() == 3 ) { pp = DecodedPID(pp(1)); } // Handle ~q qbar pairs
1036  if ( pp.ndigits() > 3 ) { pp = pp.shift(1); } // Drop gluinos and squarks
1037  return containedQuarks(pp.pid());
1038  }
1039  }
1040  return quarks;
1041 }
1042 template<> inline std::vector<int> containedQuarks(const DecodedPID& p) { return containedQuarks(p.pid()); }
1043 
1044 template<class T> inline bool isStrongInteracting(const T& p){return isStrongInteracting(p->pdg_id());}
1045 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
1046 
1047 #endif
isStrange
bool isStrange(const T &p)
Definition: AtlasPID.h:148
isStrangeMeson
bool isStrangeMeson(const T &p)
Definition: AtlasPID.h:817
beamspotman.r
def r
Definition: beamspotman.py:676
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
isGaugino
bool isGaugino(const T &p)
Definition: AtlasPID.h:449
isBottomMeson
bool isBottomMeson(const T &p)
Definition: AtlasPID.h:819
isStrongInteracting
bool isStrongInteracting(const T &p)
Definition: AtlasPID.h:1044
isNucleus
bool isNucleus(const T &p)
PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.
Definition: AtlasPID.h:610
get_generator_info.result
result
Definition: get_generator_info.py:21
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
isHeavyHadron
bool isHeavyHadron(const T &p)
Definition: AtlasPID.h:809
isTetraquark
bool isTetraquark(const T &p)
PDG rule 14 The 9-digit tetra-quark codes are±1nrnLnq1nq20nq3nq4nJ.
Definition: AtlasPID.h:282
isRMeson
bool isRMeson(const T &p)
Definition: AtlasPID.h:510
isBottomBaryon
bool isBottomBaryon(const T &p)
Definition: AtlasPID.h:835
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:443
isTopBaryon
bool isTopBaryon(const T &p)
Definition: AtlasPID.h:836
hasCharm
bool hasCharm(const T &p)
Definition: AtlasPID.h:640
isBSM
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.
Definition: AtlasPID.h:749
baryonNumber
double baryonNumber(const T &p)
Definition: AtlasPID.h:676
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:576
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:324
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:364
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:208
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:545
isSquarkRH
bool isSquarkRH(const T &p)
Definition: AtlasPID.h:416
threeCharge
double threeCharge(const T &p)
Definition: AtlasPID.h:903
isCharmMeson
bool isCharmMeson(const T &p)
Definition: AtlasPID.h:818
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:498
hasBottom
bool hasBottom(const T &p)
Definition: AtlasPID.h:641
numberOfLambdas
int numberOfLambdas(const T &p)
Definition: AtlasPID.h:727
isNeutrino
bool isNeutrino(const T &p)
APID: the fourth generation neutrinos are neutrinos.
Definition: AtlasPID.h:183
isResonance
bool isResonance(const T &p)
Definition: AtlasPID.h:347
isParton
bool isParton(const T &p)
Definition: AtlasPID.h:982
isSquark
bool isSquark(const T &p)
Definition: AtlasPID.h:400
isSleptonLH
bool isSleptonLH(const T &p)
Definition: AtlasPID.h:437
isHeavyBaryon
bool isHeavyBaryon(const T &p)
Definition: AtlasPID.h:832
isValid
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition: AtlasPID.h:778
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
isLightBaryon
bool isLightBaryon(const T &p)
Definition: AtlasPID.h:831
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:812
isLightMeson
bool isLightMeson(const T &p)
Definition: AtlasPID.h:815
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:592
isSMLepton
bool isSMLepton(const T &p)
Definition: AtlasPID.h:165
isSMQuark
bool isSMQuark(const T &p)
Definition: AtlasPID.h:144
isGluon
bool isGluon(const T &p)
Definition: AtlasPID.h:328
DeMoUpdate.reverse
reverse
Definition: DeMoUpdate.py:563
isHiggs
bool isHiggs(const T &p)
APID: HIGGS boson is only one particle.
Definition: AtlasPID.h:341
fractionalCharge
double fractionalCharge(const T &p)
Definition: AtlasPID.h:896
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:140
A
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
isLightHadron
bool isLightHadron(const T &p)
Definition: AtlasPID.h:808
isCCbarMeson
bool isCCbarMeson(const T &p)
Definition: AtlasPID.h:822
strangeness
int strangeness(const T &p)
Definition: AtlasPID.h:689
isBottom
bool isBottom(const T &p)
Definition: AtlasPID.h:154
isTopHadron
bool isTopHadron(const T &p)
Definition: AtlasPID.h:813
lumiFormat.i
int i
Definition: lumiFormat.py:85
leadingQuark
int leadingQuark(const T &p)
Definition: AtlasPID.h:789
isPythia8Specific
bool isPythia8Specific(const T &p)
Definition: AtlasPID.h:358
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:555
isWeaklyDecayingCHadron
bool isWeaklyDecayingCHadron(const T &p)
Definition: AtlasPID.h:877
hasTop
bool hasTop(const T &p)
Definition: AtlasPID.h:642
isZ
bool isZ(const T &p)
Definition: AtlasPID.h:334
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:297
isCharmBaryon
bool isCharmBaryon(const T &p)
Definition: AtlasPID.h:834
isGlueball
bool isGlueball(const T &p)
APID: Definition of Glueballs: SM glueballs 99X (X=1,5), 999Y (Y=3,7)
Definition: AtlasPID.h:379
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:826
isNeutral
bool isNeutral(const T &p)
Definition: AtlasPID.h:965
hasStrange
bool hasStrange(const T &p)
Definition: AtlasPID.h:639
isChLepton
bool isChLepton(const T &p)
APID: the fourth generation leptons are leptons.
Definition: AtlasPID.h:170
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:394
isTau
bool isTau(const T &p)
Definition: AtlasPID.h:179
isGraviton
bool isGraviton(const T &p)
Definition: AtlasPID.h:344
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:810
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:569
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:472
isTopMeson
bool isTopMeson(const T &p)
Definition: AtlasPID.h:820
isHadron
bool isHadron(const T &p)
Definition: AtlasPID.h:306
charge
double charge(const T &p)
Definition: AtlasPID.h:897
DecodedPID::ndigits
size_t ndigits() const
Definition: AtlasPID.h:31
isBaryon
bool isBaryon(const T &p)
Table 43.2.
Definition: AtlasPID.h:239
isGeantino
bool isGeantino(const T &p)
Definition: AtlasPID.h:375
isSlepton
bool isSlepton(const T &p)
Definition: AtlasPID.h:431
isWeaklyDecayingBHadron
bool isWeaklyDecayingBHadron(const T &p)
Definition: AtlasPID.h:842
spin2
int spin2(const T &p)
Definition: AtlasPID.h:986
isW
bool isW(const T &p)
Definition: AtlasPID.h:337
isRBaryon
bool isRBaryon(const T &p)
Definition: AtlasPID.h:525
isCharged
bool isCharged(const T &p)
Definition: AtlasPID.h:904
isTop
bool isTop(const T &p)
Definition: AtlasPID.h:157
isTransportable
bool isTransportable(const T &p)
Definition: AtlasPID.h:773
numberOfProtons
int numberOfProtons(const T &p)
Definition: AtlasPID.h:736
DeMoScan.first
bool first
Definition: DeMoScan.py:536
isLepton
bool isLepton(const T &p)
APID: the fourth generation leptons are leptons.
Definition: AtlasPID.h:161
isCharm
bool isCharm(const T &p)
Definition: AtlasPID.h:151
isPhoton
bool isPhoton(const T &p)
Definition: AtlasPID.h:331
charge3
int charge3(const T &p)
Definition: AtlasPID.h:895
hasSquark
bool hasSquark(const T &p, const int &q)
Definition: AtlasPID.h:423
isSquarkLH
bool isSquarkLH(const T &p)
Definition: AtlasPID.h:408
isSMNeutrino
bool isSMNeutrino(const T &p)
Definition: AtlasPID.h:186
isCharmHadron
bool isCharmHadron(const T &p)
Definition: AtlasPID.h:811
isRHadron
bool isRHadron(const T &p)
Definition: AtlasPID.h:1012
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:460
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:314
isHeavyMeson
bool isHeavyMeson(const T &p)
Definition: AtlasPID.h:816
isStrangeBaryon
bool isStrangeBaryon(const T &p)
Definition: AtlasPID.h:833
DecodedPID::last
const int & last() const
Definition: AtlasPID.h:27
isElectron
bool isElectron(const T &p)
Definition: AtlasPID.h:173
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:192
baryonNumber3
int baryonNumber3(const T &p)
Definition: AtlasPID.h:651
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
isEMInteracting
bool isEMInteracting(const T &p)
Definition: AtlasPID.h:979
containedQuarks
std::vector< int > containedQuarks(const T &p)
Definition: AtlasPID.h:1019
spin
double spin(const T &p)
Definition: AtlasPID.h:1008
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
isMuon
bool isMuon(const T &p)
Definition: AtlasPID.h:176
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:355