|
MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
|
Class that represents an output file in a ROOT-based binary format for HepMC3 events. More...
#include <OutputFileRoot.hh>
Public Member Functions | |
| OutputFileRoot (const JSON &output_config) | |
| virtual int_fast64_t | bytes_written () override |
| The number of bytes that have been written during the current MARLEY session to this file. | |
| virtual bool | resume (std::unique_ptr< marley::Generator > &gen, long &num_previous_events) override |
| Load a marley::Generator object whose configuration and state were saved to the metadata in the output file. | |
| virtual void | write_event (HepMC3::GenEvent *event) override |
| Write a new HepMC3::GenEvent to this output file. | |
Public Member Functions inherited from marley::OutputFile | |
| bool | mode_is_resume () const |
| const std::string & | name () const |
Protected Member Functions | |
| void | clear_event_data () |
| Clears the temporary storage for event data. | |
| virtual void | open () |
| Opens the owned ROOT file with the correct settings. | |
Protected Member Functions inherited from marley::OutputFile | |
| OutputFile (const JSON &output_config) | |
| bool | check_if_file_exists (const std::string &filename) |
| Checks that a given file exists (and is readable) | |
| void | prompt_before_overwrite () |
| If mode_ is OVERWRITE and the output file already exists and force_ is false, prompt the user before overwriting. If the user declines, throw a marley::Error with a diagnostic message suggesting the "force" and "mode" configuration keys. | |
| std::unique_ptr< marley::Generator > | restore_generator (const marley::JSON &config) |
| Helper function for resume() that instantiates a marley::Generator object given the previous JSON configuration object. | |
Protected Attributes | |
| std::unique_ptr< TFile > | out_tfile_ |
| TFile object used to manage input/output. | |
| TTree * | out_tree_ = nullptr |
| TTree object used to store the events. | |
| std::shared_ptr< HepMC3::GenRunInfo > | run_info_ |
| Copy of the run information to check for a mismatch. | |
| std::unique_ptr< HepMC3::GenEventData > | temp_event_data_ |
| Temporary storage for the events. | |
| HepMC3::GenEventData * | temp_event_data_ptr_ = nullptr |
| std::unique_ptr< HepMC3::GenRunInfoData > | temp_run_info_data_ |
| Temporary storage for the run information. | |
Protected Attributes inherited from marley::OutputFile | |
| bool | force_ |
| Format | format_ |
| Format to use when writing events to the file. | |
| Mode | mode_ |
| std::string | name_ |
| Name of the file to receive output. | |
Additional Inherited Members | |
Public Types inherited from marley::OutputFile | |
| enum class | Format { ASCII , ROOT } |
Static Public Member Functions inherited from marley::OutputFile | |
| static std::shared_ptr< OutputFile > | make_OutputFile (const JSON &output_config) |
Protected Types inherited from marley::OutputFile | |
| enum class | Mode { OVERWRITE , RESUME } |
Static Protected Member Functions inherited from marley::OutputFile | |
| static void | merge_reweight_provenance_weights (HepMC3::GenRunInfo &run_info, marley::Generator &gen) |
| When resuming from a file that has been through one or more reweight passes, merge the reweight provenance weight calculator configurations with the original generate-time weights. Builds a combined Weighter and gives the Generator ownership. If no reweight provenance is found, this function is a no-op. | |
Class that represents an output file in a ROOT-based binary format for HepMC3 events.
Definition at line 38 of file OutputFileRoot.hh.
| marley::OutputFileRoot::OutputFileRoot | ( | const JSON & | output_config | ) |
Definition at line 34 of file OutputFileRoot.cc.
|
virtual |
Definition at line 40 of file OutputFileRoot.cc.
|
inlineoverridevirtual |
The number of bytes that have been written during the current MARLEY session to this file.
Implements marley::OutputFile.
Definition at line 49 of file OutputFileRoot.hh.
References out_tfile_.
|
protected |
Clears the temporary storage for event data.
Definition at line 180 of file OutputFileRoot.cc.
References temp_event_data_.
Referenced by resume(), and write_event().
|
protectedvirtual |
Opens the owned ROOT file with the correct settings.
Definition at line 45 of file OutputFileRoot.cc.
References marley::OutputFile::check_if_file_exists(), marley::OutputFile::name_, out_tfile_, out_tree_, marley::OutputFile::prompt_before_overwrite(), temp_event_data_, and temp_event_data_ptr_.
|
overridevirtual |
Load a marley::Generator object whose configuration and state were saved to the metadata in the output file.
| [out] | gen | A std::unique_ptr that will be filled with a restored Generator object constructed using the saved metadata |
| [out] | num_previous_events | The number of events previously saved to the output file |
Implements marley::OutputFile.
Definition at line 78 of file OutputFileRoot.cc.
References clear_event_data(), marley::OutputFile::merge_reweight_provenance_weights(), marley::OutputFile::name_, out_tfile_, out_tree_, marley::OutputFile::restore_generator(), run_info_, temp_event_data_, temp_run_info_data_, and HepMC3::StringAttribute::value().
|
overridevirtual |
Write a new HepMC3::GenEvent to this output file.
If a nullptr is passed to this function, then a marley::Error will be thrown
Implements marley::OutputFile.
Definition at line 153 of file OutputFileRoot.cc.
References clear_event_data(), out_tfile_, out_tree_, run_info_, temp_event_data_, and temp_run_info_data_.
|
protected |
TFile object used to manage input/output.
Definition at line 63 of file OutputFileRoot.hh.
Referenced by bytes_written(), open(), resume(), and write_event().
|
protected |
TTree object used to store the events.
Definition at line 68 of file OutputFileRoot.hh.
Referenced by open(), resume(), and write_event().
|
protected |
Copy of the run information to check for a mismatch.
Definition at line 81 of file OutputFileRoot.hh.
Referenced by resume(), and write_event().
|
protected |
Temporary storage for the events.
Definition at line 71 of file OutputFileRoot.hh.
Referenced by clear_event_data(), open(), resume(), and write_event().
|
protected |
Bare pointer to the event data storage (needed for some ROOT manipulations)
Definition at line 75 of file OutputFileRoot.hh.
Referenced by open().
|
protected |
Temporary storage for the run information.
Definition at line 78 of file OutputFileRoot.hh.
Referenced by resume(), and write_event().