Version: SMASH-1.5
listmodus.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2018
3  * SMASH Team
4  *
5  * GNU General Public License (GPLv3 or later)
6  */
7 #ifndef SRC_INCLUDE_LISTMODUS_H_
8 #define SRC_INCLUDE_LISTMODUS_H_
9 
10 #include <cmath>
11 #include <cstdint>
12 #include <list>
13 #include <string>
14 #include <utility>
15 
16 #include "forwarddeclarations.h"
17 #include "modusdefault.h"
18 
19 namespace smash {
20 
56 class ListModus : public ModusDefault {
57  public:
68  explicit ListModus(Configuration modus_config,
69  const ExperimentParameters &parameters);
70 
72  ListModus() : shift_id_(0) {}
73 
86  double initial_conditions(Particles *particles,
87  const ExperimentParameters &parameters);
98  void backpropagate_to_same_time(Particles &particles);
99 
132  void try_create_particle(Particles &particles, PdgCode pdgcode, double t,
133  double x, double y, double z, double mass, double E,
134  double px, double py, double pz);
135 
139  struct LoadFailure : public std::runtime_error {
140  using std::runtime_error::runtime_error;
141  };
142 
143  protected:
145  double start_time_ = 0.;
146 
147  private:
150 
153 
156 
158  const int shift_id_;
159 
162 
164  int file_id_;
165 
170 
180  bool file_has_events_(bf::path filepath, std::streampos last_position);
181 
183  std::streampos last_read_position_;
184 
193  bf::path file_path_(const int file_id);
194 
202  std::string next_event_();
203 
210  friend std::ostream &operator<<(std::ostream &, const ListModus &);
211 };
212 
213 } // namespace smash
214 
215 #endif // SRC_INCLUDE_LISTMODUS_H_
std::string particle_list_file_directory_
File directory of the particle list.
Definition: listmodus.h:149
double initial_conditions(Particles *particles, const ExperimentParameters &parameters)
Generates initial state of the particles in the system according to a list.
Definition: listmodus.cc:231
std::string current_particle_list_file_
File name of current file.
Definition: listmodus.h:155
int file_id_
file_id_ is the id of the current file
Definition: listmodus.h:164
ListModus()
Construct an empty list. Useful for convenient JetScape connection.
Definition: listmodus.h:72
ListModus: Provides a modus for running SMASH on an external particle list, for example as an afterbu...
Definition: listmodus.h:56
void backpropagate_to_same_time(Particles &particles)
Judge whether formation times are the same for all the particles; Don&#39;t do anti-freestreaming if all ...
Definition: listmodus.cc:141
Interface to the SMASH configuration files.
int n_warns_mass_consistency_
Counter for energy-momentum conservation warnings to avoid spamming.
Definition: listmodus.h:169
Base class for Modus classes that provides default function implementations.
Definition: modusdefault.h:44
Used when external particle list cannot be found.
Definition: listmodus.h:139
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 a...
Definition: listmodus.cc:178
PdgCode stores a Particle Data Group Particle Numbering Scheme particle type number.
Definition: pdgcode.h:108
double start_time_
Starting time for the List; changed to the earliest formation time.
Definition: listmodus.h:145
int n_warns_precision_
Counter for mass-check warnings to avoid spamming.
Definition: listmodus.h:167
bool file_has_events_(bf::path filepath, std::streampos last_position)
Check if the file given by filepath has events left after streampos last_position.
Definition: listmodus.cc:333
int event_id_
event_id_ = the unique id of the current event
Definition: listmodus.h:161
std::string particle_list_file_prefix_
File prefix of the particle list.
Definition: listmodus.h:152
const int shift_id_
shift_id is the start number of file_id_
Definition: listmodus.h:158
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
std::string next_event_()
Read the next event.
Definition: listmodus.cc:293
Helper structure for Experiment.
friend std::ostream & operator<<(std::ostream &, const ListModus &)
Writes the initial state for the List to the output stream.
Definition: listmodus.cc:135
std::streampos last_read_position_
last read position in current file
Definition: listmodus.h:183
Definition: action.h:24
bf::path file_path_(const int file_id)
Return the absolute file path based on given integer.
Definition: listmodus.cc:266