  | 
  
     Version: SMASH-1.8 
   | 
           
 | 
 
 
 
 
Go to the documentation of this file.
   10 #ifndef SRC_INCLUDE_PDGCODE_H_ 
   11 #define SRC_INCLUDE_PDGCODE_H_ 
  115     using std::invalid_argument::invalid_argument;
 
  131   explicit PdgCode(
const std::string& codestring) {
 
  145     if (codenumber < 0) {
 
  147       codenumber = -codenumber;
 
  155   explicit PdgCode(
const std::uint32_t abscode) : 
dump_(0x0) {
 
  157     digits_.antiparticle_ = ((abscode & 0x80000000u) != 0);
 
  220           throw InvalidPdgCode(
"Invalid PDG code " + 
string() +
 
  221                                " (meson with even n_J)");
 
  225           throw InvalidPdgCode(
"Invalid PDG code " + 
string() +
 
  226                                " (baryon with odd n_J)");
 
  231         throw InvalidPdgCode(
"Invalid PDG code " + 
string() + 
" (n_J==0)");
 
  237       throw InvalidPdgCode(
"Invalid PDG code " + 
string() +
 
  238                            " (cannot be negative)");
 
  243   inline std::uint32_t 
dump()
 const {
 
  245     return (
dump_ & 0x8fffffff);
 
  252   inline std::string 
string()
 const {
 
  253     std::stringstream ss;
 
  271     if (std::abs(pdgcode_decimal) > 1E7) {
 
  272       return PdgCode(std::to_string(pdgcode_decimal));
 
  274     int a = pdgcode_decimal;
 
  275     int hex_pdg = 0, tmp = 1;
 
  277       hex_pdg += (a % 10) * tmp;
 
  325     const auto abs_code = std::abs(
code());
 
  331     const auto abs_code = std::abs(
code());
 
  337     const auto abs_code = std::abs(
code());
 
  351   inline bool is_Xi()
 const {
 
  367     const auto abs_code = std::abs(
code());
 
  373     const auto c = 
code();
 
  378   inline bool is_rho()
 const {
 
  379     const auto c = 
code();
 
  478       for (
int i = 1; i < 7; i++) {
 
  495     if ((
dump_ & 0x0000ffff) == 0x24) {
 
  509   inline unsigned int spin()
 const {
 
  541   inline std::int32_t 
quarks()
 const {
 
  558     std::array<int, 3> result = {static_cast<int>(
digits_.n_q1_),
 
  559                                  static_cast<int>(
digits_.n_q2_),
 
  560                                  static_cast<int>(
digits_.n_q3_)};
 
  564         for (
size_t i = 0; i < 3; i++) {
 
  565           result[i] = -result[i];
 
  572           result[2] = -result[2];
 
  576             result[1] = -result[1];
 
  579             result[2] = -result[2];
 
  584           for (
int i = 1; i <= 2; i++) {
 
  585             result[i] = -result[i];
 
  618     return dump_ < rhs.dump_;
 
  633     return code() == -rhs.code();
 
  660               10000000 * 
nucleus_.n_Lambda_ + 1000000000);
 
  700 #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) || \ 
  702 #define SMASH_BITFIELD_ORDER_ 1 
  705 #elif defined(__OTHER_COMPILER__) 
  706 #define SMASH_BITFIELD_ORDER_ 2 
  708 #error "Please determine the correct bit-field order for your target/compiler" 
  721 #if SMASH_BITFIELD_ORDER_ == 1 
  722       std::uint32_t 
n_J_ : 4;
 
  733       std::uint32_t 
n_R_ : 4;
 
  735       std::uint32_t 
n_ : 4, : 2;
 
  740 #else  // reverse ordering 
  743       std::uint32_t 
n_ : 4;
 
  744       std::uint32_t 
n_R_ : 4;
 
  745       std::uint32_t 
n_L_ : 4;
 
  746       std::uint32_t 
n_q1_ : 4;
 
  747       std::uint32_t 
n_q2_ : 4;
 
  748       std::uint32_t 
n_q3_ : 4;
 
  749       std::uint32_t 
n_J_ : 4;
 
  762 #if SMASH_BITFIELD_ORDER_ == 1 
  769       std::uint32_t : 4, excitation_ : 12; 
  770       std::uint32_t 
quarks_ : 12, : 4;
 
  775 #if SMASH_BITFIELD_ORDER_ == 1 
  777       std::uint32_t 
Z_ : 10;
 
  778       std::uint32_t 
A_ : 10;
 
  779       std::uint32_t 
I_ : 4;
 
  782 #else  // Reverse ordering 
  785       std::uint32_t 
I_ : 4;
 
  786       std::uint32_t 
A_ : 10;
 
  787       std::uint32_t 
Z_ : 10;
 
  797   inline std::uint32_t 
ucode()
 const { 
return (
dump_ & 0x0fffffff); }
 
  807     if (48 <= inp && inp <= 57) {
 
  811     if (65 <= inp && inp <= 70) {
 
  812       return inp - 65 + 10;
 
  815     if (97 <= inp && inp <= 102) {
 
  816       return inp - 97 + 10;
 
  818     throw InvalidPdgCode(
"PdgCode: Invalid character " + std::string(&inp, 1) +
 
  848     size_t length = codestring.size();
 
  850       throw InvalidPdgCode(
"Empty string does not contain PDG Code\n");
 
  855     if (codestring[c] == 
'-') {
 
  858     } 
else if (codestring[c] == 
'+') {
 
  863     unsigned int sign = c;
 
  866     if (length == 10 + sign) {
 
  868       if (codestring[c] != 
'1' || codestring[c + 1] != 
'0') {
 
  869         throw InvalidPdgCode(
"Pdg code of nucleus \"" + codestring +
 
  870                              "\" should start with 10\n");
 
  874       std::array<int, 8> digits;
 
  875       for (
int i = 0; i < 8; i++) {
 
  879       nucleus_.Z_ = 100 * digits[1] + 10 * digits[2] + digits[3];
 
  880       nucleus_.A_ = 100 * digits[4] + 10 * digits[5] + digits[6];
 
  886     if (length > 8 + sign) {
 
  887       throw InvalidPdgCode(
"String \"" + codestring +
 
  888                            "\" too long for PDG Code\n");
 
  892     if (length > 7 + sign) {
 
  896     if (length > 6 + sign) {
 
  900     if (length > 5 + sign) {
 
  904     if (length > 4 + sign) {
 
  908     if (length > 3 + sign) {
 
  911         throw InvalidPdgCode(
"Invalid PDG code " + codestring + 
" (n_q1>6)");
 
  915     if (length > 2 + sign) {
 
  918         throw InvalidPdgCode(
"Invalid PDG code " + codestring + 
" (n_q2>6)");
 
  922     if (length > 1 + sign) {
 
  925         throw InvalidPdgCode(
"Invalid PDG code " + codestring + 
" (n_q3>6)");
 
  932       throw InvalidPdgCode(
 
  933           "String \"" + codestring +
 
  934           "\" only consists of a sign, that is no valid PDG Code\n");
 
  948   inline void set_fields(std::uint32_t abscode) {
 
  951     bool ap = 
digits_.antiparticle_;
 
  952     dump_ = abscode & 0x0fffffff;
 
  956       throw InvalidPdgCode(
"Invalid digits " + std::to_string(test) +
 
  957                            " in PDG Code " + 
string());
 
  963 static_assert(
sizeof(PdgCode) == 4, 
"should fit into 32 bit integer");
 
  971 std::istream& 
operator>>(std::istream& is, PdgCode& code);
 
  977 std::ostream& 
operator<<(std::ostream& is, 
const PdgCode& code);
 
  981   const auto c1 = pdg1.
code();
 
  982   const auto c2 = pdg2.
code();
 
  983   const auto min = std::min(c1, c2);
 
  984   const auto max = std::max(c1, c2);
 
  985   return (max == 0x11 && min == -0x11) || (max == 0x13 && min == -0x13);
 
 1000 #endif  // SRC_INCLUDE_PDGCODE_H_ 
  
 
int net_quark_number(const int quark) const
Returns the net number of quarks with given flavour number For public use, see strangeness(),...
 
double frac_strange() const
 
PdgCode get_antiparticle() const
Construct the antiparticle to a given PDG code.
 
std::uint32_t excitation_
The excitation digits n_, n_R_, n_L_.
 
std::array< int, 3 > quark_content() const
The return is always an array of three numbers, which are pdgcodes of quarks: 1 - d,...
 
std::uint32_t n_q3_
third quark field
 
std::uint32_t n_J_
spin quantum number .
 
int baryon_number() const
 
static PdgCode from_decimal(const int pdgcode_decimal)
Construct PDG code from decimal number.
 
unsigned int spin() const
 
unsigned int spin_degeneracy() const
 
std::uint32_t n_L_
"angular momentum"
 
std::uint32_t n_R_
"radial excitation"
 
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
 
int antiparticle_sign() const
 
std::uint32_t n_q2_
second quark field
 
struct smash::PdgCode::@0::@4 nucleus_
Structure for the nuclei.
 
bool operator<(const PdgCode rhs) const
Sorts PDG Codes according to their numeric value.
 
struct smash::PdgCode::@0::@3 chunks_
Chunk collection: here, the chunks with  and  are directly accessible.
 
std::uint32_t dump() const
Dumps the bitfield into an unsigned integer.
 
struct smash::PdgCode::@0::@2 digits_
The single digits collection of the code.
 
constexpr int N1535_p
N(1535)⁺.
 
int32_t get_decimal() const
 
void set_fields(std::uint32_t abscode)
Sets the bitfield from an unsigned integer.
 
std::uint32_t ucode() const
 
std::string string() const
 
std::uint32_t bool is_nucleus_
1 for nuclei, 0 for the rest
 
void deexcite()
Remove all excitation, except spin. Sign and quark content remains.
 
void set_from_string(const std::string &codestring)
Set the PDG code from the given string.
 
int charge() const
The charge of the particle.
 
constexpr int decimal_antid
Anti-deuteron in decimal digits.
 
std::uint32_t quarks_
The quark digits n_q{1,2,3}_.
 
constexpr int N1535_z
N(1535)⁰.
 
constexpr int decimal_d
Deuteron in decimal digits.
 
std::istream & operator>>(std::istream &is, PdgCode &code)
Sets the PDG code from the textual representation in the input stream.
 
std::uint32_t n_
first field: "counter"
 
bool is_antiparticle_of(const PdgCode rhs) const
 
friend std::istream & operator>>(std::istream &is, PdgCode &code)
istream >> PdgCode assigns the PDG Code from an istream.
 
std::uint32_t dump_
The bitfield dumped into a single integer.
 
int test_code() const
Checks the integer for invalid hex digits.
 
std::uint32_t n_q1_
first quark field. 0 for mesons.
 
constexpr int Delta_pp
Δ⁺⁺.
 
bool operator==(const PdgCode rhs) const
 
std::int32_t quarks() const
 
bool has_lepton_pair(const PdgCode pdg1, const PdgCode pdg2, const PdgCode pdg3)
 
bool operator!=(const PdgCode rhs) const
 
void check() const
Do all sorts of validity checks.
 
static PdgCode invalid()
PdgCode 0x0 is guaranteed not to be valid by the PDG standard, but it passes all tests here,...
 
PdgCode()
Standard initializer.
 
bool contains_enough_valence_quarks(int valence_quarks_required) const
 
bool antiparticle_
first bit: stores the sign.
 
std::uint32_t get_digit_from_char(const char inp) const
 
bool has_antiparticle() const
 
std::int32_t code() const
 
bool is_dilepton(const PdgCode pdg1, const PdgCode pdg2)
 
bool is_Nstar1535() const