MARLEY (Model of Argon Reaction Low Energy Yields)  v1.2.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
marley::RootEventFileReader Class Reference

Object that parses MARLEY output files written in any of the available formats, including ROOT format. More...

#include <RootEventFileReader.hh>

Inheritance diagram for marley::RootEventFileReader:
marley::EventFileReader

Public Member Functions

 RootEventFileReader (const std::string &file_name)
 
virtual bool next_event (marley::Event &ev) override
 Read the next MARLEY event record from the file. More...
 
virtual operator bool () const override
 Implicit boolean conversion allows the state of the input stream (or ROOT file) to be tested for readiness to read in another event.
 
- Public Member Functions inherited from marley::EventFileReader
 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. More...
 
EventFileReaderoperator>> (marley::Event &ev)
 Stream operator for reading in the next event.
 

Protected Member Functions

virtual bool deduce_file_format () override
 Helper function that auto-detects which of the available output formats is appropriate for the requested file.
 
virtual void initialize () override
 Prepares the file for reading the events.
 
- Protected Member Functions inherited from marley::EventFileReader
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. More...
 

Protected Attributes

std::unique_ptr< marley::Eventevent_
 Temporary storage for reading events in from a TFile.
 
long event_num_ = -1
 The index of the last TTree entry that was read. More...
 
marley::Eventevent_ptr_
 Bare pointer used to interface the event_ data member with a branch of ttree_ without requiring a manual delete statement anywhere.
 
std::unique_ptr< TFile > tfile_
 TFile used to read ROOT format output files.
 
TTree * ttree_
 
- Protected Attributes inherited from marley::EventFileReader
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. More...
 
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. More...
 
marley::JSON json_event_array_
 Used to parse events from JSON-format files.
 
marley::JSON::JSONWrapper< std::deque< marley::JSON > > json_event_array_wrapper_
 Used to iterate over events from JSON-format files.
 
std::deque< marley::JSON >::iterator json_event_iter_
 Iterator to the next JSON event in json_event_array.
 

Detailed Description

Object that parses MARLEY output files written in any of the available formats, including ROOT format.

Member Function Documentation

◆ next_event()

bool marley::RootEventFileReader::next_event ( marley::Event ev)
overridevirtual

Read the next MARLEY event record from the file.

Parameters
[out]evReference to the object that will be filled with the next event record
Returns
True if reading the next event was successful, or false otherwise. This behavior is designed to be used as a while loop condition for iterating over events in the output file

Reimplemented from marley::EventFileReader.

Member Data Documentation

◆ event_num_

long marley::RootEventFileReader::event_num_ = -1
protected

The index of the last TTree entry that was read.

If no events have been read from the TTree yet, then this variable will have the value -1


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