Version: SMASH-1.6
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 97 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
 
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_Delta () const
 
bool is_rho () const
 
bool is_Nstar () const
 
bool is_Nstar1535 () const
 
bool is_Deltastar () const
 
bool is_stable () const
 
bool is_nucleus () const
 
bool is_deuteron () const
 
bool is_dprime () 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 ParticleType &t_a, const ParticleType &t_b) 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 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 spectral_function_no_norm (double m) const
 Full spectral function without normalization factor. More...
 
double spectral_function_const_width (double m) const
 
double spectral_function_simple (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_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...
 
std::pair< double, double > sample_resonance_masses (const ParticleType &t2, const double cms_energy, int L=0) const
 Resonance mass sampling for 2-particle final state with two resonances. 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 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...
 
double max_factor1_ = 1.
 Maximum factor for single-res mass sampling, cf. sample_resonance_mass. More...
 
double max_factor2_ = 1.
 Maximum factor for double-res mass sampling, cf. sample_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

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 126 of file particletype.cc.

128  : name_(n),
129  mass_(m),
130  width_(w),
131  parity_(p),
132  pdgcode_(id),
133  min_mass_kinematic_(-1.),
134  min_mass_spectral_(-1.),
136  isospin_(-1),
137  I3_(pdgcode_.isospin3()) {}
int charge() const
The charge of the particle.
Definition: pdgcode.h:470
int I3_
Isospin projection of the particle; filled automatically from pdgcode_.
Definition: particletype.h:628
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
Parity parity_
Parity of the particle.
Definition: particletype.h:603
std::string name_
name of the particle
Definition: particletype.h:597
double mass_
pole mass of the particle
Definition: particletype.h:599
double min_mass_spectral_
minimum mass, where the spectral function is non-zero Mutable, because it is initialized at first cal...
Definition: particletype.h:619
constexpr int p
Proton.
int32_t charge_
Charge of the particle; filled automatically from pdgcode_.
Definition: particletype.h:624
int isospin_
Isospin of the particle; filled automatically from pdgcode_.
Definition: particletype.h:626
double width_
width of the particle
Definition: particletype.h:601
constexpr int n
Neutron.
double min_mass_kinematic_
minimum kinematically allowed mass of the particle Mutable, because it is initialized at first call o...
Definition: particletype.h:612
int isospin3() const
Definition: pdgcode.h:409
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&).

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

move ctors are needed for std::sort

Member Function Documentation

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

assignment is not allowed, see copy constructor above

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

move ctors are needed for std::sort

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

Definition at line 425 of file particletype.cc.

425  {
426  const auto offset = this - std::addressof(list_all()[0]);
427  const auto &modes = (*DecayModes::all_decay_modes)[offset];
428  assert(is_stable() || !modes.is_empty());
429  return modes;
430 }
bool is_stable() const
Definition: particletype.h:236
static const ParticleTypeList & list_all()
Definition: particletype.cc:55

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 141 of file particletype.h.

141 { return name_; }
std::string name_
name of the particle
Definition: particletype.h:597

Here is the caller graph for this function:

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

Definition at line 144 of file particletype.h.

144 { return mass_; }
double mass_
pole mass of the particle
Definition: particletype.h:599

Here is the caller graph for this function:

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

Definition at line 147 of file particletype.h.

147 { return mass_ * mass_; }
double mass_
pole mass of the particle
Definition: particletype.h:599
double smash::ParticleType::width_at_pole ( ) const
inline
Returns
the particle width (at the mass pole).

Definition at line 150 of file particletype.h.

150 { return width_; }
double width_
width of the particle
Definition: particletype.h:601

Here is the caller graph for this function:

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

Definition at line 153 of file particletype.h.

153 { return parity_; }
Parity parity_
Parity of the particle.
Definition: particletype.h:603

Here is the caller graph for this function:

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

Definition at line 156 of file particletype.h.

156 { return pdgcode_; }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605

Here is the caller graph for this function:

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 159 of file particletype.h.

