20 std::shared_ptr<GenRunInfo> run): m_file(filename), m_stream(&m_file), m_events_count(0)
22 HEPMC3_WARNING(
"WriterHEPEVT::WriterHEPEVT: HEPEVT format is outdated. Please use HepMC3 format instead.")
27 std::shared_ptr<GenRunInfo> run): m_file(), m_stream(&stream), m_events_count(0)
29 HEPMC3_WARNING(
"WriterHEPEVT::WriterHEPEVT: HEPEVT format is outdated. Please use HepMC3 format instead.")
34 std::shared_ptr<GenRunInfo> run): m_file(), m_shared_stream(s_stream), m_stream(s_stream.get()), m_events_count(0)
36 HEPMC3_WARNING(
"WriterHEPEVT::WriterHEPEVT: HEPEVT format is outdated. Please use HepMC3 format instead.")
43 char* cursor = &(buf[0]);
57 unsigned long length = cursor - &(buf[0]);
66 unsigned long length = cursor - &(buf[0]);
81 std::ofstream* ofs =
dynamic_cast<std::ofstream*
>(
m_stream);
82 if (ofs && !ofs->is_open())
return;
83 if (ofs) ofs->close();
88 return (
bool)
m_file.rdstate();
#define HEPMC3_WARNING(MESSAGE)
Macro for printing HEPMC3_HEPMC3_WARNING messages.
Definition of static class Print.
Definition of class WriterHEPEVT.
Stores event-related information.
int first_child(const int index) const
Get index of 1st daughter.
int last_parent(const int index) const
Get index of last mother.
int event_number() const
Get event number.
bool GenEvent_to_HEPEVT(const GenEvent *evt)
Convert GenEvent to HEPEVT.
int last_child(const int index) const
Get index of last daughter.
void allocate_internal_storage()
Allocates m_internal_storage storage in smart pointer to hold HEPEVT of fixed size.
int first_parent(const int index) const
Get index of 1st mother.
double pz(const int index) const
Get Z momentum.
double py(const int index) const
Get Y momentum.
int id(const int index) const
Get PDG particle id.
double t(const int index) const
Get production time.
double y(const int index) const
Get Y Production vertex.
bool fix_daughters()
Tries to fix list of daughters.
int number_entries() const
Get number of entries.
double m(const int index) const
Get generated mass.
int status(const int index) const
Get status code.
double px(const int index) const
Get X momentum.
double z(const int index) const
Get Z Production vertex.
double x(const int index) const
Get X Production vertex.
double e(const int index) const
Get Energy.
HEPEVT_Wrapper_Template< 100000 > m_hepevt_interface
Templated HEPEVT interface.
bool failed() override
Get stream error state flag.
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...
void set_vertices_positions_present(bool iflong)
set flag if vertex positions are available. Effectively this adds or removes key "vertices_positions_...
virtual void write_hepevt_event_header()
Write event header to file.
int m_events_count
Events count. Needed to generate unique object name.
virtual void write_hepevt_particle(int index, bool iflong=true)
Write particle to file.
void close() override
Close file stream.
std::ofstream m_file
Output file.
WriterHEPEVT(const std::string &filename, std::shared_ptr< GenRunInfo > run=nullptr)
Default constructor.
void write_event(const GenEvent &evt) override
Write event to file.
std::ostream * m_stream
Output stream.
std::map< std::string, std::string > m_options
options