Version: SMASH-2.0
hepmcoutput.h
Go to the documentation of this file.
1 
2 /*
3  *
4  * Copyright (c) 2014-2020
5  * SMASH Team
6  *
7  * GNU General Public License (GPLv3 or later)
8  *
9  */
10 
11 #ifndef SRC_INCLUDE_SMASH_HEPMCOUTPUT_H_
12 #define SRC_INCLUDE_SMASH_HEPMCOUTPUT_H_
13 
14 #include <memory>
15 #include <string>
16 
17 #include "forwarddeclarations.h"
18 #include "outputinterface.h"
19 #include "outputparameters.h"
20 
21 #include <boost/filesystem.hpp>
22 
23 #include "HepMC3/GenEvent.h"
24 #include "HepMC3/GenParticle.h"
25 #include "HepMC3/GenVertex.h"
26 #include "HepMC3/WriterAscii.h"
27 
28 namespace smash {
29 
41 class HepMcOutput : public OutputInterface {
42  public:
52  HepMcOutput(const bf::path &path, std::string name,
53  const OutputParameters &out_par, const int total_N,
54  const int proj_N);
55 
57  ~HepMcOutput();
58 
68  void at_eventstart(const Particles &particles, const int event_number,
69  const EventInfo &) override;
70 
79  void at_eventend(const Particles &particles, const int32_t event_number,
80  const EventInfo &event) override;
81 
82  private:
87 
89  const bf::path filename_;
92 
97  const int total_N_;
102  const int proj_N_;
103 
119  int construct_nuclear_pdg_code(int na, int nz) const;
120 
122  std::unique_ptr<HepMC3::WriterAscii> output_file_;
123 
125  std::unique_ptr<HepMC3::GenEvent> current_event_;
126 
128  HepMC3::GenVertexPtr vertex_;
129 };
130 
131 } // namespace smash
132 
133 #endif // SRC_INCLUDE_SMASH_HEPMCOUTPUT_H_
smash
Definition: action.h:24
smash::HepMcOutput::proj_N_
const int proj_N_
Total number of nucleons in projectile, needed for converting nuclei to single particles.
Definition: hepmcoutput.h:102
smash::HepMcOutput::total_N_
const int total_N_
Total number of nucleons in projectile and target, needed for converting nuclei to single particles.
Definition: hepmcoutput.h:97
outputparameters.h
smash::HepMcOutput::filename_unfinished_
bf::path filename_unfinished_
Filename of output as long as simulation is still running.
Definition: hepmcoutput.h:91
smash::HepMcOutput::HepMcOutput
HepMcOutput(const bf::path &path, std::string name, const OutputParameters &out_par, const int total_N, const int proj_N)
Create HepMC particle output.
Definition: hepmcoutput.cc:51
smash::HepMcOutput::at_eventstart
void at_eventstart(const Particles &particles, const int event_number, const EventInfo &) override
Add the initial particles information of an event to the central vertex.
Definition: hepmcoutput.cc:80
smash::HepMcOutput
SMASH output to HepMC file.
Definition: hepmcoutput.h:41
smash::EventInfo
Structure to contain custom data for output.
Definition: outputinterface.h:35
smash::HepMcOutput::output_file_
std::unique_ptr< HepMC3::WriterAscii > output_file_
Pointer to Ascii HepMC3 output file.
Definition: hepmcoutput.h:122
smash::HepMcOutput::status_code_for_beam_particles
static const int status_code_for_beam_particles
HepMC convention: status code for target and projecticle particles.
Definition: hepmcoutput.h:84
smash::HepMcOutput::~HepMcOutput
~HepMcOutput()
Destructor renames file.
Definition: hepmcoutput.cc:64
forwarddeclarations.h
outputinterface.h
smash::OutputParameters
Helper structure for Experiment to hold output options and parameters.
Definition: outputparameters.h:25
smash::HepMcOutput::current_event_
std::unique_ptr< HepMC3::GenEvent > current_event_
HepMC3::GenEvent pointer for current event.
Definition: hepmcoutput.h:125
smash::OutputInterface
Abstraction of generic output.
Definition: outputinterface.h:65
smash::HepMcOutput::status_code_for_final_particles
static const int status_code_for_final_particles
HepMC convention: status code for final particles.
Definition: hepmcoutput.h:86
smash::Particles
Definition: particles.h:33
smash::HepMcOutput::vertex_
HepMC3::GenVertexPtr vertex_
HepMC3::GenVertex pointer for central vertex in event.
Definition: hepmcoutput.h:128
smash::HepMcOutput::construct_nuclear_pdg_code
int construct_nuclear_pdg_code(int na, int nz) const
Construct nulcear pdg code for porjectile and target, see PDG chapter "Monte Carlo particle numbering...
Definition: hepmcoutput.cc:66
smash::HepMcOutput::at_eventend
void at_eventend(const Particles &particles, const int32_t event_number, const EventInfo &event) override
Add the final particles information of an event to the central vertex.
Definition: hepmcoutput.cc:156
smash::HepMcOutput::filename_
const bf::path filename_
Filename of output.
Definition: hepmcoutput.h:89