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

Detailed Description

Parser for HepMC2 I/O files.

Examples
HepMC2_reader_example.cc, and convert_example.cc.

Definition at line 30 of file ReaderAsciiHepMC2.h.

#include <ReaderAsciiHepMC2.h>

+ Inheritance diagram for ReaderAsciiHepMC2:
+ Collaboration diagram for ReaderAsciiHepMC2:

Public Member Functions

 ReaderAsciiHepMC2 (const std::string &filename)
 Default constructor.
 
 ReaderAsciiHepMC2 (std::istream &)
 The ctor to read from stdin.
 
 ~ReaderAsciiHepMC2 ()
 Destructor.
 
bool read_event (GenEvent &evt)
 Implementation of Reader::read_event.
 
bool failed ()
 Return status of the stream.
 
void close ()
 Close file stream.
 
shared_ptr< GenRunInforun_info () const
 Get the global GenRunInfo object.
 

Protected Member Functions

void set_run_info (shared_ptr< GenRunInfo > run)
 Set the global GenRunInfo object.
 

Private Member Functions

int parse_event_information (GenEvent &evt, const char *buf)
 Parse event.
 
bool parse_units (GenEvent &evt, const char *buf)
 Parse units.
 
int parse_vertex_information (const char *buf)
 Parse vertex.
 
int parse_particle_information (const char *buf)
 Parse particle.
 
bool parse_weight_names (const char *buf)
 Parse weight names.
 
bool parse_heavy_ion (GenEvent &evt, const char *buf)
 Parse heavy ion information.
 
bool parse_pdf_info (GenEvent &evt, const char *buf)
 Parse pdf information.
 
bool parse_xs_info (GenEvent &evt, const char *buf)
 Parse pdf information.
 

Private Attributes

std::ifstream m_file
 Input file.
 
std::istream * m_stream
 For ctor when reading from stdin.
 
bool m_isstream
 toggles usage of m_file or m_stream
 
vector< GenVertexPtr > m_vertex_cache
 Vertex cache.
 
vector< int > m_vertex_barcodes
 Old vertex barcodes.
 
vector< GenParticlePtr > m_particle_cache
 Particle cache.
 
vector< int > m_end_vertex_barcodes
 Old end vertex barcodes.
 
GenEventm_event_ghost
 To save particle and verstex attributes.
 
vector< GenParticlePtr > m_particle_cache_ghost
 Particle cache for attributes.
 
vector< GenVertexPtr > m_vertex_cache_ghost
 Vertex cache for attributes.
 
shared_ptr< GenRunInfom_run_info
 The global GenRunInfo object.
 

Constructor & Destructor Documentation

◆ ReaderAsciiHepMC2() [1/2]

ReaderAsciiHepMC2 ( const std::string &  filename)

Default constructor.

Definition at line 25 of file ReaderAsciiHepMC2.cc.

References ERROR, ReaderAsciiHepMC2::m_event_ghost, ReaderAsciiHepMC2::m_file, and Reader::set_run_info().

◆ ReaderAsciiHepMC2() [2/2]

ReaderAsciiHepMC2 ( std::istream &  stream)

The ctor to read from stdin.

Definition at line 34 of file ReaderAsciiHepMC2.cc.

References ERROR, ReaderAsciiHepMC2::m_event_ghost, ReaderAsciiHepMC2::m_stream, and Reader::set_run_info().

◆ ~ReaderAsciiHepMC2()

Member Function Documentation

◆ close()

void close ( )
virtual

Close file stream.

Implements Reader.

Examples
HepMC2_reader_example.cc.

Definition at line 649 of file ReaderAsciiHepMC2.cc.

References GenEvent::clear(), ReaderAsciiHepMC2::m_event_ghost, and ReaderAsciiHepMC2::m_file.

◆ failed()

bool failed ( )
virtual

Return status of the stream.

Implements Reader.

Examples
HepMC2_reader_example.cc.

Definition at line 647 of file ReaderAsciiHepMC2.cc.

References ReaderAsciiHepMC2::m_file, ReaderAsciiHepMC2::m_isstream, and ReaderAsciiHepMC2::m_stream.

◆ parse_event_information()

int parse_event_information ( GenEvent evt,
const char *  buf 
)
private

Parse event.

Helper routine for parsing event information

Parameters
[out]evtEvent that will be filled with new data
[in]bufLine of text that needs to be parsed

Definition at line 250 of file ReaderAsciiHepMC2.cc.

References GenEvent::add_attribute(), DEBUG, GenEvent::set_event_number(), and GenEvent::weights().

◆ parse_heavy_ion()

bool parse_heavy_ion ( GenEvent evt,
const char *  buf 
)
private

Parse heavy ion information.

Helper routine for parsing heavy ion information

Parameters
[out]evtEvent that will be filled with new data
[in]bufLine of text that needs to be parsed

