 |
Version: SMASH-2.0
|
|
Go to the documentation of this file.
10 #include <boost/filesystem.hpp>
11 #include <boost/filesystem/fstream.hpp>
23 const std::vector<const IsoParticleType *>
28 const auto baryon_number = res.states_[0]->pdgcode().baryon_number();
29 if (res.states_[0]->is_stable() || (baryon_number <= 0)) {
40 : name_(
n), mass_(m), width_(w), spin_(s), parity_(
p) {}
73 " not found (privately)!");
91 if (name.find(
"⁺⁺") != std::string::npos) {
92 return name.substr(0, name.length() -
sizeof(
"⁺⁺") + 1);
93 }
else if (name.find(
"⁺") != std::string::npos) {
94 return name.substr(0, name.length() -
sizeof(
"⁺") + 1);
95 }
else if (name.find(
"⁻⁻") != std::string::npos) {
96 return name.substr(0, name.length() -
sizeof(
"⁻⁻") + 1);
97 }
else if (name.find(
"⁻") != std::string::npos) {
98 return name.substr(0, name.length() -
sizeof(
"⁻") + 1);
99 }
else if (name.find(
"⁰") != std::string::npos) {
100 return name.substr(0, name.length() -
sizeof(
"⁰") + 1);
107 if (
states_[0]->has_antiparticle()) {
125 auto found = std::find_if(multiplet.
states_.begin(), multiplet.
states_.end(),
127 if (found == multiplet.
states_.end()) {
128 throw std::runtime_error(
"Isospin state " +
n +
" not found!");
145 <<
"Isospin symmetry is broken by mass of " << type.
name() <<
": "
146 << type.
mass() <<
" vs. " <<
mass();
150 <<
"Isospin symmetry is broken by width of " << type.
name() <<
": "
155 <<
"Isospin symmetry is broken by spin of " << type.
name() <<
": "
156 << type.
spin() <<
" vs. " <<
spin();
167 <<
"Creating isospin multiplet " << multiname
174 return l.
name() < r.name();
179 multiplet.add_state(type);
221 const std::string &prefix,
222 const std::string &res_name) {
223 return dir / (prefix + res_name +
".bin");
227 std::unordered_map<std::string, Tabulation> &tabulations,
230 constexpr
double spacing = 2.0;
231 constexpr
double spacing2d = 3.0;
234 if (!dir.empty() && bf::exists(path)) {
235 std::ifstream file(path.string());
237 if (!integral.is_empty()) {
239 std::cout <<
"Tabulation found at " << path.filename() <<
'\r'
243 if (integral.is_empty()) {
245 std::cout <<
"Caching tabulation to " << path.filename() <<
'\r'
256 std::ofstream file(path.string());
257 integral.
write(file, hash);
260 tabulations.emplace(std::make_pair(res.
name(), integral));
261 if (antires !=
nullptr) {
262 tabulations.emplace(std::make_pair(antires->
name(), integral));
267 const bf::path &tabulations_path) {
271 FileLock lock(tabulations_path /
"tabulations.lock");
272 const bf::path &dir = lock.
acquire() ? tabulations_path :
"";
281 const auto antires = res->anti_multiplet();
306 const auto res =
states_[0]->iso_multiplet();
314 const auto res =
states_[0]->iso_multiplet();
322 const auto res =
states_[0]->iso_multiplet();
330 const auto res =
states_[0]->iso_multiplet();
338 const auto res =
states_[0]->iso_multiplet();
339 if (type_res_2->
states_[0]->is_Delta()) {
345 if (type_res_2->
name() ==
"ρ") {
351 if (type_res_2->
name() ==
"h₁(1170)") {
357 std::stringstream err;
358 err <<
"RR=" <<
name() << type_res_2->
name() <<
" is not implemented";
359 throw std::runtime_error(err.str());
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.
const IsoParticleType * anti_multiplet() const
Return a multiplet of antiparticles, if it is different from the original multiplet.
double width() const
Returns the (average) multiplet width.
static std::unordered_map< std::string, Tabulation > NR_tabulations
Tabulation of all N R integrals.
static const IsoParticleType & find(const std::string &name)
Returns the IsoParticleType object for the given name.
static std::unordered_map< std::string, Tabulation > rhoR_tabulations
Tabulation of all rho rho integrals.
double width_at_pole() const
static std::unordered_map< std::string, Tabulation > DeltaR_tabulations
Tabulation of all Delta R integrals.
A C++ interface for numerical integration in two dimensions with the Cuba Cuhre integration function.
static bf::path generate_tabulation_path(const bf::path &dir, const std::string &prefix, const std::string &res_name)
IsoParticleType * iso_multiplet() const
static Tabulation from_file(std::ifstream &stream, sha256::Hash hash)
Construct a tabulation object by reading binary data from a stream.
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.
bool has_anti_multiplet() const
Check if there is a multiplet of antiparticles, which is different from the original multiplet.
void cache_integral(std::unordered_map< std::string, Tabulation > &tabulations, const bf::path &dir, sha256::Hash hash, const IsoParticleType &part, const IsoParticleType &res, const IsoParticleType *antires, bool unstable)
unsigned int spin() const
Returns twice the spin of the multiplet.
ParticleTypePtrList states_
list of states that are contained in the multiplet
A C++ interface for numerical integration in one dimension with the GSL CQUAD integration functions.
static std::vector< const IsoParticleType * > iso_baryon_resonances
Tabulation * XS_NR_tabulation_
A tabulation for the NN -> NR cross sections, where R is a resonance from this multiplet.
Guard to create a file lock.
unsigned int spin() const
static std::string multiplet_name(std::string name)
Construct the name-string for an isospin multiplet from the given name-string for the particle.
Tabulation * XS_RK_tabulation_
A tabulation of the spectral integral for the NK -> RK cross sections.
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
static std::unordered_map< std::string, Tabulation > piR_tabulations
Tabulation of all pi R integrals.
constexpr double really_small
Numerical error tolerance.
static void tabulate_integrals(sha256::Hash hash, const bf::path &tabulations_path)
Tabulate all relevant integrals.
Tabulation spectral_integral_unstable(Integrator2d &integrate2d, const ParticleType &res1, const ParticleType &res2, double range)
Create a table for the spectral integral of two resonances.
void write(std::ofstream &stream, sha256::Hash hash) const
Write a binary representation of the tabulation to a stream.
Tabulation * XS_rhoR_tabulation_
A tabulation for the ρρ integrals.
double get_integral_piR(double sqrts)
Look up the tabulated resonance integral for the XX -> piR cross section.
static IsoParticleTypeList iso_type_list
static Integrator integrate
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...
static constexpr int LParticleType
static const std::vector< const IsoParticleType * > list_baryon_resonances()
Returns a list of all IsoParticleTypes that are baryon resonances.
void add_state(const ParticleType &type)
Add a new state to an existing multiplet (and check if isospin symmetry is fulfilled).
static bool exists(const std::string &name)
Returns whether the ParticleType with the given pdgcode exists.
double get_integral_NR(double sqrts)
Look up the tabulated resonance integral for the XX -> NR cross section.
const std::string & name() const
Tabulation * XS_piR_tabulation_
A tabulation of the spectral integral for the dpi -> d'pi cross sections.
A class for storing a one-dimensional lookup table of floating-point values.
static IsoParticleType * try_find_private(const std::string &name)
Helper function for IsoParticleType::try_find and friends.
double mass() const
Returns the (average) multiplet mass.
std::array< uint8_t, HASH_SIZE > Hash
A SHA256 hash.
static Integrator2d integrate2d(1E7)
Tabulation * XS_DeltaR_tabulation_
A tabulation for the NN -> RΔ cross sections, where R is a resonance from this multiplet.
constexpr int h1
h₁(1170).
static const IsoParticleType * try_find(const std::string &name)
Returns the IsoParticleType pointer for the given name.
double get_integral_RK(double sqrts)
Look up the tabulated resonance integral for the XX -> RK cross section.
static IsoParticleType & find_private(const std::string &name)
Private version of the 'find' method that returns a non-const reference.
double get_integral_RR(IsoParticleType *type_res_2, double sqrts)
Look up the tabulated resonance integral for the XX -> RR cross section.
Parity
Represent the parity of a particle type.
double get_value_linear(double x, Extrapolation extrapolation=Extrapolation::Linear) const
Look up a value from the tabulation using linear interpolation.
bool acquire()
Try to acquire the file lock.
IsoParticleType(const std::string &n, double m, double w, unsigned int s, Parity p)
Creates a fully initialized IsoParticleType object.
ParticleTypePtrList get_states() const
Returns list of states that form part of the multiplet.
static const IsoParticleTypeList & list_all()
Returns a list of all IsoParticleTypes.
static void create_multiplet(const ParticleType &type)
Add a new multiplet to the global list of IsoParticleTypes, which contains type.
static std::unordered_map< std::string, Tabulation > RK_tabulations
Tabulation of all K R integrals.