HepMC3 event record library
ReaderuprootTree Class Reference

Detailed Description

ReaderuprootTree.

Definition at line 25 of file ReaderuprootTree.h.

#include <ReaderuprootTree.h>

+ Inheritance diagram for ReaderuprootTree:
+ Collaboration diagram for ReaderuprootTree:

Public Member Functions

 ReaderuprootTree (const std::string &filename, const std::string &treename="hepmc3_tree", const std::string &branchname="hepmc3_event")
 Constructor with tree and branch names.
 
bool skip (const int) override
 skip events
 
bool read_event (GenEvent &evt) override
 Read event from file.
 
void close () override
 Close file.
 
bool failed () override
 Get file error state.
 
virtual std::shared_ptr< GenRunInforun_info () const
 Get the global GenRunInfo object.
 
virtual void set_options (const std::map< std::string, std::string > &options)
 Set options.
 
virtual std::map< std::string, std::string > get_options () const
 Get options.
 
virtual void set_run_info (std::shared_ptr< GenRunInfo > run)
 Set the global GenRunInfo object.
 

Protected Attributes

std::map< std::string, std::string > m_options
 Options.
 

Private Member Functions

bool init (const std::string &filename)
 init routine
 
PyObject * get_function (PyObject *, const std::string &)
 Get python functions.
 
PyObject * init_python_module (const std::string &)
 Init python module.
 
template<class T>
std::vector< T > get_vector (PyObject *file_name, const std::string &array_name, std::string desired_type="")
 Get arrays.
 

Private Attributes

int m_events_count
 Events count. Needed to read the tree.
 
GenEventDatam_event_data
 Pointer to structure that holds event data.
 
GenRunInfoDatam_run_info_data
 Pointer to structure that holds run info data.
 
std::string m_tree_name
 Name of TTree.
 
std::string m_branch_name
 Name of TBranch in TTree.
 
PyObject * m_file
 Python file handler.
 
PyObject * m_tree
 Python tree handler.
 
PyObject * m_genruninfo
 Python runInfo handler.
 
PyObject * m_access_function
 Python access function for arrays.
 
PyObject * m_python_module
 Python module.
 
long int m_tree_getEntries
 number of processed events
 
std::shared_ptr< GenRunInfom_run_info
 The global GenRunInfo object.
 

Constructor & Destructor Documentation

◆ ReaderuprootTree()

ReaderuprootTree ( const std::string & filename,
const std::string & treename = "hepmc3_tree",
const std::string & branchname = "hepmc3_event" )

Constructor with tree and branch names.

Definition at line 102 of file ReaderuprootTree.cc.

References init(), m_branch_name, m_events_count, m_tree, and m_tree_name.

◆ ~ReaderuprootTree()

Definition at line 319 of file ReaderuprootTree.cc.

Member Function Documentation

◆ close()

void close ( )
overridevirtual

Close file.

Implements Reader.

Definition at line 296 of file ReaderuprootTree.cc.

◆ failed()

bool failed ( )
overridevirtual

Get file error state.

Implements Reader.

Definition at line 313 of file ReaderuprootTree.cc.

References m_events_count, m_genruninfo, and m_run_info_data.

◆ get_function()

PyObject * get_function ( PyObject * m_python_module,
const std::string & name )
private

Get python functions.

Definition at line 71 of file ReaderuprootTree.cc.

References m_python_module.

◆ get_options()

virtual std::map< std::string, std::string > get_options ( ) const
inlinevirtualinherited

Get options.

Reimplemented in ReaderPlugin.

Definition at line 53 of file Reader.h.

References m_options.

◆ get_vector()

template<class T>
std::vector< T > get_vector ( PyObject * file_name,
const std::string & array_name,
std::string desired_type = "" )
private

Get arrays.

obtain vector of objects using name and type

Definition at line 14 of file ReaderuprootTree.cc.

References m_access_function, and m_events_count.

◆ init()

bool init ( const std::string & filename)
private

◆ init_python_module()

PyObject * init_python_module ( const std::string & code)
private

Init python module.

Definition at line 84 of file ReaderuprootTree.cc.

References m_python_module.

◆ read_event()

bool read_event ( GenEvent & evt)
overridevirtual

Read event from file.

Parameters
[out]evtContains parsed event

Implements Reader.

Definition at line 194 of file ReaderuprootTree.cc.

References m_genruninfo, and m_tree_name.

◆ run_info()

virtual std::shared_ptr< GenRunInfo > run_info ( ) const
inlinevirtualinherited

Get the global GenRunInfo object.

Reimplemented in ReaderPlugin.

Examples
LHEF_example_cat.cc.

Definition at line 44 of file Reader.h.

References m_run_info.

◆ set_options()

virtual void set_options ( const std::map< std::string, std::string > & options)
inlinevirtualinherited

Set options.

Reimplemented in ReaderPlugin.

Definition at line 51 of file Reader.h.

References m_options.

◆ set_run_info()

virtual void set_run_info ( std::shared_ptr< GenRunInfo > run)
inlinevirtualinherited

Set the global GenRunInfo object.

Reimplemented in ReaderPlugin.

Definition at line 56 of file Reader.h.

References m_run_info.

◆ skip()

bool skip ( const int n)
overridevirtual

skip events

Reimplemented from Reader.

Definition at line 186 of file ReaderuprootTree.cc.

References m_branch_name, m_file, m_tree, and m_tree_name.

Field Documentation

◆ m_access_function

PyObject* m_access_function
private

Python access function for arrays.

Definition at line 64 of file ReaderuprootTree.h.

◆ m_branch_name

std::string m_branch_name
private

Name of TBranch in TTree.

Definition at line 55 of file ReaderuprootTree.h.

◆ m_event_data

GenEventData* m_event_data
private

Pointer to structure that holds event data.

Definition at line 52 of file ReaderuprootTree.h.

◆ m_events_count

int m_events_count
private

Events count. Needed to read the tree.

Definition at line 51 of file ReaderuprootTree.h.

◆ m_file

PyObject* m_file
private

Python file handler.

Definition at line 58 of file ReaderuprootTree.h.

◆ m_genruninfo

PyObject* m_genruninfo
private

Python runInfo handler.

Definition at line 62 of file ReaderuprootTree.h.

◆ m_options

std::map<std::string, std::string> m_options
protectedinherited

Options.

Definition at line 60 of file Reader.h.

◆ m_python_module

PyObject* m_python_module
private

Python module.

Definition at line 66 of file ReaderuprootTree.h.

◆ m_run_info

std::shared_ptr<GenRunInfo> m_run_info
privateinherited

The global GenRunInfo object.

Definition at line 63 of file Reader.h.

◆ m_run_info_data

GenRunInfoData* m_run_info_data
private

Pointer to structure that holds run info data.

Definition at line 53 of file ReaderuprootTree.h.

◆ m_tree

PyObject* m_tree
private

Python tree handler.

Definition at line 60 of file ReaderuprootTree.h.

◆ m_tree_getEntries

long int m_tree_getEntries
private

number of processed events

Definition at line 68 of file ReaderuprootTree.h.

◆ m_tree_name

std::string m_tree_name
private

Name of TTree.

Definition at line 54 of file ReaderuprootTree.h.


The documentation for this class was generated from the following files: