| HepMC3 event record library
    | 
GenEvent I/O parsing for structured text files.
Definition at line 29 of file ReaderAscii.h.
#include <ReaderAscii.h>
 Inheritance diagram for ReaderAscii:
 Inheritance diagram for ReaderAscii: Collaboration diagram for ReaderAscii:
 Collaboration diagram for ReaderAscii:| Public Member Functions | |
| ReaderAscii (const std::string &filename) | |
| Constructor. | |
| ReaderAscii (std::istream &) | |
| The ctor to read from stream. | |
| ReaderAscii (std::shared_ptr< std::istream > s_stream) | |
| The ctor to read from stream. Useful for temp. streams. | |
| ~ReaderAscii () | |
| Destructor. | |
| bool | skip (const int) override | 
| skip events | |
| bool | read_event (GenEvent &evt) override | 
| Load event from file. | |
| bool | failed () override | 
| Return status of the stream. | |
| void | close () override | 
| Close file stream. | |
| 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 Member Functions | |
| std::string | unescape (const std::string &s) | 
| Unsecape '\' and ' ' characters in string. | |
| Read helpers | |
| std::pair< int, int > | parse_event_information (GenEvent &evt, const char *buf) | 
| Parse event. | |
| bool | parse_weight_values (GenEvent &evt, const char *buf) | 
| Parse weight value lines. | |
| bool | parse_units (GenEvent &evt, const char *buf) | 
| Parse units. | |
| bool | parse_pdf_info (GenEvent &evt, const char *buf) | 
| Parse struct GenPdfInfo information. | |
| bool | parse_heavy_ion (GenEvent &evt, const char *buf) | 
| Parse struct GenHeavyIon information. | |
| bool | parse_cross_section (GenEvent &evt, const char *buf) | 
| Parse struct GenCrossSection information. | |
| bool | parse_vertex_information (GenEvent &evt, const char *buf) | 
| Parse vertex. | |
| bool | parse_particle_information (GenEvent &evt, const char *buf) | 
| Parse particle. | |
| bool | parse_attribute (GenEvent &evt, const char *buf) | 
| Parse attribute. | |
| bool | parse_run_attribute (const char *buf) | 
| Parse run-level attribute. | |
| bool | parse_weight_names (const char *buf) | 
| Parse run-level weight names. | |
| bool | parse_tool (const char *buf) | 
| Parse run-level tool information. | |
| Private Attributes | |
| std::ifstream | m_file | 
| Input file. | |
| std::shared_ptr< std::istream > | m_shared_stream | 
| For ctor when reading from temp. stream. | |
| std::istream * | m_stream | 
| For ctor when reading from stream. | |
| bool | m_isstream | 
| toggles usage of m_file or m_stream | |
| std::map< std::string, std::shared_ptr< Attribute > > | m_global_attributes | 
| Store attributes global to the run being written/read. | |
| std::map< GenVertexPtr, std::set< int > > | m_forward_mothers | 
| Temp storage for outgoing particle ids. | |
| std::map< GenParticlePtr, int > | m_forward_daughters | 
| Temp storage for prod vertex ids. | |
| std::shared_ptr< GenRunInfo > | m_run_info | 
| The global GenRunInfo object. | |
| ReaderAscii | ( | const std::string & | filename | ) | 
Constructor.
Definition at line 24 of file ReaderAscii.cc.
References m_file, m_isstream, m_stream, and Reader::set_run_info().
| ReaderAscii | ( | std::istream & | stream | ) | 
The ctor to read from stream.
Definition at line 33 of file ReaderAscii.cc.
References m_isstream, m_stream, and Reader::set_run_info().
| ReaderAscii | ( | std::shared_ptr< std::istream > | s_stream | ) | 
The ctor to read from stream. Useful for temp. streams.
Definition at line 43 of file ReaderAscii.cc.
References m_isstream, m_shared_stream, m_stream, and Reader::set_run_info().
| ~ReaderAscii | ( | ) | 
| 
 | overridevirtual | 
Close file stream.
Implements Reader.
Definition at line 627 of file ReaderAscii.cc.
References m_file.
| 
 | overridevirtual | 
Return status of the stream.
Implements Reader.
Definition at line 625 of file ReaderAscii.cc.
References m_file, m_isstream, and m_stream.
| 
 | inlinevirtualinherited | 
Get options.
Reimplemented in ReaderPlugin.
Definition at line 53 of file Reader.h.
References m_options.
| 
 | private | 
Parse attribute.
Helper routine for parsing single attribute information
| [out] | evt | Event that will contain parsed attribute | 
| [in] | buf | Line of text that needs to be parsed | 
Definition at line 524 of file ReaderAscii.cc.
References GenEvent::add_attribute(), and unescape().
| 
 | private | 
Parse struct GenCrossSection information.
Helper routine for parsing cross-section information
| [out] | evt | Event that will be filled with unit information | 
| [in] | buf | Line of text that needs to be parsed | 
| 
 | 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 280 of file ReaderAscii.cc.
References HEPMC3_DEBUG, GenEvent::set_event_number(), FourVector::setT(), FourVector::setX(), FourVector::setY(), FourVector::setZ(), and GenEvent::shift_position_to().
| 
 | private | 
Parse struct GenHeavyIon information.
Helper routine for parsing heavy ion information
| [out] | evt | Event that will be filled with unit information | 
| [in] | buf | Line of text that needs to be parsed | 
| 
 | private | 
