#include <listmodus.h>
ListModus: Provides a modus for running SMASH on an external particle list, for example as an afterburner calculation.
To use this modus, choose Modus: List
in the configuration file.
Options for ListModus go in the "Modi"→"List" section of the configuration:
For configuring see List.
Since SMASH is searching for collisions in computational frame time 't', all particles need to be at the same time. If this is not the case in the list provided, the particles will be propagated backwards on straight lines ("anti-freestreaming"). To avoid unphysical interactions of these particles, the back-propagated particles receive a formation_time and zero cross_section_scaling_factor. The cross-sections are set to zero during the time, where the particle will just propagate on a straight line again to appear at the formation_time into the system.
Definition at line 57 of file listmodus.h.
Classes | |
| struct | InvalidEvents |
| Used when external particle list is invalid. More... | |
| struct | LoadFailure |
| Used when external particle list cannot be found. More... | |
Public Member Functions | |
| ListModus (Configuration modus_config, const ExperimentParameters ¶meters) | |
| Constructor. More... | |
| ListModus ()=default | |
| Construct an empty list. More... | |
| double | initial_conditions (Particles *particles, const ExperimentParameters ¶meters) |
| Generates initial state of the particles in the system according to a list. More... | |
| void | try_create_particle (Particles &particles, PdgCode pdgcode, double t, double x, double y, double z, double mass, double E, double px, double py, double pz, const std::vector< std::string > &optional_quantities={}) |
| Tries to add a new particle to particles and performs consistency checks: (i) The PDG code is legal and exists in SMASH. More... | |
| bool | is_list () const |
Public Member Functions inherited from smash::ModusDefault | |
| int | impose_boundary_conditions (Particles *, const OutputsList &={}) |
| Enforces sensible positions for the particles. More... | |
| bool | is_collider () const |
| bool | is_box () const |
| bool | is_list () const |
| bool | is_sphere () const |
| double | sqrt_s_NN () const |
| double | impact_parameter () const |
| void | sample_impact () const |
| sample impact parameter for collider modus More... | |
| double | velocity_projectile () const |
| double | velocity_target () const |
| FermiMotion | fermi_motion () const |
| double | max_timestep (double) const |
| double | equilibration_time () const |
| double | length () const |
| double | radius () const |
| bool | calculation_frame_is_fixed_target () const |
| double | nuclei_passing_time () const |
| Get the passing time of the two nuclei in a collision. More... | |
| bool | is_IC_for_hybrid () const |
| const InitialConditionParameters & | IC_parameters () const |
| const std::map< int32_t, double > & | fluid_background () |
| const RectangularLattice< EnergyMomentumTensor > & | fluid_lattice () |
| void | build_fluidization_lattice ([[maybe_unused]] const double t, [[maybe_unused]] const std::vector< Particles > &ensembles, [[maybe_unused]] const DensityParameters &dens_par) |
| Build lattice of energy momentum tensor. More... | |
| Grid< GridOptions::Normal > | create_grid (const Particles &particles, double min_cell_length, double timestep_duration, CollisionCriterion crit, const bool include_unformed_particles, CellSizeStrategy strategy=CellSizeStrategy::Optimal) const |
| Creates the Grid with normal boundary conditions. More... | |
| std::unique_ptr< GrandCanThermalizer > | create_grandcan_thermalizer (Configuration &conf) const |
| Creates GrandCanThermalizer. More... | |
Protected Attributes | |
| double | start_time_ = 0. |
| Starting time for the List; changed to the earliest formation time. More... | |
Private Member Functions | |
| void | read_particles_from_next_event_ (Particles &particles) |
| Read the next event from file. More... | |
| bool | file_has_events_ (std::filesystem::path filepath, std::streampos last_position) |
| Check if the given file has events left after the given position. More... | |
| std::filesystem::path | file_path_ (std::optional< int > file_id) |
| Return the absolute path of the data file. More... | |
| std::string | next_event_ () |
| Read the next event. More... | |
| void | validate_list_of_particles_of_all_events_ () const |
| Read and validate all events particles. More... | |
| void | validate_optional_fields_ () const |
| Validate the optional fields. More... | |
| void | backpropagate_to_same_time_if_needed_ (Particles &particles) |
| Judge whether times are the same for all the particles; don't do anti-freestreaming if all particles start already at the same time. More... | |
| void | insert_optional_quantities_to_ (ParticleData &p, const std::vector< std::string > &optional_quantities) const |
| Sets the optional fields given in the input list into a particle. More... | |
Private Attributes | |
| std::string | particle_list_file_directory_ |
| File directory of the particle list. More... | |
| std::string | particle_list_filename_or_prefix_ |
| Prefix of the file(s) containing the particle list. More... | |
| std::optional< int > | file_id_ |
| The id of the current file. More... | |
| std::vector< std::string > | optional_fields_ {} |
| Fields with optional quantities to be read. More... | |
| int | event_id_ |
| The unique id of the current event. More... | |
| std::streampos | last_read_position_ = 0 |
| Last read position in current file. More... | |
| bool | warn_about_mass_discrepancy_ = true |
| Auxiliary flag to warn about mass-discrepancies only once per instance. More... | |
| bool | warn_about_off_shell_particles_ = true |
| Auxiliary flag to warn about off-shell particles only once per instance. More... | |
| SpinInteractionType | spin_interaction_type_ = SpinInteractionType::Off |
| Auxiliary flag to indicate the type of spin interaction used. More... | |
| bool | verbose_ = true |
| Flag to suppress some error messages. More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const ListModus &m) |
| Writes the initial state for the List to the output stream. More... | |
|
explicit |
Constructor.
Gathers all configuration variables for the List.
| [in] | modus_config | The configuration object that sets all initial conditions of the experiment |
| [in] | parameters | Necessary because of templated usage in Experiment |
| InvalidEvents | If more than 2 particles are at the same position in any of the events. |
Definition at line 42 of file listmodus.cc.
|
default |
Construct an empty list.
This is needed for children construction but it is offered as public instead of protected as it is also useful for JetScape.
| double smash::ListModus::initial_conditions | ( | Particles * | particles, |
| const ExperimentParameters & | parameters | ||
| ) |
Generates initial state of the particles in the system according to a list.
| [out] | particles | An empty list that gets filled up by this function |
| [in] | parameters | Unused, but necessary because of templated use of this function |
Definition at line 266 of file listmodus.cc.
| void smash::ListModus::try_create_particle | ( | Particles & | particles, |
| PdgCode | pdgcode, | ||
| double | t, | ||
| double | x, | ||
| double | y, | ||
| double | z, | ||
| double | mass, | ||
| double | E, | ||
| double | px, | ||
| double | py, | ||
| double | pz, | ||
| const std::vector< std::string > & | optional_quantities = {} |
||
| ) |
Tries to add a new particle to particles and performs consistency checks: (i) The PDG code is legal and exists in SMASH.
If not, a warning is printed and the particle is ignored. (ii) The mass matches the pole mass of pdgcode in SMASH. If it does not, then a warning is printed, the pole mass of the particle is set equal to the corresponding mass from SMASH particle table and it's energy is recomputed as \( E^2 = p^2 + m^2 \). (iii) Any stable particle is on-shell, i.e. \( E^2 - p^2 = m^2 \). If it is not, then a warning is printed and the energy is set to \( E^2 = p^2 + m^2 \). (iv) If there are nan values in the position or momentum of the particle an exception is thrown.
This very tolerant behaviour is justified by the practical usage of SMASH as afterburner. Usually particles unknown to SMASH are rare resonances, which do not play a large role. Mass mismatch is typically less than 1% and comes from rounding and from SMASH enforcing isospin symmetry (for example the mass of neutral pion is artificially forced to be the same as charged pion). On-shellness violation typically comes from the insufficient number of significant digits in the input file + rounding.
| [in] | pdgcode | PDG code of added particle |
| [in] | t | Time of added particle |
| [in] | x | x-coordinate of added particle |
| [in] | y | y-coordinate of added particle |
| [in] | z | z-coordinate of added particle |
| [in] | mass | Mass of added particle |
| [in] | E | Energy of added particle |
| [in] | px | x-component of momentum of added particle |
| [in] | py | y-component of momentum of added particle |
| [in] | pz | z-component of momentum of added particle |
| [in] | optional_quantities | Extra values present in the input list |
| [out] | particles | Object to which the particle is added |
Definition at line 135 of file listmodus.cc.
|
inline |
Definition at line 148 of file listmodus.h.
|
private |
Read the next event from file.
| particles | The list of particles where the read information is stored |
| runtime_error | If an input list file could not be found |
| LoadFailure | If an input list file is not correctly formatted |
| invalid_argument | If the listed charge of a particle does not correspond to its pdg charge |
Definition at line 279 of file listmodus.cc.
|
private |
Check if the given file has events left after the given position.
| [in] | filepath | Path to file to be checked |
| [in] | last_position | Stream position in file after which check is performed |
true if there is at least one event left, false otherwise| runtime_error | If file could not be read for whatever reason |
Definition at line 390 of file listmodus.cc.
|
private |
Return the absolute path of the data file.
If an integer is passed, the filename is constructed using particle_list_filename_or_prefix_ concatenated with the given number, otherwise the file prefix is understood to be the full filename. The file is expected to be in particle_list_file_directory_ folder.
| [in] | file_id | An std::optional integer |
| runtime_error | If file does not exist. |
Definition at line 317 of file listmodus.cc.
|
private |
Read the next event.
Either from the current file if it has more events or from the next file (with file_id_ += 1)
| runtime_error | If file could not be read for whatever reason. |
Definition at line 344 of file listmodus.cc.
|
private |
Read and validate all events particles.
At the moment this is done w.r.t. their positions and errors are reported if more than 2 particles have the same identical position.
| InvalidEvents | If more than 2 particles with the same identical position are found. |
Definition at line 431 of file listmodus.cc.
|
private |
Validate the optional fields.
At the moment, it ensures that if at least one spin component is given, all four are given.
| std::invalid_argument | if not all spin components are given. |
Definition at line 456 of file listmodus.cc.
|
private |
Judge whether times are the same for all the particles; don't do anti-freestreaming if all particles start already at the same time.
If particles are at different times, calculate earliest time as start_time_ and free-stream all particles back to this time.
| particles | Particles to be checked and possibly back-streamed. |
Definition at line 107 of file listmodus.cc.
|
private |
Sets the optional fields given in the input list into a particle.
A warning is issued if the file is not read exactly as given, which happens if, for example, a float is present in an integer-related field.
| [in] | p | particle to be modified |
| [in] | optional_quantities | list of values to be set |
| std::invalid_argument | if the quantities in the input file do not obey the appropriate bounds. |
Definition at line 152 of file listmodus.cc.
|
protected |
Starting time for the List; changed to the earliest formation time.
Definition at line 152 of file listmodus.h.
|
private |
File directory of the particle list.
Definition at line 250 of file listmodus.h.
|
private |
Prefix of the file(s) containing the particle list.
If the user want to use a single file without numbering, this will contain the full filename.
Definition at line 256 of file listmodus.h.
|
private |
The id of the current file.
Definition at line 259 of file listmodus.h.
|
private |
Fields with optional quantities to be read.
Definition at line 262 of file listmodus.h.
|
private |
The unique id of the current event.
Definition at line 264 of file listmodus.h.
|
private |
Last read position in current file.
Definition at line 267 of file listmodus.h.
|
private |
Auxiliary flag to warn about mass-discrepancies only once per instance.
Definition at line 270 of file listmodus.h.
|
private |
Auxiliary flag to warn about off-shell particles only once per instance.
Definition at line 272 of file listmodus.h.
|
private |
Auxiliary flag to indicate the type of spin interaction used.
Definition at line 275 of file listmodus.h.
|
private |
Flag to suppress some error messages.
This is used during the validation of particles in all events, because there we do not know how many events exist and we simply try to read the next one till an error occurs. This triggers an error message which should not be printed to the user.
Definition at line 283 of file listmodus.h.