HepMC3 event record library: ReaderHEPEVT Class Reference

HepMC3 event record library

Public Member Functions | Data Fields | Protected Attributes | Private Attributes
ReaderHEPEVT Class Reference

## Detailed Description

GenEvent I/O parsing and serialization for HEPEVT files.

Definition at line 32 of file ReaderHEPEVT.h.

`#include <ReaderHEPEVT.h>`

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

## Public Member Functions
| ReaderHEPEVT (const std::string &filename)
| Default constructor.
| ReaderHEPEVT (std::istream &)
| The ctor to read from stream.
| ReaderHEPEVT (std::shared_ptr< std::istream > s_stream)
| The ctor to read from temp stream.
virtual bool | read_hepevt_event_header ()
| Find and read event header line from file.
virtual bool | read_hepevt_particle (int i)
| read particle from file
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.

## Data Fields
char * | hepevtbuffer = nullptr
| Pointer to HEPEVT Fortran common block/C struct.

## Protected Attributes
std::map< std::string, std::string > | m_options
| Options.

## Private Attributes
std::ifstream | m_file
| Input file.
std::shared_ptr< std::istream > | m_shared_stream = nullptr
| For ctor when reading from temp stream.
std::istream * | m_stream = nullptr
| For ctor when reading from stream.
bool | m_isstream
| toggles usage of m_file or m_stream
HEPEVT_Wrapper_Template< 100000 > | m_hepevt_interface
| Templated HEPEVT interface.
std::shared_ptr< GenRunInfo > | m_run_info
| The global GenRunInfo object.

## Constructor & Destructor Documentation

## ◆ ReaderHEPEVT() [1/3]

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

Default constructor.

Definition at line 18 of file ReaderHEPEVT.cc.

References m_file, and m_isstream.

## ◆ ReaderHEPEVT() [2/3]

ReaderHEPEVT | ( | std::istream & | stream | ) |

The ctor to read from stream.

Definition at line 32 of file ReaderHEPEVT.cc.

References m_isstream, and m_stream.

## ◆ ReaderHEPEVT() [3/3]

ReaderHEPEVT | ( | std::shared_ptr< std::istream > | s_stream | ) |

The ctor to read from temp stream.

Definition at line 45 of file ReaderHEPEVT.cc.

References m_isstream, m_shared_stream, and m_stream.

## Member Function Documentation

## ◆ close()

void close | ( |  | ) |
| overridevirtual

Close file stream.

Implements Reader.

Definition at line 183 of file ReaderHEPEVT.cc.

References m_file.

## ◆ failed()

bool failed | ( |  | ) |
| overridevirtual

Get stream error state.

Implements Reader.

Definition at line 189 of file ReaderHEPEVT.cc.

References m_file, m_isstream, and m_stream.

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

Implements Reader.

Definition at line 157 of file ReaderHEPEVT.cc.

References GenEvent::clear(), m_file, m_hepevt_interface, m_isstream, m_stream, read_hepevt_event_header(), read_hepevt_particle(), GenEvent::set_run_info(), and GenEvent::weights().

## ◆ read_hepevt_event_header()

bool read_hepevt_event_header | ( |  | ) |
| virtual

Find and read event header line from file.

Definition at line 76 of file ReaderHEPEVT.cc.

References m_file, m_hepevt_interface, m_isstream, and m_stream.

## ◆ read_hepevt_particle()

bool read_hepevt_particle | ( | int | i | ) |
| virtual

read particle from file

Parameters

  [in] | i | Particle id

Definition at line 106 of file ReaderHEPEVT.cc.

References HEPMC3_ERROR_LEVEL, m_file, m_hepevt_interface, m_isstream, Reader::m_options, and m_stream.

## ◆ 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 59 of file ReaderHEPEVT.cc.

References failed(), m_file, m_isstream, and m_stream.

## Field Documentation

## ◆ hepevtbuffer

char* hepevtbuffer = nullptr

Pointer to HEPEVT Fortran common block/C struct.

Definition at line 72 of file ReaderHEPEVT.h.

## ◆ m_file

std::ifstream m_file
| private

Input file.

Definition at line 74 of file ReaderHEPEVT.h.

## ◆ m_hepevt_interface

HEPEVT_Wrapper_Template<100000> m_hepevt_interface
| private

Templated HEPEVT interface.

Definition at line 78 of file ReaderHEPEVT.h.

## ◆ m_isstream

bool m_isstream
| private

toggles usage of m_file or m_stream

Definition at line 77 of file ReaderHEPEVT.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.

## ◆ m_shared_stream

std::shared_ptr<std::istream> m_shared_stream = nullptr
| private

For ctor when reading from temp stream.

Definition at line 75 of file ReaderHEPEVT.h.

## ◆ m_stream

std::istream* m_stream = nullptr
| private

For ctor when reading from stream.

Definition at line 76 of file ReaderHEPEVT.h.

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

- ReaderHEPEVT.h
- ReaderHEPEVT.cc