Version: SMASH-3.4
smash::ParticleType Class Reference

#include <particletype.h>

Particle type contains the static properties of a particle species.

Before creation of Experiment, SMASH initializes the list of particles (list_all). After construction these values are immutable.

The list of particles is stored in such a way that look up of a ParticleType object (find) for a given PDG code is as efficient as possible ( \(\mathcal O(\log N)\)). This is still not efficient enough to use PdgCode as a substitute for storing information about a particle type, though. Use ParticleTypePtr instead.

Definition at line 100 of file particletype.h.

Collaboration diagram for smash::ParticleType:
[legend]

Classes

struct  LoadFailure
 
struct  PdgNotFoundFailure
 

Public Member Functions

 ParticleType (std::string n, double m, double w, Parity p, PdgCode id)
 Creates a fully initialized ParticleType object. More...
 
 ParticleType (const ParticleType &)=delete
 Copies are not allowed as they break intended use. More...
 
ParticleTypeoperator= (const ParticleType &)=delete
 assignment is not allowed, see copy constructor above More...
 
 ParticleType (ParticleType &&)=default
 move ctors are needed for std::sort More...
 
ParticleTypeoperator= (ParticleType &&)=default
 move ctors are needed for std::sort More...
 
const DecayModesdecay_modes () const
 
const std::string & name () const
 
double mass () const
 
double mass_sqr () const
 
double width_at_pole () const
 
Parity parity () const
 
PdgCode pdgcode () const
 
bool has_antiparticle () const
 
ParticleTypePtr get_antiparticle () const
 
int antiparticle_sign () const
 
int isospin () const
 Returns twice the isospin vector length \(I\). More...
 
int isospin3 () const
 
double isospin3_rel () const
 
IsoParticleTypeiso_multiplet () const
 
int32_t charge () const
 The charge of the particle. More...
 
unsigned int spin () const
 
unsigned int spin_degeneracy () const
 
bool is_hadron () const
 
bool is_lepton () const
 
bool is_baryon () const
 
bool is_meson () const
 
int baryon_number () const
 
int strangeness () const
 
bool is_nucleon () const
 
bool is_pion () const
 
bool is_kaon () const
 
bool is_Delta () const
 
bool is_rho () const
 
bool is_Nstar () const
 
bool is_Nstar1535 () const
 
bool is_Sigmastar () const
 
bool is_Deltastar () const
 
bool is_stable () const
 
bool is_nucleus () const
 
bool is_deuteron () const
 
bool is_triton () const
 
bool is_dprime () const
 
bool is_charmonia () const
 
double min_mass_kinematic () const
 The minimum mass of the resonance that is kinematically allowed. More...
 
double min_mass_spectral () const
 The minimum mass of the resonance, where the spectral function is non-zero. More...
 
double partial_width (const double m, const DecayBranch *mode) const
 Get the mass-dependent partial decay width of a particle with mass m in a particular decay mode. More...
 
double total_width (const double m) const
 Get the mass-dependent total width of a particle with mass m. More...
 
bool wanted_decaymode (const DecayType &t, WhichDecaymodes wh) const
 Helper Function that containes the if-statement logic that decides if a decay mode is either a hadronic and dilepton decay mode. More...
 
DecayBranchList get_partial_widths (const FourVector p, const ThreeVector x, WhichDecaymodes wh) const
 Get all the mass-dependent partial decay widths of a particle with mass m. More...
 
double get_partial_width (const double m, const ParticleTypePtrList dlist) const
 Get the mass-dependent partial width of a resonance with mass m, decaying into two given daughter particles. More...
 
double get_partial_in_width (const double m, const ParticleData &p_a, const ParticleData &p_b) const
 Get the mass-dependent partial in-width of a resonance with mass m, decaying into two given daughter particles. More...
 
double full_spectral_function (double m) const
 Full spectral function \( A(m) = \frac{2}{\pi} N \frac{m^2\Gamma(m)}{(m^2-m_0^2)^2+(m\Gamma(m))^2} \) of the resonance (relativistic Breit-Wigner distribution with mass-dependent width, where N is a normalization factor). More...
 
double no_norm_spectral_function (double m) const
 Full spectral function without normalization factor. More...
 
double breit_wigner_spectral_function (double m) const
 This one is the most simple form of the spectral function, using a Cauchy distribution (non-relativistic Breit-Wigner with constant width). More...
 
double sample_breit_wigner_spectral_function (double energy=mass_limit_) const
 Sample mass from the simple spectral function (Breit-Wigner/Cauchy distribution). More...
 
double sample_full_spectral_function (double energy=mass_limit_) const
 Sample mass from the full spectral function. More...
 
double ratio_spectral_full_to_breit_wigner (double m) const
 Calculate the ratio between the full spectral function and simple one. More...
 
double max_ratio_spectral_full_to_breit_wigner () const
 Getter used in the resonance mass sampling functions. More...
 
double sample_resonance_mass (const double mass_stable, const double cms_energy, int L=0) const
 Resonance mass sampling for 2-particle final state with one resonance (type given by 'this') and one stable particle. More...
 
void dump_width_and_spectral_function () const
 Prints out width and spectral function versus mass to the standard output. More...
 
bool operator== (const ParticleType &rhs) const
 
bool operator!= (const ParticleType &rhs) const
 
bool operator< (const ParticleType &rhs) const
 "Less than" operator for sorting the ParticleType list (by PDG code) More...
 
ParticleTypePtr operator& () const
 Returns an object that acts like a pointer, except that it requires only 2 bytes and inhibits pointer arithmetics. More...
 

Static Public Member Functions

static const ParticleTypeList & list_all ()
 
static ParticleTypePtrList & list_nucleons ()
 
static ParticleTypePtrList & list_anti_nucleons ()
 
static ParticleTypePtrList & list_Deltas ()
 
static ParticleTypePtrList & list_anti_Deltas ()
 
static ParticleTypePtrList & list_baryon_resonances ()
 
static ParticleTypePtrList & list_light_nuclei ()
 
static const ParticleTypePtr try_find (PdgCode pdgcode)
 Returns the ParticleTypePtr for the given pdgcode. More...
 
static const ParticleTypefind (PdgCode pdgcode)
 Returns the ParticleType object for the given pdgcode. More...
 
static bool exists (PdgCode pdgcode)
 
static bool exists (const std::string &name)
 
static void create_type_list (const std::string &particles)
 Initialize the global ParticleType list (list_all) from the given input data. More...
 
static void check_consistency ()
 

Static Public Attributes

static constexpr double width_cutoff = 1e-5
 Decay width cutoff for considering a particle as stable. More...
 

Private Member Functions

void calculate_max_ratio_spectral_full_to_breit_wigner () const
 Calculates the maximum ratio between full spectral function and simple one. More...
 

Private Attributes

std::string name_
 name of the particle More...
 
double mass_
 pole mass of the particle More...
 
double width_
 width of the particle More...
 
Parity parity_
 Parity of the particle. More...
 
PdgCode pdgcode_
 PDG Code of the particle. More...
 
double min_mass_kinematic_
 minimum kinematically allowed mass of the particle Mutable, because it is initialized at first call of minimum mass function, so it's logically const, but not physically const, which is a classical case for using mutable. More...
 
double min_mass_spectral_
 minimum mass, where the spectral function is non-zero Mutable, because it is initialized at first call of minimum mass function, so it's logically const, but not physically const, which is a classical case for using mutable. More...
 
double norm_factor_ = -1.
 This normalization factor ensures that the spectral function is normalized to unity, when integrated over its full domain. More...
 
int32_t charge_
 Charge of the particle; filled automatically from pdgcode_. More...
 
int isospin_
 Isospin of the particle; filled automatically from pdgcode_. More...
 
int I3_
 Isospin projection of the particle; filled automatically from pdgcode_. More...
 
IsoParticleTypeiso_multiplet_ = nullptr
 Container for the isospin multiplet information. More...
 
std::optional< double > max_ratio_spectral_full_to_breit_wigner_
 Maximum ratio between full spectral function and the mass-independent Breit-Wigner. More...
 

Static Private Attributes

static constexpr double mass_limit_ = 10.0
 Limit for sampling the resonance masses. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const ParticleType &type)
 Writes all information about the particle type to the output stream. More...
 

Constructor & Destructor Documentation

◆ ParticleType() [1/3]

smash::ParticleType::ParticleType ( std::string  n,
double  m,
double  w,
Parity  p,
PdgCode  id 
)

Creates a fully initialized ParticleType object.

Parameters
[in]nThe name of the particle.
[in]mThe mass of the particle.
[in]wThe width of the particle.
[in]pThe parity of the particle.
[in]idThe PDG code of the particle.
Note
The remaining properties ParticleType provides are derived from the PDG code and therefore cannot be set explicitly (this avoids the chance of introducing inconsistencies).

