35 double time_last_coll,
36 const ParticleList &plist) {
87 double time_of_interest =
position_.
x0() + delta_time;
89 double scaling_factor;
119 return scaling_factor;
124 return out <<
p.type().name() <<
" (" << std::setw(5) <<
p.type().pdgcode()
125 <<
")" << std::right <<
"{id:" << field<6> <<
p.id()
126 <<
", process:" << field<4> <<
p.id_process()
127 <<
", pos [fm]:" <<
p.position() <<
", mom [GeV]:" <<
p.momentum()
128 <<
", formation time [fm]:" <<
p.formation_time()
129 <<
", cross section scaling factor:" <<
p.xsec_scaling_factor()
133 std::ostream &
operator<<(std::ostream &out,
const ParticleList &particle_list) {
134 auto column = out.tellp();
136 for (
const auto &
p : particle_list) {
137 if (out.tellp() - column >= 201) {
139 column = out.tellp();
142 out << std::setw(5) << std::setprecision(3) <<
p.momentum().abs3()
152 for (
const auto &
p : particle_list.
list) {
167 const FourVector &four_momentum,
int log_area,
bool &mass_warning,
168 bool &on_shell_warning) {
171 logg[log_area].fatal() <<
"Input particle has at least one nan value in "
172 "position and/or momentum four vector.";
173 throw std::invalid_argument(
174 "Invalid input (nan) for particle position or momentum.");
178 static const auto emph = einhard::Yellow_t_::ANSI();
179 static const auto restore_default = einhard::NoColor_t_::ANSI();
180 auto prepare_needed_warnings = [&mass_warning, &on_shell_warning, &mass,
182 std::array<std::optional<std::string>, 2> warnings{};
184 warnings[0] =
"Provided mass of stable particle " +
p.type().name() +
185 " = " + std::to_string(mass) +
186 " [GeV] is inconsistent with value = " +
187 std::to_string(
p.pole_mass()) +
" [GeV] from " +
188 "particles file.\nForcing E = sqrt(p^2 + m^2)" +
189 ", where m is the mass contained in the particles file." +
190 "\nFurther warnings about discrepancies between the " +
191 "input mass and the mass contained in the particles file" +
192 " will be suppressed.\n" + emph +
"Please make sure" +
193 " that changing input particle properties is an " +
194 "acceptable behavior." + restore_default;
196 if (on_shell_warning) {
197 std::stringstream ss{};
200 "Provided 4-momentum " + ss.str() +
" [GeV] and mass " +
201 std::to_string(mass) +
" [GeV] do not satisfy E^2 - p^2 = m^2.\n" +
202 "This may originate from the lack of numerical" +
203 " precision in the input. Setting E to sqrt(p^2 + " +
204 "m^2).\nFurther warnings about E != sqrt(p^2 + m^2) will" +
205 " be suppressed.\n" + emph +
"Please make sure that setting " +
206 "particles back on the mass shell is an acceptable behavior." +
211 auto warn_if_needed = [&log_area](
bool &flag,
212 const std::optional<std::string> &message) {
214 logg[log_area].warn(message.value());
218 auto is_particle_stable_and_with_invalid_mass =
220 return p.type().is_stable() &&
223 auto is_particle_off_its_mass_shell = [&mass](
const ParticleData &
p) {
224 return std::abs(
p.momentum().sqr() - mass * mass) >
really_small;
229 const auto warnings = prepare_needed_warnings(smash_particle);
230 if (is_particle_stable_and_with_invalid_mass(smash_particle)) {
231 warn_if_needed(mass_warning, warnings[0]);
232 smash_particle.set_4momentum(smash_particle.pole_mass(),
235 smash_particle.set_4momentum(four_momentum);
236 if (is_particle_off_its_mass_shell(smash_particle)) {
237 warn_if_needed(on_shell_warning, warnings[1]);
238 smash_particle.set_4momentum(mass, four_momentum.
threevec());
243 smash_particle.set_4position(four_position);
244 smash_particle.set_formation_time(four_position.
x0());
245 smash_particle.set_cross_section_scaling_factor(1.0);
247 return smash_particle;
259 auto get_propagated_position = [&time](
const ParticleData &
p) {
260 const double t =
p.position().x0();
262 return p.position() + u * (time - t);
264 return get_propagated_position(p1) == get_propagated_position(p2);
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
double abs() const
calculate the lorentz invariant absolute value
ThreeVector threevec() const
ParticleData contains the dynamic information of a certain particle.
double formation_time_
Formation time at which the particle is fully formed given as an absolute value in the computational ...
PdgCode pdgcode() const
Get the pdgcode of the particle.
double begin_formation_time_
time when the cross section scaling factor starts to increase to 1
double xsec_scaling_factor(double delta_time=0.) const
Return the cross section scaling factor at a given time.
void set_history(int ncoll, uint32_t pid, ProcessType pt, double time_of_or, const ParticleList &plist)
Store history information.
static double formation_power_
Power with which the cross section scaling factor grows in time.
const FourVector & momentum() const
Get the particle's 4-momentum.
double initial_xsec_scaling_factor_
Initial cross section scaling factor.
double effective_mass() const
Get the particle's effective mass.
FourVector position_
position in space: x0, x1, x2, x3 as t, x, y, z
double pole_mass() const
Get the particle's pole mass ("on-shell").
HistoryData history_
history information
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
PdgCode stores a Particle Data Group Particle Numbering Scheme particle type number.
Collection of useful constants that are known at compile time.
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
ProcessType
ProcessTypes are used to identify the type of the process.
@ FailedString
See here for a short description.
@ TwoToOne
See here for a short description.
@ MultiParticleThreeToTwo
See here for a short description.
@ StringSoftDoubleDiffractive
See here for a short description.
@ Bremsstrahlung
See here for a short description.
@ Thermalization
See here for a short description.
@ Freeforall
See here for a short description.
@ Decay
See here for a short description.
@ TwoToFive
See here for a short description.
@ None
See here for a short description.
@ StringSoftSingleDiffractiveXB
See here for a short description.
@ TwoToTwo
See here for a short description.
@ Wall
See here for a short description.
@ Elastic
See here for a short description.
@ TwoToFour
See here for a short description.
@ StringSoftAnnihilation
See here for a short description.
@ MultiParticleThreeMesonsToOne
See here for a short description.
@ StringSoftNonDiffractive
See here for a short description.
@ MultiParticleFourToTwo
See here for a short description.
@ StringSoftSingleDiffractiveAX
See here for a short description.
@ StringHard
See here for a short description.
@ HyperSurfaceCrossing
See here for a short description.
@ TwoToThree
See here for a short description.
@ MultiParticleFiveToTwo
See here for a short description.
bool are_particles_identical_at_given_time(const ParticleData &p1, const ParticleData &p2, double time)
Utility function to compare two ParticleData instances with respect to their PDG code,...
bool is_any_nan(const T &collection)
This function iterates through the elements of a collection and checks if any of them is NaN using th...
ParticleData create_valid_smash_particle_matching_provided_quantities(PdgCode pdgcode, double mass, const FourVector &four_position, const FourVector &four_momentum, int log_area, bool &mass_warning, bool &on_shell_warning)
This function creates a SMASH particle validating the provided information.
constexpr double really_small
Numerical error tolerance.
Generic numerical functions.
double time_last_collision
Time of the last action (excluding walls), time of kinetic freeze_out for HBT analysis this time shou...
int32_t id_process
id of the last action
PdgCode p2
PdgCode of the second parent particles.
PdgCode p1
PdgCode of the first parent particles.
int32_t collisions_per_particle
Collision counter per particle, zero only for initially present particles.
ProcessType process_type
type of the last action
const ParticleList & list
Particle list.