22 const std::vector<const IsoParticleType *>
27 const auto baryon_number = res.states_[0]->pdgcode().baryon_number();
28 if (res.states_[0]->is_stable() || (baryon_number <= 0)) {
39 : name_(
n), mass_(m), width_(w), spin_(s), parity_(
p) {}
72 " not found (privately)!");
90 if (name.find(
"⁺⁺") != std::string::npos) {
91 return name.substr(0, name.length() -
sizeof(
"⁺⁺") + 1);
92 }
else if (name.find(
"⁺") != std::string::npos) {
93 return name.substr(0, name.length() -
sizeof(
"⁺") + 1);
94 }
else if (name.find(
"⁻⁻") != std::string::npos) {
95 return name.substr(0, name.length() -
sizeof(
"⁻⁻") + 1);
96 }
else if (name.find(
"⁻") != std::string::npos) {
97 return name.substr(0, name.length() -
sizeof(
"⁻") + 1);
98 }
else if (name.find(
"⁰") != std::string::npos) {
99 return name.substr(0, name.length() -
sizeof(
"⁰") + 1);
106 if (
states_[0]->has_antiparticle()) {
124 auto found = std::find_if(multiplet.
states_.begin(), multiplet.
states_.end(),
126 if (found == multiplet.
states_.end()) {
127 throw std::runtime_error(
"Isospin state " +
n +
" not found!");
144 <<
"Isospin symmetry is broken by mass of " << type.
name() <<
": "
145 << type.
mass() <<
" vs. " <<
mass();
149 <<
"Isospin symmetry is broken by width of " << type.
name() <<
": "
154 <<
"Isospin symmetry is broken by spin of " << type.
name() <<
": "
155 << type.
spin() <<
" vs. " <<
spin();
166 <<
"Creating isospin multiplet " << multiname
173 return l.name() < r.name();
220 const std::filesystem::path &dir,
const std::string &prefix,
221 const std::string &res_name) {
222 return dir / (prefix + res_name +
".bin");
226 std::unordered_map<std::string, Tabulation> &tabulations,
230 constexpr
double spacing = 2.0;
231 constexpr
double spacing2d = 3.0;
235 if (!dir.empty() && std::filesystem::exists(path)) {
236 std::ifstream file(path.string());
240 std::cout <<
"Tabulation found at " << path.filename() <<
'\r'
246 std::cout <<
"Caching tabulation to " << path.filename() <<
'\r'
260 std::ofstream file(path.string());
261 integral.
write(file, hash);
264 tabulations.emplace(std::make_pair(res.
name(), integral));
265 if (antires !=
nullptr) {
266 tabulations.emplace(std::make_pair(antires->
name(), integral));
271 sha256::Hash hash,
const std::filesystem::path &tabulations_path) {
275 FileLock lock(tabulations_path /
"tabulations.lock");
276 const std::filesystem::path &dir = lock.
acquire() ? tabulations_path :
"";
285 const auto antires = res->anti_multiplet();
310 const auto res =
states_[0]->iso_multiplet();
318 const auto res =
states_[0]->iso_multiplet();
326 const auto res =
states_[0]->iso_multiplet();
334 const auto res =
states_[0]->iso_multiplet();
342 const auto res =
states_[0]->iso_multiplet();
343 if (type_res_2->
states_[0]->is_Delta()) {
349 if (type_res_2->
name() ==
"ρ") {
355 if (type_res_2->
name() ==
"h₁(1170)") {
361 std::stringstream err;
362 err <<
"RR=" <<
name() << type_res_2->
name() <<
" is not implemented";
363 throw std::runtime_error(err.str());
Guard to create a file lock.
bool acquire()
Try to acquire the file lock.
A C++ interface for numerical integration in two dimensions with the Cuba Cuhre integration function.
A C++ interface for numerical integration in one dimension with the GSL CQUAD integration functions.
IsoParticleType is a class to represent isospin multiplets.
void add_state(const ParticleType &type)
Add a new state to an existing multiplet (and check if isospin symmetry is fulfilled).
static const IsoParticleType * try_find(const std::string &name)
Returns the IsoParticleType pointer for the given name.
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.
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.
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.
double get_integral_NR(double sqrts)
Look up the tabulated resonance integral for the XX -> NR cross section.
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.
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.
unsigned int spin() const
Returns 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.
Particle type contains the static properties of a particle species.
const std::string & name() const
double width_at_pole() const
unsigned int spin() const
IsoParticleType * iso_multiplet() const
A class for storing a one-dimensional lookup table of floating-point values.
static Tabulation from_file(std::ifstream &stream, sha256::Hash hash)
Construct a tabulation object by reading binary data from a stream.
void write(std::ofstream &stream, sha256::Hash hash) const
Write a binary representation of the tabulation to a stream.
double get_value_linear(double x, Extrapolation extrapolation=Extrapolation::Linear) const
Look up a value from the tabulation using linear interpolation.
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
constexpr int h1
h₁(1170).
std::array< uint8_t, HASH_SIZE > Hash
A SHA256 hash.
static Integrator integrate
static IsoParticleTypeList iso_type_list
static std::unordered_map< std::string, Tabulation > NR_tabulations
Tabulation of all N R integrals.
static std::unordered_map< std::string, Tabulation > RK_tabulations
Tabulation of all K R integrals.
static std::filesystem::path generate_tabulation_path(const std::filesystem::path &dir, const std::string &prefix, const std::string &res_name)
Tabulation spectral_integral_semistable(Integrator &integrate, const ParticleType &resonance, const ParticleType &stable, double range)
Create a table for the spectral integral of a resonance and a stable particle.
static Integrator2d integrate2d(1E7)
Parity
Represent the parity of a particle type.
static std::unordered_map< std::string, Tabulation > piR_tabulations
Tabulation of all pi R integrals.
static std::unordered_map< std::string, Tabulation > DeltaR_tabulations
Tabulation of all Delta R integrals.
static std::unordered_map< std::string, Tabulation > rhoR_tabulations
Tabulation of all rho rho integrals.
constexpr double really_small
Numerical error tolerance.
void cache_integral(std::unordered_map< std::string, Tabulation > &tabulations, const std::filesystem::path &dir, sha256::Hash hash, const IsoParticleType &part, const IsoParticleType &res, const IsoParticleType *antires, bool unstable)
Tabulation spectral_integral_unstable(Integrator2d &integrate2d, const ParticleType &res1, const ParticleType &res2, double range)
Create a table for the spectral integral of two resonances.
static std::string multiplet_name(std::string name)
Construct the name-string for an isospin multiplet from the given name-string for the particle.
static std::vector< const IsoParticleType * > iso_baryon_resonances
static IsoParticleType * try_find_private(const std::string &name)
Helper function for IsoParticleType::try_find and friends.
static constexpr int LParticleType
Throw when requested particle could not be found.