26 m_file = TFile::Open(filename.c_str(),
"RECREATE");
27 if (!
init(run))
return;
36 m_file = TFile::Open(filename.c_str(),
"RECREATE");
37 if (!
init(run))
return;
44 ERROR(
"WriterRootTree: problem opening file: " <<
m_file->GetName() )
59 if ( !
m_file->IsOpen() )
return;
102 if ( !
m_file->IsOpen() )
return true;
#define ERROR(MESSAGE)
Macro for printing error messages.
Definition of class WriterRootTree.
Stores event-related information.
void write_data(GenEventData &data) const
Fill GenEventData object.
shared_ptr< GenRunInfo > run_info() const
Get a pointer to the the GenRunInfo object.
TTree * m_tree
Tree handler. Public to allow simple access, e.g. custom branches.
WriterRootTree(const std::string &filename, shared_ptr< GenRunInfo > run=shared_ptr< GenRunInfo >())
Default constructor.
GenEventData * m_event_data
Pointer to structure that holds event data.
void close()
Close file stream.
int m_events_count
Events count. Needed to read the tree.
std::string m_tree_name
Name of TTree.
std::string m_branch_name
Name of TBranch in TTree.
bool init(shared_ptr< GenRunInfo > run)
init routine
TFile * m_file
File handler.
bool failed()
Get stream error state flag.
void write_event(const GenEvent &evt)
Write event to file.
GenRunInfoData * m_run_info_data
Pointer to structure that holds run info data.
void write_run_info()
Write the GenRunInfo object to file.
void set_run_info(shared_ptr< GenRunInfo > run)
Set the global GenRunInfo object.
shared_ptr< GenRunInfo > run_info() const
Get the global GenRunInfo object.
Stores serializable event information.
Stores serializable run information.