Definition at line 122 of file particletype.cc.

124  : name_(n),
125  mass_(m),
126  width_(w),
127  parity_(p),
128  pdgcode_(id),
129  min_mass_kinematic_(-1.),
130  min_mass_spectral_(-1.),
132  isospin_(-1),
133  I3_(pdgcode_.isospin3()) {}
double min_mass_spectral_
minimum mass, where the spectral function is non-zero Mutable, because it is initialized at first cal...
Definition: particletype.h:681
int I3_
Isospin projection of the particle; filled automatically from pdgcode_.
Definition: particletype.h:690
Parity parity_
Parity of the particle.
Definition: particletype.h:665
std::string name_
name of the particle
Definition: particletype.h:659
double min_mass_kinematic_
minimum kinematically allowed mass of the particle Mutable, because it is initialized at first call o...
Definition: particletype.h:674
int isospin_
Isospin of the particle; filled automatically from pdgcode_.
Definition: particletype.h:688
double width_
width of the particle
Definition: particletype.h:663
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:667
int32_t charge_
Charge of the particle; filled automatically from pdgcode_.
Definition: particletype.h:686
double mass_
pole mass of the particle
Definition: particletype.h:661
int isospin3() const
Definition: pdgcode.h:535
int charge() const
The charge of the particle.
Definition: pdgcode.h:650
constexpr int p
Proton.
constexpr int n
Neutron.

◆ ParticleType() [2/3]

smash::ParticleType::ParticleType ( const ParticleType )
delete

Copies are not allowed as they break intended use.

Instead use a const-ref or ParticleTypePtr (as returned from operator&).

◆ ParticleType() [3/3]

smash::ParticleType::ParticleType ( ParticleType &&  )
default

move ctors are needed for std::sort

Member Function Documentation

◆ operator=() [1/2]

ParticleType& smash::ParticleType::operator= ( const ParticleType )
delete

assignment is not allowed, see copy constructor above

◆ operator=() [2/2]

ParticleType& smash::ParticleType::operator= ( ParticleType &&  )
default

move ctors are needed for std::sort

◆ decay_modes()

const DecayModes & smash::ParticleType::decay_modes ( ) const
Returns
the DecayModes object for this particle type.

Definition at line 433 of file particletype.cc.

433  {
434  const auto offset = this - std::addressof(list_all()[0]);
435  const auto &modes = (*DecayModes::all_decay_modes)[offset];
436  assert(is_stable() || !modes.is_empty());
437  return modes;
438 }
static const ParticleTypeList & list_all()
Definition: particletype.cc:51
bool is_stable() const
Definition: particletype.h:251
Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

const std::string& smash::ParticleType::name ( ) const
inline
Returns
the name of the particle.

Definition at line 144 of file particletype.h.

144 { return name_; }
Here is the caller graph for this function:

◆ mass()

double smash::ParticleType::mass ( ) const
inline
Returns
the particle pole mass.

Definition at line 147 of file particletype.h.

147 { return mass_; }
Here is the caller graph for this function:

◆ mass_sqr()

double smash::ParticleType::mass_sqr ( ) const
inline
Returns
the squared particle mass.

Definition at line 150 of file particletype.h.

150 { return mass_ * mass_; }

◆ width_at_pole()

double smash::ParticleType::width_at_pole ( ) const
inline
Returns
the particle width (at the mass pole).

Definition at line 153 of file particletype.h.

153 { return width_; }
Here is the caller graph for this function:

◆ parity()

Parity smash::ParticleType::parity ( ) const
inline
Returns
the parity of the particle.

Definition at line 156 of file particletype.h.

156 { return parity_; }
Here is the caller graph for this function:

◆ pdgcode()

PdgCode smash::ParticleType::pdgcode ( ) const
inline
Returns
the PDG code of the particle.

Definition at line 159 of file particletype.h.

159 { return pdgcode_; }
Here is the caller graph for this function:

◆ has_antiparticle()

bool smash::ParticleType::has_antiparticle ( ) const
inline

Returns
whether a particle has a distinct antiparticle (or whether it is its own antiparticle).

Definition at line 162 of file particletype.h.

162 { return pdgcode_.has_antiparticle(); }
bool has_antiparticle() const
Definition: pdgcode.h:519
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_antiparticle()

ParticleTypePtr smash::ParticleType::get_antiparticle ( ) const
inline
Returns
a pointer to the corresponding antiparticle ParticleType object.

Definition at line 812 of file particletype.h.

812  {
813  assert(has_antiparticle());
814  return &find(pdgcode_.get_antiparticle());
815 }
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
Definition: particletype.cc:99
bool has_antiparticle() const
Definition: particletype.h:162
PdgCode get_antiparticle() const
Construct the antiparticle to a given PDG code.
Definition: pdgcode.h:329
Here is the call graph for this function:

◆ antiparticle_sign()

int smash::ParticleType::antiparticle_sign ( ) const
inline

Returns
-1 for antiparticles and +1 for particles.

Definition at line 168 of file particletype.h.

168 { return pdgcode_.antiparticle_sign(); }
int antiparticle_sign() const
Definition: pdgcode.h:734
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isospin()

int smash::ParticleType::isospin ( ) const

Returns twice the isospin vector length \(I\).

This returns e.g. 1 for nucleons, 2 for pions and 3 for Deltas. It is always positive.

Definition at line 415 of file particletype.cc.

415  {
416  if (isospin_ < 0) {
419  : 0;
420  }
421  return isospin_;
422 }
int isospin() const
Returns twice the total isospin of the multiplet.
IsoParticleType * iso_multiplet_
Container for the isospin multiplet information.
Definition: particletype.h:693
bool is_hadron() const
Definition: pdgcode.h:367
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isospin3()

int smash::ParticleType::isospin3 ( ) const
inline

Returns
twice the isospin-3 component \(I_3\).

This is calculated from the sum of net_quark_number of up and down.

Definition at line 179 of file particletype.h.

179 { return I3_; }
Here is the caller graph for this function:

◆ isospin3_rel()

double smash::ParticleType::isospin3_rel ( ) const
inline
Returns
the isospin-3 component relative to the total isospin.

Definition at line 182 of file particletype.h.

182  {
183  unsigned int I = isospin();
184  return (I == 0) ? 0 : static_cast<double>(isospin3()) / I;
185  }
int isospin3() const
Definition: particletype.h:179
int isospin() const
Returns twice the isospin vector length .
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iso_multiplet()

IsoParticleType* smash::ParticleType::iso_multiplet ( ) const
inline
Returns
a pointer to the Isospin-multiplet of this PDG Code.

Definition at line 188 of file particletype.h.

188 { return iso_multiplet_; }
Here is the caller graph for this function:

◆ charge()

int32_t smash::ParticleType::charge ( ) const
inline

The charge of the particle.

The charge is calculated from the quark content (for hadrons) or basically tabulated; currently leptons, neutrinos and the standard model gauge bosons are known; unknown particles return a charge of 0.

Returns
charge of the particle

Definition at line 191 of file particletype.h.

191 { return charge_; }
Here is the caller graph for this function:

◆ spin()

unsigned int smash::ParticleType::spin ( ) const
inline

Returns
twice the spin of a particle.

The code is good for hadrons, leptons and spin-1-bosons. It returns 2 (meaning spin=1) for the Higgs, though.

Exceptions
runtime_errorif a spin of a nucleus is not coded in and has to be guessed

Definition at line 194 of file particletype.h.

194 { return pdgcode_.spin(); }
unsigned int spin() const
Definition: pdgcode.h:691
Here is the call graph for this function:
Here is the caller graph for this function:

◆ spin_degeneracy()

unsigned int smash::ParticleType::spin_degeneracy ( ) const
inline

Returns
the spin degeneracy \(2s + 1\) of a particle.

Definition at line 197 of file particletype.h.

197 { return pdgcode_.spin_degeneracy(); }
unsigned int spin_degeneracy() const
Definition: pdgcode.h:727
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_hadron()

bool smash::ParticleType::is_hadron ( ) const
inline

Returns
true if this is a baryon, antibaryon or meson.

Definition at line 200 of file particletype.h.

