 |
Version: SMASH-1.8
|
|
Go to the documentation of this file.
65 const auto offset =
this - std::addressof(
list_all()[0]);
70 assert(offset >= 0 && offset < 0xffff);
96 const auto found = std::lower_bound(
135 min_mass_kinematic_(-1.),
136 min_mass_spectral_(-1.),
137 charge_(pdgcode_.charge()),
139 I3_(pdgcode_.isospin3()) {}
150 std::string basename, charge;
152 if (name.find(
"⁺⁺") != std::string::npos) {
153 basename = name.substr(0, name.length() -
sizeof(
"⁺⁺") + 1);
155 }
else if (name.find(
"⁺") != std::string::npos) {
156 basename = name.substr(0, name.length() -
sizeof(
"⁺") + 1);
158 }
else if (name.find(
"⁻⁻") != std::string::npos) {
159 basename = name.substr(0, name.length() -
sizeof(
"⁻⁻") + 1);
161 }
else if (name.find(
"⁻") != std::string::npos) {
162 basename = name.substr(0, name.length() -
sizeof(
"⁻") + 1);
164 }
else if (name.find(
"⁰") != std::string::npos) {
165 basename = name.substr(0, name.length() -
sizeof(
"⁰") + 1);
174 constexpr
char bar[] =
"\u0305";
178 return basename + charge;
201 throw std::runtime_error(
"Invalid charge " + std::to_string(charge));
206 static ParticleTypeList type_list;
210 std::istringstream lineinput(line.text);
213 std::string parity_string;
214 std::vector<std::string> pdgcode_strings;
216 pdgcode_strings.reserve(4);
217 lineinput >>
name >>
mass >> width >> parity_string;
220 if (parity_string ==
"+") {
222 }
else if (parity_string ==
"-") {
227 if (lineinput.fail() || fail) {
229 "While loading the ParticleType data:\nFailed to convert the input "
230 "string to the expected data types.",
234 while (!lineinput.eof()) {
235 pdgcode_strings.push_back(
"");
236 lineinput >> pdgcode_strings.back();
237 if (lineinput.fail()) {
239 "While loading the ParticleType data:\nFailed to convert the input "
240 "string to the expected data types.",
244 if (pdgcode_strings.size() < 1) {
246 "While loading the ParticleType data:\nFailed to convert the input "
247 "string due to missing PDG code.",
251 pdgcode.resize(pdgcode_strings.size());
252 std::transform(pdgcode_strings.begin(), pdgcode_strings.end(),
254 [](
const std::string &s) {
return PdgCode(s); });
260 throw std::runtime_error(
261 "Nucleon mass in input file different from 0.938");
264 throw std::runtime_error(
"Kaon mass in input file different from 0.494");
267 throw std::runtime_error(
"Delta mass in input file different from 1.232");
270 throw std::runtime_error(
"d mass in input file different from 1.8756");
274 for (
size_t i = 0; i <
pdgcode.size(); i++) {
275 std::string full_name =
name;
282 <<
"Setting particle type: " << type_list.back();
289 type_list.emplace_back(full_name,
mass, width, anti_parity, anti);
291 <<
"Setting antiparticle type: " << type_list.back();
295 type_list.shrink_to_fit();
298 std::sort(type_list.begin(), type_list.end());
302 for (
const auto &t : type_list) {
303 if (t.pdgcode() == prev_pdg) {
305 t.pdgcode().string());
307 prev_pdg = t.pdgcode();
311 throw std::runtime_error(
"Error: Type list was already built!");
318 for (
const auto &t : type_list) {
322 for (
auto &t : type_list) {
345 if (type_resonance.is_stable() ||
346 type_resonance.pdgcode().baryon_number() != 1) {
354 if (type.is_nucleus()) {
366 for (
const auto &mode :
decay_modes().decay_mode_list()) {
385 const double m_step = 0.01;
386 double right_bound_bis;
387 for (
unsigned int i = 0;; i++) {
394 const double precision = 1E-6;
395 double left_bound_bis = right_bound_bis - m_step;
396 while (right_bound_bis - left_bound_bis > precision) {
397 const double mid = (left_bound_bis + right_bound_bis) / 2.0;
399 right_bound_bis = mid;
401 left_bound_bis = mid;
421 if (m < mode->threshold()) {
429 const auto offset =
this - std::addressof(
list_all()[0]);
430 const auto &modes = (*DecayModes::all_decay_modes)[offset];
431 assert(
is_stable() || !modes.is_empty());
442 for (
unsigned int i = 0; i < modes.size(); i++) {
453 if (!ptype.is_stable() && ptype.decay_modes().is_empty()) {
454 throw std::runtime_error(
"Unstable particle " + ptype.name() +
455 " has no decay chanels!");
487 throw std::runtime_error(
488 "Problem in selecting decaymodes in wanted_decaymode()");
496 if (decay_mode_list.size() == 0 ||
512 DecayBranchList partial;
513 partial.reserve(decay_mode_list.size());
514 for (
unsigned int i = 0; i < decay_mode_list.size(); i++) {
516 const auto FinalTypes = decay_mode_list[i]->type().particle_types();
517 double scale_B = 0.0;
518 double scale_I3 = 0.0;
522 for (
const auto finaltype : FinalTypes) {
525 finaltype->isospin3_rel();
528 double sqrt_s = (
p + UB * scale_B + UI3 * scale_I3).abs();
530 const double w =
partial_width(sqrt_s, decay_mode_list[i].get());
534 make_unique<DecayBranch>(decay_mode_list[i]->type(), w));
548 for (
const auto &mode : decaymodes) {
549 double partial_width_at_pole =
width_at_pole() * mode->weight();
550 const ParticleTypePtrList l = {&t_a, &t_b};
551 if (mode->type().has_particles(l)) {
552 w += mode->type().width(
mass(), partial_width_at_pole, m);
566 for (
const auto &mode : decaymodes) {
567 double partial_width_at_pole =
width_at_pole() * mode->weight();
568 const ParticleTypePtrList l = {&p_a.
type(), &p_b.
type()};
569 if (mode->type().has_particles(l)) {
570 w += mode->type().in_width(
mass(), partial_width_at_pole, m,
583 const double m_pole =
mass();
588 const double tanx = std::tan(x);
589 const double m_x = m_pole + width * tanx;
590 const double jacobian = width * (1.0 + tanx * tanx);
623 const double cms_energy,
627 const double max_mass = std::nextafter(cms_energy - mass_stable, 0.);
633 const double pcm_max =
pCM(cms_energy, mass_stable, min_mass);
640 const double sf_ratio_max =
644 double mass_res, val;
648 const double max = blw_max * q_max;
655 const double pcm =
pCM(cms_energy, mass_stable, mass_res);
666 "maximum is being increased in sample_resonance_mass: ",
667 this->max_factor1_,
" ", val / max,
" ", this->
pdgcode(),
" ",
668 mass_stable,
" ", cms_energy,
" ", mass_res);
669 this->max_factor1_ *= val / max;
680 const ParticleType &t2,
const double cms_energy,
int L)
const {
684 const double max_mass_1 =
686 const double max_mass_2 =
689 const double pcm_max =
693 double mass_1, mass_2, val;
706 const double pcm =
pCM(cms_energy, mass_1, mass_2);
718 "maximum is being increased in sample_resonance_masses: ",
720 " ", cms_energy,
" ", mass_1,
" ", mass_2);
727 return {mass_1, mass_2};
732 std::stringstream err;
733 err <<
"Particle " << *
this <<
" is stable, so it makes no"
734 <<
" sense to print its spectral function, etc.";
735 throw std::runtime_error(err.str());
738 double rightmost_pole = 0.0;
740 for (
const auto &mode : decaymodes) {
741 double pole_mass_sum = 0.0;
743 pole_mass_sum +=
p->mass();
745 if (pole_mass_sum > rightmost_pole) {
746 rightmost_pole = pole_mass_sum;
750 std::cout <<
"# mass m[GeV], width w(m) [GeV],"
751 <<
" spectral function(m^2)*m [GeV^-1] of " << *
this << std::endl;
752 constexpr
double m_step = 0.02;
756 constexpr
double spectral_function_threshold = 8.e-3;
757 std::cout << std::fixed << std::setprecision(5);
758 for (
unsigned int i = 0;; i++) {
759 const double m = m_min + m_step * i;
761 if (m > rightmost_pole * 2 && sf < spectral_function_threshold) {
764 std::cout << m <<
" " << w <<
" " << sf << std::endl;
770 return out << type.
name() << std::setfill(
' ') << std::right
771 <<
"[ mass:" << field<6> << type.
mass()
773 <<
", PDG:" << field<6> << pdg
774 <<
", charge:" << field<3> << pdg.
charge()
775 <<
", spin:" << field<2> << pdg.
spin() <<
"/2 ]";
double breit_wigner(double m, double pole, double width)
Returns a relativistic Breit-Wigner distribution.
const DecayType & type() const
build_vector_< Line > line_parser(const std::string &input)
Helper function for parsing particles.txt and decaymodes.txt.
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 par...
static bool exists(PdgCode pdgcode)
static ParticleTypePtrList & list_nucleons()
virtual unsigned int particle_number() const =0
PdgCode get_antiparticle() const
Construct the antiparticle to a given PDG code.
double spectral_function_no_norm(double m) const
Full spectral function without normalization factor.
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...
int isospin() const
Returns twice the total isospin of the multiplet.
static ParticleTypePtrList & list_anti_nucleons()
void dump_width_and_spectral_function() const
Prints out width and spectral function versus mass to the standard output.
static const IsoParticleType & find(const std::string &name)
Returns the IsoParticleType object for the given name.
double width_at_pole() const
double min_mass_spectral() const
The minimum mass of the resonance, where the spectral function is non-zero.
DecayType is the abstract base class for all decay types.
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...
std::string build_error_string(std::string message, const Line &line)
Builds a meaningful error message.
ParticleTypePtrList anti_deltas_list
Global pointer to the Particle Type list of anti-deltas.
int baryon_number() const
const DecayBranchList & decay_mode_list() const
void ensure_all_read(std::istream &input, const Line &line)
Makes sure that nothing is left to read from this line.
static std::pair< double, int > force_scale(const ParticleType &data)
Evaluates the scaling factor of the forces acting on the particles.
static ParticleTypePtrList & list_light_nuclei()
unsigned int spin() const
#define unlikely(x)
Tell the branch predictor that this expression is likely false.
Line consists of a line number and the contents of that line.
double effective_mass() const
Get the particle's effective mass.
ParticleTypePtrList deltas_list
Global pointer to the Particle Type list of deltas.
A C++ interface for numerical integration in one dimension with the GSL CQUAD integration functions.
const ParticleTypeList * all_particle_types
Global pointer to the Particle Type list.
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
double blatt_weisskopf_sqr(const double p_ab, const int L)
double spectral_function(double m) const
Full spectral function of the resonance (relativistic Breit-Wigner distribution with mass-dependent ...
int isospin_
Isospin of the particle; filled automatically from pdgcode_.
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 ...
constexpr double nucleon_mass
Nucleon mass in GeV.
static void create_type_list(const std::string &particles)
Initialize the global ParticleType list (list_all) from the given input data.
ParticleTypePtr operator&() const
Returns an object that acts like a pointer, except that it requires only 2 bytes and inhibits pointer...
double min_mass_kinematic_
minimum kinematically allowed mass of the particle Mutable, because it is initialized at first call o...
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
static ParticleTypePtrList & list_anti_Deltas()
static constexpr int LResonances
static ParticleTypePtrList & list_Deltas()
T pCM(const T sqrts, const T mass_a, const T mass_b) noexcept
double total_width(const double m) const
Get the mass-dependent total width of a particle with mass m.
constexpr double really_small
Numerical error tolerance.
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
bool has_antiparticle() const
const DecayModes & decay_modes() const
RectangularLattice< FourVector > * UI3_lat_pointer
Pointer to the symmmetry potential on the lattice.
std::string string() const
double norm_factor_
This normalization factor ensures that the spectral function is normalized to unity,...
IsoParticleType * iso_multiplet_
Container for the isospin multiplet information.
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.
static Integrator integrate
static constexpr int LParticleType
int isospin() const
Returns twice the isospin vector length .
Ignore dilepton decay modes widths.
int charge() const
The charge of the particle.
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.
RectangularLattice< FourVector > * UB_lat_pointer
Pointer to the skyrme potential on the lattice.
static bool exists(const std::string &name)
Returns whether the ParticleType with the given pdgcode exists.
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 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 ...
ParticleTypePtrList nucleons_list
Global pointer to the Particle Type list of nucleons.
WhichDecaymodes
Decide which decay mode widths are returned in get partical widths.
double isospin3_rel() const
double spectral_function_simple(double m) const
This one is the most simple form of the spectral function, using a Cauchy distribution (non-relativis...
const std::string & name() const
bool almost_equal(const N x, const N y)
Checks two numbers for relative approximate equality.
ParticleTypePtrList baryon_resonances_list
Global pointer to the Particle Type list of baryon resonances.
ParticleTypePtrList light_nuclei_list
Global pointer to the Particle Type list of light nuclei.
PdgCode pdgcode_
PDG Code of the particle.
static const ParticleTypePtr try_find(PdgCode pdgcode)
Returns the ParticleTypePtr for the given pdgcode.
ParticleType(std::string n, double m, double w, Parity p, PdgCode id)
Creates a fully initialized ParticleType object.
static void check_consistency()
static std::string chargestr(int charge)
Construct a charge string, given the charge as integer.
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.
std::iterator_traits< octet_iterator >::difference_type sequence_length(octet_iterator lead_it)
Given an iterator to the beginning of a UTF-8 sequence, return the length of the next UTF-8 code poin...
double max_factor2_
Maximum factor for double-res mass sampling, cf. sample_resonance_masses.
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.
bool has_lepton_pair(const PdgCode pdg1, const PdgCode pdg2, const PdgCode pdg3)
double min_mass_spectral_
minimum mass, where the spectral function is non-zero Mutable, because it is initialized at first cal...
double spectral_function_const_width(double m) const
constexpr double delta_mass
Delta mass in GeV.
double max_factor1_
Maximum factor for single-res mass sampling, cf. sample_resonance_mass.
virtual double width(double m0, double G0, double m) const =0
Parity
Represent the parity of a particle type.
static ParticleTypePtrList & list_baryon_resonances()
double min_mass_kinematic() const
The minimum mass of the resonance that is kinematically allowed.
Potentials * pot_pointer
Pointer to a Potential class.
double mass_
pole mass of the particle
constexpr double deuteron_mass
Deuteron mass in GeV.
Only return dilepton decays widths.
constexpr double kaon_mass
Kaon mass in GeV.
const ParticleType & type() const
Get the type of the particle.
ParticleTypePtrList anti_nucs_list
Global pointer to the Particle Type list of anti-nucleons.
bool is_dilepton(const PdgCode pdg1, const PdgCode pdg2)
const ParticleTypePtrList & particle_types() const
ParticleTypePtrList get_states() const
Returns list of states that form part of the multiplet.
static constexpr double width_cutoff
Decay width cutoff for considering a particle as stable.
static const ParticleTypeList & list_all()
static void create_multiplet(const ParticleType &type)
Add a new multiplet to the global list of IsoParticleTypes, which contains type.
int32_t charge() const
The charge of the particle.