Version: SMASH-1.5
smash::RootOutput Class Reference

#include <rootoutput.h>

SMASH output to ROOT file

SMASH supports ROOT output as an option (see http://root.cern.ch).

The ROOT framework needs to be installed when building SMASH, otherwise ROOT support will be disabled.

This class produces file smash_run.root, which contains a ROOT TTree. TTree contains information about particles during simulation from all SMASH events. Output is happening in blocks. All particles in a block are at the same time and in the same event. However, it is possible that different blocks are at the same time and from the same event. Particle information is stored in TBranches. For each particle characteristic there is a separate branch. Currently these are t,x,y,z (coordinates), p0,px,py,pz (4-momentum), pdgid - PDG code of particle, that characterizes its sort, ev - number of event particle encountered in, tcounter - number of output block in a given event, npart - number of particles and impact_b - impact parameter.

Here is an example of ROOT macro to read the ROOT output of SMASH:

int rootfile_analysis_example() {
// open SMASH output file to be read in
TFile *input_file = TFile::Open("../build/data/0/smash_run.root");
if (input_file->IsOpen()) {
printf("Successfully opened file %s\n", input_file->GetName());
} else {
printf("Error at opening file %s\n", input_file->GetName());
}
// Get a tree from file
TTree *tree = static_cast<TTree*>(input_file->Get("particles"));
// Get number of entries in a tree
Int_t nentries = tree->GetEntries();
printf("Number of entries in a tree is %d\n", nentries);
// This draws p_T distribution at initialization
// tree->Draw("sqrt(px*px + py*py)","tcounter==0");
// This draws 3D momentum space distribution at initialization
tree->Draw("px:py:pz","tcounter==0");
return 0;
}

For examples of extracting info from .root file see root.cern.ch To view ROOT file use TBrowser:

root -l
new TBrowser

If option write_collisions is set True, then in addition to particles TTree a collision TTree is created. Information about each collision is written as one leaf: nin, nout - number of incoming and outgoing particles, ev - event number, weight - total weight of the collision (wgt), partial_weight - partial weight of the collision (par_wgt), (t,x,y,z), (p0,px,py,pz) - arrays of dimension nin+nout that contain coordinates and momenta.

Definition at line 94 of file rootoutput.h.

Inheritance diagram for smash::RootOutput:
[legend]
Collaboration diagram for smash::RootOutput:
[legend]

Public Member Functions

 RootOutput (const bf::path &path, const std::string &name, const OutputParameters &out_par)
 Construct ROOT output. More...
 
 ~RootOutput ()
 Destructor. More...
 
void at_eventstart (const Particles &particles, const int event_number) override
 update event number and writes intermediate particles to a tree. More...
 
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. More...
 
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). More...
 
void at_interaction (const Action &action, const double density) override
 Writes collisions to a tree defined by treename. More...
 
- Public Member Functions inherited from smash::OutputInterface
 OutputInterface (std::string name)
 Construct output interface. More...
 
virtual ~OutputInterface ()=default
 
virtual void thermodynamics_output (const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< DensityOnLattice > &lattice)
 Output to write thermodynamics from the lattice. More...
 
virtual void thermodynamics_output (const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< EnergyMomentumTensor > &lattice)
 Output to write energy-momentum tensor and related quantities from the lattice. More...
 
virtual void thermodynamics_output (const GrandCanThermalizer &gct)
 Output to write energy-momentum tensor and related quantities from the thermalizer class. More...
 
bool is_dilepton_output () const
 Get, whether this is the dilepton output? More...
 
bool is_photon_output () const
 Get, whether this is the photon output? More...
 
const char * to_string (const ThermodynamicQuantity tq)
 Convert thermodynamic quantities to strings. More...
 
const char * to_string (const DensityType dens_type)
 Convert density types to strings. More...
 

Private Member Functions

void particles_to_tree (const Particles &particles)
 Writes particles to a tree defined by treename. More...
 
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. More...
 
void init_trees ()
 Basic initialization routine, creating the TTree objects for particles and collisions. More...
 

Private Attributes

const bf::path filename_
 Filename of output. More...
 
bf::path filename_unfinished_
 Filename of output as long as simulation is still running. More...
 
std::unique_ptr< TFile > root_out_file_
 Pointer to root output file. More...
 
TTree * particles_tree_
 TTree for particles output. More...
 
TTree * collisions_tree_
 TTree for collision output. More...
 