Parse particle.
Helper routine for parsing single particle information
| [out] | evt | Event that will contain parsed particle | 
| [in] | buf | Line of text that needs to be parsed | 
Definition at line 436 of file ReaderAscii.cc.
References GenEvent::add_particle(), GenEvent::add_vertex(), HEPMC3_DEBUG, HEPMC3_ERROR, m_forward_daughters, GenEvent::particles(), FourVector::setE(), FourVector::setPx(), FourVector::setPy(), FourVector::setPz(), and GenEvent::vertices().
| 
 | private | 
Parse struct GenPdfInfo information.
Helper routine for parsing PDF information
| [out] | evt | Event that will be filled with unit information | 
| [in] | buf | Line of text that needs to be parsed | 
| 
 | private | 
Parse run-level attribute.
Helper routine for parsing single attribute information
| [in] | buf | Line of text that needs to be parsed | 
Definition at line 549 of file ReaderAscii.cc.
References Reader::run_info(), and unescape().
| 
 | private | 
Parse run-level tool information.
Helper routine for parsing a line with information about tools being used.
| [in] | buf | Line of text that needs to be parsed | 
Definition at line 587 of file ReaderAscii.cc.
References GenRunInfo::ToolInfo::description, GenRunInfo::ToolInfo::name, Reader::run_info(), unescape(), and GenRunInfo::ToolInfo::version.
| 
 | private | 
Parse units.
Helper routine for parsing units information
| [out] | evt | Event that will be filled with unit information | 
| [in] | buf | Line of text that needs to be parsed | 
Definition at line 343 of file ReaderAscii.cc.
References HEPMC3_DEBUG, GenEvent::length_unit(), Units::length_unit(), GenEvent::momentum_unit(), Units::momentum_unit(), Units::name(), and GenEvent::set_units().
| 
 | private | 
Parse vertex.
Helper routine for parsing single event information
| [out] | evt | Event that will contain parsed vertex | 
| [in] | buf | Line of text that needs to be parsed | 
Definition at line 364 of file ReaderAscii.cc.
References GenEvent::add_vertex(), HEPMC3_DEBUG, m_forward_mothers, GenEvent::particles(), FourVector::setT(), FourVector::setX(), FourVector::setY(), and FourVector::setZ().
| 
 | private | 
Parse run-level weight names.
Helper routine for parsing a line with information about weight names.
| [in] | buf | Line of text that needs to be parsed | 
Definition at line 571 of file ReaderAscii.cc.
References Reader::run_info(), and unescape().
| 
 | private | 
Parse weight value lines.
Helper routine for parsing weight value information
| [out] | evt | Event whose GenWeights will be filled with weight values | 
| [in] | buf | Line of text that needs to be parsed | 
Definition at line 326 of file ReaderAscii.cc.
References Reader::run_info(), and GenEvent::weights().
| 
 | overridevirtual | 
Load event from file.
| [out] | evt | Event to be filled | 
Implements Reader.
Definition at line 90 of file ReaderAscii.cc.
References GenEvent::clear(), failed(), HEPMC3_DEBUG, HEPMC3_ERROR, HEPMC3_WARNING, m_file, m_forward_daughters, m_forward_mothers, m_isstream, m_stream, parse_attribute(), parse_event_information(), parse_particle_information(), parse_run_attribute(), parse_tool(), parse_units(), parse_vertex_information(), parse_weight_names(), parse_weight_values(), GenEvent::particles(), Reader::run_info(), GenEvent::set_run_info(), Reader::set_run_info(), and GenEvent::vertices().
| 
 | inlinevirtualinherited | 
Get the global GenRunInfo object.
Reimplemented in ReaderPlugin.
Definition at line 44 of file Reader.h.
References m_run_info.
| 
 | inlinevirtualinherited | 
Set options.
Reimplemented in ReaderPlugin.
Definition at line 51 of file Reader.h.
References m_options.
| 
 | inlinevirtualinherited | 
Set the global GenRunInfo object.
Reimplemented in ReaderPlugin.
Definition at line 56 of file Reader.h.
References m_run_info.
| 
 | overridevirtual | 
skip events
Reimplemented from Reader.
Definition at line 54 of file ReaderAscii.cc.
References failed(), m_file, m_isstream, m_stream, parse_run_attribute(), parse_tool(), parse_weight_names(), and Reader::set_run_info().
| 
 | private | 
Unsecape '\' and '
' characters in string. 
Definition at line 606 of file ReaderAscii.cc.
| 
 | private | 
Input file.
Definition at line 158 of file ReaderAscii.h.
| 
 | private | 
Temp storage for prod vertex ids.
Definition at line 170 of file ReaderAscii.h.
| 
 | private | 
Temp storage for outgoing particle ids.
Definition at line 168 of file ReaderAscii.h.
| 
 | private | 
Store attributes global to the run being written/read.
Definition at line 165 of file ReaderAscii.h.
| 
 | private | 
toggles usage of m_file or m_stream
Definition at line 161 of file ReaderAscii.h.
| 
 | protectedinherited | 
| 
 | privateinherited | 
The global GenRunInfo object.
| 
 | private | 
For ctor when reading from temp. stream.
Definition at line 159 of file ReaderAscii.h.
| 
 | private | 
For ctor when reading from stream.
Definition at line 160 of file ReaderAscii.h.