200 { return pdgcode_.is_hadron(); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_lepton()

bool smash::ParticleType::is_lepton ( ) const
inline

Returns
true if this is a lepton.

Definition at line 203 of file particletype.h.

203 { return pdgcode_.is_lepton(); }
bool is_lepton() const
Definition: pdgcode.h:372
Here is the call graph for this function:

◆ is_baryon()

bool smash::ParticleType::is_baryon ( ) const
inline

Returns
whether this PDG code identifies a baryon.

Definition at line 206 of file particletype.h.

206 { return pdgcode_.is_baryon(); }
bool is_baryon() const
Definition: pdgcode.h:398
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_meson()

bool smash::ParticleType::is_meson ( ) const
inline

Returns
whether this PDG code identifies a meson.

Definition at line 209 of file particletype.h.

209 { return pdgcode_.is_meson(); }
bool is_meson() const
Definition: pdgcode.h:401
Here is the call graph for this function:
Here is the caller graph for this function:

◆ baryon_number()

int smash::ParticleType::baryon_number ( ) const
inline

Returns
the baryon number of the particle.

Definition at line 212 of file particletype.h.

212 { return pdgcode_.baryon_number(); }
int baryon_number() const
Definition: pdgcode.h:388
Here is the call graph for this function:
Here is the caller graph for this function:

◆ strangeness()

int smash::ParticleType::strangeness ( ) const
inline

Returns
the net number of \(\bar s\) quarks.

For particles with one strange quark, -1 is returned.

Definition at line 215 of file particletype.h.

215 { return pdgcode_.strangeness(); }
int strangeness() const
Definition: pdgcode.h:626
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_nucleon()

bool smash::ParticleType::is_nucleon ( ) const
inline

Returns
whether this is a nucleon/anti-nucleon (p, n, -p, -n)

Definition at line 218 of file particletype.h.

218 { return pdgcode_.is_nucleon(); }
bool is_nucleon() const
Definition: pdgcode.h:404
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_pion()

bool smash::ParticleType::is_pion ( ) const
inline

Returns
whether this is a pion (pi+/pi0/pi-)

Definition at line 221 of file particletype.h.

221 { return pdgcode_.is_pion(); }
bool is_pion() const
Definition: pdgcode.h:471
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_kaon()

bool smash::ParticleType::is_kaon ( ) const
inline

Returns
whether this is a kaon (K+, K-, K0, Kbar0)

Definition at line 224 of file particletype.h.

224 { return pdgcode_.is_kaon(); }
bool is_kaon() const
Definition: pdgcode.h:465
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_Delta()

bool smash::ParticleType::is_Delta ( ) const
inline

Returns
whether this is a Delta(1232) (with anti-delta)

Definition at line 227 of file particletype.h.

227 { return pdgcode_.is_Delta(); }
bool is_Delta() const
Definition: pdgcode.h:428
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_rho()

bool smash::ParticleType::is_rho ( ) const
inline

Returns
whether this is a rho meson (rho+/rho0/rho-)

Definition at line 230 of file particletype.h.

230 { return pdgcode_.is_rho(); }
bool is_rho() const
Definition: pdgcode.h:483
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_Nstar()

bool smash::ParticleType::is_Nstar ( ) const
inline
Returns
Is this a nucleon resonance (N*)?

Definition at line 233 of file particletype.h.

233  {
234  return is_baryon() && isospin() == 1 && !pdgcode_.is_nucleon() &&
235  pdgcode_.strangeness() == 0 && pdgcode_.charmness() == 0;
236  }
bool is_baryon() const
Definition: particletype.h:206
int charmness() const
Definition: pdgcode.h:633
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_Nstar1535()

bool smash::ParticleType::is_Nstar1535 ( ) const
inline

Returns
whether this is a N*(1535) (+/0)

Definition at line 239 of file particletype.h.

239 { return pdgcode_.is_Nstar1535(); }
bool is_Nstar1535() const
Definition: pdgcode.h:422
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_Sigmastar()

bool smash::ParticleType::is_Sigmastar ( ) const
inline
Returns
Is this a Sigma resonance (Sigma*)?

Definition at line 242 of file particletype.h.

242 { return pdgcode_.is_Sigmastar(); }
bool is_Sigmastar() const
Definition: pdgcode.h:458
Here is the call graph for this function:

◆ is_Deltastar()

bool smash::ParticleType::is_Deltastar ( ) const
inline
Returns
Is this a Delta resonance (Delta*)?

Definition at line 245 of file particletype.h.

245  {
246  return is_baryon() && isospin() == 3 && !pdgcode_.is_Delta() &&
247  pdgcode_.strangeness() == 0 && pdgcode_.charmness() == 0;
248  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_stable()

bool smash::ParticleType::is_stable ( ) const
inline
Returns
whether the particle is stable

Definition at line 251 of file particletype.h.

251 { return width_ < width_cutoff; }
static constexpr double width_cutoff
Decay width cutoff for considering a particle as stable.
Definition: particletype.h:110
Here is the caller graph for this function:

◆ is_nucleus()

bool smash::ParticleType::is_nucleus ( ) const
inline
Returns
whether the particle is a nucleus

Definition at line 254 of file particletype.h.

254 { return pdgcode_.is_nucleus(); }
bool is_nucleus() const
Definition: pdgcode.h:361
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_deuteron()

bool smash::ParticleType::is_deuteron ( ) const
inline
Returns
whether the particle is an (anti-)deuteron

Definition at line 257 of file particletype.h.

257 { return pdgcode_.is_deuteron(); }
bool is_deuteron() const
Definition: pdgcode.h:504
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_triton()

bool smash::ParticleType::is_triton ( ) const
inline
Returns
whether the particle is an (anti-)triton

Definition at line 260 of file particletype.h.

260 { return pdgcode_.is_triton(); }
bool is_triton() const
Definition: pdgcode.h:510
Here is the call graph for this function:

◆ is_dprime()

bool smash::ParticleType::is_dprime ( ) const
inline
Returns
whether the particle is an artificial d' resonance

Definition at line 263 of file particletype.h.

263  {
264  return is_nucleus() && std::abs(pdgcode_.get_decimal()) == 1000010021;
265  }
bool is_nucleus() const
Definition: particletype.h:254
int32_t get_decimal() const
Definition: pdgcode.h:852
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_charmonia()

bool smash::ParticleType::is_charmonia ( ) const
inline
Returns
whether the particle is a cc̅ state

Definition at line 268 of file particletype.h.

268 { return pdgcode_.is_charmonia(); }
bool is_charmonia() const
Definition: pdgcode.h:383
Here is the call graph for this function:

◆ min_mass_kinematic()

double smash::ParticleType::min_mass_kinematic ( ) const

The minimum mass of the resonance that is kinematically allowed.

Calculate the minimum rest energy the resonance must have for any decay channel to be kinematically available. (In other words, find the smallest sum of final-state particle masses.)

Returns
The minimum mass that a particle of this type can assume, where at least one decay is possible.

Definition at line 365 of file particletype.cc.

365  {
366  if (unlikely(min_mass_kinematic_ < 0.)) {
367  /* If the particle is stable, min. mass is just the mass. */
369  /* Otherwise, find the lowest mass value needed in any decay mode */
370  if (!is_stable()) {
371  for (const auto &mode : decay_modes().decay_mode_list()) {
372  min_mass_kinematic_ = std::min(min_mass_kinematic_, mode->threshold());
373  }
374  }
375  }
376  return min_mass_kinematic_;
377 }
const DecayModes & decay_modes() const
#define unlikely(x)
Tell the branch predictor that this expression is likely false.
Definition: macros.h:16
Here is the call graph for this function:
Here is the caller graph for this function:

◆ min_mass_spectral()

double smash::ParticleType::min_mass_spectral ( ) const

The minimum mass of the resonance, where the spectral function is non-zero.

Calculate the the smallest mass where the spectral function still has a contribution. This value can be different from min_mass_kinematic, if the spectral function becomes zero at masses higher than min_mass_kinematic, since the width is put to zero due to the width_cutoff.

The distinction between it and min_mass_kinematic() might be necessary in edge cases, where a reaction is very close to the kinematic threshold or for optimizations.

Returns
The minimum mass that a particle of this type can assume, where the spectral function still has a non-zero value.

Definition at line 379 of file particletype.cc.

379  {
380  if (unlikely(min_mass_spectral_ < 0.)) {
381  /* If the particle is stable or it has a non-zero spectral function value at
382  * the minimum mass that is allowed by kinematics, min_mass_spectral is just
383  * the min_mass_kinetic. */
385  /* Otherwise, find the lowest mass value where spectral function has a
386  * non-zero value by bisection.*/
387  if (!is_stable() &&
389  // find a right bound that has non-zero spectral function for bisection
390  const double m_step = 0.01;
391  double right_bound_bis;
392  for (unsigned int i = 0;; i++) {
393  right_bound_bis = min_mass_kinematic() + m_step * i;
394  if (full_spectral_function(right_bound_bis) > really_small) {
395  break;
396  }
397  }
398  // bisection
399  const double precision = 1E-6;
400  double left_bound_bis = right_bound_bis - m_step;
401  while (right_bound_bis - left_bound_bis > precision) {
402  const double mid = (left_bound_bis + right_bound_bis) / 2.0;
404  right_bound_bis = mid;
405  } else {
406  left_bound_bis = mid;
407  }
408  }
409  min_mass_spectral_ = right_bound_bis;
410  }
411  }
412  return min_mass_spectral_;
413 }
double min_mass_kinematic() const
The minimum mass of the resonance that is kinematically allowed.
double full_spectral_function(double m) const
Full spectral function of the resonance (relativistic Breit-Wigner distribution with mass-dependent ...
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ partial_width()

double smash::ParticleType::partial_width ( const double  m,
const DecayBranch mode 
) const

Get the mass-dependent partial decay width of a particle with mass m in a particular decay mode.

Parameters
[in]mInvariant mass of the decaying particle.
[in]modeDecay mode to consider.
Returns
the partial width of this specific mode for this mass

Definition at line 424 of file particletype.cc.

425  {
426  if (m < mode->threshold()) {
427  return 0.;
428  }
429  double partial_width_at_pole = width_at_pole() * mode->weight();
430  return mode->type().width(mass(), partial_width_at_pole, m);
431 }
double width_at_pole() const
Definition: particletype.h:153
double mass() const
Definition: particletype.h:147
Here is the call graph for this function:
Here is the caller graph for this function:

◆ total_width()

double smash::ParticleType::total_width ( const double  m) const

Get the mass-dependent total width of a particle with mass m.

Parameters
[in]mInvariant mass of the decaying particle.
Returns
the total width for all modes for this mass

Definition at line 440 of file particletype.cc.

440  {
441  double w = 0.;
442  if (is_stable()) {
443  return w;
444  }
445  /* Loop over decay modes and sum up all partial widths. */
446  const auto &modes = decay_modes().decay_mode_list();
447  for (unsigned int i = 0; i < modes.size(); i++) {
448  w = w + partial_width(m, modes[i].get());
449  }
450  if (w < width_cutoff) {
451  return 0.;
452  }
453  return w;
454 }
const DecayBranchList & decay_mode_list() const
Definition: decaymodes.h:63
double partial_width(const double m, const DecayBranch *mode) const
Get the mass-dependent partial decay width of a particle with mass m in a particular decay mode.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wanted_decaymode()

bool smash::ParticleType::wanted_decaymode ( const DecayType t,
WhichDecaymodes  wh 
) const

Helper Function that containes the if-statement logic that decides if a decay mode is either a hadronic and dilepton decay mode.

Parameters
[in]ttype of decay.
[in]whenum that decides which decay modes are wanted.
Returns
true if a decay branch is wanted and false if not.

Definition at line 472 of file particletype.cc.

473  {
474  switch (wh) {
475  case WhichDecaymodes::All: {
476  return true;
477  }
479  return !t.is_dilepton_decay();
480  }
482  return t.is_dilepton_decay();
483  }
484  default:
485  throw std::runtime_error(
486  "Problem in selecting decaymodes in wanted_decaymode()");
487  }
488 }
@ Hadronic
Ignore dilepton decay modes widths.
@ Dileptons
Only return dilepton decays widths.
@ All
All decay mode widths.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_partial_widths()

