34 double time_last_coll,
35 const ParticleList &plist) {
86 double time_of_interest =
position_.
x0() + delta_time;
88 double scaling_factor;
118 return scaling_factor;
123 return out <<
p.type().name() <<
" (" << std::setw(5) <<
p.type().pdgcode()
124 <<
")" << std::right <<
"{id:" << field<6> <<
p.id()
125 <<
", process:" << field<4> <<
p.id_process()
126 <<
", pos [fm]:" <<
p.position() <<
", mom [GeV]:" <<
p.momentum()
127 <<
", formation time [fm]:" <<
p.formation_time()
128 <<
", cross section scaling factor:" <<
p.xsec_scaling_factor()
132 std::ostream &
operator<<(std::ostream &out,
const ParticleList &particle_list) {
133 auto column = out.tellp();
135 for (
const auto &
p : particle_list) {
136 if (out.tellp() - column >= 201) {
138 column = out.tellp();
141 out << std::setw(5) << std::setprecision(3) <<
p.momentum().abs3()
151 for (
const auto &
p : particle_list.
list) {
166 bool &mass_warning,
bool &on_shell_warning) {
168 static const auto emph = einhard::Yellow_t_::ANSI();
169 static const auto restore_default = einhard::NoColor_t_::ANSI();
170 auto prepare_needed_warnings = [&mass_warning, &on_shell_warning, &mass,
172 std::array<std::optional<std::string>, 2> warnings{};
174 warnings[0] =
"Provided mass of stable particle " +
p.type().name() +
175 " = " + std::to_string(mass) +
176 " [GeV] is inconsistent with value = " +
177 std::to_string(
p.pole_mass()) +
" [GeV] from " +
178 "particles file.\nForcing E = sqrt(p^2 + m^2)" +
179 ", where m is the mass contained in the particles file." +
180 "\nFurther warnings about discrepancies between the " +
181 "input mass and the mass contained in the particles file" +
182 " will be suppressed.\n" + emph +
"Please make sure" +
183 " that changing input particle properties is an " +
184 "acceptable behavior." + restore_default;
186 if (on_shell_warning) {
187 std::stringstream ss{};
190 "Provided 4-momentum " + ss.str() +
" [GeV] and mass " +
191 std::to_string(mass) +
" [GeV] do not satisfy E^2 - p^2 = m^2.\n" +
192 "This may originate from the lack of numerical" +
193 " precision in the input. Setting E to sqrt(p^2 + " +
194 "m^2).\nFurther warnings about E != sqrt(p^2 + m^2) will" +
195 " be suppressed.\n" + emph +
"Please make sure that setting " +
196 "particles back on the mass shell is an acceptable behavior." +
201 auto warn_if_needed = [&log_area](
bool &flag,
202 const std::optional<std::string> &message) {
204 logg[log_area].warn(message.value());
208 auto is_particle_stable_and_with_invalid_mass =
210 return p.type().is_stable() &&
213 auto is_particle_off_its_mass_shell = [&mass](
const ParticleData &
p) {
214 return std::abs(
p.momentum().sqr() - mass * mass) >
really_small;
219 const auto warnings = prepare_needed_warnings(smash_particle);
220 if (is_particle_stable_and_with_invalid_mass(smash_particle)) {
221 warn_if_needed(mass_warning, warnings[0]);
222 smash_particle.set_4momentum(smash_particle.pole_mass(),
225 smash_particle.set_4momentum(four_momentum);
226 if (is_particle_off_its_mass_shell(smash_particle)) {
227 warn_if_needed(on_shell_warning, warnings[1]);
228 smash_particle.set_4momentum(mass, four_momentum.
threevec());
231 return smash_particle;
243 auto get_propagated_position = [&time](
const ParticleData &
p) {
244 const double t =
p.position().x0();
246 return p.position() + u * (time - t);
248 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.
ParticleData create_valid_smash_particle_matching_provided_quantities(PdgCode pdgcode, double mass, const FourVector &four_momentum, int log_area, bool &mass_warning, bool &on_shell_warning)
This function creates a SMASH particle validating the provided information.
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,...
constexpr double really_small
Numerical error tolerance.
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.