HepMC event record
|
GenEvent I/O serialization for root files based on root TTree.
If HepMC was compiled with path to ROOT available, this class can be used for root writing in the same manner as with HepMC::WriterAscii class.
Definition at line 33 of file WriterRootTree.h.
#include <WriterRootTree.h>
Public Member Functions | |
WriterRootTree (const std::string &filename, shared_ptr< GenRunInfo > run=shared_ptr< GenRunInfo >()) | |
Default constructor. More... | |
WriterRootTree (const std::string &filename, const std::string &treename, const std::string &branchname, shared_ptr< GenRunInfo > run=shared_ptr< GenRunInfo >()) | |
Constructor with tree name. More... | |
void | write_event (const GenEvent &evt) |
Write event to file. More... | |
void | write_run_info () |
Write the GenRunInfo object to file. More... | |
void | close () |
Close file stream. More... | |
bool | failed () |
Get stream error state flag. More... | |
void | set_run_info (shared_ptr< GenRunInfo > run) |
Set the global GenRunInfo object. More... | |
void | set_run_info (shared_ptr< GenRunInfo > run) |
Set the global GenRunInfo object. More... | |
shared_ptr< GenRunInfo > | run_info () const |
Get the global GenRunInfo object. More... | |
shared_ptr< GenRunInfo > | run_info () const |
Get the global GenRunInfo object. More... | |
Data Fields | |
TTree * | m_tree |
Tree handler. Public to allow simple access, e.g. custom branches. More... | |
Private Member Functions | |
bool | init (shared_ptr< GenRunInfo > run) |
init routine More... | |
Private Attributes | |
TFile | m_file |
File handler. More... | |
int | m_events_count |
Events count. Needed to read the tree. More... | |
GenEventData * | m_event_data |
std::string | m_tree_name |
std::string | m_branch_name |
WriterRootTree | ( | const std::string & | filename, |
shared_ptr< GenRunInfo > | run = shared_ptr<GenRunInfo>() |
||
) |
Default constructor.
Definition at line 14 of file WriterRootTree.cc.
References WriterRootTree::init().
WriterRootTree | ( | const std::string & | filename, |
const std::string & | treename, | ||
const std::string & | branchname, | ||
shared_ptr< GenRunInfo > | run = shared_ptr<GenRunInfo>() |
||
) |
Constructor with tree name.
Definition at line 24 of file WriterRootTree.cc.
References WriterRootTree::init().
|
virtual |
Close file stream.
Implements Writer.
Definition at line 94 of file WriterRootTree.cc.
References WriterRootTree::m_file, and WriterRootTree::m_tree.
|
virtual |
Get stream error state flag.
Implements Writer.
Definition at line 101 of file WriterRootTree.cc.
References WriterRootTree::m_file.
|
private |
init routine
Definition at line 34 of file WriterRootTree.cc.
References WriterRootTree::m_file, WriterRootTree::m_tree, Writer::run_info(), Writer::set_run_info(), and WriterRootTree::write_run_info().
|
inlineinherited |
Get the global GenRunInfo object.
Definition at line 42 of file build/outputs/include/HepMC/Writer.h.
References Writer::m_run_info.
|
inlineinherited |
Get the global GenRunInfo object.
Definition at line 42 of file include/HepMC/Writer.h.
References Writer::m_run_info.
|
inlineinherited |
Set the global GenRunInfo object.
Definition at line 37 of file include/HepMC/Writer.h.
References Writer::m_run_info.
|
inlineinherited |
Set the global GenRunInfo object.
Definition at line 37 of file build/outputs/include/HepMC/Writer.h.
References Writer::m_run_info.
|
virtual |
Write event to file.
[in] | evt | Event to be serialized |
Implements Writer.
Definition at line 49 of file WriterRootTree.cc.
References GenEventData::attribute_id, GenEventData::attribute_name, GenEventData::attribute_string, GenEventData::links1, GenEventData::links2, WriterRootTree::m_events_count, WriterRootTree::m_file, WriterRootTree::m_tree, GenEventData::particles, Writer::run_info(), GenEvent::run_info(), Writer::set_run_info(), GenEventData::vertices, GenEvent::write_data(), and WriterRootTree::write_run_info().
void write_run_info | ( | ) |
Write the GenRunInfo object to file.
Definition at line 79 of file WriterRootTree.cc.
References WriterRootTree::m_file, and Writer::run_info().
|
private |
Events count. Needed to read the tree.
Definition at line 78 of file WriterRootTree.h.
|
private |
File handler.
Definition at line 74 of file WriterRootTree.h.
TTree* m_tree |
Tree handler. Public to allow simple access, e.g. custom branches.
Definition at line 76 of file WriterRootTree.h.