Version: SMASH-3.1
isoparticletype.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2022
3  * SMASH Team
4  *
5  * GNU General Public License (GPLv3 or later)
6  */
7 
8 #ifndef SRC_INCLUDE_SMASH_ISOPARTICLETYPE_H_
9 #define SRC_INCLUDE_SMASH_ISOPARTICLETYPE_H_
10 
11 #include <filesystem>
12 #include <string>
13 #include <unordered_map>
14 #include <vector>
15 
16 #include "particletype.h"
17 #include "sha256.h"
18 #include "tabulation.h"
19 
20 namespace smash {
21 
30  public:
40  IsoParticleType(const std::string &n, double m, double w, unsigned int s,
41  Parity p);
42 
47  IsoParticleType(const IsoParticleType &) = delete;
50 
55 
62  bool operator==(const IsoParticleType &rhs) const {
63  return states_[0]->pdgcode() == rhs.states_[0]->pdgcode();
64  }
65 
67  const std::string &name() const { return name_; }
68 
79  const std::string name_filtered_prime() const {
80  std::string tmp_s = name_;
81  std::size_t found_position = tmp_s.find("'");
82  if (found_position != std::string::npos) {
83  tmp_s.erase(found_position, 1);
84  tmp_s.insert(found_position, "_prime");
85  }
86  return tmp_s;
87  }
88 
90  double mass() const { return mass_; }
91 
93  double width() const { return width_; }
94 
96  int isospin() const { return states_.size() - 1; }
97 
102  unsigned int spin() const { return spin_; }
103 
107  Parity parity() const { return parity_; }
108 
112  bool is_hadron() const { return states_[0]->is_hadron(); }
113 
115  ParticleTypePtrList get_states() const { return states_; }
116 
123  void add_state(const ParticleType &type);
124 
129  const IsoParticleType *anti_multiplet() const;
130 
135  bool has_anti_multiplet() const;
136 
138  static const IsoParticleTypeList &list_all();
139 
142  static const std::vector<const IsoParticleType *> list_baryon_resonances();
143 
152  static const IsoParticleType *try_find(const std::string &name);
153 
161  static const IsoParticleType &find(const std::string &name);
162 
170  static IsoParticleType *find(const ParticleType &type);
171 
176  struct ParticleNotFoundFailure : public std::runtime_error {
177  using std::runtime_error::runtime_error;
178  };
179 
186  static bool exists(const std::string &name);
187 
195  static const ParticleTypePtr find_state(const std::string &name);
196 
204  static void create_multiplet(const ParticleType &type);
205 
215  static void tabulate_integrals(sha256::Hash hash,
216  const std::filesystem::path &tabulations_path);
217 
223  double get_integral_NR(double sqrts);
224 
231  double get_integral_RR(IsoParticleType *type_res_2, double sqrts);
232 
238  double get_integral_RK(double sqrts);
239 
245  double get_integral_piR(double sqrts);
246 
252  double get_integral_rhoR(double sqrts);
253 
254  private:
256  std::string name_;
258  double mass_;
260  double width_;
262  unsigned int spin_;
266  ParticleTypePtrList states_;
267 
286 
293  static IsoParticleType &find_private(const std::string &name);
294 };
295 
296 } // namespace smash
297 
298 #endif // SRC_INCLUDE_SMASH_ISOPARTICLETYPE_H_
IsoParticleType is a class to represent isospin multiplets.
double mass_
(average) mass of the multiplet
void add_state(const ParticleType &type)
Add a new state to an existing multiplet (and check if isospin symmetry is fulfilled).
bool operator==(const IsoParticleType &rhs) const
Returns whether the two IsoParticleType objects have the same PDG code for their first state; if so,...
double width_
(average) width of the multiplet
static const IsoParticleType * try_find(const std::string &name)
Returns the IsoParticleType pointer for the given name.
IsoParticleType(IsoParticleType &&)=default
Move constructor of IsoParticleType (needed for std::sort)
Tabulation * XS_NR_tabulation_
A tabulation for the NN -> NR cross sections, where R is a resonance from this multiplet.
Tabulation * XS_rhoR_tabulation_
A tabulation for the ρρ integrals.
Parity parity_
parity of the multiplet
static bool exists(const std::string &name)
Returns whether the ParticleType with the given pdgcode exists.
double width() const
Returns the (average) multiplet width.
static const IsoParticleType & find(const std::string &name)
Returns the IsoParticleType object for the given name.
double get_integral_RR(IsoParticleType *type_res_2, double sqrts)
Look up the tabulated resonance integral for the XX -> RR cross section.
const std::string name_filtered_prime() const
Returns the name of the multiplet, after replacing "'" with "_prime".
static IsoParticleType & find_private(const std::string &name)
Private version of the 'find' method that returns a non-const reference.
static void tabulate_integrals(sha256::Hash hash, const std::filesystem::path &tabulations_path)
Tabulate all relevant integrals.
Tabulation * XS_piR_tabulation_
A tabulation of the spectral integral for the dpi -> d'pi cross sections.
int isospin() const
Returns twice the total isospin of the multiplet.
static void create_multiplet(const ParticleType &type)
Add a new multiplet to the global list of IsoParticleTypes, which contains type.
ParticleTypePtrList states_
list of states that are contained in the multiplet
bool has_anti_multiplet() const
Check if there is a multiplet of antiparticles, which is different from the original multiplet.
IsoParticleType(const std::string &n, double m, double w, unsigned int s, Parity p)
Creates a fully initialized IsoParticleType object.
IsoParticleType & operator=(const IsoParticleType &)=delete
Assignment is not allowed, see copy constructor above.
double get_integral_NR(double sqrts)
Look up the tabulated resonance integral for the XX -> NR cross section.
IsoParticleType(const IsoParticleType &)=delete
Copies are not allowed as they break intended use.
static const IsoParticleTypeList & list_all()
Returns a list of all IsoParticleTypes.
double mass() const
Returns the (average) multiplet mass.
Tabulation * XS_DeltaR_tabulation_
A tabulation for the NN -> RΔ cross sections, where R is a resonance from this multiplet.
const IsoParticleType * anti_multiplet() const
Return a multiplet of antiparticles, if it is different from the original multiplet.
IsoParticleType & operator=(IsoParticleType &&)=default
Move constructor of IsoParticleType "="-operator (needed for std::sort)
const std::string & name() const
Returns the name of the multiplet.
double get_integral_rhoR(double sqrts)
Look up the tabulated resonance integral for the XX -> rhoR cross section.
static const std::vector< const IsoParticleType * > list_baryon_resonances()
Returns a list of all IsoParticleTypes that are baryon resonances.
double get_integral_RK(double sqrts)
Look up the tabulated resonance integral for the XX -> RK cross section.
std::string name_
name of the multiplet
unsigned int spin() const
Returns twice the spin of the multiplet.
unsigned int spin_
twice the spin of the multiplet
ParticleTypePtrList get_states() const
Returns list of states that form part of the multiplet.
Tabulation * XS_RK_tabulation_
A tabulation of the spectral integral for the NK -> RK cross sections.
double get_integral_piR(double sqrts)
Look up the tabulated resonance integral for the XX -> piR cross section.
static const ParticleTypePtr find_state(const std::string &name)
Returns the ParticleType object for the given name, by first finding the correct multiplet and then l...
A pointer-like interface to global references to ParticleType objects.
Definition: particletype.h:676
Particle type contains the static properties of a particle species.
Definition: particletype.h:98
A class for storing a one-dimensional lookup table of floating-point values.
Definition: tabulation.h:35
constexpr int p
Proton.
constexpr int n
Neutron.
std::array< uint8_t, HASH_SIZE > Hash
A SHA256 hash.
Definition: sha256.h:25
Definition: action.h:24
Parity
Represent the parity of a particle type.
Definition: particletype.h:25
Throw when requested particle could not be found.