HepMC3 event record library
|
GenEvent I/O serialization for HEPEVT files.
Definition at line 27 of file WriterHEPEVT.h.
#include <WriterHEPEVT.h>
Public Member Functions | |
WriterHEPEVT (const std::string &filename, std::shared_ptr< GenRunInfo > run=nullptr) | |
Default constructor. | |
WriterHEPEVT (std::ostream &stream, std::shared_ptr< GenRunInfo > run=nullptr) | |
Constructor from ostream. | |
WriterHEPEVT (std::shared_ptr< std::ostream > s_stream, std::shared_ptr< GenRunInfo > run=nullptr) | |
Constructor from temp ostream. | |
virtual void | write_hepevt_particle (int index, bool iflong=true) |
Write particle to file. | |
virtual void | write_hepevt_event_header () |
Write event header to file. | |
void | write_event (const GenEvent &evt) override |
Write event to file. | |
void | close () override |
Close file stream. | |
bool | failed () override |
Get stream error state flag. | |
void | set_vertices_positions_present (bool iflong) |
set flag if vertex positions are available. Effectively this adds or removes key "vertices_positions_are_absent" to/from the m_options. | |
bool | get_vertices_positions_present () const |
get flag if vertex positions are available. The flag is deduced from m_options. If the m_options have the key "vertices_positions_are_absent" the result if false. True otherwise. | |
void | set_run_info (std::shared_ptr< GenRunInfo > run) |
Set the global GenRunInfo object. | |
std::shared_ptr< GenRunInfo > | run_info () const |
Get the global GenRunInfo object. | |
void | set_options (const std::map< std::string, std::string > &options) |
Set options. | |
std::map< std::string, std::string > | get_options () const |
Set options. | |
Protected Attributes | |
std::ofstream | m_file |
Output file. | |
std::shared_ptr< std::ostream > | m_shared_stream |
Output temp. stream. | |
std::ostream * | m_stream |
Output stream. | |
char * | hepevtbuffer |
Pointer to HEPEVT Fortran common block/C struct. | |
int | m_events_count |
Events count. Needed to generate unique object name. | |
HEPEVT_Wrapper_Template< 100000 > | m_hepevt_interface |
Templated HEPEVT interface. | |
std::map< std::string, std::string > | m_options |
options | |
Private Attributes | |
std::shared_ptr< GenRunInfo > | m_run_info |
The global GenRunInfo object. | |
WriterHEPEVT | ( | const std::string & | filename, |
std::shared_ptr< GenRunInfo > | run = nullptr |
||
) |
Default constructor.
Definition at line 19 of file WriterHEPEVT.cc.
References HEPEVT_Wrapper_Template< max_particles, momentum_type >::allocate_internal_storage(), HEPMC3_WARNING, and WriterHEPEVT::m_hepevt_interface.
WriterHEPEVT | ( | std::ostream & | stream, |
std::shared_ptr< GenRunInfo > | run = nullptr |
||
) |
Constructor from ostream.
Definition at line 26 of file WriterHEPEVT.cc.
References HEPEVT_Wrapper_Template< max_particles, momentum_type >::allocate_internal_storage(), HEPMC3_WARNING, and WriterHEPEVT::m_hepevt_interface.
WriterHEPEVT | ( | std::shared_ptr< std::ostream > | s_stream, |
std::shared_ptr< GenRunInfo > | run = nullptr |
||
) |
Constructor from temp ostream.
Definition at line 33 of file WriterHEPEVT.cc.
References HEPEVT_Wrapper_Template< max_particles, momentum_type >::allocate_internal_storage(), HEPMC3_WARNING, and WriterHEPEVT::m_hepevt_interface.
|
overridevirtual |
Close file stream.
Implements Writer.
Definition at line 79 of file WriterHEPEVT.cc.
References WriterHEPEVT::m_stream.
|
overridevirtual |
Get stream error state flag.
Implements Writer.
Definition at line 86 of file WriterHEPEVT.cc.
References WriterHEPEVT::m_file.
|
inlineinherited |
bool get_vertices_positions_present | ( | ) | const |
get flag if vertex positions are available. The flag is deduced from m_options. If the m_options have the key "vertices_positions_are_absent" the result if false. True otherwise.
Definition at line 93 of file WriterHEPEVT.cc.
References Writer::m_options.
|
inlineinherited |
Get the global GenRunInfo object.
Definition at line 47 of file Writer.h.
References Writer::m_run_info.
|
inlineinherited |
|
inlineinherited |
Set the global GenRunInfo object.
Definition at line 42 of file Writer.h.
References Writer::m_run_info.
void set_vertices_positions_present | ( | bool | iflong | ) |
set flag if vertex positions are available. Effectively this adds or removes key "vertices_positions_are_absent" to/from the m_options.
Definition at line 91 of file WriterHEPEVT.cc.
References Writer::m_options.
|
overridevirtual |
Write event to file.
[in] | evt | Event to be serialized |
Implements Writer.
Definition at line 70 of file WriterHEPEVT.cc.
References HEPEVT_Wrapper_Template< max_particles, momentum_type >::fix_daughters(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::GenEvent_to_HEPEVT(), WriterHEPEVT::get_vertices_positions_present(), WriterHEPEVT::m_events_count, WriterHEPEVT::m_hepevt_interface, HEPEVT_Wrapper_Template< max_particles, momentum_type >::number_entries(), WriterHEPEVT::write_hepevt_event_header(), and WriterHEPEVT::write_hepevt_particle().
|
virtual |
Write event header to file.
Reimplemented in WriterHEPEVTZEUS.
Definition at line 61 of file WriterHEPEVT.cc.
References HEPEVT_Wrapper_Template< max_particles, momentum_type >::event_number(), WriterHEPEVT::m_hepevt_interface, WriterHEPEVT::m_stream, and HEPEVT_Wrapper_Template< max_particles, momentum_type >::number_entries().
|
virtual |
Write particle to file.
[in] | index | Particle to be serialized |
[in] | iflong | Format of record |
Reimplemented in WriterHEPEVTZEUS.
Definition at line 40 of file WriterHEPEVT.cc.
References HEPEVT_Wrapper_Template< max_particles, momentum_type >::e(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::first_child(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::first_parent(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::id(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::last_child(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::last_parent(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::m(), WriterHEPEVT::m_hepevt_interface, WriterHEPEVT::m_stream, HEPEVT_Wrapper_Template< max_particles, momentum_type >::px(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::py(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::pz(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::status(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::t(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::x(), HEPEVT_Wrapper_Template< max_particles, momentum_type >::y(), and HEPEVT_Wrapper_Template< max_particles, momentum_type >::z().
|
protected |
Pointer to HEPEVT Fortran common block/C struct.
Definition at line 87 of file WriterHEPEVT.h.
|
protected |
Events count. Needed to generate unique object name.
Definition at line 88 of file WriterHEPEVT.h.
|
protected |
Output file.
Definition at line 84 of file WriterHEPEVT.h.
|
protected |
Templated HEPEVT interface.
Definition at line 89 of file WriterHEPEVT.h.
|
protectedinherited |
|
privateinherited |
The global GenRunInfo object.
|
protected |
Output temp. stream.
Definition at line 85 of file WriterHEPEVT.h.
|
protected |
Output stream.
Definition at line 86 of file WriterHEPEVT.h.