HepMC3 event record library
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
ReaderuprootTree Class Reference

Detailed Description

ReaderuprootTree.

Definition at line 19 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.
 
std::shared_ptr< GenRunInforun_info () const
 Get the global GenRunInfo object.
 
void set_options (const std::map< std::string, std::string > &options)
 Set options.
 
std::map< std::string, std::string > get_options () const
 Set options.
 

Protected Member Functions

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 100 of file ReaderuprootTree.cc.

References ReaderuprootTree::init().

◆ ~ReaderuprootTree()

Definition at line 318 of file ReaderuprootTree.cc.

Member Function Documentation

◆ close()

void close ( )
overridevirtual

Close file.

Implements Reader.

Definition at line 295 of file ReaderuprootTree.cc.

◆ failed()

bool failed ( )
overridevirtual

Get file error state.

Implements Reader.

Definition at line 312 of file ReaderuprootTree.cc.

◆ get_function()

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

Get python functions.

Definition at line 66 of file ReaderuprootTree.cc.

References ReaderuprootTree::m_python_module.

◆ get_options()

std::map< std::string, std::string > get_options ( ) const
inlineinherited

Set options.

Definition at line 58 of file Reader.h.

References Reader::m_options.

◆ get_vector()

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 9 of file ReaderuprootTree.cc.

References ReaderuprootTree::m_access_function, and ReaderuprootTree::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 79 of file ReaderuprootTree.cc.

References ReaderuprootTree::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 193 of file ReaderuprootTree.cc.

◆ run_info()

std::shared_ptr< GenRunInfo > run_info ( ) const
inlineinherited

Get the global GenRunInfo object.

Examples
LHEF_example_cat.cc.

Definition at line 44 of file Reader.h.

References Reader::m_run_info.

◆ set_options()

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

Set options.

Definition at line 53 of file Reader.h.

References Reader::m_options.

◆ set_run_info()

void set_run_info ( std::shared_ptr< GenRunInfo run)
inlineprotectedinherited

Set the global GenRunInfo object.

Definition at line 64 of file Reader.h.

References Reader::m_run_info.

◆ skip()

bool skip ( const int  n)
overridevirtual

skip events

Reimplemented from Reader.

Definition at line 184 of file ReaderuprootTree.cc.

Field Documentation

◆ m_access_function

PyObject* m_access_function
private

Python access function for arrays.

Definition at line 58 of file ReaderuprootTree.h.

◆ m_branch_name

std::string m_branch_name
private

Name of TBranch in TTree.

Definition at line 49 of file ReaderuprootTree.h.

◆ m_event_data

GenEventData* m_event_data
private

Pointer to structure that holds event data.

Definition at line 46 of file ReaderuprootTree.h.

◆ m_events_count

int m_events_count
private

Events count. Needed to read the tree.

Definition at line 45 of file ReaderuprootTree.h.

◆ m_file

PyObject* m_file
private

Python file handler.

Definition at line 52 of file ReaderuprootTree.h.

◆ m_genruninfo

PyObject* m_genruninfo
private

Python runInfo handler.

Definition at line 56 of file ReaderuprootTree.h.

◆ m_options

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

options

Definition at line 68 of file Reader.h.

◆ m_python_module

PyObject* m_python_module
private

Python module.

Definition at line 60 of file ReaderuprootTree.h.

◆ m_run_info

std::shared_ptr<GenRunInfo> m_run_info
privateinherited

The global GenRunInfo object.

Definition at line 71 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 47 of file ReaderuprootTree.h.

◆ m_tree

PyObject* m_tree
private

Python tree handler.

Definition at line 54 of file ReaderuprootTree.h.

◆ m_tree_getEntries

long int m_tree_getEntries
private

number of processed events

Definition at line 62 of file ReaderuprootTree.h.

◆ m_tree_name

std::string m_tree_name
private

Name of TTree.

Definition at line 48 of file ReaderuprootTree.h.


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