4 #ifndef TRUTHUTILS_ATLASPID_H
5 #define TRUTHUTILS_ATLASPID_H
16 class DecodedPID:
public std::pair<int,std::vector<int>> {
22 for(;
ap;
ap/=10) this->
second.push_back( ap%10 );
27 inline const int&
last()
const {
return this->
second.back();}
28 inline const int&
pid()
const {
return this->
first;}
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
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
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;
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;
76 static const int GLUON = 21;
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;
90 static const int DARKPHOTON = 60000;
91 static const int MAVTOP = 60001;
93 static const int PIPLUS = 211;
94 static const int PIMINUS = -PIPLUS;
95 static const int PI0 = 111;
96 static const int K0L = 130;
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;
115 static const int LEAD = 1000822080;
116 static const int OXYGEN = 1000080160;
117 static const int NEON = 1000100200;
122 static const int POMERON = 990;
123 static const int ODDERON = 9990;
124 static const int REGGEON = 110;
131 static const int GEANTINOPLUS = 998;
132 static const int GEANTINO0 = 999;
141 template<>
inline bool isQuark(
const int&
p) {
return p != 0 && (std::abs(
p) <= 8 || std::abs(
p) == MAVTOP);}
145 template<>
inline bool isSMQuark(
const int&
p) {
return p != 0 && std::abs(
p) <= TQUARK;}
149 template<>
inline bool isStrange(
const int&
p){
return std::abs(
p) == 3;}
152 template<>
inline bool isCharm(
const int&
p){
return std::abs(
p) == 4;}
155 template<>
inline bool isBottom(
const int&
p){
return std::abs(
p) == 5;}
158 template<>
inline bool isTop(
const int&
p){
return std::abs(
p) == 6;}
162 template<>
inline bool isLepton(
const int&
p){
auto sp = std::abs(
p);
return sp >= 11 && sp <= 18; }
166 template<>
inline bool isSMLepton(
const int&
p){
auto sp = std::abs(
p);
return sp >= 11 && sp <= 16; }
171 template<>
inline bool isChLepton(
const int&
p){
auto sp = std::abs(
p);
return sp >= 11 && sp <= 18 && sp%2 == 1; }
174 template<>
inline bool isElectron(
const int&
p){
return std::abs(
p) == ELECTRON;}
177 template<>
inline bool isMuon(
const int&
p){
return std::abs(
p) ==
MUON;}
180 template<>
inline bool isTau(
const int&
p){
return std::abs(
p) == TAU;}
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; }
187 template<>
inline bool isSMNeutrino(
const int&
p){
auto sp = std::abs(
p);
return sp == NU_E || sp == NU_MU || sp == NU_TAU; }
194 if (
p.ndigits() == 4 &&
p(0) >=
p(1) &&
p(2) == 0 &&
p.last() % 2 == 1
195 &&
p.max_digit(2,4) <= TQUARK
210 if (
p.ndigits() < 3 )
return false;
211 if (
p.ndigits() == 7 && (
p(0) == 1 ||
p(0) == 2))
return false;
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;
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;
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;
230 if (
p.ndigits() == 6 &&
p(3) >=
p(4) &&
p(4) != 0 &&
p.last() % 2 == 1 )
return true;
232 if (
p.ndigits() == 7 &&
p(0) == 9 &&
p(1) == 0 &&
p(4) >=
p(5) &&
p(5) != 0)
return true;
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;
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;
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;
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;
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;
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;
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))))
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)) );
315 template<>
inline bool isTrajectory(
const int&
p){
return std::abs(
p) == POMERON || std::abs(
p) == ODDERON || std::abs(
p) == REGGEON; }
325 template<>
inline bool isBoson(
const int&
p){
auto sp = std::abs(
p);
return sp > 20 && sp < 41; }
329 template<>
inline bool isGluon(
const int&
p){
return p == GLUON; }
332 template<>
inline bool isPhoton(
const int&
p){
return p == PHOTON; }
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; }
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; }
342 template<>
inline bool isHiggs(
const int&
p){
return p == HIGGSBOSON; }
345 template<>
inline bool isGraviton(
const int&
p){
return p == GRAVITON; }
356 template<>
inline bool isLeptoQuark(
const int&
p){
return std::abs(
p) == LEPTOQUARK; }
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;
376 template<>
inline bool isGeantino(
const int&
p){
return (std::abs(
p) == GEANTINO0 || std::abs(
p) == GEANTINOPLUS);}
381 if (
p.ndigits() > 4)
return false;
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) ) );
425 auto pp =
p.shift(1);
return isSUSY(
p) && pp.ndigits() != 2 && pp(0) ==
q;
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) &&
475 const auto& pp = (
p.ndigits() == 7) ?
p.shift(2) :
DecodedPID(0);
476 return (
p.ndigits() == 7 && (
p(0) == 4 &&
p(1) == 0) &&
500 if (
p.ndigits() != 7 ||
p(0) != 1)
return false;
501 auto pp =
p.shift(1);
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) ) );
512 if (!(
p.ndigits() == 7 && (
p(0) == 1 ||
p(0) == 2)))
return false;
513 auto pp =
p.shift(1);
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)) ||
518 (pp.ndigits() == 3 && pp.max_digit(1,3) < COMPOSITEGLUON && pp(1) <= pp(0) &&
isSMQuark(pp(0)) &&
isSMQuark(pp(1)) && pp.last() == 2)
527 if (!(
p.ndigits() == 7 && (
p(0) == 1 ||
p(0) == 2)))
return false;
528 auto pp =
p.shift(1);
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)) ||
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))
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 ) );}
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);}
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; }
579 const auto& pp = (
p.ndigits() == 7) ?
p.shift(2) :
DecodedPID(0);
580 return (
p.ndigits() == 7 &&
p(0) == 4 &&
p(1) == 9 &&
612 if (std::abs(
p.pid()) == PROTON)
return true;
613 return (
p.ndigits() == 10 &&
p(0) == 1 &&
p(1) == 0 );
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;}
623 if (
isBaryon(
p)) {
auto i =
std::find(
p.second.rbegin() + 1,
p.second.rbegin()+4,
q);
return (
i!=
p.second.rbegin()+4);}
626 if (
isNucleus(
p) && std::abs(
p.pid()) != PROTON) {
return (
q == 1 ||
q == 2 || (
q==3 &&
p(2) > 0));}
628 auto pp =
p.shift(1);
629 if ( pp.ndigits() == 1 ) {
return false; }
630 if ( pp.ndigits() == 3 ) {
return (pp(1) ==
q); }
631 if ( pp.ndigits() == 4 ) {
return (pp(1) ==
q || pp(2) ==
q); }
632 if ( pp.ndigits() == 5 ) {
return (pp(1) ==
q || pp(2) ==
q || pp(3) ==
q); }
633 if ( pp.ndigits() > 5 ) { pp = pp.shift(1); }
653 if (
isQuark(
p.pid())) {
return (
p.pid() > 0) ? 1 : - 1;}
654 if (
isDiquark(
p)) {
return (
p.pid() > 0) ? 2 : -2; }
658 const int result = 3*
p(8) + 30*
p(7) + 300*
p(6);
662 auto pp =
p.shift(1);
664 if (pp(0) == COMPOSITEGLUON) {
665 if (pp(1) == COMPOSITEGLUON) {
return 0; }
666 if ( pp.ndigits() == 4 ) {
return 0; }
667 if ( pp.ndigits() == 5) {
return (
p.pid() > 0) ? 3 : -3; }
669 if (pp.ndigits() == 3) {
return 0; }
670 if (pp.ndigits() == 4) {
return (
p.pid() > 0) ? 3 : -3; }
687 static const std::array<int,10> is_strange = {
688 +0, +0, +0, -1, +0, +0, +0, +0, +0, +0 };
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; }
694 if (std::abs(
p.pid()) == K0) {
return (
p.pid() > 0) ? 1 : -1; }
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)) {
707 auto pp =
p.shift(1);
709 if (pp(0) == COMPOSITEGLUON) {
710 if (pp(1) == COMPOSITEGLUON) {
return 0; }
711 if ( pp.ndigits() == 4 || pp.ndigits() == 5) {
715 if (pp.ndigits() == 3) { classified =
true; nq = 2;
if (
p.last()%2==0) {
sign = -1;} signmult = -1; }
716 if (pp.ndigits() == 4) { classified =
true; nq = 3; }
718 for (
auto r =
p.second.rbegin() + 1;
r !=
p.second.rbegin() + 1 + nq; ++
r) {
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); }
738 if (std::abs(
p.pid()) == PROTON) {
return (
p.pid() > 0) ? 1 : -1; }
740 const int result =
p(5) + 10*
p(4) + 100*
p(3);
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;
760 if (
isKK(
p))
return true;
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;
784 template<>
inline bool isValid(
const int&
p){
if (!
p)
return false;
if (std::abs(
p) < 42)
return true;
791 if (
isQuark(
p.pid())) {
return std::abs(
p.pid());}
792 if (
isMeson(
p)) {
return p.max_digit(1,3);}
798 auto pp =
p.shift(1);
799 if ( pp.ndigits() == 1 ) {
return 0; }
800 if ( pp.ndigits() == 3 ) { pp =
DecodedPID(pp(1)); }
801 if ( pp.ndigits() > 3 ) { pp = pp.shift(1); }
844 const int pid = std::abs(
p);
845 return (
pid == 511 ||
879 const int pid = std::abs(
p);
880 return (
pid == 411 ||
897 template<
class T>
inline double charge(
const T&
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;
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)); }
925 if (!classified &&
isSUSY(
p)) {
927 auto pp =
p.shift(1);
928 if (pp.ndigits() < 3 ) {
return charge3(pp); }
929 if (pp(0) == COMPOSITEGLUON) {
930 if (pp(1) == COMPOSITEGLUON) {
return 0; }
931 if ( pp.ndigits() == 4 || pp.ndigits() == 5) {
935 if (pp.ndigits() == 3) { classified =
true; nq = 2;
if (
p.last()%2==0) {
sign = -1;} signmult = -1; }
936 if (pp.ndigits() == 4) { classified =
true; nq = 3; }
942 return ( (
p.pid() > 0 &&
p(2) == 1) || (
p.pid() < 0 &&
p(2) == 2) ) ?
result : -
result;
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;
947 if (
p(0) == 2) abs_charge = (
p(3)*10. +
p(4))/(
p(5)*10.0 +
p(6));
948 int abs_threecharge =
static_cast<int>(
std::round(abs_charge * 3.));
949 return p.pid() > 0 ? abs_threecharge : -1 * abs_threecharge;
951 for (
auto r =
p.second.rbegin() + 1;
r !=
p.second.rbegin() + 1 + nq; ++
r) {
958 int ap = std::abs(
p);
959 if (
ap < TABLESIZE)
return p > 0 ? triple_charge.at(
ap):-triple_charge.at(
ap);
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;
974 if (
p(0) == 2) abs_charge = (
p(3)*10. +
p(4))/(
p(5)*10.0 +
p(6));
975 return p.pid() > 0 ? abs_charge : -1 * abs_charge;
986 template<
class T>
inline int spin2(
const T&
p) {
return spin2(
p->pdg_id()); }
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); }
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; }
998 if (
ap == DARKPHOTON) {
return 2; }
999 if (
ap < TABLESIZE ) {
return double_spin.at(
ap); }
1004 return p.last() > 0 ? 1 : 0;
1008 template<
class T>
inline double spin(
const T&
p) {
return spin(
p->pdg_id()); }
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)); }
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); }
1034 if ( pp.ndigits() > 1 ) {
1035 if ( pp.ndigits() == 3 ) { pp =
DecodedPID(pp(1)); }
1036 if ( pp.ndigits() > 3 ) { pp = pp.shift(1); }