HepMC3 event record library
WriterRootTreeOPAL Class Reference

Detailed Description

GenEvent I/O output to files similar to these produced by OPAL software.

Definition at line 23 of file WriterRootTreeOPAL.h.

#include <WriterRootTreeOPAL.h>

+ Inheritance diagram for WriterRootTreeOPAL:
+ Collaboration diagram for WriterRootTreeOPAL:

Public Member Functions

 WriterRootTreeOPAL (const std::string &filename, std::shared_ptr< GenRunInfo > run=std::shared_ptr< GenRunInfo >())
 Constructor.
 
void init_branches ()
 Init ROOT branches.
 
void write_event (const GenEvent &evt)
 Write event.
 
void set_run_number (const int nr)
 Set run number.
 
void write_run_info ()
 Write the GenRunInfo object to file.
 
void close () override
 Close file stream.
 
bool failed () override
 Get stream error state flag.
 
virtual void set_run_info (std::shared_ptr< GenRunInfo > run)
 Set the global GenRunInfo object.
 
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
 Set options.
 

Data Fields

TTree * m_tree
 Tree handler. Public to allow simple access, e.g. custom branches.
 

Protected Attributes

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

Private Member Functions

bool init (std::shared_ptr< GenRunInfo > run)
 init routine
 

Private Attributes

float m_Ebeam
 Beam energy in GEV.
 
int m_Irun
 Run number.
 
int m_Ievnt
 Event number.
 
TFile * m_file
 File handler.
 
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.
 
std::shared_ptr< GenRunInfom_run_info
 The global GenRunInfo object.
 

Constructor & Destructor Documentation

◆ WriterRootTreeOPAL()

WriterRootTreeOPAL ( const std::string & filename,
std::shared_ptr< GenRunInfo > run = std::shared_ptr<GenRunInfo>() )

Constructor.

Definition at line 10 of file WriterRootTreeOPAL.cc.

References WriterRootTree::WriterRootTree().

Member Function Documentation

◆ close()

void close ( )
overridevirtualinherited

Close file stream.

Implements Writer.

Definition at line 93 of file WriterRootTree.cc.

References m_event_data, m_file, m_run_info_data, and m_tree.

◆ failed()

bool failed ( )
overridevirtualinherited

Get stream error state flag.

Implements Writer.

Definition at line 101 of file WriterRootTree.cc.

References m_file.

◆ get_options()

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

Set options.

Reimplemented in WriterPlugin.

Definition at line 54 of file Writer.h.

References m_options.

◆ init()

bool init ( std::shared_ptr< GenRunInfo > run)
privateinherited

◆ init_branches()

void init_branches ( )

Init ROOT branches.

Definition at line 11 of file WriterRootTreeOPAL.cc.

References m_Ebeam, m_Ievnt, m_Irun, and WriterRootTree::m_tree.

◆ run_info()

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

Get the global GenRunInfo object.

Reimplemented in WriterPlugin.

Definition at line 45 of file Writer.h.

References m_run_info.

◆ set_options()

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

Set options.

Reimplemented in WriterPlugin.

Definition at line 52 of file Writer.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 WriterPlugin.

Definition at line 42 of file Writer.h.

References m_run_info.

◆ set_run_number()

void set_run_number ( const int nr)

Set run number.

Definition at line 32 of file WriterRootTreeOPAL.cc.

References m_Irun.

◆ write_event()

void write_event ( const GenEvent & evt)
virtual

Write event.

Reimplemented from WriterRootTree.

Definition at line 17 of file WriterRootTreeOPAL.cc.

References GenEvent::event_number(), m_Ebeam, m_Ievnt, GenEvent::particles(), and WriterRootTree::write_event().

◆ write_run_info()

void write_run_info ( )
inherited

Write the GenRunInfo object to file.

Definition at line 91 of file WriterRootTree.cc.

Field Documentation

◆ m_branch_name

std::string m_branch_name
privateinherited

Name of TBranch in TTree.

Definition at line 88 of file WriterRootTree.h.

◆ m_Ebeam

float m_Ebeam
private

Beam energy in GEV.

Definition at line 35 of file WriterRootTreeOPAL.h.

◆ m_event_data

GenEventData* m_event_data
privateinherited

Pointer to structure that holds event data.

Definition at line 85 of file WriterRootTree.h.

◆ m_events_count

int m_events_count
privateinherited

Events count. Needed to read the tree.

Definition at line 84 of file WriterRootTree.h.

◆ m_file

TFile* m_file
privateinherited

File handler.

Definition at line 80 of file WriterRootTree.h.

◆ m_Ievnt

int m_Ievnt
private

Event number.

Definition at line 37 of file WriterRootTreeOPAL.h.

◆ m_Irun

int m_Irun
private

Run number.

Definition at line 36 of file WriterRootTreeOPAL.h.

◆ m_options

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

options

Definition at line 59 of file Writer.h.

◆ m_run_info

std::shared_ptr<GenRunInfo> m_run_info
privateinherited

The global GenRunInfo object.

Definition at line 64 of file Writer.h.

◆ m_run_info_data

GenRunInfoData* m_run_info_data
privateinherited

Pointer to structure that holds run info data.

Definition at line 86 of file WriterRootTree.h.

◆ m_tree

TTree* m_tree
inherited

Tree handler. Public to allow simple access, e.g. custom branches.

Definition at line 82 of file WriterRootTree.h.

◆ m_tree_name

std::string m_tree_name
privateinherited

Name of TTree.

Definition at line 87 of file WriterRootTree.h.


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