DecayBranchList smash::ParticleType::get_partial_widths ( const FourVector  p,
const ThreeVector  x,
WhichDecaymodes  wh 
) const

Get all the mass-dependent partial decay widths of a particle with mass m.

This function needs to know the 4-momentum and the position of the decaying particle to calculate the square root of s of the final state particles and mass

Parameters
[in]p4-momentum of the decaying particle.
[in]xposition of the decaying particle.
[in]whenum that decides which decaymodes are returned.
Returns
a list of process branches, whose weights correspond to the actual partial widths.

Definition at line 490 of file particletype.cc.

492  {
493  const auto &decay_mode_list = decay_modes().decay_mode_list();
494  /* Determine whether the decay is affected by the potentials. If it's
495  * affected, read the values of the potentials at the position of the
496  * particle */
497  FourVector UB = FourVector();
498  FourVector UI3 = FourVector();
499  if (UB_lat_pointer != nullptr) {
500  UB_lat_pointer->value_at(x, UB);
501  }
502  if (UI3_lat_pointer != nullptr) {
503  UI3_lat_pointer->value_at(x, UI3);
504  }
505  /* Loop over decay modes and calculate all partial widths. */
506  DecayBranchList partial;
507  partial.reserve(decay_mode_list.size());
508  for (unsigned int i = 0; i < decay_mode_list.size(); i++) {
509  /* Calculate the square root s of the final state particles. */
510  const auto FinalTypes = decay_mode_list[i]->type().particle_types();
511  double scale_B = 0.0;
512  double scale_I3 = 0.0;
513  if (pot_pointer != nullptr) {
514  scale_B += pot_pointer->force_scale(*this).first;
515  scale_I3 += pot_pointer->force_scale(*this).second * isospin3_rel();
516  for (const auto &finaltype : FinalTypes) {
517  scale_B -= pot_pointer->force_scale(*finaltype).first;
518  scale_I3 -= pot_pointer->force_scale(*finaltype).second *
519  finaltype->isospin3_rel();
520  }
521  }
522  double sqrt_s = (p + UB * scale_B + UI3 * scale_I3).abs();
523 
524  const double w = partial_width(sqrt_s, decay_mode_list[i].get());
525  if (w > 0.) {
526  if (wanted_decaymode(decay_mode_list[i]->type(), wh)) {
527  partial.push_back(
528  std::make_unique<DecayBranch>(decay_mode_list[i]->type(), w));
529  }
530  }
531  }
532  return partial;
533 }
bool wanted_decaymode(const DecayType &t, WhichDecaymodes wh) const
Helper Function that containes the if-statement logic that decides if a decay mode is either a hadron...
double isospin3_rel() const
Definition: particletype.h:182
static std::pair< double, int > force_scale(const ParticleType &data)
Evaluates the scaling factor of the forces acting on the particles.
Definition: potentials.cc:152
Potentials * pot_pointer
Pointer to a Potential class.
RectangularLattice< FourVector > * UB_lat_pointer
Pointer to the skyrme potential on the lattice.
RectangularLattice< FourVector > * UI3_lat_pointer
Pointer to the symmmetry potential on the lattice.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_partial_width()

double smash::ParticleType::get_partial_width ( const double  m,
const ParticleTypePtrList  dlist 
) const

Get the mass-dependent partial width of a resonance with mass m, decaying into two given daughter particles.

Parameters
[in]mInvariant mass of the decaying resonance.
[in]dlistList of daughter particles.
Returns
the partial width for this mass and this specific decay channel

Definition at line 535 of file particletype.cc.

