#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 56 of file listmodus.h.
Classes | |
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 | backpropagate_to_same_time (Particles &particles) |
Judge whether formation times are the same for all the particles; Don't do anti-freestreaming if all particles start already at the same time. 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) |
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... | |
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 | |
bool | file_has_events_ (std::filesystem::path filepath, std::streampos last_position) |
Check if the file given by filepath has events left after streampos last_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... | |
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... | |
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... | |
Friends | |
std::ostream & | operator<< (std::ostream &, const ListModus &) |
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. |
Definition at line 38 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 |
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 135 of file listmodus.cc.
void smash::ListModus::backpropagate_to_same_time | ( | Particles & | particles | ) |
Judge whether formation 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 formation 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 81 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 | ||
) |
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 |
[out] | particles | structure, to which the particle is added |
Definition at line 118 of file listmodus.cc.
|
inline |
Definition at line 148 of file listmodus.h.
|
private |
Check if the file given by filepath has events left after streampos last_position.
[in] | filepath | Path to file to be checked. |
[in] | last_position | Stream position in file after which check is performed |
runtime_error | If file could not be read for whatever reason. |
Definition at line 241 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 173 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 198 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 193 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 199 of file listmodus.h.
|
private |
The id of the current file.
Definition at line 202 of file listmodus.h.
|
private |
The unique id of the current event.
Definition at line 205 of file listmodus.h.
|
private |
Last read position in current file.
Definition at line 208 of file listmodus.h.
|
private |
Auxiliary flag to warn about mass-discrepancies only once per instance.
Definition at line 211 of file listmodus.h.
|
private |
Auxiliary flag to warn about off-shell particles only once per instance.
Definition at line 213 of file listmodus.h.