159 { return pdgcode_.has_antiparticle(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool has_antiparticle() const
Definition: pdgcode.h:393

Here is the caller graph for this function:

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

Definition at line 735 of file particletype.h.

735  {
736  assert(has_antiparticle());
737  return &find(pdgcode_.get_antiparticle());
738 }
bool has_antiparticle() const
Definition: particletype.h:159
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
PdgCode get_antiparticle() const
Construct the antiparticle to a given PDG code.
Definition: pdgcode.h:259
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.

Here is the caller graph for this function:

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

Returns
-1 for antiparticles and +1 for particles.

Definition at line 165 of file particletype.h.

165 { return pdgcode_.antiparticle_sign(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
int antiparticle_sign() const
Definition: pdgcode.h:537

Here is the caller graph for this function:

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 407 of file particletype.cc.

407  {
408  if (isospin_ < 0) {
411  : 0;
412  }
413  return isospin_;
414 }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_hadron() const
Definition: pdgcode.h:297
int isospin() const
Returns twice the total isospin of the multiplet.
IsoParticleType * iso_multiplet_
Container for the isospin multiplet information.
Definition: particletype.h:631
int isospin_
Isospin of the particle; filled automatically from pdgcode_.
Definition: particletype.h:626

Here is the call graph for this function:

Here is the caller graph for this function:

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 176 of file particletype.h.

176 { return I3_; }
int I3_
Isospin projection of the particle; filled automatically from pdgcode_.
Definition: particletype.h:628

Here is the caller graph for this function:

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

Definition at line 179 of file particletype.h.

179  {
180  unsigned int I = isospin();
181  return (I == 0) ? 0 : static_cast<double>(isospin3()) / I;
182  }
int isospin3() const
Definition: particletype.h:176
int isospin() const
Returns twice the isospin vector length .

Here is the caller graph for this function:

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

Definition at line 185 of file particletype.h.

185 { return iso_multiplet_; }
IsoParticleType * iso_multiplet_
Container for the isospin multiplet information.
Definition: particletype.h:631

Here is the caller graph for this function:

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 188 of file particletype.h.

188 { return charge_; }
int32_t charge_
Charge of the particle; filled automatically from pdgcode_.
Definition: particletype.h:624

Here is the caller graph for this function:

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

Todo:
(oliiny): take care of spin for nuclei
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.

Definition at line 191 of file particletype.h.

191 { return pdgcode_.spin(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
unsigned int spin() const
Definition: pdgcode.h:509

Here is the caller graph for this function:

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

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

Definition at line 194 of file particletype.h.

194 { return pdgcode_.is_hadron(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_hadron() const
Definition: pdgcode.h:297

Here is the caller graph for this function:

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

Returns
true if this is a lepton.

Definition at line 197 of file particletype.h.

197 { return pdgcode_.is_lepton(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_lepton() const
Definition: pdgcode.h:302
bool smash::ParticleType::is_baryon ( ) const
inline

Returns
whether this PDG code identifies a baryon.

Definition at line 200 of file particletype.h.

200 { return pdgcode_.is_baryon(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_baryon() const
Definition: pdgcode.h:318

Here is the caller graph for this function:

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

Returns
whether this PDG code identifies a meson.

Definition at line 203 of file particletype.h.

203 { return pdgcode_.is_meson(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_meson() const
Definition: pdgcode.h:321

Here is the caller graph for this function:

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

Returns
the baryon number of the particle.

Definition at line 206 of file particletype.h.

206 { return pdgcode_.baryon_number(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
int baryon_number() const
Definition: pdgcode.h:308

Here is the caller graph for this function:

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 209 of file particletype.h.

209 { return pdgcode_.strangeness(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
int strangeness() const
Definition: pdgcode.h:446

Here is the caller graph for this function:

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

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

Definition at line 212 of file particletype.h.

212 { return pdgcode_.is_nucleon(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_nucleon() const
Definition: pdgcode.h:324

Here is the caller graph for this function:

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

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

Definition at line 215 of file particletype.h.

215 { return pdgcode_.is_Delta(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_Delta() const
Definition: pdgcode.h:336

Here is the caller graph for this function:

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

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

Definition at line 218 of file particletype.h.

218 { return pdgcode_.is_rho(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_rho() const
Definition: pdgcode.h:378
bool smash::ParticleType::is_Nstar ( ) const
inline
Returns
Is this a nucleon resonance (N*)?

Definition at line 221 of file particletype.h.

221  {
222  return is_baryon() && isospin() == 1 && !pdgcode_.is_nucleon() &&
223  pdgcode_.strangeness() == 0 && pdgcode_.charmness() == 0;
224  }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
int isospin() const
Returns twice the isospin vector length .
bool is_nucleon() const
Definition: pdgcode.h:324
bool is_baryon() const
Definition: particletype.h:200
int charmness() const
Definition: pdgcode.h:453
int strangeness() const
Definition: pdgcode.h:446

Here is the caller graph for this function:

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

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

Definition at line 227 of file particletype.h.

227 { return pdgcode_.is_Nstar1535(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_Nstar1535() const
Definition: pdgcode.h:330

Here is the caller graph for this function:

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

Definition at line 230 of file particletype.h.

230  {
231  return is_baryon() && isospin() == 3 && !pdgcode_.is_Delta() &&
232  pdgcode_.strangeness() == 0 && pdgcode_.charmness() == 0;
233  }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
int isospin() const
Returns twice the isospin vector length .
bool is_baryon() const
Definition: particletype.h:200
int charmness() const
Definition: pdgcode.h:453
bool is_Delta() const
Definition: pdgcode.h:336
int strangeness() const
Definition: pdgcode.h:446

Here is the caller graph for this function:

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

Definition at line 236 of file particletype.h.

236 { return width_ < width_cutoff; }
static constexpr double width_cutoff
Decay width cutoff for considering a particle as stable.
Definition: particletype.h:107
double width_
width of the particle
Definition: particletype.h:601

Here is the caller graph for this function:

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

Definition at line 239 of file particletype.h.

239 { return pdgcode_.is_nucleus(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_nucleus() const
Definition: pdgcode.h:291

Here is the caller graph for this function:

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

Definition at line 242 of file particletype.h.

242 { return pdgcode_.is_deuteron(); }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_deuteron() const
Definition: pdgcode.h:384

Here is the caller graph for this function:

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

Definition at line 245 of file particletype.h.

245  {
246  return is_nucleus() && std::abs(pdgcode_.get_decimal()) == 1000010021;
247  }
PdgCode pdgcode_
PDG Code of the particle.
Definition: particletype.h:605
bool is_nucleus() const
Definition: particletype.h:239
int32_t get_decimal() const
Definition: pdgcode.h:655

Here is the caller graph for this function:

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 357 of file particletype.cc.

357  {
358  if (unlikely(min_mass_kinematic_ < 0.)) {
359  /* If the particle is stable, min. mass is just the mass. */
361  /* Otherwise, find the lowest mass value needed in any decay mode */
362  if (!is_stable()) {
363  for (const auto &mode : decay_modes().decay_mode_list()) {
364  min_mass_kinematic_ = std::min(min_mass_kinematic_, mode->threshold());
365  }
366  }
367  }
368  return min_mass_kinematic_;
369 }
bool is_stable() const
Definition: particletype.h:236
double mass_
pole mass of the particle
Definition: particletype.h:599
#define unlikely(x)
Tell the branch predictor that this expression is likely false.
Definition: macros.h:16
double min_mass_kinematic_
minimum kinematically allowed mass of the particle Mutable, because it is initialized at first call o...
Definition: particletype.h:612
const DecayModes & decay_modes() const

Here is the call graph for this function:

Here is the caller graph for this function:

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.

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 371 of file particletype.cc.

371  {
372  if (unlikely(min_mass_spectral_ < 0.)) {
373  /* If the particle is stable or it has a non-zero spectral function value at
374  * the minimum mass that is allowed by kinematics, min_mass_spectral is just
375  * the min_mass_kinetic. */
377  /* Otherwise, find the lowest mass value where spectral function has a
378  * non-zero value by bisection.*/
379  if (!is_stable() &&
381  // find a right bound that has non-zero spectral function for bisection
382  const double m_step = 0.01;
383  double right_bound_bis;
384  for (unsigned int i = 0;; i++) {
385  right_bound_bis = min_mass_kinematic() + m_step * i;
386  if (this->spectral_function(right_bound_bis) > really_small) {
387  break;
388  }
389  }
390  // bisection
391  const double precision = 1E-6;
392  double left_bound_bis = right_bound_bis - m_step;
393  while (right_bound_bis - left_bound_bis > precision) {
394  const double mid = (left_bound_bis + right_bound_bis) / 2.0;
395  if (this->spectral_function(mid) > really_small) {
396  right_bound_bis = mid;
397  } else {
398  left_bound_bis = mid;
399  }
400  }
401  min_mass_spectral_ = right_bound_bis;
402  }
403  }
404  return min_mass_spectral_;
405 }
constexpr double really_small
Numerical error tolerance.
Definition: constants.h:34
bool is_stable() const
Definition: particletype.h:236
double spectral_function(double m) const
Full spectral function of the resonance (relativistic Breit-Wigner distribution with mass-dependent ...
double min_mass_kinematic() const
The minimum mass of the resonance that is kinematically allowed.
double min_mass_spectral_
minimum mass, where the spectral function is non-zero Mutable, because it is initialized at first cal...
Definition: particletype.h:619
#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:

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 416 of file particletype.cc.

417  {
418  if (m < mode->threshold()) {
419  return 0.;
420  }
421  double partial_width_at_pole = width_at_pole() * mode->weight();
422  return mode->type().width(mass(), partial_width_at_pole, m);
423 }
double mass() const
Definition: particletype.h:144
double width_at_pole() const
Definition: particletype.h:150

Here is the call graph for this function:

Here is the caller graph for this function:

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 432 of file particletype.cc.

432  {
433  double w = 0.;
434  if (is_stable()) {
435  return w;
436  }
437  /* Loop over decay modes and sum up all partial widths. */
438  const auto &modes = decay_modes().decay_mode_list();
439  for (unsigned int i = 0; i < modes.size(); i++) {
440  w = w + partial_width(m, modes[i].get());
441  }
442  if (w < width_cutoff) {
443  return 0.;
444  }
445  return w;
446 }
bool is_stable() const
Definition: particletype.h:236
const DecayBranchList & decay_mode_list() const
Definition: decaymodes.h:63
static constexpr double width_cutoff
Decay width cutoff for considering a particle as stable.
Definition: particletype.h:107
const DecayModes & decay_modes() const
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:

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 457 of file particletype.cc.

458  {
459  const auto FinalTypes = t.particle_types();
460  switch (wh) {
461  case WhichDecaymodes::All: {
462  return true;
463  }
465  // No dileptons in final state particles for 2 or 3-body decays
466  return (
467  (t.particle_number() == 2 &&
468  !(is_dilepton(FinalTypes[0]->pdgcode(),
469  FinalTypes[1]->pdgcode()))) ||
470  (t.particle_number() == 3 &&
471  !(has_lepton_pair(FinalTypes[0]->pdgcode(), FinalTypes[1]->pdgcode(),
472  FinalTypes[2]->pdgcode()))));
473  }
475  // Lepton pair in final state particles for 2 or 3-body decays
476  return (
477  (t.particle_number() == 2 &&
478  is_dilepton(FinalTypes[0]->pdgcode(), FinalTypes[1]->pdgcode())) ||
479  (t.particle_number() == 3 &&
480  has_lepton_pair(FinalTypes[0]->pdgcode(), FinalTypes[1]->pdgcode(),
481  FinalTypes[2]->pdgcode())));
482  }
483  default:
484  throw std::runtime_error(
485  "Problem in selecting decaymodes in wanted_decaymode()");
486  }
487 }
bool is_dilepton(const PdgCode pdg1, const PdgCode pdg2)
Definition: pdgcode.h:980
bool has_lepton_pair(const PdgCode pdg1, const PdgCode pdg2, const PdgCode pdg3)
Definition: pdgcode.h:992
Ignore dilepton decay modes widths.
Only return dilepton decays widths.
All decay mode widths.
PdgCode pdgcode() const
Definition: particletype.h:156

Here is the call graph for this function:

Here is the caller graph for this function:

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 489 of file particletype.cc.

491  {
492  const auto &decay_mode_list = decay_modes().decay_mode_list();
493  if (decay_mode_list.size() == 0 ||
494  (wh == WhichDecaymodes::Hadronic && is_stable())) {
495  return {};
496  }
497  /* Determine whether the decay is affected by the potentials. If it's
498  * affected, read the values of the potentials at the position of the
499  * particle */
500  FourVector UB = FourVector();
501  FourVector UI3 = FourVector();
502  if (UB_lat_pointer != nullptr) {
503  UB_lat_pointer->value_at(x, UB);
504  }
505  if (UI3_lat_pointer != nullptr) {
506  UI3_lat_pointer->value_at(x, UI3);
507  }
508  /* Loop over decay modes and calculate all partial widths. */
509  DecayBranchList partial;
510  partial.reserve(decay_mode_list.size());
511  for (unsigned int i = 0; i < decay_mode_list.size(); i++) {
512  /* Calculate the sqare root s of the final state particles. */
513  const auto FinalTypes = decay_mode_list[i]->type().particle_types();
514  double scale_B = 0.0;
515  double scale_I3 = 0.0;
516  if (pot_pointer != nullptr) {
517  scale_B += pot_pointer->force_scale(*this).first;
518  scale_I3 += pot_pointer->force_scale(*this).second * isospin3_rel();
519  for (const auto finaltype : FinalTypes) {
520  scale_B -= pot_pointer->force_scale(*finaltype).first;
521  scale_I3 -= pot_pointer->force_scale(*finaltype).second *
522  finaltype->isospin3_rel();
523  }
524  }
525  double sqrt_s = (p + UB * scale_B + UI3 * scale_I3).abs();
526 
527  const double w = partial_width(sqrt_s, decay_mode_list[i].get());
528  if (w > 0.) {
529  if (wanted_decaymode(decay_mode_list[i]->type(), wh)) {
530  partial.push_back(
531  make_unique<DecayBranch>(decay_mode_list[i]->type(), w));
532  }
533  }
534  }
535  return partial;
536 }
Potentials * pot_pointer
Pointer to a Potential class.
bool is_stable() const
Definition: particletype.h:236
RectangularLattice< FourVector > * UI3_lat_pointer
Pointer to the symmmetry potential on the lattice.
const DecayBranchList & decay_mode_list() const
Definition: decaymodes.h:63
RectangularLattice< FourVector > * UB_lat_pointer
Pointer to the skyrme potential on the lattice.
Ignore dilepton decay modes widths.
std::pair< double, int > force_scale(const ParticleType &data) const
Evaluates the scaling factor of the forces acting on the particles.
Definition: potentials.cc:137
constexpr int p
Proton.
double isospin3_rel() const
Definition: particletype.h:179
const DecayModes & decay_modes() const
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 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:

double smash::ParticleType::get_partial_width ( const double  m,
const ParticleType t_a,
const ParticleType t_b 
) 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]t_aType of first daughter particle.
[in]t_bType of second daughter particle.
Returns
the partial width for this mass and this specific decay channel

Definition at line 538 of file particletype.cc.

539  {
540  /* Get all decay modes. */
541  const auto &decaymodes = decay_modes().decay_mode_list();
542 
543  /* Find the right one(s) and add up corresponding widths. */
544  double w = 0.;
545  for (const auto &mode : decaymodes) {
546  double partial_width_at_pole = width_at_pole() * mode->weight();
547  const ParticleTypePtrList l = {&t_a, &t_b};
548  if (mode->type().has_particles(l)) {
549  w += mode->type().width(mass(), partial_width_at_pole, m);
550  }
551  }
552  return w;
553 }
const DecayBranchList & decay_mode_list() const
Definition: decaymodes.h:63
double mass() const
Definition: particletype.h:144
double width_at_pole() const
Definition: particletype.h:150
const DecayModes & decay_modes() const

Here is the call graph for this function:

Here is the caller graph for this function:

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 555 of file particletype.cc.

557  {
558  /* Get all decay modes. */
559  const auto &decaymodes = decay_modes().decay_mode_list();
560 
561  /* Find the right one(s) and add up corresponding widths. */
562  double w = 0.;
563  for (const auto &mode : decaymodes) {
564  double partial_width_at_pole = width_at_pole() * mode->weight();
565  const ParticleTypePtrList l = {&p_a.type(), &p_b.type()};
566  if (mode->type().has_particles(l)) {
567  w += mode->type().in_width(mass(), partial_width_at_pole, m,
568  p_a.effective_mass(), p_b.effective_mass());
569  }
570  }
571  return w;
572 }
const DecayBranchList & decay_mode_list() const
Definition: decaymodes.h:63
double mass() const
Definition: particletype.h:144
double width_at_pole() const
Definition: particletype.h:150
const DecayModes & decay_modes() const

Here is the call graph for this function:

Here is the caller graph for this function:

double smash::ParticleType::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 574 of file particletype.cc.

574  {
575  if (norm_factor_ < 0.) {
576  /* Initialize the normalization factor
577  * by integrating over the unnormalized spectral function. */
578  static /*thread_local (see #3075)*/ Integrator integrate;
579  const double width = width_at_pole();
580  const double m_pole = mass();
581  // We transform the integral using m = m_min + width_pole * tan(x), to
582  // make it definite and to avoid numerical issues.
583  const double x_min = std::atan((min_mass_kinematic() - m_pole) / width);
584  norm_factor_ = 1. / integrate(x_min, M_PI / 2., [&](double x) {
585  const double tanx = std::tan(x);
586  const double m_x = m_pole + width * tanx;
587  const double jacobian = width * (1.0 + tanx * tanx);
588  return spectral_function_no_norm(m_x) * jacobian;
589  });
590  }
592 }
double min_mass_kinematic() const
The minimum mass of the resonance that is kinematically allowed.
double mass() const
Definition: particletype.h:144
double norm_factor_
This normalization factor ensures that the spectral function is normalized to unity, when integrated over its full domain.
Definition: particletype.h:622
double width_at_pole() const
Definition: particletype.h:150
double spectral_function_no_norm(double m) const
Full spectral function without normalization factor.
static Integrator integrate
Definition: decaytype.cc:147

Here is the call graph for this function:

Here is the caller graph for this function:

double smash::ParticleType::spectral_function_no_norm ( 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 594 of file particletype.cc.

594  {
595  /* The spectral function is a relativistic Breit-Wigner function
596  * with mass-dependent width. Here: without normalization factor. */
597  const double resonance_width = total_width(m);
598  if (resonance_width < ParticleType::width_cutoff) {
599  return 0.;
600  }
601  return breit_wigner(m, mass(), resonance_width);
602 }
static constexpr double width_cutoff
Decay width cutoff for considering a particle as stable.
Definition: particletype.h:107
double total_width(const double m) const
Get the mass-dependent total width of a particle with mass m.
double mass() const
Definition: particletype.h:144
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:

double smash::ParticleType::spectral_function_const_width ( double  m) const
Todo:
unused The spectral function with a constant width (= width at pole).

It is guaranteed to be normalized to 1, when integrated from 0 to inf.

Definition at line 604 of file particletype.cc.

604  {
605  /* The spectral function is a relativistic Breit-Wigner function.
606  * This variant is using a constant width (evaluated at the pole mass). */
607  const double resonance_width = width_at_pole();
608  if (resonance_width < ParticleType::width_cutoff) {
609  return 0.;
610  }
611  return breit_wigner(m, mass(), resonance_width);
612 }
static constexpr double width_cutoff
Decay width cutoff for considering a particle as stable.
Definition: particletype.h:107
double mass() const
Definition: particletype.h:144
double breit_wigner(double m, double pole, double width)
Returns a relativistic Breit-Wigner distribution.
double width_at_pole() const
Definition: particletype.h:150

Here is the call graph for this function:

double smash::ParticleType::spectral_function_simple ( 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 614 of file particletype.cc.

614  {
615  return breit_wigner_nonrel(m, mass(), width_at_pole());
616 }
double breit_wigner_nonrel(double m, double pole, double width)
Returns a non-relativistic Breit-Wigner distribution, which is essentially a Cauchy distribution with...
double mass() const
Definition: particletype.h:144
double width_at_pole() const
Definition: particletype.h:150

Here is the call graph for this function:

Here is the caller graph for this function:

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 619 of file particletype.cc.

621  {
622  /* largest possible mass: Use 'nextafter' to make sure it is not above the
623  * physical limit by numerical error. */
624  const double max_mass = std::nextafter(cms_energy - mass_stable, 0.);
625 
626  // smallest possible mass to find non-zero spectral function contributions
627  const double min_mass = this->min_mass_spectral();
628  assert(min_mass < max_mass);
629 
630  // largest possible cm momentum (from smallest mass)
631  const double pcm_max = pCM(cms_energy, mass_stable, min_mass);
632  const double blw_max = pcm_max * blatt_weisskopf_sqr(pcm_max, L);
633  /* The maximum of the spectral-function ratio 'usually' happens at the
634  * largest mass. However, this is not always the case, therefore we need
635  * and additional fudge factor (determined automatically). Additionally,
636  * a heuristic knowledge is used that usually such mass exist that
637  * spectral_function(m) > spectral_function_simple(m). */
638  const double sf_ratio_max =
639  std::max(1., this->spectral_function(max_mass) /
640  this->spectral_function_simple(max_mass));
641 
642  double mass_res, val;
643  // outer loop: repeat if maximum is too small
644  do {
645  const double q_max = sf_ratio_max * this->max_factor1_;
646  const double max = blw_max * q_max; // maximum value for rejection sampling
647  // inner loop: rejection sampling
648  do {
649  // sample mass from a simple Breit-Wigner (aka Cauchy) distribution
650  mass_res = random::cauchy(this->mass(), this->width_at_pole() / 2.,
651  this->min_mass_spectral(), max_mass);
652  // determine cm momentum for this case
653  const double pcm = pCM(cms_energy, mass_stable, mass_res);
654  const double blw = pcm * blatt_weisskopf_sqr(pcm, L);
655  // determine ratio of full to simple spectral function
656  const double q = this->spectral_function(mass_res) /
657  this->spectral_function_simple(mass_res);
658  val = q * blw;
659  } while (val < random::uniform(0., max));
660 
661  // check that we are using the proper maximum value
662  if (val > max) {
663  const auto &log = logger<LogArea::Resonances>();
664  log.debug("maximum is being increased in sample_resonance_mass: ",
665  this->max_factor1_, " ", val / max, " ", this->pdgcode(), " ",
666  mass_stable, " ", cms_energy, " ", mass_res);
667  this->max_factor1_ *= val / max;
668  } else {
669  break; // maximum ok, exit loop
670  }
671  } while (true);
672 
673  return mass_res;
674 }
double spectral_function(double m) const
Full spectral function of the resonance (relativistic Breit-Wigner distribution with mass-dependent ...
double blatt_weisskopf_sqr(const double p_ab, const int L)
Definition: formfactors.h:33
double mass() const
Definition: particletype.h:144
double min_mass_spectral() const
The minimum mass of the resonance, where the spectral function is non-zero.
T uniform(T min, T max)
Definition: random.h:88
double max_factor1_
Maximum factor for single-res mass sampling, cf. sample_resonance_mass.
Definition: particletype.h:634
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:307
PdgCode pdgcode() const
Definition: particletype.h:156
double width_at_pole() const
Definition: particletype.h:150
T pCM(const T sqrts, const T mass_a, const T mass_b) noexcept
Definition: kinematics.h:79
double spectral_function_simple(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:

std::pair< double, double > smash::ParticleType::sample_resonance_masses ( const ParticleType t2,
const double  cms_energy,
int  L = 0 
) const

Resonance mass sampling for 2-particle final state with two resonances.

Parameters
[in]t2Type of the second resonance (the first resonance is given by 'this').
[in]cms_energycenter-of-mass energy of the 2-particle final state.
[in]Lrelative angular momentum of the final-state particles
Returns
The masses of the resonance particles.

Definition at line 677 of file particletype.cc.

678  {
679  const ParticleType &t1 = *this;
680  /* Sample resonance mass from the distribution
681  * used for calculating the cross section. */
682  const double max_mass_1 =
683  std::nextafter(cms_energy - t2.min_mass_spectral(), 0.);
684  const double max_mass_2 =
685  std::nextafter(cms_energy - t1.min_mass_spectral(), 0.);
686  // largest possible cm momentum (from smallest mass)
687  const double pcm_max =
688  pCM(cms_energy, t1.min_mass_spectral(), t2.min_mass_spectral());
689  const double blw_max = pcm_max * blatt_weisskopf_sqr(pcm_max, L);
690 
691  double mass_1, mass_2, val;
692  // outer loop: repeat if maximum is too small
693  do {
694  // maximum value for rejection sampling (determined automatically)
695  const double max = blw_max * t1.max_factor2_;
696  // inner loop: rejection sampling
697  do {
698  // sample mass from a simple Breit-Wigner (aka Cauchy) distribution
699  mass_1 = random::cauchy(t1.mass(), t1.width_at_pole() / 2.,
700  t1.min_mass_spectral(), max_mass_1);
701  mass_2 = random::cauchy(t2.mass(), t2.width_at_pole() / 2.,
702  t2.min_mass_spectral(), max_mass_2);
703  // determine cm momentum for this case
704  const double pcm = pCM(cms_energy, mass_1, mass_2);
705  const double blw = pcm * blatt_weisskopf_sqr(pcm, L);
706  // determine ratios of full to simple spectral function
707  const double q1 =
708  t1.spectral_function(mass_1) / t1.spectral_function_simple(mass_1);
709  const double q2 =
710  t2.spectral_function(mass_2) / t2.spectral_function_simple(mass_2);
711  val = q1 * q2 * blw;
712  } while (val < random::uniform(0., max));
713 
714  if (val > max) {
715  const auto &log = logger<LogArea::Resonances>();
716  log.debug("maximum is being increased in sample_resonance_masses: ",
717  t1.max_factor2_, " ", val / max, " ", t1.pdgcode(), " ",
718  t2.pdgcode(), " ", cms_energy, " ", mass_1, " ", mass_2);
719  t1.max_factor2_ *= val / max;
720  } else {
721  break; // maximum ok, exit loop
722  }
723  } while (true);
724 
725  return {mass_1, mass_2};
726 }
double blatt_weisskopf_sqr(const double p_ab, const int L)
Definition: formfactors.h:33
T uniform(T min, T max)
Definition: random.h:88
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:307
T pCM(const T sqrts, const T mass_a, const T mass_b) noexcept
Definition: kinematics.h:79
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:

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 728 of file particletype.cc.

728  {
729  if (is_stable()) {
730  std::stringstream err;
731  err << "Particle " << *this << " is stable, so it makes no"
732  << " sense to print its spectral function, etc.";
733  throw std::runtime_error(err.str());
734  }
735 
736  double rightmost_pole = 0.0;
737  const auto &decaymodes = decay_modes().decay_mode_list();
738  for (const auto &mode : decaymodes) {
739  double pole_mass_sum = 0.0;
740  for (const ParticleTypePtr p : mode->type().particle_types()) {
741  pole_mass_sum += p->mass();
742  }
743  if (pole_mass_sum > rightmost_pole) {
744  rightmost_pole = pole_mass_sum;
745  }
746  }
747 
748  std::cout << "# mass m[GeV], width w(m) [GeV],"
749  << " spectral function(m^2)*m [GeV^-1] of " << *this << std::endl;
750  constexpr double m_step = 0.02;
751  const double m_min = min_mass_spectral();
752  // An empirical value used to stop the printout. Assumes that spectral
753  // function decays at high mass, which is true for all known resonances.
754  constexpr double spectral_function_threshold = 8.e-3;
755  std::cout << std::fixed << std::setprecision(5);
756  for (unsigned int i = 0;; i++) {
757  const double m = m_min + m_step * i;
758  const double w = total_width(m), sf = spectral_function(m);
759  if (m > rightmost_pole * 2 && sf < spectral_function_threshold) {
760  break;
761  }
762  std::cout << m << " " << w << " " << sf << std::endl;
763  }
764 }
bool is_stable() const
Definition: particletype.h:236
double spectral_function(double m) const
Full spectral function of the resonance (relativistic Breit-Wigner distribution with mass-dependent ...
const DecayBranchList & decay_mode_list() const
Definition: decaymodes.h:63
double total_width(const double m) const
Get the mass-dependent total width of a particle with mass m.
double min_mass_spectral() const
The minimum mass of the resonance, where the spectral function is non-zero.
constexpr int p
Proton.
const DecayModes & decay_modes() const

Here is the call graph for this function:

Here is the caller graph for this function:

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 55 of file particletype.cc.

55  {
56  assert(all_particle_types);
57  return *all_particle_types;
58 }
const ParticleTypeList * all_particle_types
Global pointer to the Particle Type list.
Definition: particletype.cc:40

Here is the caller graph for this function:

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

Definition at line 73 of file particletype.cc.

73 { return nucleons_list; }
ParticleTypePtrList nucleons_list
Global pointer to the Particle Type list of nucleons.
Definition: particletype.cc:42

Here is the caller graph for this function:

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

Definition at line 75 of file particletype.cc.

75  {
76  return anti_nucs_list;
77 }
ParticleTypePtrList anti_nucs_list
Global pointer to the Particle Type list of anti-nucleons.
Definition: particletype.cc:44

Here is the caller graph for this function:

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

Definition at line 79 of file particletype.cc.

79 { return deltas_list; }
ParticleTypePtrList deltas_list
Global pointer to the Particle Type list of deltas.
Definition: particletype.cc:46

Here is the caller graph for this function:

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 81 of file particletype.cc.

81  {
82  return anti_deltas_list;
83 }
ParticleTypePtrList anti_deltas_list
Global pointer to the Particle Type list of anti-deltas.
Definition: particletype.cc:48

Here is the caller graph for this function:

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

Definition at line 85 of file particletype.cc.

85  {
87 }
ParticleTypePtrList baryon_resonances_list
Global pointer to the Particle Type list of baryon resonances.
Definition: particletype.cc:50

Here is the caller graph for this function:

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 89 of file particletype.cc.

89  {
90  return light_nuclei_list;
91 }
ParticleTypePtrList light_nuclei_list
Global pointer to the Particle Type list of light nuclei.
Definition: particletype.cc:52

Here is the caller graph for this function:

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 93 of file particletype.cc.

93  {
94  const auto found = std::lower_bound(
96  [](const ParticleType &l, const PdgCode &r) { return l.pdgcode() < r; });
97  if (found == all_particle_types->end() || found->pdgcode() != pdgcode) {
98  return {}; // The default constructor creates an invalid pointer.
99  }
100  return &*found;
101 }
const ParticleTypeList * all_particle_types
Global pointer to the Particle Type list.
Definition: particletype.cc:40
PdgCode pdgcode() const
Definition: particletype.h:156
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:

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 103 of file particletype.cc.

103  {
104  const auto found = ParticleType::try_find(pdgcode);
105  if (!found) {
106  throw PdgNotFoundFailure("PDG code " + pdgcode.string() + " not found!");
107  }
108  return *found;
109 }
PdgCode pdgcode() const
Definition: particletype.h:156
static const ParticleTypePtr try_find(PdgCode pdgcode)
Returns the ParticleTypePtr for the given pdgcode.
Definition: particletype.cc:93
std::string string() const
Definition: pdgcode.h:252

Here is the call graph for this function:

Here is the caller graph for this function:

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 111 of file particletype.cc.

111  {
112  const auto found = ParticleType::try_find(pdgcode);
113  return found;
114 }
PdgCode pdgcode() const
Definition: particletype.h:156
static const ParticleTypePtr try_find(PdgCode pdgcode)
Returns the ParticleTypePtr for the given pdgcode.
Definition: particletype.cc:93

Here is the call graph for this function:

Here is the caller graph for this function:

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 116 of file particletype.cc.

116  {
117  const auto found =
118  std::find_if(all_particle_types->begin(), all_particle_types->end(),
119  [&](const ParticleType &p) { return p.name() == name; });
120  if (found == all_particle_types->end()) {
121  return false;
122  }
123  return true;
124 }
const std::string & name() const
Definition: particletype.h:141
const ParticleTypeList * all_particle_types
Global pointer to the Particle Type list.
Definition: particletype.cc:40
constexpr int p
Proton.
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:

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 203 of file particletype.cc.

203  { // {{{
204  const auto &log = logger<LogArea::ParticleType>();
205  static ParticleTypeList type_list;
206  type_list.clear(); // in case LoadFailure was thrown and caught and we should
207  // try again
208  for (const Line &line : line_parser(input)) {
209  std::istringstream lineinput(line.text);
210  std::string name;
211  double mass, width;
212  std::string parity_string;
213  std::vector<std::string> pdgcode_strings;
214  // We expect at most 4 PDG codes per multiplet.
215  pdgcode_strings.reserve(4);
216  lineinput >> name >> mass >> width >> parity_string;
217  Parity parity;
218  bool fail = false;
219  if (parity_string == "+") {
220  parity = Parity::Pos;
221  } else if (parity_string == "-") {
222  parity = Parity::Neg;
223  } else {
224  fail = true;
225  }
226  if (lineinput.fail() || fail) {
227  throw ParticleType::LoadFailure(build_error_string(
228  "While loading the ParticleType data:\nFailed to convert the input "
229  "string to the expected data types.",
230  line));
231  }
232  // read additional PDG codes (if present)
233  while (!lineinput.eof()) {
234  pdgcode_strings.push_back("");
235  lineinput >> pdgcode_strings.back();
236  if (lineinput.fail()) {
237  throw ParticleType::LoadFailure(build_error_string(
238  "While loading the ParticleType data:\nFailed to convert the input "
239  "string to the expected data types.",
240  line));
241  }
242  }
243  if (pdgcode_strings.size() < 1) {
244  throw ParticleType::LoadFailure(build_error_string(
245  "While loading the ParticleType data:\nFailed to convert the input "
246  "string due to missing PDG code.",
247  line));
248  }
249  std::vector<PdgCode> pdgcode;
250  pdgcode.resize(pdgcode_strings.size());
251  std::transform(pdgcode_strings.begin(), pdgcode_strings.end(),
252  pdgcode.begin(),
253  [](const std::string &s) { return PdgCode(s); });
254  ensure_all_read(lineinput, line);
255 
256  /* Check if nucleon, kaon, and delta masses are
257  * the same as hardcoded ones, if present */
258  if (pdgcode[0].is_nucleon() && !almost_equal(mass, nucleon_mass)) {
259  throw std::runtime_error(
260  "Nucleon mass in input file different from 0.938");
261  }
262  if (pdgcode[0].is_kaon() && !almost_equal(mass, kaon_mass)) {
263  throw std::runtime_error("Kaon mass in input file different from 0.494");
264  }
265  if (pdgcode[0].is_Delta() && !almost_equal(mass, delta_mass)) {
266  throw std::runtime_error("Delta mass in input file different from 1.232");
267  }
268  if (pdgcode[0].is_deuteron() && !almost_equal(mass, deuteron_mass)) {
269  throw std::runtime_error("d mass in input file different from 1.8756");
270  }
271 
272  // add all states to type list
273  for (size_t i = 0; i < pdgcode.size(); i++) {
274  std::string full_name = name;
275  if (pdgcode.size() > 1) {
276  // for multiplets: add charge string to name
277  full_name += chargestr(pdgcode[i].charge());
278  }
279  type_list.emplace_back(full_name, mass, width, parity, pdgcode[i]);
280  log.debug() << "Setting particle type: " << type_list.back();
281  if (pdgcode[i].has_antiparticle()) {
282  /* add corresponding antiparticle */
283  PdgCode anti = pdgcode[i].get_antiparticle();
284  // For bosons the parity does not change, for fermions it gets inverted.
285  const auto anti_parity = (anti.spin() % 2 == 0) ? parity : -parity;
286  full_name = antiname(full_name, pdgcode[i]);
287  type_list.emplace_back(full_name, mass, width, anti_parity, anti);
288  log.debug() << "Setting antiparticle type: " << type_list.back();
289  }
290  }
291  }
292  type_list.shrink_to_fit();
293 
294  /* Sort the type list by PDG code. */
295  std::sort(type_list.begin(), type_list.end());
296 
297  /* Look for duplicates. */
298  PdgCode prev_pdg = 0;
299  for (const auto &t : type_list) {
300  if (t.pdgcode() == prev_pdg) {
301  throw ParticleType::LoadFailure("Duplicate PdgCode in particles.txt: " +
302  t.pdgcode().string());
303  }
304  prev_pdg = t.pdgcode();
305  }
306 
307  if (all_particle_types != nullptr) {
308  throw std::runtime_error("Error: Type list was already built!");
309  }
310  all_particle_types = &type_list; // note that type_list is a function-local
311  // static and thus will live on until after
312  // main().
313 
314  // create all isospin multiplets
315  for (const auto &t : type_list) {
317  }
318  // link the multiplets to the types
319  for (auto &t : type_list) {
320  t.iso_multiplet_ = IsoParticleType::find(t);
321  }
322 
323  // Create nucleons/anti-nucleons list
324  if (IsoParticleType::exists("N")) {
325  for (const auto state : IsoParticleType::find("N").get_states()) {
326  nucleons_list.push_back(state);
327  anti_nucs_list.push_back(state->get_antiparticle());
328  }
329  }
330 
331  // Create deltas list
332  if (IsoParticleType::exists("Δ")) {
333  for (const auto state : IsoParticleType::find("Δ").get_states()) {
334  deltas_list.push_back(state);
335  anti_deltas_list.push_back(state->get_antiparticle());
336  }
337  }
338 
339  // Create baryon resonances list
340  for (const ParticleType &type_resonance : ParticleType::list_all()) {
341  /* Only loop over baryon resonances. */
342  if (type_resonance.is_stable() ||
343  type_resonance.pdgcode().baryon_number() != 1) {
344  continue;
345  }
346  baryon_resonances_list.push_back(&type_resonance);
347  baryon_resonances_list.push_back(type_resonance.get_antiparticle());
348  }
349 
350  for (const ParticleType &type : ParticleType::list_all()) {
351  if (type.is_nucleus()) {
352  light_nuclei_list.push_back(&type);
353  }
354  }
355 } /*}}}*/
static const IsoParticleType & find(const std::string &name)
Returns the IsoParticleType object for the given name.
bool is_Delta() const
Definition: particletype.h:215
bool has_antiparticle() const
Definition: particletype.h:159
bool almost_equal(const N x, const N y)
Checks two numbers for relative approximate equality.
Definition: numerics.h:42
ParticleTypePtrList anti_deltas_list
Global pointer to the Particle Type list of anti-deltas.
Definition: particletype.cc:48
ParticleTypePtrList nucleons_list
Global pointer to the Particle Type list of nucleons.
Definition: particletype.cc:42
Parity
Represent the parity of a particle type.
Definition: particletype.h:24
constexpr double nucleon_mass
Nucleon mass in GeV.
Definition: constants.h:52
static bool exists(const std::string &name)
Returns whether the ParticleType with the given pdgcode exists.
static std::string chargestr(int charge)
Construct a charge string, given the charge as integer.
static const ParticleTypeList & list_all()
Definition: particletype.cc:55
double mass() const
Definition: particletype.h:144
bool is_nucleon() const
Definition: particletype.h:212
const std::string & name() const
Definition: particletype.h:141
ParticleTypePtrList deltas_list
Global pointer to the Particle Type list of deltas.
Definition: particletype.cc:46
constexpr double deuteron_mass
Deuteron mass in GeV.
Definition: constants.h:92
ParticleTypePtrList anti_nucs_list
Global pointer to the Particle Type list of anti-nucleons.
Definition: particletype.cc:44
static void create_multiplet(const ParticleType &type)
Add a new multiplet to the global list of IsoParticleTypes, which contains type.
constexpr double kaon_mass
Kaon mass in GeV.
Definition: constants.h:66
Negative parity.
int32_t charge() const
The charge of the particle.
Definition: particletype.h:188
ParticleTypePtrList baryon_resonances_list
Global pointer to the Particle Type list of baryon resonances.
Definition: particletype.cc:50
ParticleTypePtrList light_nuclei_list
Global pointer to the Particle Type list of light nuclei.
Definition: particletype.cc:52
bool is_deuteron() const
Definition: particletype.h:242
build_vector_< Line > line_parser(const std::string &input)
Helper function for parsing particles.txt and decaymodes.txt.
const ParticleTypeList * all_particle_types
Global pointer to the Particle Type list.
Definition: particletype.cc:40
PdgCode pdgcode() const
Definition: particletype.h:156
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...
ParticleTypePtrList get_states() const
Returns list of states that form part of the multiplet.
Parity parity() const
Definition: particletype.h:153
void ensure_all_read(std::istream &input, const Line &line)
Makes sure that nothing is left to read from this line.
constexpr double delta_mass
Delta mass in GeV.
Definition: constants.h:86
ParticleType(std::string n, double m, double w, Parity p, PdgCode id)
Creates a fully initialized ParticleType object.
std::string build_error_string(std::string message, const Line &line)
Builds a meaningful error message.
Positive parity.

Here is the call graph for this function:

Here is the caller graph for this function:

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 524 of file particletype.h.

524  {
525  return pdgcode() == rhs.pdgcode();
526  }
PdgCode pdgcode() const
Definition: particletype.h:156

Here is the call graph for this function:

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 531 of file particletype.h.

531  {
532  return pdgcode() != rhs.pdgcode();
533  }
PdgCode pdgcode() const
Definition: particletype.h:156

Here is the call graph for this function:

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 540 of file particletype.h.

540  {
541  return pdgcode() < rhs.pdgcode();
542  }
PdgCode pdgcode() const
Definition: particletype.h:156

Here is the call graph for this function:

void smash::ParticleType::check_consistency ( )
static
Exceptions
runtime_errorif unstable particles have no decay modes

Definition at line 448 of file particletype.cc.

448  {
449  for (const ParticleType &ptype : ParticleType::list_all()) {
450  if (!ptype.is_stable() && ptype.decay_modes().is_empty()) {
451  throw std::runtime_error("Unstable particle " + ptype.name() +
452  " has no decay chanels!");
453  }
454  }
455 }
static const ParticleTypeList & list_all()
Definition: particletype.cc:55
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:

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 61 of file particletype.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

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

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 107 of file particletype.h.

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

name of the particle

Definition at line 597 of file particletype.h.

double smash::ParticleType::mass_
private

pole mass of the particle

Definition at line 599 of file particletype.h.

double smash::ParticleType::width_
private

width of the particle

Definition at line 601 of file particletype.h.

Parity smash::ParticleType::parity_
private

Parity of the particle.

Definition at line 603 of file particletype.h.

PdgCode smash::ParticleType::pdgcode_
private

PDG Code of the particle.

Definition at line 605 of file particletype.h.

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 612 of file particletype.h.

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 619 of file particletype.h.

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 622 of file particletype.h.

int32_t smash::ParticleType::charge_
private

Charge of the particle; filled automatically from pdgcode_.

Definition at line 624 of file particletype.h.

int smash::ParticleType::isospin_
mutableprivate

Isospin of the particle; filled automatically from pdgcode_.

Definition at line 626 of file particletype.h.

int smash::ParticleType::I3_
private

Isospin projection of the particle; filled automatically from pdgcode_.

Definition at line 628 of file particletype.h.

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

Container for the isospin multiplet information.

Definition at line 631 of file particletype.h.

double smash::ParticleType::max_factor1_ = 1.
mutableprivate

Maximum factor for single-res mass sampling, cf. sample_resonance_mass.

Definition at line 634 of file particletype.h.

double smash::ParticleType::max_factor2_ = 1.
mutableprivate

Maximum factor for double-res mass sampling, cf. sample_resonance_masses.

Definition at line 636 of file particletype.h.


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