14 #include <boost/filesystem.hpp> 97 file_{path /
"SMASH_IC.dat",
"w"},
101 "# %s initial conditions: hypersurface of constant proper time\n",
103 std::fprintf(
file_.
get(),
"# tau x y eta mt px py Rap ID charge\n");
104 std::fprintf(
file_.
get(),
"# fm fm fm none GeV GeV GeV none none e\n");
110 std::fprintf(
file_.
get(),
"# event %i start\n", event_number + 1);
115 const auto &log = logger<LogArea::HyperSurfaceCrossing>();
116 std::fprintf(
file_.
get(),
"# event %i end\n", event_number + 1);
120 if (particles.
size() != 0) {
122 "End time might be too small for initial conditions output. " 123 "Hypersurface has not yet been crossed by ",
124 particles.
size(),
" particle(s).");
129 const std::unique_ptr<Clock> &,
141 const double m_trans = sqrt(particle.type().mass() * particle.type().mass() +
142 particle.momentum()[1] * particle.momentum()[1] +
143 particle.momentum()[2] * particle.momentum()[2]);
145 const double rapidity =
146 0.5 * log((particle.momentum()[0] + particle.momentum()[3]) /
147 (particle.momentum()[0] - particle.momentum()[3]));
150 std::fprintf(
file_.
get(),
"%g %g %g %g %g %g %g %g %i %i \n",
151 particle.position().tau(), particle.position()[1],
152 particle.position()[2], particle.position().eta(), m_trans,
153 particle.momentum()[1], particle.momentum()[2], rapidity,
154 particle.id(), particle.type().charge());
161 const double next_proper_time = particle.position().tau();
163 throw std::runtime_error(
164 "Hypersurface proper time changed during evolution.");
A class to pre-calculate and store parameters relevant for density calculation.
constexpr double really_small
Numerical error tolerance.
ICOutput(const bf::path &path, const std::string &name, const OutputParameters &out_par)
Create a new IC output.
FILE * get()
Get the underlying FILE* pointer.
void at_interaction(const Action &action, const double) override
Write particle data at the hypersurface crossing point to the IC output.
void at_eventstart(const Particles &, const int event_number) override
Write event start line.
virtual ProcessType get_type() const
Get the process type.
Hypersurface crossing Particles are removed from the evolution and printed to a separate output to se...
void at_intermediate_time(const Particles &, const std::unique_ptr< Clock > &, const DensityParameters &) override
Unused, but needed since virtually declared in mother class.
void at_eventend(const Particles &particles, const int event_number, double, bool) override
Write event end line.
const OutputParameters out_par_
Structure that holds all the information about what to printout.
Helper structure for Experiment to hold output options and parameters.
Action is the base class for a generic process that takes a number of incoming particles and transfor...
double IC_proper_time_
Proper time of the particles removed when extracting initial conditions.
RenamingFilePtr file_
Pointer to output file.
const ParticleList & incoming_particles() const
Get the list of particles that go into the action.
The Particles class abstracts the storage and manipulation of particles.
ParticleData contains the dynamic information of a certain particle.
Abstraction of generic output.