4#ifndef TRUTHUTILS_ATLASPID_H
5#define TRUTHUTILS_ATLASPID_H
16class DecodedPID:
public std::pair<int,std::vector<int>> {
20 this->second.reserve(10);
22 for(; ap; ap/=10) this->second.push_back( ap%10 );
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();}
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
51 +0, +1, +1, +1, +1, +1, +1, +1, +1, +0,
52 +0, +1, +1, +1, +1, +1, +1, +1, +1, +0,
53 +2, +2, +2, +2, +2, +0, +0, +0, +0, +0,
54 +0, +0, +2, +2, +2, +0, +0, +0, +0, +4,
55 +0, +0, +0, +0, +0, +0, +0, +0, +0, +0,
56 +0, +0, +1, +2, +0, +2, +0, +1, +2, +0,
57 +0, +0, +0, +0, +0, +0, +0, +0, +0, +0,
58 +0, +0, +0, +0, +0, +0, +0, +0, +0, +0,
59 +0, +0, +0, +0, +0, +0, +0, +0, +0, +0,
60 +0, +0, +0, +0, +0, +0, +0, +0, +0, +0
79static const int TAU = 15;
111static const int PI0 = 111;
112static const int K0L = 130;
114static const int K0S = 310;
115static const int K0 = 311;
119static const int D0 = 421;
122static const int B0 = 511;
141static const int LEAD = 1000822080;
147static const int NEON = 1000100200;
174template <>
inline bool isQuark(
const int& p) {
return p != 0 && (std::abs(p) <=
TPRIME || std::abs(p) ==
MAVTOP);}
179template <>
inline bool isSMQuark(
const int& p) {
return p != 0 && std::abs(p) <=
TQUARK;}
186template <>
inline bool isCharm(
const int& p){
return std::abs(p) ==
CQUARK;}
191template <
class T>
inline bool isTop(
const T& p){
return isTop(p->pdg_id());}
192template <>
inline bool isTop(
const int& p){
return std::abs(p) ==
TQUARK;}
211template <
class T>
inline bool isMuon(
const T& p){
return isMuon(p->pdg_id());}
212template <>
inline bool isMuon(
const int& p){
return std::abs(p) ==
MUON;}
214template <
class T>
inline bool isTau(
const T& p){
return isTau(p->pdg_id());}
215template <>
inline bool isTau(
const int& p){
return std::abs(p) ==
TAU;}
235 if ( p.ndigits() == 4 && p(0) >= p(1) && p(1) !=0 && p(2) == 0 && (p.last() == 1 || p.last() == 3)
252 if (p.ndigits() < 3 )
return false;
253 if (p.ndigits() == 7 && (p(0) == 1 || p(0) == 2))
return false;
254 if (std::abs(p.pid()) ==
K0S)
return true;
255 if (std::abs(p.pid()) ==
K0L)
return true;
256 if (std::abs(p.pid()) ==
K0)
return true;
257 if (p.last() % 2 != 1 )
return false;
258 if (p.max_digit(1,3) >=
QUARK_LIMIT )
return false;
259 if (p.min_digit(1,3) == 0 )
return false;
260 if (*(p.second.rbegin() + 2) < *(p.second.rbegin() + 1) )
return false;
261 if (*(p.second.rbegin() + 2) == *(p.second.rbegin() + 1) && p.pid() < 0 )
return false;
262 if (p.ndigits() == 3 )
return true;
263 if (*(p.second.rbegin() + 3) != 0 )
return false;
264 if (p.ndigits() == 5 && p(0) == 1 )
return true;
265 if (p.ndigits() == 5 && p(0) == 2 && p.last() > 1 )
return true;
266 if (p.ndigits() == 5 && p(0) == 3 && p.last() > 1 )
return true;
267 if (p.ndigits() == 6 && p.last() % 2 == 1 )
return true;
268 if (p.ndigits() == 7 && p(0) == 9 && p(1) == 0 )
return true;
282 return (*(p.second.rbegin() + 2) >
SQUARK && p.last() > 0 && *(p.second.rbegin() + 1) == *(p.second.rbegin() + 2));
290 if (p.ndigits() < 4 )
return false;
291 if (p.max_digit(1,4) >=
QUARK_LIMIT )
return false;
292 if (p.min_digit(1,4) == 0)
return false;
293 if (p.ndigits() == 4 && (p.last() == 2 || p.last() == 4|| p.last() == 6|| p.last() == 8) )
return true;
295 if (p.ndigits() == 5 && p(0) == 1 && (p.last() == 2 || p.last() == 4) )
return true;
296 if (p.ndigits() == 5 && p(0) == 3 && (p.last() == 2 || p.last() == 4) )
return true;
298 if (p.ndigits() == 6 ) {
299 if (p(0) == 1 && p(1) == 0 && p.last() == 2 )
return true;
300 if (p(0) == 1 && p(1) == 0 && p.last() == 4 )
return true;
301 if (p(0) == 1 && p(1) == 0 && p.last() == 6 )
return true;
302 if (p(0) == 1 && p(1) == 1 && p.last() == 2 )
return true;
303 if (p(0) == 1 && p(1) == 2 && p.last() == 4 )
return true;
305 if (p(0) == 2 && p(1) == 0 && p.last() == 2 )
return true;
306 if (p(0) == 2 && p(1) == 0 && p.last() == 4 )
return true;
307 if (p(0) == 2 && p(1) == 0 && p.last() == 6 )
return true;
308 if (p(0) == 2 && p(1) == 0 && p.last() == 8 )
return true;
309 if (p(0) == 2 && p(1) == 1 && p.last() == 2 )
return true;
312 if (p.ndigits() == 5 ) {
313 if (p(0) == 2 && p.last() == 2 )
return true;
314 if (p(0) == 2 && p.last() == 4 )
return true;
315 if (p(0) == 2 && p.last() == 6 )
return true;
316 if (p(0) == 5 && p.last() == 2 )
return true;
317 if (p(0) == 1 && p.last() == 6 )
return true;
318 if (p(0) == 4 && p.last() == 2 )
return true;
333 return (p.ndigits() == 9 && p(0) == 1 && p(5) == 0 &&
334 p.max_digit(1,3) <
QUARK_LIMIT && p.min_digit(1,3) > 0 &&
335 p.max_digit(4,6) <
QUARK_LIMIT && p.min_digit(4,6) > 0 &&
336 ( p(3) >= p(4) && p(6) >= p(7) ) && ( ( p(3) > p(6) ) || ( p(3) == p(6) && (p(4) >= p(7))))
350 return (p.ndigits() == 9 && p(0) == 1 &&
351 p.max_digit(1,6) <
QUARK_LIMIT && p.min_digit(1,6) > 0 &&
352 ( p(3) >= p(4) && p(4) >= p(5) && p(5) >= p(6)) );
376template <>
inline bool isBoson(
const int& p){
auto sp = std::abs(p);
return sp > 20 &&
sp < 41; }
385template <
class T>
inline bool isZ(
const T& p){
return isZ(p->pdg_id());}
386template <>
inline bool isZ(
const int& p){
return p ==
Z0BOSON; }
388template <
class T>
inline bool isW(
const T& p){
return isW(p->pdg_id());}
389template <>
inline bool isW(
const int& p){
return std::abs(p) ==
WPLUSBOSON; }
433 int ap = std::abs(p);
434 if (ap >= 81 && ap <= 100)
return true;
435 if (ap >= 901 && ap <= 930)
return true;
436 if (ap >= 998 && ap <= 999)
return true;
437 if (ap >= 1901 && ap <= 1930)
return true;
438 if (ap >= 2901 && ap <= 2930)
return true;
439 if (ap >= 3901 && ap <= 3930)
return true;
449 if (p.ndigits() > 4)
return false;
466 auto pp = p.shift(1);
return (p.ndigits() == 7 && (p(0) == 1 || p(0) == 2) &&
isSMQuark(pp));
474 auto pp = p.shift(1);
return (p.ndigits() == 7 && p(0) == 1 &&
isSMQuark(pp));
482 auto pp = p.shift(1);
return (p.ndigits() == 7 && p(0) == 2 &&
isSMQuark(pp));
496 auto pp = p.shift(1);
return (p.ndigits() == 7 && p(0) == 1 &&
isSMLepton(pp));
504 auto pp = p.shift(1);
return (p.ndigits() == 7 && p(0) == 2 &&
isSMLepton(pp));
512 auto pp = p.shift(1);
return (p.ndigits() == 7 && p(0) == 1 &&
isBoson(pp.pid()));
533 const auto& pp = (p.ndigits() == 7) ? p.shift(2) :
DecodedPID(0);
534 return (p.ndigits() == 7 && p(0) == 3 && (p(1) == 0 || p(1) == 1) &&
545 const auto& pp = (p.ndigits() == 7) ? p.shift(2) :
DecodedPID(0);
546 return (p.ndigits() == 7 && (p(0) == 4 && p(1) == 0) &&
570 if (p.ndigits() != 7 || p(0) != 1)
return false;
571 auto pp = p.shift(1);
582 if (!(p.ndigits() == 7 && (p(0) == 1 || p(0) == 2)))
return false;
583 auto pp = p.shift(1);
586 (pp.ndigits() == 4 && p(0) == 1 && pp(0) ==
COMPOSITEGLUON && pp.min_digit(1,3) > 0 && pp.max_digit(1,3) <
QUARK_LIMIT && pp(2) <= pp(1) && (pp.last() == 1 || pp.last() == 3)) ||
588 (pp.ndigits() == 3 && pp.min_digit(1,3) > 0 && pp.max_digit(1,3) <
QUARK_LIMIT && pp(1) <= pp(0) && pp.last() == 2)
597 if (!(p.ndigits() == 7 && (p(0) == 1 || p(0) == 2)))
return false;
598 auto pp = p.shift(1);
601 (pp.ndigits() == 5 && p(0) == 1 && pp(0) ==
COMPOSITEGLUON && pp.min_digit(1,4) > 0 && pp.max_digit(1,4) <
QUARK_LIMIT && pp(2) <= pp(1) && pp(3) <= pp(2) && (pp.last() == 2 || pp.last() == 4)) ||
603 (pp.ndigits() == 4 && pp.min_digit(1,4) > 0 && pp.max_digit(1,4) <
QUARK_LIMIT && pp(1) <= pp(0) && pp(2) <= pp(1) && (pp.last() == 1 || pp.last() == 3))
616template <
class T>
inline bool hasSquark(
const T& p,
const int& q) {
return hasSquark(p->pdg_id(), q); }
618 auto pp = p.shift(1);
return (
629template <
class T>
inline bool isSUSY(
const T& p){
return isSUSY(p->pdg_id());}
641template <
class T>
inline bool isKK(
const T& p){
return isKK(p->pdg_id());}
642template <>
inline bool isKK(
const DecodedPID& p){
return (p.ndigits() == 7 && (p(0) == 5 || p(0) == 6 ) && (p(1) != 9) );}
643template <>
inline bool isKK(
const int& p){
auto value_digits =
DecodedPID(p);
return isKK(value_digits);}
652template <>
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);}
664template <
class T>
inline bool isDM(
const T& p){
return isDM(p->pdg_id());}
665template <>
inline bool isDM(
const int& p){
666 auto sp = std::abs(p);
668 return (
sp >= 51 &&
sp <= 60) || (value_digits.ndigits() == 7 && value_digits(0) == 5 && value_digits(1) == 9) ||
sp ==
DARKPHOTON; }
677 const auto& pp = (p.ndigits() == 7) ? p.shift(2) :
DecodedPID(0);
678 return (p.ndigits() == 7 && p(0) == 4 && p(1) == 9 &&
710 if (std::abs(p.pid()) ==
PROTON)
return true;
711 if (p.ndigits() != 10)
return false;
714 const int A = p(8) + 10*p(7) + 100*p(6);
715 const int Z = p(5) + 10*p(4) + 100*p(3);
716 return (
A >= Z && p(0) == 1 && p(1) == 0 );
721template <
class T>
inline bool hasQuark(
const T& p,
const int& q);
723 if (
isQuark(p.pid())) {
return (std::abs(p.pid()) == q );}
724 if (
isMeson(p)) {
return *(p.second.rbegin() + 1) == q ||*(p.second.rbegin()+2) ==q;}
725 if (
isDiquark(p)) {
auto i = std::find(p.second.rbegin() + 2,p.second.rbegin()+4,q);
return (i!=p.second.rbegin()+4);}
726 if (
isBaryon(p)) {
auto i = std::find(p.second.rbegin() + 1,p.second.rbegin()+4,q);
return (i!=p.second.rbegin()+4);}
727 if (
isTetraquark(p)) {
auto i = std::find(p.second.rbegin() + 1,p.second.rbegin()+5,q);
return (i!=p.second.rbegin()+5);}
728 if (
isPentaquark(p)) {
auto i = std::find(p.second.rbegin() + 1,p.second.rbegin()+6,q);
return (i!=p.second.rbegin()+6);}
729 if (
isNucleus(p) && std::abs(p.pid()) !=
PROTON) {
return (q == 1 || q == 2 || (q==3 && p(2) > 0));}
731 auto pp = p.shift(1);
732 if ( pp.ndigits() == 1 ) {
return false; }
733 if ( pp.ndigits() == 3 ) {
return (pp(1) == q); }
734 if ( pp.ndigits() == 4 ) {
return (pp(1) == q || pp(2) == q); }
735 if ( pp.ndigits() == 5 ) {
return (pp(1) == q || pp(2) == q || pp(3) == q); }
736 if ( pp.ndigits() > 5 ) { pp = pp.shift(1); }
756 if (
isQuark(p.pid())) {
return (p.pid() > 0) ? 1 : - 1;}
757 if (
isDiquark(p)) {
return (p.pid() > 0) ? 2 : -2; }
761 const int result = 3*p(8) + 30*p(7) + 300*p(6);
762 return (p.pid() > 0) ? result : -result;
765 auto pp = p.shift(1);
769 if ( pp.ndigits() == 4 ) {
return 0; }
770 if ( pp.ndigits() == 5) {
return (p.pid() > 0) ? 3 : -3; }
772 if (pp.ndigits() == 3) {
return 0; }
773 if (pp.ndigits() == 4) {
return (p.pid() > 0) ? 3 : -3; }
791 +0, +0, +0, -1, +0, +0, +0, +0, +0, +0 };
794 if (
isNucleus(p) && p.ndigits() == 10) {
return (p.pid() > 0) ? -p(2) : p(2); }
795 if (
isStrange(p.pid())) {
return (p.pid() > 0) ? -1 : 1; }
797 if (std::abs(p.pid()) ==
K0) {
return (p.pid() > 0) ? 1 : -1; }
802 bool classified =
false;
803 if (!classified &&
isMeson(p)) { classified =
true; nq = 2;
if ((*(p.second.rbegin()+2)) == 2||(*(p.second.rbegin()+2)) == 4 ) {
sign=-1;} signmult =-1; }
805 if (!classified &&
isBaryon(p)) { classified =
true; nq = 3; }
808 if (!classified &&
isSUSY(p)) {
810 auto pp = p.shift(1);
814 if ( pp.ndigits() == 4 || pp.ndigits() == 5) {
818 if (pp.ndigits() == 3) { classified =
true; nq = 2;
if (p.last()%2==0) {
sign = -1;} signmult = -1; }
819 if (pp.ndigits() == 4) { classified =
true; nq = 3; }
821 for (
auto r = p.second.rbegin() + 1;
r != p.second.rbegin() + 1 + nq; ++
r) {
825 return p.pid() > 0 ? result : -result;
832 if (std::abs(p.pid()) ==
LAMBDA0) {
return (p.pid() > 0) ? 1 : -1; }
833 if (
isNucleus(p) && p.ndigits() == 10) {
return (p.pid() > 0) ? p(2) : -p(2); }
841 if (std::abs(p.pid()) ==
PROTON) {
return (p.pid() > 0) ? 1 : -1; }
843 const int result = p(5) + 10*p(4) + 100*p(3);
844 return (p.pid() > 0) ? result : -result;
852template <
class T>
inline bool isBSM(
const T& p){
return isBSM(p->pdg_id());}
855 if (std::abs(p.pid()) > 16 && std::abs(p.pid()) < 19)
return true;
856 if (std::abs(p.pid()) > 31 && std::abs(p.pid()) < 39)
return true;
857 if (std::abs(p.pid()) > 39 && std::abs(p.pid()) < 81)
return true;
858 if (std::abs(p.pid()) > 6 && std::abs(p.pid()) < 9)
return true;
859 if (
isSUSY(p))
return true;
864 if (
isKK(p))
return true;
867 if (
isDM(p.pid()))
return true;
870template <>
inline bool isBSM(
const int& p){
872 if (std::abs(p) > 16 && std::abs(p) < 19)
return true;
873 if (std::abs(p) > 31 && std::abs(p) < 38)
return true;
874 if (std::abs(p) > 39 && std::abs(p) < 81)
return true;
875 if (std::abs(p) > 6 && std::abs(p) < 9)
return true;
890template <>
inline bool isValid(
const int& p){
if (!p)
return false;
if (std::abs(p) < 42)
return true;
897 if (
isQuark(p.pid())) {
return std::abs(p.pid());}
898 if (
isMeson(p)) {
return p.max_digit(1,3);}
899 if (
isDiquark(p)) {
return p.max_digit(2,4);}
900 if (
isBaryon(p)) {
return p.max_digit(1,4);}
904 auto pp = p.shift(1);
905 if ( pp.ndigits() == 1 ) {
return 0; }
906 if ( pp.ndigits() == 3 ) { pp =
DecodedPID(pp(1)); }
907 if ( pp.ndigits() > 3 ) { pp = pp.shift(1); }
950 const int pid = std::abs(p);
951 return ( pid == 511 ||
985 const int pid = std::abs(p);
986 return ( pid == 411 ||
1003template <
class T>
inline double charge(
const T& p){
1014 auto ap = std::abs(p.pid());
1016 if (ap ==
K0)
return 0;
1019 if (ap ==
MAVTOP)
return p.pid() > 0 ? 2 : -2;
1024 bool classified =
false;
1025 if (!classified &&
isMeson(p)) { classified =
true; nq = 2;
if ((*(p.second.rbegin()+2)) == 2||(*(p.second.rbegin()+2)) == 4 ) {
sign=-1;} signmult =-1; }
1027 if (!classified &&
isBaryon(p)) { classified =
true; nq = 3; }
1031 if (!classified &&
isSUSY(p)) {
1033 auto pp = p.shift(1);
1034 if (pp.ndigits() < 3 ) {
return charge3(pp); }
1037 if ( pp.ndigits() == 4 || pp.ndigits() == 5) {
1041 if (pp.ndigits() == 3) { classified =
true; nq = 2;
if (p.last()%2==0) {
sign = -1;} signmult = -1; }
1042 if (pp.ndigits() == 4) { classified =
true; nq = 3; }
1045 auto pp = p.shift(2);
1046 if (!classified &&
isMeson(pp)) { classified =
true; nq = 2;
if ((*(pp.second.rbegin()+2)) == 2||(*(pp.second.rbegin()+2)) == 4 ) {
sign=-1;} signmult =-1; }
1048 if (!classified &&
isBaryon(pp)) { classified =
true; nq = 3; }
1051 auto pp = p.shift(2);
1052 auto ap = std::abs(pp.pid());
1055 if (!classified &&
isKK(p)) {
1056 auto pp = p.shift(2);
1057 auto ap = std::abs(pp.pid());
1061 if (!classified &&
isDM(p.pid())) {
1062 if (p.ndigits() == 7){
1063 auto pp = p.shift(3);
1064 auto ap = std::abs(pp.pid());
1071 result = 3*(p(3)*100 + p(4)*10 + p(5));
1072 return ( (p.pid() > 0 && p(2) == 1) || (p.pid() < 0 && p(2) == 2) ) ? result : -result;
1075 double abs_charge = 0.0;
1076 if (p(0) == 1) abs_charge = p(3)*100. + p(4)*10. + p(5)*1 + p(6)*0.1;
1077 if (p(0) == 2) abs_charge = (p(3)*10. + p(4))/(p(5)*10.0 + p(6));
1078 int abs_threecharge =
static_cast<int>(std::round(abs_charge * 3.));
1079 return p.pid() > 0 ? abs_threecharge : -1 * abs_threecharge;
1081 for (
auto r = p.second.rbegin() + 1;
r != p.second.rbegin() + 1 + nq; ++
r) {
1085 return p.pid() > 0 ? result : -result;
1088 int ap = std::abs(p);
1095template <
class T>
inline bool isNeutral(
const T& p){
return p->pdg_id() != 0 &&
charge3(p) == 0;}
1102 double abs_charge = 0;
1103 if (p(0) == 1) abs_charge = p(3)*100. + p(4)*10. + p(5)*1 + p(6)*0.1;
1104 if (p(0) == 2) abs_charge = (p(3)*10. + p(4))/(p(5)*10.0 + p(6));
1105 return p.pid() > 0 ? abs_charge : -1 * abs_charge;
1117template <
class T>
inline int spin2(
const T& p) {
return spin2(p->pdg_id()); }
1120 auto pp = p.shift(1);
1121 auto ap = std::abs(pp.pid());
1126 auto pp = p.shift(2);
1127 if (
isHadron(pp)) {
return pp.last()-1; }
1130 auto pp = p.shift(2);
1131 auto ap = std::abs(pp.pid());
1134 if (
isDM(std::abs(p.pid()))) {
1135 if (p.ndigits() == 7) {
1136 auto pp = p.shift(3);
1137 auto ap = std::abs(pp.pid());
1139 }
else if (std::abs(p.pid()) <
TABLESIZE) {
1140 return std::abs(
double_spin.at(std::abs(p.pid())));
1143 auto ap = std::abs(p.pid());
1144 if (ap ==
K0S) {
return 0; }
1145 if (ap ==
K0L) {
return 0; }
1146 if (ap ==
MAVTOP) {
return 1; }
1149 if (
isHadron(p)) {
return p.last()-1; }
1153 return p.last() > 0 ? 1 : 0;
1157template <
class T>
inline double spin(
const T& p) {
return spin(p->pdg_id()); }
1159template <>
inline double spin(
const int& p){
auto value_digits =
DecodedPID(p);
return spin(value_digits);}
1166 std::vector<int> quarks;
1167 if (
isQuark(pp.pid())) { quarks.push_back(std::abs(pp.pid())); }
1168 else if (
isDiquark(pp)) { quarks.push_back(pp(0)); quarks.push_back(pp(1)); }
1169 else if (
isMeson(pp)) { quarks.push_back(*(pp.second.rbegin() + 1)); quarks.push_back(*(pp.second.rbegin()+2)); }
1170 else if (
isBaryon(pp)) {
for (
size_t digit = 1; digit < 4; ++digit) { quarks.push_back(*(pp.second.rbegin() + digit)); } }
1171 else if (
isTetraquark(pp)) {
for (
size_t digit = 1; digit < 5; ++digit) { quarks.push_back(*(pp.second.rbegin() + digit)); } }
1172 else if (
isPentaquark(pp)) {
for (
size_t digit = 1; digit < 6; ++digit) { quarks.push_back(*(pp.second.rbegin() + digit)); } }
1174 const int n_uquarks =
A + Z;
const int n_dquarks = 2*
A - Z - L;
const int n_squarks = L;
1175 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); }
1178 if ( pp.ndigits() > 1 ) {
1179 if ( pp.ndigits() == 3 ) { pp =
DecodedPID(pp(1)); }
1180 if ( pp.ndigits() > 3 ) { pp = pp.shift(1); }
bool isValid() const
Test to see if the link can be dereferenced.
bool isGraviton(const T &p)
bool isSMLepton(const T &p)
APID: the fourth generation leptons are not standard model leptons.
bool isWeaklyDecayingBHadron(const T &p)
static const int GRAVITON
static const int HIGGSBOSON
static const int ZDBLPRIME
int numberOfProtons(const T &p)
bool hasStrange(const T &p)
static const int TABLESIZE
bool isBottomBaryon(const T &p)
bool isBottomMeson(const T &p)
bool isRGlueball(const T &p)
PDG rule 11g: Within several scenarios of new physics, it is possible to have colored particles suffici...
bool isElectron(const T &p)
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 ...
bool isBottom(const T &p)
bool isStrange(const T &p)
bool isExcited(const T &p)
PDG rule 11f Excited (composite) quarks and leptons are identified by setting n= 4 and nr= 0.
bool isRBaryon(const T &p)
bool isSleptonLH(const T &p)
bool isSlepton(const T &p)
int strangeness(const T &p)
bool isTransportable(const T &p)
bool isPentaquark(const T &p)
PDG rule 15 The 9-digit penta-quark codes are ±1nrnLnq1nq2nq3nq4nq5nJ, sorted such that nq1≥nq2≥nq3≥n...
static const std::array< int, 10 > is_strange
static const std::array< int, TABLESIZE > triple_charge
bool isChLepton(const T &p)
APID: the fourth generation leptons are leptons.
double baryonNumber(const T &p)
static const int RH_NU_MU
static const int ELECTRON
static const int HIGGSPLUS
bool isStrangeHadron(const T &p)
double fractionalCharge(const T &p)
bool isLepton(const T &p)
APID: the fourth generation leptons are leptons.
bool isHiggs(const T &p)
APID: HIGGS boson is only one particle.
int numberOfLambdas(const T &p)
bool isLightBaryon(const T &p)
static const int POMERON
PDG rule 8: The pomeron and odderon trajectories and a generic reggeon trajectory of states in QCD ar...
bool isQuarkonium(const T &p)
Is this a heavy-flavour quarkonium meson?
bool isTopMeson(const T &p)
bool hasQuark(const T &p, const int &q)
bool isGaugino(const T &p)
bool isHeavyBoson(const T &p)
APID: Additional "Heavy"/"prime" versions of W and Z bosons (Used in MCTruthClassifier).
bool isTetraquark(const T &p)
PDG rule 14 The 9-digit tetra-quark codes are ±1nrnLnq1nq20nq3nq4nJ.
static const int WBOSON_LRSM
bool isCharged(const T &p)
bool isMonopole(const T &p)
PDG rule 11i Magnetic monopoles and dyons are assumed to have one unit of Dirac monopole charge and a...
bool isHeavyMeson(const T &p)
bool isSMQuark(const T &p)
bool isFourthGeneration(const T &p)
Is this a 4th generation fermion?
static const int QUARK_LIMIT
bool isSuperpartner(const T &p)
static const int POSITRON
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...
bool hasBottom(const T &p)
bool isSquarkLH(const T &p)
static const int LEPTOQUARK
bool isGlueball(const T &p)
APID: Definition of Glueballs: SM glueballs 99X (X=1,5), 999Y (Y=3,7).
bool isLightHadron(const T &p)
bool isTechnicolor(const T &p)
PDG rule 11e Technicolor states have n = 3, with technifermions treated like ordinary fermions.
double charge(const T &p)
bool isResonance(const T &p)
bool isStrongInteracting(const T &p)
bool isParton(const T &p)
bool isCCbarMeson(const T &p)
int baryonNumber3(const T &p)
static const int MAGNESIUM
bool isBBbarMeson(const T &p)
bool isTopHadron(const T &p)
bool isEMInteracting(const T &p)
bool isStrangeBaryon(const T &p)
static const int RH_NU_E
PDG Rule 12: Generator defined PDG ID values for right handed neutrinos and corresponding W+ boson fr...
bool hasCharm(const T &p)
bool isSleptonRH(const T &p)
static const int LAMBDAB0
bool isBottomHadron(const T &p)
bool isQuark(const T &p)
PDG rule 2: Quarks and leptons are numbered consecutively starting from 1 and 11 respectively; to do ...
std::vector< int > containedQuarks(const T &p)
bool isMeson(const T &p)
Table 43.1 PDG rule 5a: The numbers specifying the meson’s quark content conform to the convention nq...
static const int GEANTINOPLUS
PDG rule 10: Codes 81–100 are reserved for generator-specific pseudoparticles and concepts.
bool isGeantino(const T &p)
bool isDiquark(const T &p)
PDG rule 4 Diquarks have 4-digit numbers with nq1 >= nq2 and nq3 = 0 APID: states with top quarks are...
bool isGenericMultichargedParticle(const T &p)
In addition, there is a need to identify ”Q-ball” and similar very exotic (multi-charged) particles w...
bool isNeutrino(const T &p)
APID: the fourth generation neutrinos are neutrinos.
static const int WPLUSPRIME
bool isRMeson(const T &p)
static const int GEANTINO0
static const int COMPOSITEGLUON
bool isCharmBaryon(const T &p)
bool isSquarkRH(const T &p)
bool isPhoton(const T &p)
bool isHeavyBaryon(const T &p)
static const int RH_NU_TAU
double threeCharge(const T &p)
bool isKK(const T &p)
PDG rule 11h A black hole in models with extra dimensions has code 5000040.
bool isCharmMeson(const T &p)
bool isNeutrinoRH(const T &p)
PDG Rule 12: APID: Helper function for right-handed neutrino states These are generator defined PDG I...
bool isBaryon(const T &p)
Table 43.2 APID: states with fourth generation quarks are not baryons.
bool hasSquark(const T &p, const int &q)
int leadingQuark(const T &p)
bool isLeptoQuark(const T &p)
PDG rule 11c: “One-of-a-kind” exotic particles are assigned numbers in the range 41–80.
bool isNucleus(const T &p)
PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.
static const int LAMBDACPLUS
bool isSMNeutrino(const T &p)
bool isMSSMHiggs(const T &p)
APID: Additional Higgs bosons for MSSM (Used in MCTruthClassifier).
bool isSquark(const T &p)
PDG rule 11d Fundamental supersymmetric particles are identified by adding a nonzero n to the particl...
bool isTopBaryon(const T &p)
bool isTrajectory(const T &p)
PDG rule 8: The pomeron and odderon trajectories and a generic reggeon trajectory of states in QCD ar...
static const int WPLUSBOSON
static const int HIGGSPLUSPLUS
static const int DARKPHOTON
PDG Ids for Mavtop madgraph UFO model found under DarkX.
bool isCharmHadron(const T &p)
bool isRHadron(const T &p)
bool isHadron(const T &p)
bool isLightMeson(const T &p)
bool isStrangeMeson(const T &p)
bool isHeavyHadron(const T &p)
bool isGenSpecific(const T &p)
Main Table for MC internal use 81–100,901–930,998-999,1901–1930,2901–2930, and 3901–3930.
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.
bool isDM(const T &p)
PDG rule 11j: The nature of Dark Matter (DM) is not known, and therefore a definitive classificationi...
bool isPythia8Specific(const T &p)
bool isNeutral(const T &p)
static const std::array< int, TABLESIZE > double_spin
bool isWeaklyDecayingCHadron(const T &p)
Implementation of classification functions according to PDG2022.
int min_digit(const int m, const int n) const
DecodedPID shift(const size_t n) const
int max_digit(const int m, const int n) const
const int & operator()(const size_t n) const
void reverse(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of reverse for DataVector/List.
hold the test vectors and ease the comparison