int output_counter_ = 0
 Number of output in a given event. More...
 
int current_event_ = 0
 Number of current event. More...
 
bool write_collisions_
 Option to write collisions tree. More...
 
bool write_particles_
 Option to write particles tree. More...
 
bool particles_only_final_
 Print only final particles in the event, no intermediate output. More...
 
int autosave_frequency_
 Root file cannot be read if it was not properly closed and finalized. More...
 
std::array< double, max_buffer_size_p0
 Buffer for filling TTree. See class documentation for definitions. More...
 
std::array< double, max_buffer_size_px
 Buffer for filling TTree. See class documentation for definitions. More...
 
std::array< double, max_buffer_size_py
 Buffer for filling TTree. See class documentation for definitions. More...
 
std::array< double, max_buffer_size_pz
 Buffer for filling TTree. See class documentation for definitions. More...
 
std::array< double, max_buffer_size_t
 Buffer for filling TTree. See class documentation for definitions. More...
 
std::array< double, max_buffer_size_x
 Buffer for filling TTree. See class documentation for definitions. More...
 
std::array< double, max_buffer_size_y
 Buffer for filling TTree. See class documentation for definitions. More...
 
std::array< double, max_buffer_size_z
 Buffer for filling TTree. See class documentation for definitions. More...
 
std::array< int, max_buffer_size_pdgcode
 Buffer for filling TTree. See class documentation for definitions. More...
 
int npart
 Buffer for filling TTree. See class documentation for definitions. More...
 
int tcounter
 Buffer for filling TTree. See class documentation for definitions. More...
 
int ev
 Buffer for filling TTree. See class documentation for definitions. More...
 
int nin
 Buffer for filling TTree. See class documentation for definitions. More...
 
int nout
 Buffer for filling TTree. See class documentation for definitions. More...
 
double wgt
 Buffer for filling TTree. See class documentation for definitions. More...
 
double par_wgt
 Buffer for filling TTree. See class documentation for definitions. More...
 
double impact_b
 Buffer for filling TTree. See class documentation for definitions. More...
 

Static Private Attributes

static const int max_buffer_size_ = 10000
 Maximal buffer size. More...
 

Additional Inherited Members

- Protected Attributes inherited from smash::OutputInterface
const bool is_dilepton_output_
 Is this the dilepton output? More...
 
const bool is_photon_output_
 Is this the photon output? More...
 

Constructor & Destructor Documentation

◆ RootOutput()

smash::RootOutput::RootOutput ( const bf::path &  path,
const std::string &  name,
const OutputParameters out_par 
)

Construct ROOT output.

Parameters
[in]pathOutput path.
[in]nameName of the ouput.
[in]out_parA structure containing parameters of the output.

Definition at line 79 of file rootoutput.cc.

81  : OutputInterface(name),
82  filename_(path / (name + ".root")),
83  write_collisions_(name == "Collisions" || name == "Dileptons" ||
84  name == "Photons"),
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>();
89  if (out_par.part_extended || out_par.coll_extended) {
90  log.warn() << "Creating Root output: There is no extended Root format.";
91  }
93  filename_unfinished_ += ".unfinished";
95  make_unique<TFile>(filename_unfinished_.native().c_str(), "NEW");
96  init_trees();
97 }
const bf::path filename_
Filename of output.
Definition: rootoutput.h:144
bool write_particles_
Option to write particles tree.
Definition: rootoutput.h:198
std::unique_ptr< TFile > root_out_file_
Pointer to root output file.
Definition: rootoutput.h:148
void init_trees()
Basic initialization routine, creating the TTree objects for particles and collisions.
Definition: rootoutput.cc:99
bool write_collisions_
Option to write collisions tree.
Definition: rootoutput.h:195
bf::path filename_unfinished_
Filename of output as long as simulation is still running.
Definition: rootoutput.h:146
bool particles_only_final_
Print only final particles in the event, no intermediate output.
Definition: rootoutput.h:201
OutputInterface(std::string name)
Construct output interface.
int autosave_frequency_
Root file cannot be read if it was not properly closed and finalized.
Definition: rootoutput.h:212
Here is the call graph for this function:

◆ ~RootOutput()

smash::RootOutput::~RootOutput ( )

Destructor.

RootOutput destructor.

Writes root objects (here TTrees) to file and closes it.

Definition at line 149 of file rootoutput.cc.