536  {
537  /* Get all decay modes. */
538  const auto &decaymodes = decay_modes().decay_mode_list();
539 
540  /* Find the right one(s) and add up corresponding widths. */
541  double w = 0.;
542  for (const auto &mode : decaymodes) {
543  double partial_width_at_pole = width_at_pole() * mode->weight();
544  if (mode->type().has_particles(dlist)) {
545  w += mode->type().width(mass(), partial_width_at_pole, m);
546  }
547  }
548  return w;
549 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_partial_in_width()

double smash::ParticleType::get_partial_in_width ( const double  m,
const ParticleData p_a,
const ParticleData p_b 
) const

Get the mass-dependent partial in-width of a resonance with mass m, decaying into two given daughter particles.

For stable daughter particles, the in-width equals the 'normal' partial decay width (i.e. the 'out-width').

Parameters
[in]mInvariant mass of the decaying resonance.
[in]p_aFirst daughter particle.
[in]p_bSecond daughter particle.
Returns
the partial in-width for this mass and this specific decay channel

Definition at line 551 of file particletype.cc.

553  {
554  /* Get all decay modes. */
555  const auto &decaymodes = decay_modes().decay_mode_list();
556 
557  /* Find the right one(s) and add up corresponding widths. */
558  double w = 0.;
559  for (const auto &mode : decaymodes) {
560  double partial_width_at_pole = width_at_pole() * mode->weight();
561  const ParticleTypePtrList l = {&p_a.type(), &p_b.type()};
562  if (mode->type().has_particles(l)) {
563  w += mode->type().in_width(mass(), partial_width_at_pole, m,
564  p_a.effective_mass(), p_b.effective_mass());
565  }
566  }
567  return w;
568 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ full_spectral_function()

double smash::ParticleType::full_spectral_function ( double  m) const

Full spectral function \( A(m) = \frac{2}{\pi} N \frac{m^2\Gamma(m)}{(m^2-m_0^2)^2+(m\Gamma(m))^2} \) of the resonance (relativistic Breit-Wigner distribution with mass-dependent width, where N is a normalization factor).

Parameters
[in]mActual off-shell mass of the resonance, where the spectral function is to be evaluated.
Returns
the value of the spectral function for this mass
Note
The normalization factor N ensures that the spectral function is normalized to unity.

Definition at line 570 of file particletype.cc.

570  {
571  if (norm_factor_ < 0.) {
572  /* Initialize the normalization factor
573  * by integrating over the unnormalized spectral function. */
574  static /*thread_local (see commit 897d0b8)*/ Integrator integrate;
575  const double width = width_at_pole();
576  const double m_pole = mass();
577  // We transform the integral using m = m_min + width_pole * tan(x), to
578  // make it definite and to avoid numerical issues.
579  const double x_min = std::atan((min_mass_kinematic() - m_pole) / width);
580  norm_factor_ = 1. / integrate(x_min, M_PI / 2., [&](double x) {
581  const double tanx = std::tan(x);
582  const double m_x = m_pole + width * tanx;
583  const double jacobian = width * (1.0 + tanx * tanx);
584  return no_norm_spectral_function(m_x) * jacobian;
585  });
586  }
588 }
double norm_factor_
This normalization factor ensures that the spectral function is normalized to unity,...
Definition: particletype.h:684
double no_norm_spectral_function(double m) const
Full spectral function without normalization factor.
static Integrator integrate
Definition: decaytype.cc:143
Here is the call graph for this function:
Here is the caller graph for this function:

◆ no_norm_spectral_function()

double smash::ParticleType::no_norm_spectral_function ( double  m) const

Full spectral function without normalization factor.

See also
spectral_function
Parameters
[in]mActual off-shell mass of the resonance, where the spectral function is to be evaluated.
Returns
the value of the non-normalized spectral function for this mass

Definition at line 590 of file particletype.cc.

590  {
591  /* The spectral function is a relativistic Breit-Wigner function
592  * with mass-dependent width. Here: without normalization factor. */
593  const double resonance_width = total_width(m);
594  if (resonance_width < ParticleType::width_cutoff) {
595  return 0.;
596  }
597  return breit_wigner(m, mass(), resonance_width);
598 }
double total_width(const double m) const
Get the mass-dependent total width of a particle with mass m.
double breit_wigner(double m, double pole, double width)
Returns a relativistic Breit-Wigner distribution.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ breit_wigner_spectral_function()

double smash::ParticleType::breit_wigner_spectral_function ( double  m) const

This one is the most simple form of the spectral function, using a Cauchy distribution (non-relativistic Breit-Wigner with constant width).

It can be integrated analytically, and is normalized to 1 when integrated from -inf to inf.

Parameters
[in]mActual off-shell mass of the resonance, where the spectral function is to be evaluated.
Returns
the Cauchy spectral function at mass m

Definition at line 627 of file particletype.cc.

627  {
628  return breit_wigner_nonrel(m, mass(), width_at_pole());
629 }
double breit_wigner_nonrel(double m, double pole, double width)
Returns a non-relativistic Breit-Wigner distribution, which is essentially a Cauchy distribution with...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sample_breit_wigner_spectral_function()

double smash::ParticleType::sample_breit_wigner_spectral_function ( double  energy = mass_limit_) const

Sample mass from the simple spectral function (Breit-Wigner/Cauchy distribution).

Parameters
[in]energyMaximum energy from which the mass should be sampled. If not given, the mass is sampled from the relevant range of the Breit-Wigner distribution, truncating it at mass_limit_.
Returns
sampled mass
Note
The energy can be larger than mass_limit_, which is set to a high enough value such that the spectral functions are negligible above it.

Definition at line 631 of file particletype.cc.

632  {
634  energy);
635 }
double min_mass_spectral() const
The minimum mass of the resonance, where the spectral function is non-zero.
T cauchy(T pole, T width, T min, T max)
Draws a random number from a Cauchy distribution (sometimes also called Lorentz or non-relativistic B...
Definition: random.h:351
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sample_full_spectral_function()

double smash::ParticleType::sample_full_spectral_function ( double  energy = mass_limit_) const

Sample mass from the full spectral function.

Parameters
[in]energyMaximum energy from which the mass should be sampled. If not given, the mass is sampled from the relevant range of the spectral function, truncating it at mass_limit_.
Returns
sampled mass

Definition at line 637 of file particletype.cc.

637  {
638  if (is_stable()) {
639  return mass();
640  }
641  double mass, acceptance = 0;
642  double sf_ratio_max = std::max(max_ratio_spectral_full_to_breit_wigner(),
644  while (true) {
645  do {
648  } while (acceptance < random::uniform(0., sf_ratio_max));
649  if (unlikely(acceptance - sf_ratio_max > really_small)) {
650  logg[LResonances].debug(
651  "Warning: maximum ratio between full spectral function and Breit-",
652  "Wigner increased in sample_full_spectral_function: ", sf_ratio_max,
653  " to ", acceptance, " for ", name(), ". Sampled mass is ", mass,
654  " GeV with ", energy,
655  " GeV available.\n This might happen rarely at"
656  " the edges of the spectral function.");
657  // increase fudge factor
658  sf_ratio_max *= acceptance / sf_ratio_max;
660  } else {
661  break;
662  }
663  }
664  return mass;
665 }
const std::string & name() const
Definition: particletype.h:144
double max_ratio_spectral_full_to_breit_wigner() const
Getter used in the resonance mass sampling functions.
Definition: particletype.h:442
double ratio_spectral_full_to_breit_wigner(double m) const
Calculate the ratio between the full spectral function and simple one.
double sample_breit_wigner_spectral_function(double energy=mass_limit_) const
Sample mass from the simple spectral function (Breit-Wigner/Cauchy distribution).
std::optional< double > max_ratio_spectral_full_to_breit_wigner_
Maximum ratio between full spectral function and the mass-independent Breit-Wigner.
Definition: particletype.h:699
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > & logg
An array that stores all pre-configured Logger objects.
Definition: logging.h:245
T uniform(T min, T max)
Definition: random.h:91
static constexpr int LResonances
Here is the call graph for this function:

◆ ratio_spectral_full_to_breit_wigner()

double smash::ParticleType::ratio_spectral_full_to_breit_wigner ( double  m) const

Calculate the ratio between the full spectral function and simple one.

Parameters
[in]mMass of the resonance where the ratio is to be evaluated.
Returns
ratio between spectral functions

Definition at line 600 of file particletype.cc.

600  {
602 }
double breit_wigner_spectral_function(double m) const
This one is the most simple form of the spectral function, using a Cauchy distribution (non-relativis...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ max_ratio_spectral_full_to_breit_wigner()

double smash::ParticleType::max_ratio_spectral_full_to_breit_wigner ( ) const
inline

Getter used in the resonance mass sampling functions.

If the member is not yet initialized, it runs the algorithm to find the value.

Returns
maximum ratio between full spectral function and simple

Definition at line 442 of file particletype.h.

442  {
445  }
447  }
void calculate_max_ratio_spectral_full_to_breit_wigner() const
Calculates the maximum ratio between full spectral function and simple one.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sample_resonance_mass()

double smash::ParticleType::sample_resonance_mass ( const double  mass_stable,
const double  cms_energy,
int  L = 0 
) const

Resonance mass sampling for 2-particle final state with one resonance (type given by 'this') and one stable particle.

Parameters
[in]mass_stableMass of the stable particle.
[in]cms_energycenter-of-mass energy of the 2-particle final state.
[in]Lrelative angular momentum of the final-state particles
Returns
The mass of the resonance particle.

Definition at line 668 of file particletype.cc.

670  {
671  /* largest possible mass: Use 'nextafter' to make sure it is not above the
672  * physical limit by numerical error. */
673  const double max_mass = std::nextafter(cms_energy - mass_stable, 0.);
674 
675  // smallest possible mass to find non-zero spectral function contributions
676  const double min_mass = min_mass_spectral();
677 
678  // largest possible cm momentum (from smallest mass)
679  const double pcm_max = pCM(cms_energy, mass_stable, min_mass);
680  /* The maximum of the spectral-function ratio 'usually' happens at the
681  * largest mass. However, this is not always the case, therefore we need
682  * and additional fudge factor (determined automatically). Additionally,
683  * a heuristic knowledge is used that usually such mass exist that
684  * full_spectral_function(m) > breit_wigner_spectral_function(m). */
685  const double sf_ratio_max =
688 
689  int max_trials = 10;
690  double mass_res, acceptance, fudge_factor = 1;
691  double max = sf_ratio_max * pcm_max * blatt_weisskopf_sqr(pcm_max, L);
692  do {
693  max *= fudge_factor;
694  do {
695  // sample mass from a simple Breit-Wigner (aka Cauchy) distribution
696  mass_res = sample_breit_wigner_spectral_function(max_mass);
697  // determine cm momentum for this case
698  const double pcm = pCM(cms_energy, mass_stable, mass_res);
699  acceptance = ratio_spectral_full_to_breit_wigner(mass_res) * pcm *
700  blatt_weisskopf_sqr(pcm, L);
701  } while (acceptance < random::uniform(0., max));
702  fudge_factor *= acceptance / max;
703  --max_trials;
704  } while (acceptance > max && max_trials > 0);
705 
706  if (acceptance > max && max_trials == 0) {
707  logg[LResonances].fatal(
708  "Maximum acceptance should be increased in sample_resonance_mass: ",
709  sf_ratio_max, " ", acceptance / max, " ", pdgcode(), " ", mass_stable,
710  " ", cms_energy, " ", mass_res);
711  throw std::runtime_error(
712  "Precomputation of maximum spectral function is not working properly. "
713  "Please contact the developers.");
714  }
715  return mass_res;
716 }
PdgCode pdgcode() const
Definition: particletype.h:159
T pCM(const T sqrts, const T mass_a, const T mass_b) noexcept
Definition: kinematics.h:79
double blatt_weisskopf_sqr(const double p_ab, const int L)
Definition: formfactors.h:36
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_width_and_spectral_function()

void smash::ParticleType::dump_width_and_spectral_function ( ) const

Prints out width and spectral function versus mass to the standard output.

This is useful for debugging and analysis.

Exceptions
ifthe particle type is stable

Definition at line 789 of file particletype.cc.

789  {
790  if (is_stable()) {
791  std::stringstream err;
792  err << "Particle " << *this << " is stable, so it makes no"
793  << " sense to print its spectral function, etc.";
794  throw std::runtime_error(err.str());
795  }
796 
797  double rightmost_pole = 0.0;
798  const auto &decaymodes = decay_modes().decay_mode_list();
799  for (const auto &mode : decaymodes) {
800  double pole_mass_sum = 0.0;
801  for (const ParticleTypePtr p : mode->type().particle_types()) {
802  pole_mass_sum += p->mass();
803  }
804  if (pole_mass_sum > rightmost_pole) {
805  rightmost_pole = pole_mass_sum;
806  }
807  }
808 
809  std::cout << "# mass m[GeV], width w(m) [GeV],"
810  << " spectral function(m^2)*m [GeV^-1] of " << *this << std::endl;
811  constexpr double m_step = 0.02;
812  const double m_min = min_mass_spectral();
813  // An empirical value used to stop the printout. Assumes that spectral
814  // function decays at high mass, which is true for all known resonances.
815  constexpr double spectral_function_threshold = 8.e-3;
816  std::cout << std::fixed << std::setprecision(5);
817  for (unsigned int i = 0;; i++) {
818  const double m = m_min + m_step * i;
819  const double w = total_width(m), sf = full_spectral_function(m);
820  if (m > rightmost_pole * 2 && sf < spectral_function_threshold) {
821  break;
822  }
823  std::cout << m << " " << w << " " << sf << std::endl;
824  }
825 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ list_all()

const ParticleTypeList & smash::ParticleType::list_all ( )
static
Returns
a list of all ParticleType objects.
Note
This list is currently sorted, but do not rely on it.
It might make sense to inline this function to optimize runtime performance.

Definition at line 51 of file particletype.cc.

51  {
52  assert(all_particle_types);
53  return *all_particle_types;
54 }
const ParticleTypeList * all_particle_types
Global pointer to the Particle Type list.
Definition: particletype.cc:36
Here is the caller graph for this function:

◆ list_nucleons()

ParticleTypePtrList & smash::ParticleType::list_nucleons ( )
static
Returns
a list of all nucleons (i.e. proton and neutron).

Definition at line 69 of file particletype.cc.

69 { return nucleons_list; }
ParticleTypePtrList nucleons_list
Global pointer to the Particle Type list of nucleons.
Definition: particletype.cc:38
Here is the caller graph for this function:

◆ list_anti_nucleons()

ParticleTypePtrList & smash::ParticleType::list_anti_nucleons ( )
static
Returns
a list of all anti-nucleons (i.e. anti-proton and anti-neutron).

Definition at line 71 of file particletype.cc.

71  {
72  return anti_nucs_list;
73 }
ParticleTypePtrList anti_nucs_list
Global pointer to the Particle Type list of anti-nucleons.
Definition: particletype.cc:40
Here is the caller graph for this function:

◆ list_Deltas()

ParticleTypePtrList & smash::ParticleType::list_Deltas ( )
static
Returns
a list of the Delta(1232) baryons (i.e. all four charge states).

Definition at line 75 of file particletype.cc.

75 { return deltas_list; }
ParticleTypePtrList deltas_list
Global pointer to the Particle Type list of deltas.
Definition: particletype.cc:42
Here is the caller graph for this function:

◆ list_anti_Deltas()

ParticleTypePtrList & smash::ParticleType::list_anti_Deltas ( )
static
Returns
a list of the anti-Delta(1232) baryons (i.e. all four charge states).

Definition at line 77 of file particletype.cc.

77  {
78  return anti_deltas_list;
79 }
ParticleTypePtrList anti_deltas_list
Global pointer to the Particle Type list of anti-deltas.
Definition: particletype.cc:44
Here is the caller graph for this function:

◆ list_baryon_resonances()

ParticleTypePtrList & smash::ParticleType::list_baryon_resonances ( )
static
Returns
a list of all baryon resonances, i.e. unstable baryons (not including antibaryons).

Definition at line 81 of file particletype.cc.

81  {
83 }
ParticleTypePtrList baryon_resonances_list
Global pointer to the Particle Type list of baryon resonances.
Definition: particletype.cc:46
Here is the caller graph for this function:

◆ list_light_nuclei()

ParticleTypePtrList & smash::ParticleType::list_light_nuclei ( )
static
Returns
a list of all light nuclei from SMASH particle list. Nucleons are not included into light nuclei by convention.

Definition at line 85 of file particletype.cc.

85  {
86  return light_nuclei_list;
87 }
ParticleTypePtrList light_nuclei_list
Global pointer to the Particle Type list of light nuclei.
Definition: particletype.cc:48
Here is the caller graph for this function:

◆ try_find()

const ParticleTypePtr smash::ParticleType::try_find ( PdgCode  pdgcode)
static

Returns the ParticleTypePtr for the given pdgcode.

If the particle type is not found, an invalid ParticleTypePtr is returned. You can convert a ParticleTypePtr to a bool to check whether it is valid.

Note
The complexity of the search is \(\mathcal O(\log N)\). Therefore, do not use this function except for user input that selects a particle type. All other internal references for a particle type should use ParticleTypePtr instead.
Parameters
[in]pdgcodethe unique pdg code to try to find
Returns
the ParticleTypePtr that corresponds to this pdg code, or an invalid pointer

Definition at line 89 of file particletype.cc.

89  {
90  const auto found = std::lower_bound(
92  [](const ParticleType &l, const PdgCode &r) { return l.pdgcode() < r; });
93  if (found == all_particle_types->end() || found->pdgcode() != pdgcode) {
94  return {}; // The default constructor creates an invalid pointer.
95  }
96  return &*found;
97 }
ParticleType(std::string n, double m, double w, Parity p, PdgCode id)
Creates a fully initialized ParticleType object.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ find()

const ParticleType & smash::ParticleType::find ( PdgCode  pdgcode)
static

Returns the ParticleType object for the given pdgcode.

If the particle is not found, a PdgNotFoundFailure is thrown.

Note
The complexity of the search is \(\mathcal O(\log N)\). Therefore, do not use this function except for user input that selects a particle type. All other internal references for a particle type should use ParticleTypePtr instead.
Parameters
[in]pdgcodethe unique pdg code to try to find
Returns
the ParticleTypePtr that corresponds to this pdg code
Exceptions
PdgNotFoundFailurepdgcode not found in available particle types

Definition at line 99 of file particletype.cc.

99  {
100  const auto found = ParticleType::try_find(pdgcode);
101  if (!found) {
102  throw PdgNotFoundFailure("PDG code " + pdgcode.string() + " not found!");
103  }
104  return *found;
105 }
static const ParticleTypePtr try_find(PdgCode pdgcode)
Returns the ParticleTypePtr for the given pdgcode.
Definition: particletype.cc:89
std::string string() const
Definition: pdgcode.h:322
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exists() [1/2]

bool smash::ParticleType::exists ( PdgCode  pdgcode)
static
Parameters
[in]pdgcodethe PdgCode to look for
Returns
whether the ParticleType with the given pdgcode exists.
Note
The complexity of the search is \(\mathcal O(\log N)\).

Definition at line 107 of file particletype.cc.

107  {
108  const auto found = ParticleType::try_find(pdgcode);
109  return found;
110 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exists() [2/2]

bool smash::ParticleType::exists ( const std::string &  name)
static
Parameters
[in]namethe name to look for
Returns
whether the ParticleType with the given name exists.
Note
The complexity of the search is \(\mathcal O(N)\).

Definition at line 112 of file particletype.cc.

112  {
113  const auto found =
114  std::find_if(all_particle_types->begin(), all_particle_types->end(),
115  [&](const ParticleType &p) { return p.name() == name; });
116  if (found == all_particle_types->end()) {
117  return false;
118  }
119  return true;
120 }

◆ create_type_list()

void smash::ParticleType::create_type_list ( const std::string &  particles)
static

Initialize the global ParticleType list (list_all) from the given input data.

This function must only be called once (will fail on second invocation).

Parameters
[in]particlesA string that contains the definition of ParticleTypes to be created.
Exceptions
LoadFailureif a line in the particle file could not be read, or if there are duplicates in it
runtime_errorif the mass of of nucleons, kaons and deltas are different from the hardcoded masses, or if this function is called more than once

Definition at line 200 of file particletype.cc.

200  { // {{{
201  static ParticleTypeList type_list;
202  type_list.clear(); // in case LoadFailure was thrown and caught and we should
203  // try again
204  for (const Line &line : line_parser(input)) {
205  std::istringstream lineinput(line.text);
206  std::string name;
207  double mass, width;
208  std::string parity_string;
209  std::vector<std::string> pdgcode_strings;
210  // We expect at most 4 PDG codes per multiplet.
211  pdgcode_strings.reserve(4);
212  lineinput >> name >> mass >> width >> parity_string;
213  Parity parity;
214  bool fail = false;
215  if (parity_string == "+") {
217  } else if (parity_string == "-") {
219  } else {
220  fail = true;
221  }
222  if (lineinput.fail() || fail) {
223  throw ParticleType::LoadFailure(build_error_string(
224  "While loading the ParticleType data:\nFailed to convert the input "
225  "string to the expected data types.",
226  line));
227  }
228  // read additional PDG codes (if present)
229  while (!lineinput.eof()) {
230  pdgcode_strings.push_back("");
231  lineinput >> pdgcode_strings.back();
232  if (lineinput.fail()) {
233  throw ParticleType::LoadFailure(build_error_string(
234  "While loading the ParticleType data:\nFailed to convert the input "
235  "string to the expected data types.",
236  line));
237  }
238  }
239  if (pdgcode_strings.size() < 1) {
240  throw ParticleType::LoadFailure(build_error_string(
241  "While loading the ParticleType data:\nFailed to convert the input "
242  "string due to missing PDG code.",
243  line));
244  }
245  std::vector<PdgCode> pdgcode;
246  pdgcode.resize(pdgcode_strings.size());
247  std::transform(pdgcode_strings.begin(), pdgcode_strings.end(),
248  pdgcode.begin(),
249  [](const std::string &s) { return PdgCode(s); });
250  ensure_all_read(lineinput, line);
251 
252  // Check if provided masses are the same as hardcoded ones, if present
254  throw std::runtime_error("Nucleon mass in input file different from " +
256  }
257  if (pdgcode[0].is_pion() && !almost_equal(mass, pion_mass)) {
258  throw std::runtime_error("Pion mass in input file different from " +
260  }
261  if (pdgcode[0].is_kaon() && !almost_equal(mass, kaon_mass)) {
262  throw std::runtime_error("Kaon mass in input file different from " +
264  }
265  if (pdgcode[0].is_omega() && !almost_equal(mass, omega_mass)) {
266  throw std::runtime_error("Omega mass in input file different from " +
268  }
269  if (pdgcode[0].is_Delta() && !almost_equal(mass, delta_mass)) {
270  throw std::runtime_error("Delta mass in input file different from " +
272  }
274  throw std::runtime_error("Deuteron mass in input file different from " +
276  }
277 
278  // add all states to type list
279  for (size_t i = 0; i < pdgcode.size(); i++) {
280  std::string full_name = name;
281  if (pdgcode.size() > 1) {
282  // for multiplets: add charge string to name
283  full_name += chargestr(pdgcode[i].charge());
284  }
285  type_list.emplace_back(full_name, mass, width, parity, pdgcode[i]);
286  logg[LParticleType].debug()
287  << "Setting particle type: " << type_list.back();
288  if (pdgcode[i].has_antiparticle()) {
289  /* add corresponding antiparticle */
290  PdgCode anti = pdgcode[i].get_antiparticle();
291  // For bosons the parity does not change, for fermions it gets inverted.
292  const auto anti_parity = (anti.spin() % 2 == 0) ? parity : -parity;
293  full_name = antiname(full_name, pdgcode[i]);
294  type_list.emplace_back(full_name, mass, width, anti_parity, anti);
295  logg[LParticleType].debug()
296  << "Setting antiparticle type: " << type_list.back();
297  }
298  }
299  }
300  type_list.shrink_to_fit();
301 
302  /* Sort the type list by PDG code. */
303  std::sort(type_list.begin(), type_list.end());
304 
305  /* Look for duplicates. */
306  PdgCode prev_pdg = 0;
307  for (const auto &t : type_list) {
308  if (t.pdgcode() == prev_pdg) {
309  throw ParticleType::LoadFailure("Duplicate PdgCode in particles.txt: " +
310  t.pdgcode().string());
311  }
312  prev_pdg = t.pdgcode();
313  }
314 
315  if (all_particle_types != nullptr) {
316  throw std::runtime_error("Error: Type list was already built!");
317  }
318  all_particle_types = &type_list; // note that type_list is a function-local
319  // static and thus will live on until after
320  // main().
321 
322  // create all isospin multiplets
323  for (const auto &t : type_list) {
325  }
326  // link the multiplets to the types
327  for (auto &t : type_list) {
328  t.iso_multiplet_ = IsoParticleType::find(t);
329  }
330 
331  // Create nucleons/anti-nucleons list
332  if (IsoParticleType::exists("N")) {
333  for (const auto &state : IsoParticleType::find("N").get_states()) {
334  nucleons_list.push_back(state);
335  anti_nucs_list.push_back(state->get_antiparticle());
336  }
337  }
338 
339  // Create deltas list
340  if (IsoParticleType::exists("Δ")) {
341  for (const auto &state : IsoParticleType::find("Δ").get_states()) {
342  deltas_list.push_back(state);
343  anti_deltas_list.push_back(state->get_antiparticle());
344  }
345  }
346 
347  // Create baryon resonances list
348  for (const ParticleType &type_resonance : ParticleType::list_all()) {
349  /* Only loop over baryon resonances. */
350  if (type_resonance.is_stable() ||
351  type_resonance.pdgcode().baryon_number() != 1) {
352  continue;
353  }
354  baryon_resonances_list.push_back(&type_resonance);
355  baryon_resonances_list.push_back(type_resonance.get_antiparticle());
356  }
357 
358  for (const ParticleType &type : ParticleType::list_all()) {
359  if (type.is_nucleus()) {
360  light_nuclei_list.push_back(&type);
361  }
362  }
363 } /*}}}*/
static bool exists(const std::string &name)
Returns whether the ParticleType with the given pdgcode exists.
static const IsoParticleType & find(const std::string &name)
Returns the IsoParticleType object for the given name.
static void create_multiplet(const ParticleType &type)
Add a new multiplet to the global list of IsoParticleTypes, which contains type.
bool is_pion() const
Definition: particletype.h:221
int32_t charge() const
The charge of the particle.
Definition: particletype.h:191
bool is_Delta() const
Definition: particletype.h:227
bool is_nucleon() const
Definition: particletype.h:218
bool is_deuteron() const
Definition: particletype.h:257
bool is_kaon() const
Definition: particletype.h:224
Parity parity() const
Definition: particletype.h:156
constexpr double delta_mass
Delta mass in GeV.
Definition: constants.h:97
bool almost_equal(const N x, const N y)
Checks whether two floating-point numbers are almost equal.
Definition: numerics.h:89
void ensure_all_read(std::istream &input, const Line &line)
Makes sure that nothing is left to read from this line.
static std::string antiname(const std::string &name, PdgCode code)
Construct an antiparticle name-string from the given name-string for the particle and its PDG code.
build_vector_< Line > line_parser(const std::string &input)
Helper function for parsing particles.txt and decaymodes.txt.
Parity
Represent the parity of a particle type.
Definition: particletype.h:27
@ Neg
Negative parity.
@ Pos
Positive parity.
std::string to_string(ThermodynamicQuantity quantity)
Convert a ThermodynamicQuantity enum value to its corresponding string.
Definition: stringify.cc:26
constexpr double deuteron_mass
Deuteron mass in GeV.
Definition: constants.h:103
constexpr double nucleon_mass
Nucleon mass in GeV.
Definition: constants.h:69
constexpr double pion_mass
Pion mass in GeV.
Definition: constants.h:76
std::string build_error_string(std::string message, const Line &line)
Builds a meaningful error message.
constexpr double kaon_mass
Kaon mass in GeV.
Definition: constants.h:83
static std::string chargestr(int charge)
Construct a charge string, given the charge as integer.
constexpr double omega_mass
omega mass in GeV.
Definition: constants.h:90
static constexpr int LParticleType
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator==()

bool smash::ParticleType::operator== ( const ParticleType rhs) const
inline
Parameters
[in]rhsanother ParticleType to compare to
Returns
whether the two ParticleType objects have the same PDG code.

Definition at line 575 of file particletype.h.

575  {
576  return pdgcode() == rhs.pdgcode();
577  }
Here is the call graph for this function:

◆ operator!=()

bool smash::ParticleType::operator!= ( const ParticleType rhs) const
inline
Parameters
[in]rhsanother ParticleType to compare to
Returns
whether the two ParticleType objects have different PDG codes.

Definition at line 582 of file particletype.h.

582  {
583  return pdgcode() != rhs.pdgcode();
584  }
Here is the call graph for this function:

◆ operator<()

bool smash::ParticleType::operator< ( const ParticleType rhs) const
inline

"Less than" operator for sorting the ParticleType list (by PDG code)

Parameters
[in]rhsanother ParticleType to compare to
Returns
whether the PDG code of rhs is larger than the one from *this

Definition at line 591 of file particletype.h.

591  {
592  return pdgcode() < rhs.pdgcode();
593  }
Here is the call graph for this function:

◆ check_consistency()

void smash::ParticleType::check_consistency ( )
static
Exceptions
runtime_errorif unstable particles have no decay modes
runtime_errorif fake dibaryon d' is present without d

Note that the particles and decay modes have to be initialized, otherwise calling this is undefined behavior.

Definition at line 456 of file particletype.cc.

456  {
457  for (const ParticleType &ptype : ParticleType::list_all()) {
458  if (!ptype.is_stable() && ptype.decay_modes().is_empty()) {
459  throw std::runtime_error(
460  "Unstable particle " + ptype.name() +
461  " has no decay chanels! Either add one to it in decaymodes file or "
462  "set it's width to 0 in particles file.");
463  }
464  if (ptype.is_dprime() && !ParticleType::try_find(pdg::deuteron)) {
465  throw std::runtime_error(
466  "d' cannot be used without deuteron. Modify input particles file "
467  "accordingly.");
468  }
469  }
470 }
constexpr int64_t deuteron
Deuteron.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator&()

ParticleTypePtr smash::ParticleType::operator& ( ) const

Returns an object that acts like a pointer, except that it requires only 2 bytes and inhibits pointer arithmetics.

This is an optimization for creating references to ParticleType objects. With a normal pointer you would require the original object to stay in its place in memory, as otherwise the pointer would dangle. The ParticleTypePtr does not have this problem as it only stores the index of the ParticleType in the global vector of ParticleType objects.

In addition to returning a more efficient reference type, the overload of operator& effectively inhibits passing ParticleType objects by pointer. This is an intended restriction since ParticleType objects should only be passed by const-ref. (You can now pass by ParticleTypePtr instead, but please prefer not to. It might be useful when you want to store a reference inside the function anyway, but that can just as well be done with a const-ref parameter. A ParticleTypePtr can be invalid, a const-ref is always a valid reference semantically.)

Pre-condition:
The operator expects that the ParticleType object is stored in the vector returned by ParticleType::list_all. Therefore, never create new ParticleType objects (that includes copies and moves)!
Note on distributed execution:
At some point we might want to have several copies of the ParticleType vector - on different machines or NUMA nodes. In that case ParticleType::list_all will return the local vector. This operator will continue to work as expected as long as the ParticleType object is an entry of this local vector. The ParticleTypePtr can then be used to communicate a ParticleType over node / NUMA boundaries (an actual pointer would not work, though).
Note
It might make sense to inline this function to optimize runtime performance.
Returns
A pointer-like object referencing this ParticleType object.
See also
ParticleTypePtr

Definition at line 57 of file particletype.cc.

57  {
58  // Calculate the offset via pointer subtraction:
59  const auto offset = this - std::addressof(list_all()[0]);
60  // Since we're using uint16_t for storing the index better be safe than sorry:
61  // The offset must fit into the data type. If this ever fails we got a lot
62  // more particle types than initially expected and you have to increase the
63  // ParticleTypePtr storage to uint32_t.
64  assert(offset >= 0 && offset < 0xffff);
65  // After the assertion above the down-cast to uint16_t is safe:
66  return ParticleTypePtr(static_cast<uint16_t>(offset));
67 }
Here is the call graph for this function:

◆ calculate_max_ratio_spectral_full_to_breit_wigner()

void smash::ParticleType::calculate_max_ratio_spectral_full_to_breit_wigner ( ) const
private

Calculates the maximum ratio between full spectral function and simple one.

Usually it will be at the right edge of a mass range, but numerically this might be a problem since at very large masses both spectral functions go to zero, so we take a fixed maximal value. For some resonances the full spectral function has peaks beyond the pole mass, which will give the largest ratio, so this algorithm scans for this case from the right, until the regular pole mass peak. The actual value is the maximum between the ratio at the last found peak, the ratio at the mass limit, and 1 as a fallback.

Definition at line 604 of file particletype.cc.

604  {
605  if (is_stable()) {
607  return;
608  }
609  /*
610  * These values are arbitrary but sufficed at the time of writing. Since
611  * the performance cost of making this more precise is (probably) not large,
612  * the resolution can in principle be increased without significant impact.
613  */
614  constexpr double step_size = 0.02;
615  constexpr double safety_factor = 1.01;
617  for (double m = mass_limit_; m > mass_ - width_; m -= step_size) {
618  double current_value = ratio_spectral_full_to_breit_wigner(m);
619  if (current_value > max_ratio) {
620  max_ratio = current_value;
621  }
622  }
624  std::max(1.0, safety_factor * max_ratio);
625 }
static constexpr double mass_limit_
Limit for sampling the resonance masses.
Definition: particletype.h:657
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ width_cutoff

constexpr double smash::ParticleType::width_cutoff = 1e-5
staticconstexpr

Decay width cutoff for considering a particle as stable.

We currently regard a particle type as stable if its on-shell width is less than 10 keV. The cutoff is chosen such that the η and the η' are stable.

Definition at line 110 of file particletype.h.

◆ mass_limit_

constexpr double smash::ParticleType::mass_limit_ = 10.0
staticconstexprprivate

Limit for sampling the resonance masses.

Implicitly, this assumes that the spectral functions of all resonances are negligible at this value.

Definition at line 657 of file particletype.h.

◆ name_

std::string smash::ParticleType::name_
private

name of the particle

Definition at line 659 of file particletype.h.

◆ mass_

double smash::ParticleType::mass_
private

pole mass of the particle

Definition at line 661 of file particletype.h.

◆ width_

double smash::ParticleType::width_
private

width of the particle

Definition at line 663 of file particletype.h.

◆ parity_

Parity smash::ParticleType::parity_
private

Parity of the particle.

Definition at line 665 of file particletype.h.

◆ pdgcode_

PdgCode smash::ParticleType::pdgcode_
private

PDG Code of the particle.

Definition at line 667 of file particletype.h.

◆ min_mass_kinematic_

double smash::ParticleType::min_mass_kinematic_
mutableprivate

minimum kinematically allowed mass of the particle Mutable, because it is initialized at first call of minimum mass function, so it's logically const, but not physically const, which is a classical case for using mutable.

Definition at line 674 of file particletype.h.

◆ min_mass_spectral_

double smash::ParticleType::min_mass_spectral_
mutableprivate

minimum mass, where the spectral function is non-zero Mutable, because it is initialized at first call of minimum mass function, so it's logically const, but not physically const, which is a classical case for using mutable.

Definition at line 681 of file particletype.h.

◆ norm_factor_

double smash::ParticleType::norm_factor_ = -1.
mutableprivate

This normalization factor ensures that the spectral function is normalized to unity, when integrated over its full domain.

Definition at line 684 of file particletype.h.

◆ charge_

int32_t smash::ParticleType::charge_
private

Charge of the particle; filled automatically from pdgcode_.

Definition at line 686 of file particletype.h.

◆ isospin_

int smash::ParticleType::isospin_
mutableprivate

Isospin of the particle; filled automatically from pdgcode_.

Definition at line 688 of file particletype.h.

◆ I3_

int smash::ParticleType::I3_
private

Isospin projection of the particle; filled automatically from pdgcode_.

Definition at line 690 of file particletype.h.

◆ iso_multiplet_

IsoParticleType* smash::ParticleType::iso_multiplet_ = nullptr
private

Container for the isospin multiplet information.

Definition at line 693 of file particletype.h.

◆ max_ratio_spectral_full_to_breit_wigner_

std::optional<double> smash::ParticleType::max_ratio_spectral_full_to_breit_wigner_
mutableprivate
Initial value:
=
std::nullopt

Maximum ratio between full spectral function and the mass-independent Breit-Wigner.

This is used for sampling the resonance mass.

Definition at line 699 of file particletype.h.


The documentation for this class was generated from the following files: