13#include "HepMC3/Version.h"
28 m_file = TFile::Open(filename.c_str(),
"RECREATE");
29 if (!
init(run))
return;
38 m_file = TFile::Open(filename.c_str(),
"RECREATE");
39 if (!
init(run))
return;
61 if ( !
m_file->IsOpen() )
return;
#define HEPMC3_ERROR(MESSAGE)
Macro for printing error messages.
Definition of class WriterRootTree.
Stores event-related information.
void write_data(GenEventData &data) const
Fill GenEventData object.
std::shared_ptr< GenRunInfo > run_info() const
Get a pointer to the the GenRunInfo object.
Stores run-related information.
GenEvent I/O serialization for root files based on root TTree.
TTree * m_tree
Tree handler. Public to allow simple access, e.g. custom branches.
bool failed() override
Get stream error state flag.
WriterRootTree(const std::string &filename, std::shared_ptr< GenRunInfo > run=std::shared_ptr< GenRunInfo >())
Default constructor.
GenEventData * m_event_data
Pointer to structure that holds event data.
int m_events_count
Events count. Needed to read the tree.
void close() override
Close file stream.
bool init(std::shared_ptr< GenRunInfo > run)
init routine
std::string m_tree_name
Name of TTree.
std::string m_branch_name
Name of TBranch in TTree.
TFile * m_file
File handler.
GenRunInfoData * m_run_info_data
Pointer to structure that holds run info data.
void write_event(const GenEvent &evt) override
Write event to file.
void write_run_info()
Write the GenRunInfo object to file.
virtual void set_run_info(std::shared_ptr< GenRunInfo > run)
Set the global GenRunInfo object.
virtual std::shared_ptr< GenRunInfo > run_info() const
Get the global GenRunInfo object.
Stores serializable event information.
Stores serializable run information.