18 m_tree(0),m_events_count(0),m_tree_name(
"hepmc3_tree"),m_branch_name(
"hepmc3_event")
20 m_file = TFile::Open(filename.c_str());
26 m_tree(0),m_events_count(0),m_tree_name(treename.c_str()),m_branch_name(branchname.c_str())
28 m_file = TFile::Open(filename.c_str());
36 ERROR(
"ReaderRootTree: problem opening file: " <<
m_file->GetName() )
41 m_tree=
reinterpret_cast<TTree*
>(
m_file->Get(m_tree_name.c_str()));
44 ERROR(
"ReaderRootTree: problem opening tree: " << m_tree_name)
48 int result=
m_tree->SetBranchAddress(m_branch_name.c_str(),&m_event_data);
51 ERROR(
"ReaderRootTree: problem reading branch tree: " << m_tree_name)
55 result=
m_tree->SetBranchAddress(
"GenRunInfo",&m_run_info_data);
58 ERROR(
"ReaderRootTree2: problem reading branch tree: " <<
"GenRunInfo")
73 m_event_data->
links1.clear();
74 m_event_data->
links2.clear();
90 run_info()->read_data(*m_run_info_data);
103 if ( !
m_file->IsOpen() )
return true;
void set_run_info(shared_ptr< GenRunInfo > run)
Set the GenRunInfo object by smart pointer.
std::vector< int > attribute_id
Attribute owner id.
#define ERROR(MESSAGE)
Macro for printing error messages.
std::vector< std::string > attribute_name
Attribute name.
std::vector< int > links2
Second id of the vertex links.
Definition of class ReaderRootTree.
TTree * m_tree
Tree handler. Public to allow simple access, e.g. custom branches.
TFile * m_file
File handler.
bool failed()
Get stream error state.
std::vector< int > links1
First id of the vertex links.
std::vector< std::string > attribute_string
Attribute serialized as string.
shared_ptr< GenRunInfo > run_info() const
Get the global GenRunInfo object.
void close()
Close file stream.
bool read_event(GenEvent &evt)
Read event from file.
Stores event-related information.
Stores serializable event information.
std::vector< std::string > attribute_string
Attribute serialized as string.
std::vector< std::string > tool_name
Tool names.
std::vector< std::string > attribute_name
Attribute name.
Stores serializable run information.
int m_events_count
Events count. Needed to read the tree.
void read_data(const GenEventData &data)
Fill GenEvent based on GenEventData.
Definition of class Units.
std::vector< GenParticleData > particles
Particles.
void set_run_info(shared_ptr< GenRunInfo > run)
Set the global GenRunInfo object.
std::vector< GenVertexData > vertices
Vertices.
std::vector< std::string > tool_version
Tool versions.
std::vector< std::string > weight_names
Weight names.
std::vector< std::string > tool_description
Tool descriptions.
ReaderRootTree(const std::string &filename)
Default constructor.