Version: SMASH-2.0
pdgcode.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2020
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_SMASH_PDGCODE_H_
11 #define SRC_INCLUDE_SMASH_PDGCODE_H_
12 
13 #include <algorithm>
14 #include <array>
15 #include <cassert>
16 #include <cstdlib>
17 #include <iosfwd>
18 #include <sstream>
19 #include <stdexcept>
20 #include <string>
21 
22 #include <iostream>
23 
24 #include "pdgcode_constants.h"
25 
26 namespace smash {
27 
108 class PdgCode {
109  public:
114  struct InvalidPdgCode : public std::invalid_argument {
115  using std::invalid_argument::invalid_argument;
116  };
117 
118  /****************************************************************************
119  * *
120  * First, the constructors *
121  * *
122  ****************************************************************************/
123 
125  PdgCode() : dump_(0x0) {}
131  explicit PdgCode(const std::string& codestring) {
132  set_from_string(codestring);
133  }
134 
143  PdgCode(std::int32_t codenumber) : dump_(0x0) { // NOLINT(runtime/explicit)
144  digits_.antiparticle_ = false;
145  if (codenumber < 0) {
146  digits_.antiparticle_ = true;
147  codenumber = -codenumber;
148  }
149  set_fields(codenumber);
150  }
155  explicit PdgCode(const std::uint32_t abscode) : dump_(0x0) {
156  // use the first bit for the antiparticle_ boolean.
157  digits_.antiparticle_ = ((abscode & 0x80000000u) != 0);
158  set_fields(abscode);
159  }
160 
161  /****************************************************************************
162  * *
163  * test function and export functions *
164  * *
165  ****************************************************************************/
166 
180  inline int test_code() const {
181  int fail = 0;
182  if (digits_.n_ > 9) {
183  fail |= 1 << 6;
184  }
185  if (digits_.n_R_ > 9) {
186  fail |= 1 << 5;
187  }
188  if (digits_.n_L_ > 9) {
189  fail |= 1 << 4;
190  }
191  if (digits_.n_q1_ > 6) {
192  fail |= 1 << 3;
193  }
194  if (digits_.n_q2_ > 6) {
195  fail |= 1 << 2;
196  }
197  if (digits_.n_q3_ > 6) {
198  fail |= 1 << 1;
199  }
200  if (digits_.n_J_ > 15) {
201  fail |= 1;
202  }
203  return fail;
204  }
205 
214  void check() const {
215  // n_J must be odd for mesons and even for baryons (and cannot be zero)
216  if (is_hadron()) {
217  if (baryon_number() == 0) {
218  // mesons: special cases K0_L=0x130 and K0_S=0x310
219  if ((digits_.n_J_ % 2 == 0) && dump() != 0x130 && dump() != 0x310) {
220  throw InvalidPdgCode("Invalid PDG code " + string() +
221  " (meson with even n_J)");
222  }
223  } else {
224  if ((digits_.n_J_ % 2 != 0) || digits_.n_J_ == 0) {
225  throw InvalidPdgCode("Invalid PDG code " + string() +
226  " (baryon with odd n_J)");
227  }
228  }
229  } else {
230  if (digits_.n_J_ == 0 && dump() != 0x0) {
231  throw InvalidPdgCode("Invalid PDG code " + string() + " (n_J==0)");
232  }
233  }
234  /* The antiparticle flag only makes sense for particle types
235  * that have an antiparticle. */
236  if (digits_.antiparticle_ && !has_antiparticle()) {
237  throw InvalidPdgCode("Invalid PDG code " + string() +
238  " (cannot be negative)");
239  }
240  }
241 
243  inline std::uint32_t dump() const {
244  // this cuts the three unused bits.
245  return (dump_ & 0x8fffffff);
246  }
247 
249  inline std::int32_t code() const { return antiparticle_sign() * ucode(); }
250 
252  inline std::string string() const {
253  std::stringstream ss;
254  ss << get_decimal();
255  return ss.str();
256  }
257 
259  PdgCode get_antiparticle() const {
260  PdgCode result = *this;
261  result.digits_.antiparticle_ = !digits_.antiparticle_;
262  return result;
263  }
264 
269  static PdgCode from_decimal(const int pdgcode_decimal) {
270  // Nucleus and special codes with 2J+1 > 9
271  if (std::abs(pdgcode_decimal) > 1E7) {
272  return PdgCode(std::to_string(pdgcode_decimal));
273  }
274  int a = pdgcode_decimal;
275  int hex_pdg = 0, tmp = 1;
276  while (a) {
277  hex_pdg += (a % 10) * tmp;
278  tmp *= 16;
279  a = a / 10;
280  }
281  return PdgCode(hex_pdg);
282  }
283 
284  /****************************************************************************
285  * *
286  * accessors of various properties *
287  * *
288  ****************************************************************************/
289 
291  inline bool is_nucleus() const {
292  assert(digits_.is_nucleus_ == nucleus_.is_nucleus_);
293  return nucleus_.is_nucleus_;
294  }
295 
297  inline bool is_hadron() const {
298  return (digits_.n_q3_ != 0 && digits_.n_q2_ != 0 && !is_nucleus());
299  }
300 
302  inline bool is_lepton() const {
303  return (digits_.n_q1_ == 0 && digits_.n_q2_ == 0 && digits_.n_q3_ == 1 &&
304  !is_nucleus());
305  }
306 
308  inline int baryon_number() const {
309  if (is_nucleus()) {
310  return static_cast<int>(nucleus_.A_) * antiparticle_sign();
311  }
312  if (!is_hadron() || digits_.n_q1_ == 0) {
313  return 0;
314  }
316  }
318  inline bool is_baryon() const { return is_hadron() && digits_.n_q1_ != 0; }
319 
321  inline bool is_meson() const { return is_hadron() && digits_.n_q1_ == 0; }
322 
324  inline bool is_nucleon() const {
325  const auto abs_code = std::abs(code());
326  return (abs_code == pdg::p || abs_code == pdg::n);
327  }
328 
330  inline bool is_proton() const {
331  const auto abs_code = std::abs(code());
332  return (abs_code == pdg::p);
333  }
334 
336  inline bool is_neutron() const {
337  const auto abs_code = std::abs(code());
338  return (abs_code == pdg::n);
339  }
340 
342  inline bool is_Nstar1535() const {
343  const auto abs_code = std::abs(code());
344  return (abs_code == pdg::N1535_p || abs_code == pdg::N1535_z);
345  }
346 
348  inline bool is_Delta() const {
349  const auto abs_code = std::abs(code());
350  return (abs_code == pdg::Delta_pp || abs_code == pdg::Delta_p ||
351  abs_code == pdg::Delta_z || abs_code == pdg::Delta_m);
352  }
353 
355  inline bool is_hyperon() const { return is_hadron() && digits_.n_q1_ == 3; }
356 
358  inline bool is_Omega() const {
359  return is_hyperon() && digits_.n_q2_ == 3 && digits_.n_q3_ == 3;
360  }
361 
363  inline bool is_Xi() const {
364  return is_hyperon() && digits_.n_q2_ == 3 && digits_.n_q3_ != 3;
365  }
366 
368  inline bool is_Lambda() const {
369  return is_hyperon() && digits_.n_q2_ == 1 && digits_.n_q3_ == 2;
370  }
371 
373  inline bool is_Sigma() const {
374  return is_hyperon() && digits_.n_q2_ != 3 && !is_Lambda();
375  }
376 
378  inline bool is_kaon() const {
379  const auto abs_code = std::abs(code());
380  return (abs_code == pdg::K_p) || (abs_code == pdg::K_z);
381  }
382 
384  inline bool is_pion() const {
385  const auto c = code();
386  return (c == pdg::pi_z) || (c == pdg::pi_p) || (c == pdg::pi_m);
387  }
388 
390  inline bool is_rho() const {
391  const auto c = code();
392  return (c == pdg::rho_z) || (c == pdg::rho_p) || (c == pdg::rho_m);
393  }
394 
396  inline bool is_deuteron() const {
397  const int dec = get_decimal();
398  return is_nucleus() && (dec == pdg::decimal_d || dec == pdg::decimal_antid);
399  }
400 
405  bool has_antiparticle() const {
406  if (is_nucleus()) {
407  return true;
408  }
409  if (is_hadron()) {
410  return (baryon_number() != 0) || (digits_.n_q2_ != digits_.n_q3_);
411  } else {
412  return digits_.n_q3_ == 1; // leptons!
413  }
414  }
415 
421  inline int isospin3() const {
422  /* net_quark_number(2) is the number of u quarks,
423  * net_quark_number(1) is the number of d quarks. */
424  return net_quark_number(2) - net_quark_number(1);
425  }
426 
434  inline double frac_strange() const {
435  /* The quarkonium state has 0 net strangeness
436  * but there are actually 2 strange quarks out of 2 total */
437  if (is_hadron() && digits_.n_q3_ == 3 && digits_.n_q2_ == 3) {
438  return 1.;
439  } else {
440  // For all other cases, there isn't both a strange and anti-strange
441  if (is_baryon()) {
442  return std::abs(strangeness()) / 3.;
443  } else if (is_meson()) {
444  return std::abs(strangeness()) / 2.;
445  } else {
446  /* If not baryon or meson, this should be 0, as AQM does not
447  * extend to non-hadrons */
448  return 0.;
449  }
450  }
451  }
452 
458  inline int strangeness() const { return -net_quark_number(3); }
459 
465  inline int charmness() const { return +net_quark_number(4); }
466 
472  inline int bottomness() const { return -net_quark_number(5); }
473 
482  int charge() const {
483  if (is_hadron() || is_nucleus()) {
484  // Q will accumulate 3*charge (please excuse the upper case. I
485  // want to distinguish this from q which might be interpreted as
486  // shorthand for "quark".)
487  int Q = 0;
488  /* This loops over d,u,s,c,b,t quarks (the latter can be safely ignored,
489  * but I don't think this will be a bottle neck. */
490  for (int i = 1; i < 7; i++) {
491  /* u,c,t quarks have charge = 2/3 e, while d,s,b quarks have -1/3 e.
492  * The antiparticle sign is already in net_quark_number. */
493  Q += (i % 2 == 0 ? 2 : -1) * net_quark_number(i);
494  }
495  return Q / 3;
496  }
497  /* non-hadron:
498  * Leptons: 11, 13, 15 are e, μ, τ and have a charge -1, while
499  * 12, 14, 16 are the neutrinos that have no charge. */
500  if (digits_.n_q3_ == 1) {
501  return -1 * (digits_.n_J_ % 2) * antiparticle_sign();
502  }
503  /* Bosons: 24 is the W+, all else is uncharged.
504  * we ignore the first digits so that this also finds strange gauge
505  * boson "resonances" (in particular, \f$\tilde \chi_1^+\f$ with PDG
506  * Code 1000024). */
507  if ((dump_ & 0x0000ffff) == 0x24) {
508  return antiparticle_sign();
509  }
510  // default (this includes all other Bosons) is 0.
511  return 0;
512  }
513 
521  inline unsigned int spin() const {
522  if (is_nucleus()) {
523  /* Currently the only nucleus I care about is deutron,
524  * which has spin one. */
525  return 2;
526  }
527 
528  if (is_hadron()) {
529  if (digits_.n_J_ == 0) {
530  return 0; // special cases: K0_L=0x130 & K0_S=0x310
531  } else {
532  return digits_.n_J_ - 1;
533  }
534  }
535  /* this assumes that we only have white particles (no single
536  * quarks): Electroweak fermions have 11-17, so the
537  * second-to-last-digit is the spin. The same for the Bosons: they
538  * have 21-29 and 2spin = 2 (this fails for the Higgs). */
539  return digits_.n_q3_;
540  }
542  inline unsigned int spin_degeneracy() const {
543  if (is_hadron() && digits_.n_J_ > 0) {
544  return digits_.n_J_;
545  }
546  return spin() + 1;
547  }
549  inline int antiparticle_sign() const {
550  return (digits_.antiparticle_ ? -1 : +1);
551  }
553  inline std::int32_t quarks() const {
554  if (!is_hadron() || is_nucleus()) {
555  return 0;
556  }
557  return chunks_.quarks_;
558  }
559 
569  std::array<int, 3> quark_content() const {
570  std::array<int, 3> result = {static_cast<int>(digits_.n_q1_),
571  static_cast<int>(digits_.n_q2_),
572  static_cast<int>(digits_.n_q3_)};
573  if (is_hadron()) {
574  // Antibaryons
575  if (digits_.n_q1_ != 0 && digits_.antiparticle_) {
576  for (size_t i = 0; i < 3; i++) {
577  result[i] = -result[i];
578  }
579  }
580  // Mesons
581  if (digits_.n_q1_ == 0) {
582  // Own antiparticle
583  if (digits_.n_q2_ == digits_.n_q3_) {
584  result[2] = -result[2];
585  } else {
586  // Like pi-
587  if (digits_.antiparticle_) {
588  result[1] = -result[1];
589  // Like pi+
590  } else {
591  result[2] = -result[2];
592  }
593  }
594  // add extra minus sign according to the pdg convention
595  if (digits_.n_q2_ != digits_.n_q3_ && digits_.n_q2_ % 2 == 1) {
596  for (int i = 1; i <= 2; i++) {
597  result[i] = -result[i];
598  }
599  }
600  }
601  } else {
602  result = {0, 0, 0};
603  }
604  return result;
605  }
606 
617  bool contains_enough_valence_quarks(int valence_quarks_required) const;
618 
619  /****************************************************************************
620  * *
621  * operations with more than one PDG Code *
622  * *
623  ****************************************************************************/
624 
629  inline bool operator<(const PdgCode rhs) const {
630  return dump_ < rhs.dump_;
631  /* the complex thing to do here is to calculate:
632  * code() < rhs.code()
633  * but for getting a total order that's overkill. The uint32_t value in
634  * dump_ works just fine. */
635  }
636 
638  inline bool operator==(const PdgCode rhs) const { return dump_ == rhs.dump_; }
639 
641  inline bool operator!=(const PdgCode rhs) const { return !(*this == rhs); }
642 
644  inline bool is_antiparticle_of(const PdgCode rhs) const {
645  return code() == -rhs.code();
646  }
647 
649  friend std::istream& operator>>(std::istream& is, PdgCode& code);
650 
656  static PdgCode invalid() { return PdgCode(0x0); }
657 
667  int32_t get_decimal() const {
668  if (is_nucleus()) {
669  // ±10LZZZAAAI
670  return antiparticle_sign() *
671  (nucleus_.I_ + 10 * nucleus_.A_ + 10000 * nucleus_.Z_ +
672  10000000 * nucleus_.n_Lambda_ + 1000000000);
673  }
674  int n_J_1 = 0;
675  int n_J_2 = digits_.n_J_;
676  if (n_J_2 > 9) {
677  n_J_1 = n_J_2 - 9;
678  n_J_2 = 9;
679  }
680  return antiparticle_sign() *
681  (n_J_2 + digits_.n_q3_ * 10 + digits_.n_q2_ * 100 +
682  digits_.n_q1_ * 1000 + digits_.n_L_ * 10000 +
683  digits_.n_R_ * 100000 + digits_.n_ * 1000000 + n_J_1 * 10000000);
684  }
685 
687  void deexcite() {
688  if (!is_nucleus()) {
689  chunks_.excitation_ = 0;
690  } else {
691  nucleus_.I_ = 0;
692  }
693  }
694 
705  int net_quark_number(const int quark) const;
706 
707  private:
708 /* amend this line with something that identifies your compiler if its
709  * bit field order is like in the gnu c compiler for 64 bit
710  * architectures (if you are unsure, try one and check the pdgcode
711  * test). */
712 #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) || \
713  defined(DOXYGEN)
714 #define SMASH_BITFIELD_ORDER_ 1
715 /* put your compiler here if the bit field order is reversed w.r.t. gnu
716  * c compiler for 64 bit. */
717 #elif defined(__OTHER_COMPILER__)
718 #define SMASH_BITFIELD_ORDER_ 2
719 #else
720 #error "Please determine the correct bit-field order for your target/compiler"
721 #endif
722 
727  union {
732  struct {
733 #if SMASH_BITFIELD_ORDER_ == 1
734  std::uint32_t n_J_ : 4;
737  std::uint32_t n_q3_ : 4;
739  std::uint32_t n_q2_ : 4;
741  std::uint32_t n_q1_ : 4;
743  std::uint32_t n_L_ : 4;
745  std::uint32_t n_R_ : 4;
747  std::uint32_t n_ : 4, : 2;
749  bool is_nucleus_ : 1;
751  bool antiparticle_ : 1;
752 #else // reverse ordering
753  bool antiparticle_ : 1;
754  bool is_nucleus : 1, : 2;
755  std::uint32_t n_ : 4;
756  std::uint32_t n_R_ : 4;
757  std::uint32_t n_L_ : 4;
758  std::uint32_t n_q1_ : 4;
759  std::uint32_t n_q2_ : 4;
760  std::uint32_t n_q3_ : 4;
761  std::uint32_t n_J_ : 4;
762 #endif
763  } digits_;
768  std::uint32_t dump_;
773  struct {
774 #if SMASH_BITFIELD_ORDER_ == 1
775  std::uint32_t : 4;
777  std::uint32_t quarks_ : 12;
779  std::uint32_t excitation_ : 12, : 4;
780 #else
781  std::uint32_t : 4, excitation_ : 12;
782  std::uint32_t quarks_ : 12, : 4;
783 #endif
786  struct {
787 #if SMASH_BITFIELD_ORDER_ == 1
788  std::uint32_t n_Lambda_ : 6;
789  std::uint32_t Z_ : 10;
790  std::uint32_t A_ : 10;
791  std::uint32_t I_ : 4;
792  bool is_nucleus_ : 1;
793  bool antiparticle_ : 1;
794 #else // Reverse ordering
795  bool antiparticle_ : 1;
796  bool is_nucleus_ : 1;
797  std::uint32_t I_ : 4;
798  std::uint32_t A_ : 10;
799  std::uint32_t Z_ : 10;
800  std::uint32_t n_Lambda_ : 6;
801 #endif
802  } nucleus_;
803  };
804 
809  inline std::uint32_t ucode() const { return (dump_ & 0x0fffffff); }
810 
817  inline std::uint32_t get_digit_from_char(const char inp) const {
818  // Decimal digit
819  if (48 <= inp && inp <= 57) {
820  return inp - 48;
821  }
822  // Hexdecimal digit, uppercase
823  if (65 <= inp && inp <= 70) {
824  return inp - 65 + 10;
825  }
826  // Hexdecimal digit, lowercase
827  if (97 <= inp && inp <= 102) {
828  return inp - 97 + 10;
829  }
830  throw InvalidPdgCode("PdgCode: Invalid character " + std::string(&inp, 1) +
831  " found.\n");
832  }
833 
855  inline void set_from_string(const std::string& codestring) {
856  dump_ = 0;
857  // Implicit with the above: digits_.antiparticle_ = false;
858  digits_.n_ = digits_.n_R_ = digits_.n_L_ = digits_.n_q1_ = digits_.n_q2_ =
859  digits_.n_q3_ = digits_.n_J_ = digits_.is_nucleus_ = 0;
860  size_t length = codestring.size();
861  if (length < 1) {
862  throw InvalidPdgCode("Empty string does not contain PDG Code\n");
863  }
864  int c = 0;
865  /* Look at current character; if it is a + or minus sign, read it
866  * and advance to next char. */
867  if (codestring[c] == '-') {
868  digits_.antiparticle_ = true;
869  ++c;
870  } else if (codestring[c] == '+') {
871  digits_.antiparticle_ = false;
872  ++c;
873  }
874  // Save if the first character was a sign:
875  unsigned int sign = c;
876 
877  // Nucleus
878  if (length == 10 + sign) {
879  nucleus_.is_nucleus_ = true;
880  if (codestring[c] != '1' || codestring[c + 1] != '0') {
881  throw InvalidPdgCode("Pdg code of nucleus \"" + codestring +
882  "\" should start with 10\n");
883  }
884  c += 2;
885  // ±10LZZZAAAI is the standard for nuclei
886  std::array<int, 8> digits;
887  for (int i = 0; i < 8; i++) {
888  digits[i] = get_digit_from_char(codestring[c + i]);
889  }
890  nucleus_.n_Lambda_ = digits[0];
891  nucleus_.Z_ = 100 * digits[1] + 10 * digits[2] + digits[3];
892  nucleus_.A_ = 100 * digits[4] + 10 * digits[5] + digits[6];
893  nucleus_.I_ = digits[7];
894  return;
895  }
896 
897  // Codestring shouldn't be longer than 8 + sign, except for nuclei
898  if (length > 8 + sign) {
899  throw InvalidPdgCode("String \"" + codestring +
900  "\" too long for PDG Code\n");
901  }
902  /* Please note that in what follows, we actually need c++, not ++c.
903  * first digit is used for n_J if the last digit is not enough. */
904  if (length > 7 + sign) {
905  digits_.n_J_ += get_digit_from_char(codestring[c++]);
906  }
907  // Codestring has 7 digits? 7th from last goes in n_.
908  if (length > 6 + sign) {
909  digits_.n_ = get_digit_from_char(codestring[c++]);
910  }
911  // It has 6 or 7 digits? 6th from last is n_R_.
912  if (length > 5 + sign) {
913  digits_.n_R_ = get_digit_from_char(codestring[c++]);
914  }
915  // 5th from last is n_L_.
916  if (length > 4 + sign) {
917  digits_.n_L_ = get_digit_from_char(codestring[c++]);
918  }
919  // 4th from last is n_q1_.
920  if (length > 3 + sign) {
921  digits_.n_q1_ = get_digit_from_char(codestring[c++]);
922  if (digits_.n_q1_ > 6) {
923  throw InvalidPdgCode("Invalid PDG code " + codestring + " (n_q1>6)");
924  }
925  }
926  // 3rd from last is n_q2_.
927  if (length > 2 + sign) {
928  digits_.n_q2_ = get_digit_from_char(codestring[c++]);
929  if (digits_.n_q2_ > 6) {
930  throw InvalidPdgCode("Invalid PDG code " + codestring + " (n_q2>6)");
931  }
932  }
933  // Next to last is n_q3_.
934  if (length > 1 + sign) {
935  digits_.n_q3_ = get_digit_from_char(codestring[c++]);
936  if (digits_.n_q3_ > 6) {
937  throw InvalidPdgCode("Invalid PDG code " + codestring + " (n_q3>6)");
938  }
939  }
940  // Last digit is the spin degeneracy.
941  if (length > sign) {
942  digits_.n_J_ += get_digit_from_char(codestring[c++]);
943  } else {
944  throw InvalidPdgCode(
945  "String \"" + codestring +
946  "\" only consists of a sign, that is no valid PDG Code\n");
947  }
948  check();
949  }
950 
960  inline void set_fields(std::uint32_t abscode) {
961  /* "dump_ =" overwrites antiparticle_, but this needs to have been set
962  * already, so we carry it around the assignment. */
963  bool ap = digits_.antiparticle_;
964  dump_ = abscode & 0x0fffffff;
965  digits_.antiparticle_ = ap;
966  int test = test_code();
967  if (test > 0) {
968  throw InvalidPdgCode("Invalid digits " + std::to_string(test) +
969  " in PDG Code " + string());
970  }
971  check();
972  }
973 };
974 
975 static_assert(sizeof(PdgCode) == 4, "should fit into 32 bit integer");
976 
983 std::istream& operator>>(std::istream& is, PdgCode& code);
989 std::ostream& operator<<(std::ostream& is, const PdgCode& code);
990 
992 inline bool is_dilepton(const PdgCode pdg1, const PdgCode pdg2) {
993  const auto c1 = pdg1.code();
994  const auto c2 = pdg2.code();
995  const auto min = std::min(c1, c2);
996  const auto max = std::max(c1, c2);
997  return (max == 0x11 && min == -0x11) || (max == 0x13 && min == -0x13);
998 }
999 
1004 inline bool has_lepton_pair(const PdgCode pdg1, const PdgCode pdg2,
1005  const PdgCode pdg3) {
1006  return is_dilepton(pdg1, pdg2) || is_dilepton(pdg1, pdg3) ||
1007  is_dilepton(pdg2, pdg3);
1008 }
1009 
1010 } // namespace smash
1011 
1012 #endif // SRC_INCLUDE_SMASH_PDGCODE_H_
smash::PdgCode::is_Lambda
bool is_Lambda() const
Definition: pdgcode.h:365
smash::PdgCode::net_quark_number
int net_quark_number(const int quark) const
Returns the net number of quarks with given flavour number For public use, see strangeness(),...
Definition: pdgcode.cc:31
smash
Definition: action.h:24
smash::PdgCode::frac_strange
double frac_strange() const
Definition: pdgcode.h:431
smash::PdgCode::get_antiparticle
PdgCode get_antiparticle() const
Construct the antiparticle to a given PDG code.
Definition: pdgcode.h:257
smash::PdgCode::excitation_
std::uint32_t excitation_
The excitation digits n_, n_R_, n_L_.
Definition: pdgcode.h:775
smash::PdgCode::quark_content
std::array< int, 3 > quark_content() const
The return is always an array of three numbers, which are pdgcodes of quarks: 1 - d,...
Definition: pdgcode.h:566
smash::PdgCode::n_q3_
std::uint32_t n_q3_
third quark field
Definition: pdgcode.h:733
smash::PdgCode::n_J_
std::uint32_t n_J_
spin quantum number .
Definition: pdgcode.h:731
smash::PdgCode::baryon_number
int baryon_number() const
Definition: pdgcode.h:305
smash::PdgCode::is_nucleon
bool is_nucleon() const
Definition: pdgcode.h:321
smash::PdgCode::Z_
std::uint32_t Z_
Definition: pdgcode.h:785
smash::PdgCode::is_hadron
bool is_hadron() const
Definition: pdgcode.h:294
smash::PdgCode::is_Sigma
bool is_Sigma() const
Definition: pdgcode.h:370
smash::PdgCode::from_decimal
static PdgCode from_decimal(const int pdgcode_decimal)
Construct PDG code from decimal number.
Definition: pdgcode.h:267
smash::PdgCode::spin
unsigned int spin() const
Definition: pdgcode.h:518
smash::PdgCode::spin_degeneracy
unsigned int spin_degeneracy() const
Definition: pdgcode.h:539
smash::PdgCode::is_Delta
bool is_Delta() const
Definition: pdgcode.h:345
smash::PdgCode::is_pion
bool is_pion() const
Definition: pdgcode.h:381
smash::pdg::Delta_m
constexpr int Delta_m
Δ⁻.
Definition: pdgcode_constants.h:44
smash::PdgCode::n_L_
std::uint32_t n_L_
"angular momentum"
Definition: pdgcode.h:739
smash::PdgCode::n_R_
std::uint32_t n_R_
"radial excitation"
Definition: pdgcode.h:741
smash::operator<<
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Definition: action.h:518
smash::PdgCode::antiparticle_sign
int antiparticle_sign() const
Definition: pdgcode.h:546
smash::PdgCode::is_lepton
bool is_lepton() const
Definition: pdgcode.h:299
smash::pdg::Delta_p
constexpr int Delta_p
Δ⁺.
Definition: pdgcode_constants.h:40
smash::pdg::rho_z
constexpr int rho_z
ρ⁰.
Definition: pdgcode_constants.h:85
smash::PdgCode::n_q2_
std::uint32_t n_q2_
second quark field
Definition: pdgcode.h:735
smash::PdgCode::is_kaon
bool is_kaon() const
Definition: pdgcode.h:375
smash::PdgCode::is_nucleus
bool is_nucleus() const
Definition: pdgcode.h:288
smash::pdg::rho_p
constexpr int rho_p
ρ⁺.
Definition: pdgcode_constants.h:83
smash::PdgCode::nucleus_
struct smash::PdgCode::@0::@4 nucleus_
Structure for the nuclei.
smash::PdgCode::operator<
bool operator<(const PdgCode rhs) const
Sorts PDG Codes according to their numeric value.
Definition: pdgcode.h:625
smash::pdg::Delta_z
constexpr int Delta_z
Δ⁰.
Definition: pdgcode_constants.h:42
smash::PdgCode::chunks_
struct smash::PdgCode::@0::@3 chunks_
Chunk collection: here, the chunks with and are directly accessible.
smash::PdgCode::is_rho
bool is_rho() const
Definition: pdgcode.h:387
smash::PdgCode::dump
std::uint32_t dump() const
Dumps the bitfield into an unsigned integer.
Definition: pdgcode.h:241
smash::pdg::pi_z
constexpr int pi_z
π⁰.
Definition: pdgcode_constants.h:64
smash::PdgCode::digits_
struct smash::PdgCode::@0::@2 digits_
The single digits collection of the code.
smash::PdgCode::is_hyperon
bool is_hyperon() const
Definition: pdgcode.h:352
smash::pdg::N1535_p
constexpr int N1535_p
N(1535)⁺.
Definition: pdgcode_constants.h:33
smash::PdgCode::get_decimal
int32_t get_decimal() const
Definition: pdgcode.h:663
smash::PdgCode::set_fields
void set_fields(std::uint32_t abscode)
Sets the bitfield from an unsigned integer.
Definition: pdgcode.h:956
smash::PdgCode::isospin3
int isospin3() const
Definition: pdgcode.h:418
smash::PdgCode::I_
std::uint32_t I_
Definition: pdgcode.h:787
smash::PdgCode::ucode
std::uint32_t ucode() const
Definition: pdgcode.h:805
smash::PdgCode::is_proton
bool is_proton() const
Definition: pdgcode.h:327
smash::PdgCode::string
std::string string() const
Definition: pdgcode.h:250
smash::PdgCode::is_nucleus_
std::uint32_t bool is_nucleus_
1 for nuclei, 0 for the rest
Definition: pdgcode.h:743
smash::PdgCode::deexcite
void deexcite()
Remove all excitation, except spin. Sign and quark content remains.
Definition: pdgcode.h:683
smash::PdgCode::set_from_string
void set_from_string(const std::string &codestring)
Set the PDG code from the given string.
Definition: pdgcode.h:851
smash::PdgCode::charge
int charge() const
The charge of the particle.
Definition: pdgcode.h:479
smash::PdgCode::bottomness
int bottomness() const
Definition: pdgcode.h:469
smash::pdg::decimal_antid
constexpr int decimal_antid
Anti-deuteron in decimal digits.
Definition: pdgcode_constants.h:95
smash::PdgCode::quarks_
std::uint32_t quarks_
The quark digits n_q{1,2,3}_.
Definition: pdgcode.h:773
smash::pdg::N1535_z
constexpr int N1535_z
N(1535)⁰.
Definition: pdgcode_constants.h:35
smash::pdg::decimal_d
constexpr int decimal_d
Deuteron in decimal digits.
Definition: pdgcode_constants.h:93
smash::operator>>
std::istream & operator>>(std::istream &is, PdgCode &code)
Sets the PDG code from the textual representation in the input stream.
Definition: pdgcode.cc:14
smash::PdgCode
Definition: pdgcode.h:108
smash::PdgCode::A_
std::uint32_t A_
Definition: pdgcode.h:786
smash::PdgCode::n_
std::uint32_t n_
first field: "counter"
Definition: pdgcode.h:743
smash::PdgCode::n_Lambda_
std::uint32_t n_Lambda_
Definition: pdgcode.h:784
smash::pdg::K_z
constexpr int K_z
K⁰.
Definition: pdgcode_constants.h:71
smash::PdgCode::is_neutron
bool is_neutron() const
Definition: pdgcode.h:333
smash::PdgCode::is_antiparticle_of
bool is_antiparticle_of(const PdgCode rhs) const
Definition: pdgcode.h:640
pdgcode_constants.h
smash::PdgCode::operator>>
friend std::istream & operator>>(std::istream &is, PdgCode &code)
istream >> PdgCode assigns the PDG Code from an istream.
Definition: pdgcode.cc:14
smash::PdgCode::dump_
std::uint32_t dump_
The bitfield dumped into a single integer.
Definition: pdgcode.h:764
smash::PdgCode::test_code
int test_code() const
Checks the integer for invalid hex digits.
Definition: pdgcode.h:178
smash::PdgCode::n_q1_
std::uint32_t n_q1_
first quark field. 0 for mesons.
Definition: pdgcode.h:737
smash::pdg::Delta_pp
constexpr int Delta_pp
Δ⁺⁺.
Definition: pdgcode_constants.h:38
smash::PdgCode::charmness
int charmness() const
Definition: pdgcode.h:462
smash::PdgCode::strangeness
int strangeness() const
Definition: pdgcode.h:455
smash::PdgCode::operator==
bool operator==(const PdgCode rhs) const
Definition: pdgcode.h:634
smash::PdgCode::is_deuteron
bool is_deuteron() const
Definition: pdgcode.h:393
smash::PdgCode::quarks
std::int32_t quarks() const
Definition: pdgcode.h:550
smash::has_lepton_pair
bool has_lepton_pair(const PdgCode pdg1, const PdgCode pdg2, const PdgCode pdg3)
Definition: pdgcode.h:1004
smash::PdgCode::operator!=
bool operator!=(const PdgCode rhs) const
Definition: pdgcode.h:637
smash::PdgCode::check
void check() const
Do all sorts of validity checks.
Definition: pdgcode.h:212
smash::PdgCode::invalid
static PdgCode invalid()
PdgCode 0x0 is guaranteed not to be valid by the PDG standard, but it passes all tests here,...
Definition: pdgcode.h:652
smash::PdgCode::PdgCode
PdgCode()
Standard initializer.
Definition: pdgcode.h:124
smash::PdgCode::contains_enough_valence_quarks
bool contains_enough_valence_quarks(int valence_quarks_required) const
Definition: pdgcode.cc:92
smash::PdgCode::is_Xi
bool is_Xi() const
Definition: pdgcode.h:360
smash::PdgCode::antiparticle_
bool antiparticle_
first bit: stores the sign.
Definition: pdgcode.h:747
smash::PdgCode::get_digit_from_char
std::uint32_t get_digit_from_char(const char inp) const
Definition: pdgcode.h:813
smash::PdgCode::InvalidPdgCode
Definition: pdgcode.h:114
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28
smash::PdgCode::is_baryon
bool is_baryon() const
Definition: pdgcode.h:315
smash::PdgCode::has_antiparticle
bool has_antiparticle() const
Definition: pdgcode.h:402
smash::pdg::n
constexpr int n
Neutron.
Definition: pdgcode_constants.h:30
smash::pdg::rho_m
constexpr int rho_m
ρ⁻.
Definition: pdgcode_constants.h:87
smash::PdgCode::is_Omega
bool is_Omega() const
Definition: pdgcode.h:355
smash::pdg::pi_m
constexpr int pi_m
π⁻.
Definition: pdgcode_constants.h:66
smash::PdgCode::code
std::int32_t code() const
Definition: pdgcode.h:247
smash::is_dilepton
bool is_dilepton(const PdgCode pdg1, const PdgCode pdg2)
Definition: pdgcode.h:992
smash::PdgCode::is_Nstar1535
bool is_Nstar1535() const
Definition: pdgcode.h:339
smash::pdg::pi_p
constexpr int pi_p
π⁺.
Definition: pdgcode_constants.h:62
smash::PdgCode::is_meson
bool is_meson() const
Definition: pdgcode.h:318
smash::pdg::K_p
constexpr int K_p
K⁺.
Definition: pdgcode_constants.h:69