25#include "marley/OutputFile.hh"
29#include "HepMC3/Data/GenEventData.h"
30#include "HepMC3/Data/GenRunInfoData.h"
31#include "HepMC3/GenRunInfo.h"
48 class EventFileReader {
52 EventFileReader(
const std::string& file_name );
54 virtual ~EventFileReader() =
default;
83 virtual operator bool()
const;
100 std::shared_ptr< HepMC3::ReaderAscii >
reader_;
104 std::unique_ptr< TFile > tfile_;
107 TTree* ttree_ =
nullptr;
112 long event_num_ = -1;
116 std::unique_ptr< HepMC3::GenEventData > temp_event_data_;
127 std::shared_ptr< HepMC3::GenRunInfo > run_info_;
Stores event-related information.
Stores run-related information.
GenEvent I/O parsing for structured text files.
virtual void initialize()
Prepares the file for reading the events.
virtual bool deduce_file_format()
Helper function that auto-detects which of the available output formats is appropriate for the reques...
bool initialized_
Flag that indicates whether initialize() has been called or not.
double flux_avg_tot_xs_
Flux-averaged total cross section (MeV -2) used to produce the events in the file,...
virtual bool next_event(HepMC3::GenEvent &ev)
Read the next MARLEY event record from the file.
void ensure_initialized()
This function should be called at the beginning of all public member functions of EventFileReader tha...
std::string file_name_
Name of the file (with any needed path specification) to be read.
void get_flux_averaged_xsec(const HepMC3::GenRunInfo &run_info)
double flux_averaged_xsec(bool natural_units=false)
Returns the flux-averaged total cross section used to produce the events in the file.
std::shared_ptr< HepMC3::ReaderAscii > reader_
Helper object used to interpret ASCII-format HepMC3 files.
OutputFile::Format format_
Format of the output file being read.
std::ifstream in_
Input stream used to read from textual output formats.
EventFileReader & operator>>(HepMC3::GenEvent &ev)
Stream operator for reading in the next event.
Stores serializable event information.
Stores serializable run information.