15 std::string codestring(
"");
25 is.setstate(std::ios::failbit);
35 const int absQuark = std::abs(signedQuark);
36 if (absQuark < 1 || absQuark > 6)
40 const int absPdgId = std::abs(pdgId);
42 if (absPdgId == 111 || absPdgId == 113 || absPdgId == 223) {
43 return (absQuark == 1 || absQuark == 2);
45 if (absPdgId == 221 || absPdgId == 331) {
46 return (absQuark == 1 || absQuark == 2 || absQuark == 3);
51 return signedQuark > 0 ? (netFlavor > 0) : (netFlavor < 0);
57 const int flavorDigit1 =
digits_.n_q2_;
58 const int flavorDigit2 =
digits_.n_q3_;
59 return (absQuark == flavorDigit1 || absQuark == flavorDigit2);
64 if (quark < 1 || quark > 6) {
65 throw std::invalid_argument(
66 std::string(
"PdgCode::net_quark_number(): ") +
67 std::string(
"Quark number must be in [1..6], received ") +
111 if (quark > otherquark) {
120 return s << code.
string();
124 int valence_quarks_required)
const {
126 return valence_quarks_required == 1 || valence_quarks_required == -1;
130 return valence_quarks_required == 1 || valence_quarks_required == 2;
133 return valence_quarks_required == -1 || valence_quarks_required == -2;
136 throw std::runtime_error(
"String fragment is neither baryon nor meson");
PdgCode stores a Particle Data Group Particle Numbering Scheme particle type number.
int antiparticle_sign() const
int baryon_number() const
int net_quark_number(const int quark) const
Returns the net number of quarks with given flavour number For public use, see strangeness(),...
struct smash::PdgCode::@0::@2 digits_
The single digits collection of the code.
int32_t get_decimal() const
std::string string() const
static PdgCode invalid()
PdgCode 0x0 is guaranteed not to be valid by the PDG standard, but it passes all tests here,...
bool contains_enough_valence_quarks(int valence_quarks_required) const
void set_from_string(const std::string &codestring)
Set the PDG code from the given string.
bool contains_quark(int quark) const
Checks whether this hadron contains a quark (or antiquark) of a given flavour.
struct smash::PdgCode::@0::@4 nucleus_
Structure for the nuclei.
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
std::istream & operator>>(std::istream &is, PdgCode &code)
Sets the PDG code from the textual representation in the input stream.
std::string to_string(ThermodynamicQuantity quantity)
Convert a ThermodynamicQuantity enum value to its corresponding string.
thrown for invalid inputs