|
MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
|
Object that parses MARLEY output files. More...
#include <EventFileReader.hh>
Public Member Functions | |
| EventFileReader (const std::string &file_name) | |
| double | flux_averaged_xsec (bool natural_units=false) |
| Returns the flux-averaged total cross section used to produce the events in the file. | |
| virtual bool | next_event (HepMC3::GenEvent &ev) |
| Read the next MARLEY event record from the file. | |
| virtual | operator bool () const |
| Implicit boolean conversion allows the state of the input stream (or ROOT file) to be tested for readiness to read in another event. | |
| EventFileReader & | operator>> (HepMC3::GenEvent &ev) |
| Stream operator for reading in the next event. | |
Protected Member Functions | |
| virtual bool | deduce_file_format () |
| Helper function that auto-detects which of the available output formats is appropriate for the requested file. | |
| void | ensure_initialized () |
| This function should be called at the beginning of all public member functions of EventFileReader that interact with data in the file. | |
| void | get_flux_averaged_xsec (const HepMC3::GenRunInfo &run_info) |
| virtual void | initialize () |
| Prepares the file for reading the events. | |
Protected Attributes | |
| std::string | file_name_ |
| Name of the file (with any needed path specification) to be read. | |
| double | flux_avg_tot_xs_ = 0. |
| Flux-averaged total cross section (MeV -2) used to produce the events in the file, or zero if that information is not included in a particular format. | |
| OutputFile::Format | format_ |
| Format of the output file being read. | |
| std::ifstream | in_ |
| Input stream used to read from textual output formats. | |
| bool | initialized_ = false |
| Flag that indicates whether initialize() has been called or not. | |
| std::shared_ptr< HepMC3::ReaderAscii > | reader_ |
| Helper object used to interpret ASCII-format HepMC3 files. | |
Object that parses MARLEY output files.
Definition at line 48 of file EventFileReader.hh.
| marley::EventFileReader::EventFileReader | ( | const std::string & | file_name | ) |
Definition at line 39 of file EventFileReader.cc.
|
protectedvirtual |
Helper function that auto-detects which of the available output formats is appropriate for the requested file.
Definition at line 47 of file EventFileReader.cc.
References file_name_, format_, get_flux_averaged_xsec(), marley::FileManager::Instance(), HepMC3::ReaderAscii::read_event(), and HepMC3::GenEvent::run_info().
Referenced by ensure_initialized().
|
protected |
This function should be called at the beginning of all public member functions of EventFileReader that interact with data in the file.
It provides necessary initialization as a workaround to calling virtual functions in the constructor
Definition at line 220 of file EventFileReader.cc.
References deduce_file_format(), file_name_, initialize(), and initialized_.
Referenced by flux_averaged_xsec(), and next_event().
| double marley::EventFileReader::flux_averaged_xsec | ( | bool | natural_units = false | ) |
Returns the flux-averaged total cross section used to produce the events in the file.
For file formats which do not include this information, this function will return zero
| [in] | natural_units | If true, then this function will return the flux-averaged total cross section in natural units (MeV -2). If false (default), then 10-42 cm2 will be used. |
Definition at line 231 of file EventFileReader.cc.
References ensure_initialized(), and flux_avg_tot_xs_.
|
protected |
Helper function for loading the flux-averaged total cross section information from the HepMC3 run information
Definition at line 239 of file EventFileReader.cc.
References HepMC3::GenRunInfo::attribute(), and flux_avg_tot_xs_.
Referenced by deduce_file_format(), and initialize().
|
protectedvirtual |
Prepares the file for reading the events.
Definition at line 106 of file EventFileReader.cc.
References file_name_, format_, get_flux_averaged_xsec(), in_, and reader_.
Referenced by ensure_initialized().
|
virtual |
Read the next MARLEY event record from the file.
| [out] | ev | Reference to the object that will be filled with the next event record |
Definition at line 146 of file EventFileReader.cc.
References ensure_initialized(), format_, in_, HepMC3::GenEvent::read_data(), reader_, and HepMC3::GenEvent::set_run_info().
Referenced by operator>>().
|
virtual |
Implicit boolean conversion allows the state of the input stream (or ROOT file) to be tested for readiness to read in another event.
Definition at line 194 of file EventFileReader.cc.
|
inline |
Stream operator for reading in the next event.
Definition at line 75 of file EventFileReader.hh.
References next_event().
|
protected |
Name of the file (with any needed path specification) to be read.
Definition at line 89 of file EventFileReader.hh.
Referenced by deduce_file_format(), ensure_initialized(), and initialize().
|
protected |
Flux-averaged total cross section (MeV -2) used to produce the events in the file, or zero if that information is not included in a particular format.
Definition at line 133 of file EventFileReader.hh.
Referenced by flux_averaged_xsec(), and get_flux_averaged_xsec().
|
protected |
Format of the output file being read.
This format will be determined automatically by deduce_file_format() and does not need to be specified by the user
Definition at line 94 of file EventFileReader.hh.
Referenced by deduce_file_format(), initialize(), next_event(), and operator bool().
|
protected |
Input stream used to read from textual output formats.
Definition at line 97 of file EventFileReader.hh.
Referenced by initialize(), next_event(), and operator bool().
|
protected |
Flag that indicates whether initialize() has been called or not.
To avoid problems with using virtual functions in the constructor, we defer nearly all of the initialization to the first call to one of the other public member functions.
Definition at line 139 of file EventFileReader.hh.
Referenced by ensure_initialized().
|
protected |
Helper object used to interpret ASCII-format HepMC3 files.
Definition at line 100 of file EventFileReader.hh.
Referenced by initialize(), and next_event().