82 filename_(path / (name +
".root")),
83 write_collisions_(name ==
"Collisions" || name ==
"Dileptons" ||
85 write_particles_(name ==
"Particles"),
86 particles_only_final_(out_par.part_only_final),
87 autosave_frequency_(1000) {
88 const auto &log = logger<LogArea::Output>();
90 log.warn() <<
"Creating Root output: There is no extended Root format.";
157 const int event_number) {
180 double impact_parameter) {
211 for (
const auto &
p : particles) {
218 t[i] =
p.position().x0();
219 x[i] =
p.position().x1();
220 y[i] =
p.position().x2();
221 z[i] =
p.position().x3();
223 p0[i] =
p.momentum().x0();
224 px[i] =
p.momentum().x1();
225 py[i] =
p.momentum().x2();
226 pz[i] =
p.momentum().x3();
228 pdgcode[i] =
p.pdgcode().get_decimal();
241 const ParticleList &outgoing,
243 const double partial_weight) {
245 nin = incoming.size();
246 nout = outgoing.size();
258 for (
const auto &
p : incoming) {
259 t[i] =
p.position().x0();
260 x[i] =
p.position().x1();
261 y[i] =
p.position().x2();
262 z[i] =
p.position().x3();
264 p0[i] =
p.momentum().x0();
265 px[i] =
p.momentum().x1();
266 py[i] =
p.momentum().x2();
267 pz[i] =
p.momentum().x3();
269 pdgcode[i] =
p.pdgcode().get_decimal();
274 for (
const auto &
p : outgoing) {
275 t[i] =
p.position().x0();
276 x[i] =
p.position().x1();
277 y[i] =
p.position().x2();
278 z[i] =
p.position().x3();
280 p0[i] =
p.momentum().x0();
281 px[i] =
p.momentum().x1();
282 py[i] =
p.momentum().x2();
283 pz[i] =
p.momentum().x3();
285 pdgcode[i] =
p.pdgcode().get_decimal();
const bf::path filename_
Filename of output.
A class to pre-calculate and store parameters relevant for density calculation.
int nout
Buffer for filling TTree. See class documentation for definitions.
int current_event_
Number of current event.
bool write_particles_
Option to write particles tree.
std::array< double, max_buffer_size_ > py
Buffer for filling TTree. See class documentation for definitions.
std::unique_ptr< TFile > root_out_file_
Pointer to root output file.
void at_eventstart(const Particles &particles, const int event_number) override
update event number and writes intermediate particles to a tree.
bool part_extended
Extended format for particles output.
std::array< double, max_buffer_size_ > x
Buffer for filling TTree. See class documentation for definitions.
int npart
Buffer for filling TTree. See class documentation for definitions.
std::array< double, max_buffer_size_ > p0
Buffer for filling TTree. See class documentation for definitions.
virtual double get_partial_weight() const =0
Return the specific weight for the chosen outgoing channel, which is mainly used for the partial weig...
TTree * particles_tree_
TTree for particles output.
void init_trees()
Basic initialization routine, creating the TTree objects for particles and collisions.
int nin
Buffer for filling TTree. See class documentation for definitions.
void at_eventend(const Particles &particles, const int event_number, double impact_parameter) override
update event number and impact parameter, and writes intermediate particles to a tree.
void at_intermediate_time(const Particles &particles, const Clock &clock, const DensityParameters &dens_param) override
Writes intermediate particles to a tree defined by treename, if it is allowed (i.e., particles_only_final_ is false).
void collisions_to_tree(const ParticleList &incoming, const ParticleList &outgoing, const double weight, const double partial_weight)
Writes collisions to a tree defined by treename.
std::array< double, max_buffer_size_ > t
Buffer for filling TTree. See class documentation for definitions.
RootOutput(const bf::path &path, const std::string &name, const OutputParameters &out_par)
Construct ROOT output.
int output_counter_
Number of output in a given event.
bool coll_extended
Extended format for collisions output.
std::array< double, max_buffer_size_ > z
Buffer for filling TTree. See class documentation for definitions.
Helper structure for Experiment to hold output options and parameters.
Clock tracks the time in the simulation.
Action is the base class for a generic process that takes a number of incoming particles and transfor...
virtual double get_total_weight() const =0
Return the total weight value, which is mainly used for the weight output entry.
std::array< double, max_buffer_size_ > y
Buffer for filling TTree. See class documentation for definitions.
bool write_collisions_
Option to write collisions tree.
std::array< double, max_buffer_size_ > px
Buffer for filling TTree. See class documentation for definitions.
double wgt
Buffer for filling TTree. See class documentation for definitions.
bf::path filename_unfinished_
Filename of output as long as simulation is still running.
void at_interaction(const Action &action, const double density) override
Writes collisions to a tree defined by treename.
double impact_b
Buffer for filling TTree. See class documentation for definitions.
TTree * collisions_tree_
TTree for collision output.
void particles_to_tree(const Particles &particles)
Writes particles to a tree defined by treename.
int tcounter
Buffer for filling TTree. See class documentation for definitions.
bool particles_only_final_
Print only final particles in the event, no intermediate output.
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.
int ev
Buffer for filling TTree. See class documentation for definitions.
std::array< double, max_buffer_size_ > pz
Buffer for filling TTree. See class documentation for definitions.
const ParticleList & outgoing_particles() const
Get the list of particles that resulted from the action.
std::array< int, max_buffer_size_ > pdgcode
Buffer for filling TTree. See class documentation for definitions.
int autosave_frequency_
Root file cannot be read if it was not properly closed and finalized.
Abstraction of generic output.
static const int max_buffer_size_
Maximal buffer size.
double par_wgt
Buffer for filling TTree. See class documentation for definitions.