Definition at line 557 of file ReaderAsciiHepMC2.cc.

References GenEvent::add_attribute().

◆ parse_particle_information()

int parse_particle_information ( const char *  buf)
private

◆ parse_pdf_info()

bool parse_pdf_info ( GenEvent evt,
const char *  buf 
)
private

Parse pdf information.

Helper routine for parsing pdf information

Parameters
[out]evtEvent that will be filled with new data
[in]bufLine of text that needs to be parsed

Definition at line 608 of file ReaderAsciiHepMC2.cc.

References GenEvent::add_attribute().

◆ parse_units()

bool parse_units ( GenEvent evt,
const char *  buf 
)
private

Parse units.

Helper routine for parsing unit information

Parameters
[out]evtEvent that will be filled with unit information
[in]bufLine of text that needs to be parsed

Definition at line 334 of file ReaderAsciiHepMC2.cc.

References DEBUG, GenEvent::length_unit(), Units::length_unit(), GenEvent::momentum_unit(), Units::momentum_unit(), Units::name(), and GenEvent::set_units().

◆ parse_vertex_information()

int parse_vertex_information ( const char *  buf)
private

Parse vertex.

Helper routine for parsing single event information

Parameters
[in]bufLine of text that needs to be parsed

Definition at line 354 of file ReaderAsciiHepMC2.cc.

References GenEvent::add_vertex(), DEBUG, ReaderAsciiHepMC2::m_event_ghost, ReaderAsciiHepMC2::m_vertex_barcodes, ReaderAsciiHepMC2::m_vertex_cache, ReaderAsciiHepMC2::m_vertex_cache_ghost, FourVector::setT(), FourVector::setX(), FourVector::setY(), and FourVector::setZ().

◆ parse_weight_names()

bool parse_weight_names ( const char *  buf)
private

Parse weight names.

Helper routine for parsing weight names

Parameters
[in]bufLine of text that needs to be parsed

Definition at line 523 of file ReaderAsciiHepMC2.cc.

References Reader::run_info().

◆ parse_xs_info()

bool parse_xs_info ( GenEvent evt,
const char *  buf 
)
private

Parse pdf information.

Helper routine for parsing cross-section information

Parameters
[out]evtEvent that will be filled with new data
[in]bufLine of text that needs to be parsed

Definition at line 507 of file ReaderAsciiHepMC2.cc.

References GenEvent::add_attribute().

◆ read_event()

bool read_event ( GenEvent evt)
virtual

◆ run_info()

shared_ptr< GenRunInfo > run_info ( ) const
inlineinherited

Get the global GenRunInfo object.

Examples
LHEF_example_cat.cc, and convert_example.cc.

Definition at line 39 of file Reader.h.

References Reader::m_run_info.

◆ set_run_info()

void set_run_info ( shared_ptr< GenRunInfo run)
inlineprotectedinherited

Set the global GenRunInfo object.

Definition at line 46 of file Reader.h.

References Reader::m_run_info.

Field Documentation

◆ m_end_vertex_barcodes

vector<int> m_end_vertex_barcodes
private

Old end vertex barcodes.

Definition at line 133 of file ReaderAsciiHepMC2.h.

◆ m_event_ghost

GenEvent* m_event_ghost
private

To save particle and verstex attributes.

Definition at line 135 of file ReaderAsciiHepMC2.h.

◆ m_file

std::ifstream m_file
private

Input file.

Definition at line 125 of file ReaderAsciiHepMC2.h.

◆ m_isstream

bool m_isstream
private

toggles usage of m_file or m_stream

Definition at line 127 of file ReaderAsciiHepMC2.h.

◆ m_particle_cache

vector<GenParticlePtr> m_particle_cache
private

Particle cache.

Definition at line 132 of file ReaderAsciiHepMC2.h.

◆ m_particle_cache_ghost

vector<GenParticlePtr> m_particle_cache_ghost
private

Particle cache for attributes.

Definition at line 136 of file ReaderAsciiHepMC2.h.

◆ m_run_info

shared_ptr<GenRunInfo> m_run_info
privateinherited

The global GenRunInfo object.

Definition at line 53 of file Reader.h.

◆ m_stream

std::istream* m_stream
private

For ctor when reading from stdin.

Definition at line 126 of file ReaderAsciiHepMC2.h.

◆ m_vertex_barcodes

vector<int> m_vertex_barcodes
private

Old vertex barcodes.

Definition at line 130 of file ReaderAsciiHepMC2.h.

◆ m_vertex_cache

vector<GenVertexPtr> m_vertex_cache
private

Vertex cache.

Definition at line 129 of file ReaderAsciiHepMC2.h.

◆ m_vertex_cache_ghost

vector<GenVertexPtr> m_vertex_cache_ghost
private

Vertex cache for attributes.

Definition at line 137 of file ReaderAsciiHepMC2.h.


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