HepMC3 event record library: ReaderRoot Class Reference

HepMC3 event record library

Public Member Functions | Protected Attributes | Private Attributes
ReaderRoot Class Reference

## Detailed Description

GenEvent I/O parsing and serialization for root files.

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.

Examples
  rootIO_example_read.cc.

Definition at line 33 of file ReaderRoot.h.

`#include <ReaderRoot.h>`

Inheritance diagram for ReaderRoot:
[legend]
Collaboration diagram for ReaderRoot:
[legend]

## Public Member Functions
| ReaderRoot (const std::string &filename)
| Default constructor.
bool | skip (const int) override
| skip events
bool | read_event (GenEvent &evt) override
| Read event from file.
void | close () override
| Close file stream.
bool | failed () override
| Get stream error state.
virtual std::shared_ptr< GenRunInfo > | run_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 Attributes
TFile * | m_file
| File handler.
TIter * | m_next
| Iterator for event reading.
std::shared_ptr< GenRunInfo > | m_run_info
| The global GenRunInfo object.

## Constructor & Destructor Documentation

## ◆ ReaderRoot()

ReaderRoot | ( | const std::string & | filename | ) |

Default constructor.

Definition at line 17 of file ReaderRoot.cc.

References HEPMC3_ERROR_LEVEL, m_file, m_next, ReaderRoot(), and Reader::set_run_info().

## Member Function Documentation

## ◆ close()

void close | ( |  | ) |
| overridevirtual

Close file stream.

Implements Reader.

Examples
  rootIO_example_read.cc.

Definition at line 88 of file ReaderRoot.cc.

References m_file.

## ◆ failed()

bool failed | ( |  | ) |
| overridevirtual

Get stream error state.

Implements Reader.

Examples
  rootIO_example_read.cc.

Definition at line 92 of file ReaderRoot.cc.

References m_file.

## ◆ 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.

## ◆ read_event()

bool read_event | ( | GenEvent & | evt | ) |
| overridevirtual

Read event from file.

Parameters

  [out] | evt | Contains parsed event

Implements Reader.

Examples
  rootIO_example_read.cc.

Definition at line 49 of file ReaderRoot.cc.

References HEPMC3_ERROR_LEVEL, HEPMC3_WARNING_LEVEL, m_file, m_next, GenEvent::read_data(), Reader::run_info(), and GenEvent::set_run_info().

## ◆ run_info()

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

Get the global GenRunInfo object.

Reimplemented in ReaderGZ< T >, and 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 ReaderGZ< T >, and 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 38 of file ReaderRoot.cc.

References GenEvent::clear(), failed(), and read_event().

## Field Documentation

## ◆ m_file

TFile* m_file
| private

File handler.

Definition at line 63 of file ReaderRoot.h.

## ◆ m_next

TIter* m_next
| private

Iterator for event reading.

Definition at line 64 of file ReaderRoot.h.

## ◆ m_options

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

Options.

Definition at line 60 of file Reader.h.

## ◆ m_run_info

std::shared_ptr<GenRunInfo> m_run_info
| privateinherited

The global GenRunInfo object.

Definition at line 63 of file Reader.h.

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

- ReaderRoot.h
- ReaderRoot.cc