HepMC3 event record library
|
Parser for HepMC2 I/O files. More...
#include <ReaderAsciiHepMC2.h>
Public Member Functions | |
ReaderAsciiHepMC2 (const std::string &filename) | |
Default constructor. More... | |
ReaderAsciiHepMC2 (std::istream &) | |
The ctor to read from stdin. More... | |
~ReaderAsciiHepMC2 () | |
Destructor. More... | |
bool | skip (const int) override |
skip events More... | |
bool | read_event (GenEvent &evt) override |
Implementation of Reader::read_event. More... | |
bool | failed () override |
Return status of the stream. More... | |
void | close () override |
Close file stream. More... | |
std::shared_ptr< GenRunInfo > | run_info () const |
Get the global GenRunInfo object. More... | |
void | set_options (const std::map< std::string, std::string > &options) |
Set options. More... | |
std::map< std::string, std::string > | get_options () const |
Set options. More... | |
Protected Member Functions | |
void | set_run_info (std::shared_ptr< GenRunInfo > run) |
Set the global GenRunInfo object. More... | |
Protected Attributes | |
std::map< std::string, std::string > | m_options |
options More... | |
Private Member Functions | |
int | parse_event_information (GenEvent &evt, const char *buf) |
Parse event. More... | |
bool | parse_units (GenEvent &evt, const char *buf) |
Parse units. More... | |
int | parse_vertex_information (const char *buf) |
Parse vertex. More... | |
int | parse_particle_information (const char *buf) |
Parse particle. More... | |
bool | parse_weight_names (const char *buf) |
Parse weight names. More... | |
bool | parse_heavy_ion (GenEvent &evt, const char *buf) |
Parse heavy ion information. More... | |
bool | parse_pdf_info (GenEvent &evt, const char *buf) |
Parse pdf information. More... | |
bool | parse_xs_info (GenEvent &evt, const char *buf) |
Parse pdf information. More... | |
Private Attributes | |
std::ifstream | m_file |
Input file. More... | |
std::istream * | m_stream |
For ctor when reading from stdin. More... | |
bool | m_isstream |
toggles usage of m_file or m_stream More... | |
std::vector< GenVertexPtr > | m_vertex_cache |
Vertex cache. More... | |
std::vector< int > | m_vertex_barcodes |
Old vertex barcodes. More... | |
std::vector< GenParticlePtr > | m_particle_cache |
Particle cache. More... | |
std::vector< int > | m_end_vertex_barcodes |
Old end vertex barcodes. More... | |
GenEvent * | m_event_ghost |
To save particle and verstex attributes. More... | |
std::vector< GenParticlePtr > | m_particle_cache_ghost |
Particle cache for attributes. More... | |
std::vector< GenVertexPtr > | m_vertex_cache_ghost |
Vertex cache for attributes. More... | |
Parser for HepMC2 I/O files.
Definition at line 30 of file ReaderAsciiHepMC2.h.
ReaderAsciiHepMC2 | ( | const std::string & | filename | ) |
Default constructor.
Definition at line 23 of file ReaderAsciiHepMC2.cc.
References HEPMC3_ERROR, ReaderAsciiHepMC2::m_event_ghost, ReaderAsciiHepMC2::m_file, and Reader::set_run_info().
ReaderAsciiHepMC2 | ( | std::istream & | stream | ) |
The ctor to read from stdin.
Definition at line 32 of file ReaderAsciiHepMC2.cc.
References HEPMC3_ERROR, ReaderAsciiHepMC2::m_event_ghost, ReaderAsciiHepMC2::m_stream, and Reader::set_run_info().
~ReaderAsciiHepMC2 | ( | ) |
Destructor.
Definition at line 42 of file ReaderAsciiHepMC2.cc.
References GenEvent::clear(), ReaderAsciiHepMC2::close(), ReaderAsciiHepMC2::m_event_ghost, and ReaderAsciiHepMC2::m_isstream.
|
overridevirtual |
Close file stream.
Implements Reader.
Definition at line 718 of file ReaderAsciiHepMC2.cc.
References GenEvent::clear(), ReaderAsciiHepMC2::m_event_ghost, and ReaderAsciiHepMC2::m_file.
|
overridevirtual |
Return status of the stream.
Implements Reader.
Definition at line 716 of file ReaderAsciiHepMC2.cc.
References ReaderAsciiHepMC2::m_file, ReaderAsciiHepMC2::m_isstream, and ReaderAsciiHepMC2::m_stream.
|
inlineinherited |
|
private |
Parse event.
Helper routine for parsing event information
[out] | evt | Event that will be filled with new data |
[in] | buf | Line of text that needs to be parsed |
Definition at line 296 of file ReaderAsciiHepMC2.cc.
References GenEvent::add_attribute(), HEPMC3_DEBUG, Reader::m_options, GenEvent::set_event_number(), and GenEvent::weights().
|
private |
Parse heavy ion information.
Helper routine for parsing heavy ion information
[out] | evt | Event that will be filled with new data |
[in] | buf | Line of text that needs to be parsed |
Definition at line 626 of file ReaderAsciiHepMC2.cc.
References GenEvent::add_attribute().
|
private |
Parse particle.
Helper routine for parsing single particle information
[in] | buf | Line of text that needs to be parsed |
Definition at line 481 of file ReaderAsciiHepMC2.cc.
References GenEvent::add_particle(), HEPMC3_DEBUG, ReaderAsciiHepMC2::m_end_vertex_barcodes, ReaderAsciiHepMC2::m_event_ghost, Reader::m_options, ReaderAsciiHepMC2::m_particle_cache, ReaderAsciiHepMC2::m_particle_cache_ghost, ReaderAsciiHepMC2::m_vertex_barcodes, ReaderAsciiHepMC2::m_vertex_cache, FourVector::setE(), FourVector::setPx(), FourVector::setPy(), and FourVector::setPz().
|
private |
Parse pdf information.
Helper routine for parsing pdf information
[out] | evt | Event that will be filled with new data |
[in] | buf | Line of text that needs to be parsed |
Definition at line 677 of file ReaderAsciiHepMC2.cc.
References GenEvent::add_attribute().
|
private |
Parse units.
Helper routine for parsing unit information
[out] | evt | Event that will be filled with unit information |
[in] | buf | Line of text that needs to be parsed |
Definition at line 385 of file ReaderAsciiHepMC2.cc.
References HEPMC3_DEBUG, Units::length_unit(), GenEvent::length_unit(), Units::momentum_unit(), GenEvent::momentum_unit(), Units::name(), and GenEvent::set_units().
|
private |
Parse vertex.
Helper routine for parsing single event information
[in] | buf | Line of text that needs to be parsed |
Definition at line 405 of file ReaderAsciiHepMC2.cc.
References GenEvent::add_vertex(), HEPMC3_DEBUG, ReaderAsciiHepMC2::m_event_ghost, Reader::m_options, ReaderAsciiHepMC2::m_vertex_barcodes, ReaderAsciiHepMC2::m_vertex_cache, and ReaderAsciiHepMC2::m_vertex_cache_ghost.
|
private |
Parse weight names.
Helper routine for parsing weight names
[in] | buf | Line of text that needs to be parsed |
Definition at line 592 of file ReaderAsciiHepMC2.cc.
References Reader::run_info().
|
private |
Parse pdf information.
Helper routine for parsing cross-section information
[out] | evt | Event that will be filled with new data |
[in] | buf | Line of text that needs to be parsed |
Definition at line 576 of file ReaderAsciiHepMC2.cc.
References GenEvent::add_attribute().
|
overridevirtual |
Implementation of Reader::read_event.
Implements Reader.
Definition at line 60 of file ReaderAsciiHepMC2.cc.
References GenEvent::add_attribute(), GenEvent::add_tree(), GenEvent::attribute(), GenEvent::clear(), ReaderAsciiHepMC2::failed(), HEPMC3_DEBUG, HEPMC3_ERROR, HEPMC3_WARNING, ReaderAsciiHepMC2::m_end_vertex_barcodes, ReaderAsciiHepMC2::m_event_ghost, ReaderAsciiHepMC2::m_file, ReaderAsciiHepMC2::m_isstream, Reader::m_options, ReaderAsciiHepMC2::m_particle_cache, ReaderAsciiHepMC2::m_particle_cache_ghost, ReaderAsciiHepMC2::m_stream, ReaderAsciiHepMC2::m_vertex_barcodes, ReaderAsciiHepMC2::m_vertex_cache, ReaderAsciiHepMC2::m_vertex_cache_ghost, ReaderAsciiHepMC2::parse_event_information(), ReaderAsciiHepMC2::parse_heavy_ion(), ReaderAsciiHepMC2::parse_particle_information(), ReaderAsciiHepMC2::parse_pdf_info(), ReaderAsciiHepMC2::parse_units(), ReaderAsciiHepMC2::parse_vertex_information(), ReaderAsciiHepMC2::parse_weight_names(), ReaderAsciiHepMC2::parse_xs_info(), GenEvent::reserve(), Reader::run_info(), GenEvent::set_run_info(), and IntAttribute::value().
|
inlineinherited |
Get the global GenRunInfo object.
Definition at line 44 of file Reader.h.
References Reader::m_run_info.
|
inlineinherited |
|
inlineprotectedinherited |
Set the global GenRunInfo object.
Definition at line 64 of file Reader.h.
References Reader::m_run_info.
|
overridevirtual |
skip events
Reimplemented from Reader.
Definition at line 44 of file ReaderAsciiHepMC2.cc.
References ReaderAsciiHepMC2::failed(), ReaderAsciiHepMC2::m_file, ReaderAsciiHepMC2::m_isstream, and ReaderAsciiHepMC2::m_stream.
|
private |
Old end vertex barcodes.
Definition at line 136 of file ReaderAsciiHepMC2.h.
|
private |
To save particle and verstex attributes.
Definition at line 138 of file ReaderAsciiHepMC2.h.
|
private |
Input file.
Definition at line 128 of file ReaderAsciiHepMC2.h.
|
private |
toggles usage of m_file or m_stream
Definition at line 130 of file ReaderAsciiHepMC2.h.
|
protectedinherited |
|
private |
Particle cache.
Definition at line 135 of file ReaderAsciiHepMC2.h.
|
private |
Particle cache for attributes.
Definition at line 139 of file ReaderAsciiHepMC2.h.
|
private |
For ctor when reading from stdin.
Definition at line 129 of file ReaderAsciiHepMC2.h.
|
private |
Old vertex barcodes.
Definition at line 133 of file ReaderAsciiHepMC2.h.
|
private |
Vertex cache.
Definition at line 132 of file ReaderAsciiHepMC2.h.
|
private |
Vertex cache for attributes.
Definition at line 140 of file ReaderAsciiHepMC2.h.