HepMC3 event record library
|
GenEvent I/O parsing and serialization for root files based on root TTree. More...
#include <ReaderRootTree.h>
Public Member Functions | |
ReaderRootTree (const std::string &filename) | |
Default constructor. More... | |
ReaderRootTree (const std::string &filename, const std::string &treename, const std::string &branchname) | |
Constructor with tree name. More... | |
bool | skip (const int) override |
skip events More... | |
bool | read_event (GenEvent &evt) override |
Read event from file. More... | |
void | close () override |
Close file. More... | |
bool | failed () override |
Get file error state. More... | |
std::shared_ptr< GenRunInfo > | run_info () const |
Get the global GenRunInfo object. More... | |
void | set_options (const std::map< std::string, std::string > &options) |
Set options. More... | |
std::map< std::string, std::string > | get_options () const |
Set options. More... | |
Data Fields | |
TTree * | m_tree |
Tree handler. Public to allow simple access, e.g. custom branches. More... | |
Protected Member Functions | |
void | set_run_info (std::shared_ptr< GenRunInfo > run) |
Set the global GenRunInfo object. More... | |
Protected Attributes | |
std::map< std::string, std::string > | m_options |
options More... | |
Private Member Functions | |
bool | init () |
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 |
Pointer to structure that holds event data. More... | |
GenRunInfoData * | m_run_info_data |
Pointer to structure that holds run info data. More... | |
std::string | m_tree_name |
Name of TTree. More... | |
std::string | m_branch_name |
Name of TBranch in TTree. More... | |
GenEvent I/O parsing and serialization for root files based on root TTree.
If HepMC was compiled with path to ROOT available, this class can be used for root file I/O in the same manner as with HepMC::ReaderAscii class.
Definition at line 34 of file ReaderRootTree.h.
ReaderRootTree | ( | const std::string & | filename | ) |
Default constructor.
Definition at line 18 of file ReaderRootTree.cc.
ReaderRootTree | ( | const std::string & | filename, |
const std::string & | treename, | ||
const std::string & | branchname | ||
) |
Constructor with tree name.
Definition at line 26 of file ReaderRootTree.cc.
References ReaderRootTree::init(), and ReaderRootTree::m_file.
|
overridevirtual |
Close file.
Implements Reader.
Definition at line 113 of file ReaderRootTree.cc.
References ReaderRootTree::m_file.
|
overridevirtual |
Get file error state.
Implements Reader.
Definition at line 118 of file ReaderRootTree.cc.
References ReaderRootTree::m_events_count, ReaderRootTree::m_file, and ReaderRootTree::m_tree.
|
inlineinherited |
|
private |
init routine
Definition at line 33 of file ReaderRootTree.cc.
References HEPMC3_ERROR, HEPMC3_WARNING, ReaderRootTree::m_branch_name, ReaderRootTree::m_event_data, ReaderRootTree::m_file, ReaderRootTree::m_run_info_data, ReaderRootTree::m_tree, ReaderRootTree::m_tree_name, and Reader::set_run_info().
|
overridevirtual |
Read event from file.
[out] | evt | Contains parsed event |
Implements Reader.
Definition at line 85 of file ReaderRootTree.cc.
References GenEventData::attribute_id, GenRunInfoData::attribute_name, GenEventData::attribute_name, GenRunInfoData::attribute_string, GenEventData::attribute_string, GenEventData::links1, GenEventData::links2, ReaderRootTree::m_event_data, ReaderRootTree::m_events_count, ReaderRootTree::m_run_info_data, ReaderRootTree::m_tree, GenEventData::particles, GenEvent::read_data(), Reader::run_info(), GenEvent::set_run_info(), GenRunInfoData::tool_description, GenRunInfoData::tool_name, GenRunInfoData::tool_version, GenEventData::vertices, and GenRunInfoData::weight_names.
|
inlineinherited |
Get the global GenRunInfo object.
Definition at line 44 of file Reader.h.
References Reader::m_run_info.
|
inlineinherited |
|
inlineprotectedinherited |
Set the global GenRunInfo object.
Definition at line 64 of file Reader.h.
References Reader::m_run_info.
|
overridevirtual |
skip events
Reimplemented from Reader.
Definition at line 76 of file ReaderRootTree.cc.
References ReaderRootTree::m_events_count, and ReaderRootTree::m_tree.
|
private |
Name of TBranch in TTree.
Definition at line 80 of file ReaderRootTree.h.
|
private |
Pointer to structure that holds event data.
Definition at line 77 of file ReaderRootTree.h.
|
private |
Events count. Needed to read the tree.
Definition at line 76 of file ReaderRootTree.h.
|
private |
File handler.
Definition at line 72 of file ReaderRootTree.h.
|
protectedinherited |
|
private |
Pointer to structure that holds run info data.
Definition at line 78 of file ReaderRootTree.h.
TTree* m_tree |
Tree handler. Public to allow simple access, e.g. custom branches.
Definition at line 74 of file ReaderRootTree.h.
|
private |
Name of TTree.
Definition at line 79 of file ReaderRootTree.h.