149  {
150  // kOverwrite option prevents from writing extra TKey objects into root file
151  root_out_file_->Write("", TObject::kOverwrite);
152  root_out_file_->Close();
153  bf::rename(filename_unfinished_, filename_);
154 }
const bf::path filename_
Filename of output.
Definition: rootoutput.h:144
std::unique_ptr< TFile > root_out_file_
Pointer to root output file.
Definition: rootoutput.h:148
bf::path filename_unfinished_
Filename of output as long as simulation is still running.
Definition: rootoutput.h:146

Member Function Documentation

◆ at_eventstart()

void smash::RootOutput::at_eventstart ( const Particles particles,
const int  event_number 
)
overridevirtual

update event number and writes intermediate particles to a tree.

Parameters
[in]particlesParticles to be written to output.
[in]event_numberevent number to be used in ROOT output.

Implements smash::OutputInterface.

Definition at line 156 of file rootoutput.cc.

157  {
158  // save event number
159  current_event_ = event_number;
160 
162  output_counter_ = 0;
163  // This is to have only one output of positive impact parameter per event
164  impact_b = -1.0;
165  particles_to_tree(particles);
166  output_counter_++;
167  }
168 }
int current_event_
Number of current event.
Definition: rootoutput.h:181
bool write_particles_
Option to write particles tree.
Definition: rootoutput.h:198
int output_counter_
Number of output in a given event.
Definition: rootoutput.h:179
double impact_b
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:191
void particles_to_tree(const Particles &particles)
Writes particles to a tree defined by treename.
Definition: rootoutput.cc:205
bool particles_only_final_
Print only final particles in the event, no intermediate output.
Definition: rootoutput.h:201
Here is the call graph for this function:

◆ at_eventend()

void smash::RootOutput::at_eventend ( const Particles particles,
const int  event_number,
double  impact_parameter 
)
overridevirtual

update event number and impact parameter, and writes intermediate particles to a tree.

Parameters
[in]particlesParticles to be written to output.
[in]event_numberevent number to be used in ROOT output.
[in]impact_parameterevent number to be used in ROOT output. [fm]

Implements smash::OutputInterface.

Definition at line 178 of file rootoutput.cc.

180  {
181  impact_b = impact_parameter;
182  if (write_particles_) {
183  particles_to_tree(particles);
184  }
185  /* Forced regular dump from operational memory to disk. Very demanding!
186  * If program crashes written data will NOT be lost. */
188  if (write_particles_) {
189  particles_tree_->AutoSave("SaveSelf");
190  }
191  if (write_collisions_) {
192  collisions_tree_->AutoSave("SaveSelf");
193  }
194  }
195 }
int current_event_
Number of current event.
Definition: rootoutput.h:181
bool write_particles_
Option to write particles tree.
Definition: rootoutput.h:198
TTree * particles_tree_
TTree for particles output.
Definition: rootoutput.h:155
bool write_collisions_
Option to write collisions tree.
Definition: rootoutput.h:195
double impact_b
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:191
TTree * collisions_tree_
TTree for collision output.
Definition: rootoutput.h:162
void particles_to_tree(const Particles &particles)
Writes particles to a tree defined by treename.
Definition: rootoutput.cc:205
int autosave_frequency_
Root file cannot be read if it was not properly closed and finalized.
Definition: rootoutput.h:212
Here is the call graph for this function:

◆ at_intermediate_time()

void smash::RootOutput::at_intermediate_time ( const Particles particles,
const Clock clock,
const DensityParameters dens_param 
)
overridevirtual

Writes intermediate particles to a tree defined by treename, if it is allowed (i.e., particles_only_final_ is false).

Parameters
[in]particlesParticles to be written to output.
[in]clockUnused, needed since inherited.
[in]dens_paramUnused, needed since inherited.

Reimplemented from smash::OutputInterface.

Definition at line 170 of file rootoutput.cc.

171  {
173  particles_to_tree(particles);
174  output_counter_++;
175  }
176 }
bool write_particles_
Option to write particles tree.
Definition: rootoutput.h:198
int output_counter_
Number of output in a given event.
Definition: rootoutput.h:179
void particles_to_tree(const Particles &particles)
Writes particles to a tree defined by treename.
Definition: rootoutput.cc:205
bool particles_only_final_
Print only final particles in the event, no intermediate output.
Definition: rootoutput.h:201
Here is the call graph for this function:

◆ at_interaction()

void smash::RootOutput::at_interaction ( const Action action,
const double  density 
)
overridevirtual

Writes collisions to a tree defined by treename.

Parameters
[in]actionan Action object containing incoming, outgoing particles and type of interactions.
[in]densityUnused, needed since inherited.

Reimplemented from smash::OutputInterface.

Definition at line 197 of file rootoutput.cc.

198  {
199  if (write_collisions_) {
200  collisions_to_tree(action.incoming_particles(), action.outgoing_particles(),
201  action.get_total_weight(), action.get_partial_weight());
202  }
203 }
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.
Definition: rootoutput.cc:240
bool write_collisions_
Option to write collisions tree.
Definition: rootoutput.h:195
Here is the call graph for this function:

◆ particles_to_tree()

void smash::RootOutput::particles_to_tree ( const Particles particles)
private

Writes particles to a tree defined by treename.

Parameters
[in]particlesParticles to be written to output.

Definition at line 205 of file rootoutput.cc.

205  {
206  int i = 0;
207 
209  ev = current_event_;
210 
211  for (const auto &p : particles) {
212  // Buffer full - flush to tree, else fill with particles
213  if (i >= max_buffer_size_) {
215  i = 0;
216  particles_tree_->Fill();
217  } else {
218  t[i] = p.position().x0();
219  x[i] = p.position().x1();
220  y[i] = p.position().x2();
221  z[i] = p.position().x3();
222 
223  p0[i] = p.momentum().x0();
224  px[i] = p.momentum().x1();
225  py[i] = p.momentum().x2();
226  pz[i] = p.momentum().x3();
227 
228  pdgcode[i] = p.pdgcode().get_decimal();
229 
230  i++;
231  }
232  }
233  // Flush rest to tree
234  if (i > 0) {
235  npart = i;
236  particles_tree_->Fill();
237  }
238 }
int current_event_
Number of current event.
Definition: rootoutput.h:181
std::array< double, max_buffer_size_ > py
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< double, max_buffer_size_ > x
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
int npart
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
std::array< double, max_buffer_size_ > p0
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
TTree * particles_tree_
TTree for particles output.
Definition: rootoutput.h:155
std::array< double, max_buffer_size_ > t
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
int output_counter_
Number of output in a given event.
Definition: rootoutput.h:179
std::array< double, max_buffer_size_ > z
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< double, max_buffer_size_ > y
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< double, max_buffer_size_ > px
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
constexpr int p
Proton.
int tcounter
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
int ev
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
std::array< double, max_buffer_size_ > pz
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< int, max_buffer_size_ > pdgcode
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:189
static const int max_buffer_size_
Maximal buffer size.
Definition: rootoutput.h:184
Here is the caller graph for this function:

◆ collisions_to_tree()

void smash::RootOutput::collisions_to_tree ( const ParticleList &  incoming,
const ParticleList &  outgoing,
const double  weight,
const double  partial_weight 
)
private

Writes collisions to a tree defined by treename.

Parameters
[in]incomingIncoming particles to be written to output.
[in]outgoingOutgoing particles to be written to output.
[in]weightTotal weight of the collision.
[in]partial_weightPartial weight of the collision

Definition at line 240 of file rootoutput.cc.

243  {
244  ev = current_event_;
245  nin = incoming.size();
246  nout = outgoing.size();
247  npart = nin + nout;
248  wgt = weight;
249  par_wgt = partial_weight;
250 
251  int i = 0;
252 
253  /* It is assumed that nin + nout < max_buffer_size_
254  * This is true for any possible reaction for current buffer size: 10000
255  * But if one wants initial/final particles written to collisions
256  * then implementation should be updated. */
257 
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();
263 
264  p0[i] = p.momentum().x0();
265  px[i] = p.momentum().x1();
266  py[i] = p.momentum().x2();
267  pz[i] = p.momentum().x3();
268 
269  pdgcode[i] = p.pdgcode().get_decimal();
270 
271  i++;
272  }
273 
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();
279 
280  p0[i] = p.momentum().x0();
281  px[i] = p.momentum().x1();
282  py[i] = p.momentum().x2();
283  pz[i] = p.momentum().x3();
284 
285  pdgcode[i] = p.pdgcode().get_decimal();
286 
287  i++;
288  }
289 
290  collisions_tree_->Fill();
291 }
int nout
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
int current_event_
Number of current event.
Definition: rootoutput.h:181
std::array< double, max_buffer_size_ > py
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< double, max_buffer_size_ > x
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
int npart
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
std::array< double, max_buffer_size_ > p0
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
int nin
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
std::array< double, max_buffer_size_ > t
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< double, max_buffer_size_ > z
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< double, max_buffer_size_ > y
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< double, max_buffer_size_ > px
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
double wgt
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:191
constexpr int p
Proton.
TTree * collisions_tree_
TTree for collision output.
Definition: rootoutput.h:162
int ev
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
std::array< double, max_buffer_size_ > pz
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< int, max_buffer_size_ > pdgcode
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:189
double par_wgt
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:191
Here is the caller graph for this function:

◆ init_trees()

void smash::RootOutput::init_trees ( )
private

Basic initialization routine, creating the TTree objects for particles and collisions.

Definition at line 99 of file rootoutput.cc.

99  {
100  if (write_particles_) {
101  particles_tree_ = new TTree("particles", "particles");
102 
103  particles_tree_->Branch("npart", &npart, "npart/I");
104  particles_tree_->Branch("impact_b", &impact_b, "impact_b/D");
105  particles_tree_->Branch("ev", &ev, "ev/I");
106  particles_tree_->Branch("tcounter", &tcounter, "tcounter/I");
107 
108  particles_tree_->Branch("pdgcode", &pdgcode[0], "pdgcode[npart]/I");
109 
110  particles_tree_->Branch("p0", &p0[0], "p0[npart]/D");
111  particles_tree_->Branch("px", &px[0], "px[npart]/D");
112  particles_tree_->Branch("py", &py[0], "py[npart]/D");
113  particles_tree_->Branch("pz", &pz[0], "pz[npart]/D");
114 
115  particles_tree_->Branch("t", &t[0], "t[npart]/D");
116  particles_tree_->Branch("x", &x[0], "x[npart]/D");
117  particles_tree_->Branch("y", &y[0], "y[npart]/D");
118  particles_tree_->Branch("z", &z[0], "z[npart]/D");
119  }
120 
121  if (write_collisions_) {
122  collisions_tree_ = new TTree("collisions", "collisions");
123 
124  collisions_tree_->Branch("nin", &nin, "nin/I");
125  collisions_tree_->Branch("nout", &nout, "nout/I");
126  collisions_tree_->Branch("npart", &npart, "npart/I");
127  collisions_tree_->Branch("ev", &ev, "ev/I");
128  collisions_tree_->Branch("weight", &wgt, "weight/D");
129  collisions_tree_->Branch("partial_weight", &par_wgt, "partial_weight/D");
130 
131  collisions_tree_->Branch("pdgcode", &pdgcode[0], "pdgcode[npart]/I");
132 
133  collisions_tree_->Branch("p0", &p0[0], "p0[npart]/D");
134  collisions_tree_->Branch("px", &px[0], "px[npart]/D");
135  collisions_tree_->Branch("py", &py[0], "py[npart]/D");
136  collisions_tree_->Branch("pz", &pz[0], "pz[npart]/D");
137 
138  collisions_tree_->Branch("t", &t[0], "t[npart]/D");
139  collisions_tree_->Branch("x", &x[0], "x[npart]/D");
140  collisions_tree_->Branch("y", &y[0], "y[npart]/D");
141  collisions_tree_->Branch("z", &z[0], "z[npart]/D");
142  }
143 }
int nout
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
bool write_particles_
Option to write particles tree.
Definition: rootoutput.h:198
std::array< double, max_buffer_size_ > py
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< double, max_buffer_size_ > x
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
int npart
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
std::array< double, max_buffer_size_ > p0
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
TTree * particles_tree_
TTree for particles output.
Definition: rootoutput.h:155
int nin
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
std::array< double, max_buffer_size_ > t
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< double, max_buffer_size_ > z
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< double, max_buffer_size_ > y
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
bool write_collisions_
Option to write collisions tree.
Definition: rootoutput.h:195
std::array< double, max_buffer_size_ > px
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
double wgt
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:191
double impact_b
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:191
TTree * collisions_tree_
TTree for collision output.
Definition: rootoutput.h:162
int tcounter
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
int ev
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:190
std::array< double, max_buffer_size_ > pz
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:188
std::array< int, max_buffer_size_ > pdgcode
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:189
double par_wgt
Buffer for filling TTree. See class documentation for definitions.
Definition: rootoutput.h:191
Here is the caller graph for this function:

Member Data Documentation

◆ filename_

const bf::path smash::RootOutput::filename_
private

Filename of output.

Definition at line 144 of file rootoutput.h.

◆ filename_unfinished_

bf::path smash::RootOutput::filename_unfinished_
private

Filename of output as long as simulation is still running.

Definition at line 146 of file rootoutput.h.

◆ root_out_file_

std::unique_ptr<TFile> smash::RootOutput::root_out_file_
private

Pointer to root output file.

Definition at line 148 of file rootoutput.h.

◆ particles_tree_

TTree* smash::RootOutput::particles_tree_
private

TTree for particles output.

TFile takes ownership of all TTrees. That's why TTree is not a unique pointer.

Definition at line 155 of file rootoutput.h.

◆ collisions_tree_

TTree* smash::RootOutput::collisions_tree_
private

TTree for collision output.

TFile takes ownership of all TTrees. That's why TTree is not a unique pointer.

Definition at line 162 of file rootoutput.h.

◆ output_counter_

int smash::RootOutput::output_counter_ = 0
private

Number of output in a given event.

Definition at line 179 of file rootoutput.h.

◆ current_event_

int smash::RootOutput::current_event_ = 0
private

Number of current event.

Definition at line 181 of file rootoutput.h.

◆ max_buffer_size_

const int smash::RootOutput::max_buffer_size_ = 10000
staticprivate

Maximal buffer size.

Definition at line 184 of file rootoutput.h.

◆ p0

std::array<double, max_buffer_size_> smash::RootOutput::p0
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 188 of file rootoutput.h.

◆ px

std::array<double, max_buffer_size_> smash::RootOutput::px
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 188 of file rootoutput.h.

◆ py

std::array<double, max_buffer_size_> smash::RootOutput::py
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 188 of file rootoutput.h.

◆ pz

std::array<double, max_buffer_size_> smash::RootOutput::pz
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 188 of file rootoutput.h.

◆ t

std::array<double, max_buffer_size_> smash::RootOutput::t
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 188 of file rootoutput.h.

◆ x

std::array<double, max_buffer_size_> smash::RootOutput::x
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 188 of file rootoutput.h.

◆ y

std::array<double, max_buffer_size_> smash::RootOutput::y
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 188 of file rootoutput.h.

◆ z

std::array<double, max_buffer_size_> smash::RootOutput::z
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 188 of file rootoutput.h.

◆ pdgcode

std::array<int, max_buffer_size_> smash::RootOutput::pdgcode
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 189 of file rootoutput.h.

◆ npart

int smash::RootOutput::npart
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 190 of file rootoutput.h.

◆ tcounter

int smash::RootOutput::tcounter
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 190 of file rootoutput.h.

◆ ev

int smash::RootOutput::ev
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 190 of file rootoutput.h.

◆ nin

int smash::RootOutput::nin
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 190 of file rootoutput.h.

◆ nout

int smash::RootOutput::nout
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 190 of file rootoutput.h.

◆ wgt

double smash::RootOutput::wgt
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 191 of file rootoutput.h.

◆ par_wgt

double smash::RootOutput::par_wgt
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 191 of file rootoutput.h.

◆ impact_b

double smash::RootOutput::impact_b
private

Buffer for filling TTree. See class documentation for definitions.

Definition at line 191 of file rootoutput.h.

◆ write_collisions_

bool smash::RootOutput::write_collisions_
private

Option to write collisions tree.

Definition at line 195 of file rootoutput.h.

◆ write_particles_

bool smash::RootOutput::write_particles_
private

Option to write particles tree.

Definition at line 198 of file rootoutput.h.

◆ particles_only_final_

bool smash::RootOutput::particles_only_final_
private

Print only final particles in the event, no intermediate output.

Definition at line 201 of file rootoutput.h.

◆ autosave_frequency_

int smash::RootOutput::autosave_frequency_
private

Root file cannot be read if it was not properly closed and finalized.

It can happen that SMASH simulation crashed and root file was not closed. To save results of simulation in such case, "AutoSave" is applied every N events. The autosave_frequency_ sets this N (default N = 1000). Note that "AutoSave" operation is very time-consuming, so the Autosave_Frequency is always a compromise between safety and speed.

Definition at line 212 of file rootoutput.h.


The documentation for this class was generated from the following files: