MARLEY (Model of Argon Reaction Low Energy Yields)  v1.0.0
A Monte Carlo event generator for tens-of-MeV neutrino-nucleus interactions in liquid argon
 All Classes Functions Variables Enumerations Pages
Public Member Functions | Protected Member Functions | List of all members
marley::RootConfigurationFile Class Reference

ConfigurationFile that adds support for ROOT input and output. More...

#include <RootConfigurationFile.hh>

Inheritance diagram for marley::RootConfigurationFile:
marley::ConfigurationFile

Public Member Functions

 RootConfigurationFile ()
 Create a RootConfigurationFile object with all options set to their default values.
 
 RootConfigurationFile (const std::string &file_name)
 Parse a file to create this RootConfigurationFile object. More...
 
Executable option accessors

Functions that access configuration file options that are only used if MARLEY is being run as an executable

bool check_overwrite_root () const
 Check whether a pre-existing ROOT file will be silently overwritten (true) or whether the executable will prompt the user to confirm an overwrite (false)
 
bool check_write_root () const
 Check whether a ROOT format file will be written (true) or not (false)
 
std::string get_root_filename () const
 Get the name of the ROOT format file that will receive Event output.
 
- Public Member Functions inherited from marley::ConfigurationFile
 ConfigurationFile ()
 Create a ConfigurationFile object with all options set to their default values.
 
 ConfigurationFile (const std::string &file_name)
 Parse a file to create this ConfigurationFile object. More...
 
void add_reaction_filename (const std::string &rfile)
 Add a new reaction data file name. More...
 
void clear_reaction_filenames ()
 Clear the list of reaction data files.
 
const std::array< double, 3 > & get_neutrino_direction ()
 Gets a three-vector pointing in the direction of the incident neutrinos.
 
const std::unordered_set
< std::string > & 
get_reaction_filenames () const
 Get the name(s) of the reaction data files that will be used to create the Reaction object(s)
 
uint_fast64_t get_seed () const
 Get the random number seed that will be used to initialize a Generator.
 
std::unique_ptr
< marley::NeutrinoSource > & 
get_source ()
 Get a unique_ptr reference to the NeutrinoSource that will be used to help create a Generator object.
 
std::unique_ptr
< marley::StructureDatabase > & 
get_structure_db ()
 Get a unique_ptr reference to the StructureDatabase that will be used to help create a Generator object.
 
void print_summary (std::ostream &os=std::cout)
 Print a summary of the configuration file settings to a std::ostream.
 
void remove_reaction_filename (const std::string &rfile)
 Remove an existing reaction data file name. More...
 
void set_neutrino_direction (const std::array< double, 3 > &dir_vec)
 Sets the incident neutrino direction. More...
 
void set_seed (uint_fast64_t s)
 Set the random number seed that will be used to initialize a Generator.
 
void set_source (std::unique_ptr< marley::NeutrinoSource > &&new_source)
 Transfers ownership of a NeutrinoSource to this ConfigurationFile, deleting the previous source if one exists.
 
bool check_overwrite_hepevt () const
 Check whether a pre-existing HEPEvt file will be silently overwritten (true) or whether the executable will prompt the user to confirm an overwrite (false)
 
bool check_write_hepevt () const
 Check whether a HEPEvt format file will be written (true) or not (false)
 
std::string get_hepevt_filename () const
 Get the name of the HEPEvt format file that will receive Event output.
 
size_t get_num_events ()
 Get the number of events that should be generated during a single run of the executable.
 

Protected Member Functions

virtual bool process_extra_keywords () override
 Helper function that allows extra configuration file keywords to be processed by derived classes (like RootConfigurationFile) without needing to override parse(). More...
 
virtual bool process_extra_source_types (const std::string &type, int neutrino_pid) override
 Helper function that allows extra NeutrinoSource types to be created by derived classes (like RootConfigurationFile) without needing to override parse(). More...
 
- Protected Member Functions inherited from marley::ConfigurationFile
void add_decay_schemes (const std::string &file_name, const marley::DecayScheme::FileFormat format, const std::set< int > &nucleus_pdg_codes)
 Helper function to add DecayScheme objects to the structure database. More...
 
bool next_word_from_line (std::string &word, bool enable_exceptions=true, bool make_lowercase=true)
 Helper function for parse() that gets the next word from a parsed line of the configuration file. More...
 
void parse ()
 Helper function for the constructor that handles file parsing.
 

Protected Attributes

Executable options

Data members that store configuration file options that are only used if MARLEY is being run as an executable

bool check_root_overwrite_
 Whether to prompt the user (true) or not (false) before overwriting a previously-existing ROOT format file.
 
std::string root_filename_
 Name of the ROOT format file that will receive Event output.
 
bool write_root_
 Whether to create a ROOT format output file (true) or not (false)
 
- Protected Attributes inherited from marley::ConfigurationFile
std::array< double, 3 > dir_vec_ = DEFAULT_INCIDENT_NEUTRINO_DIRECTION_
 Three-vector that points in the direction of the incident neutrinos.
 
std::string filename_
 Name of the configuration file to parse.
 
std::unordered_set< std::string > reaction_filenames_
 Reaction data files to parse when creating Reaction objects.
 
uint_fast64_t seed_
 Random number seed to use when creating a Generator.
 
std::unique_ptr
< marley::NeutrinoSource
source_
 A NeutrinoSource object that is created based on the specifications given in the configuration file. More...
 
std::unique_ptr
< marley::StructureDatabase
structure_db_
 StructureDatabase that holds the discrete level data specified in the configuration file.
 
std::ifstream file_in_
 std::ifstream used to read the configuration file
 
std::istringstream iss_
 Stream used to parse each line.
 
std::string keyword_
 String that stores the current keyword read in from the configuration file.
 
std::string line_
 String that stores the current line of the configuration file during parsing.
 
size_t line_num_
 The current line number being processed.
 
bool check_hepevt_overwrite_
 Whether to prompt the user (true) or not (false) before overwriting a previously-existing HEPEvt format file.
 
std::string hepevt_filename_
 Name of the HEPEvt format file that will receive Event output.
 
size_t num_events_
 The number of events to generate.
 
bool write_hepevt_
 Whether to create a HEPEvt format output file (true) or not (false)
 

Additional Inherited Members

- Static Public Member Functions inherited from marley::ConfigurationFile
static std::array< double, 3 > get_default_neutrino_direction ()
 Gets a three-vector pointing in the default incident neutrino direction.
 
- Static Protected Member Functions inherited from marley::ConfigurationFile
static std::string neutrino_pid_to_string (int pdg)
 Convert a neutrino PDG code to a string. More...
 
- Static Protected Attributes inherited from marley::ConfigurationFile
static const std::array
< double, 3 > 
DEFAULT_INCIDENT_NEUTRINO_DIRECTION_ = { 0., 0., 1.}
 Default incident neutrino direction to use for generating events.
 
static constexpr size_t DEFAULT_NUM_EVENTS_ = 1000
 The default number of events to generate.
 

Detailed Description

ConfigurationFile that adds support for ROOT input and output.

Constructor & Destructor Documentation

marley::RootConfigurationFile::RootConfigurationFile ( const std::string &  file_name)

Parse a file to create this RootConfigurationFile object.

Parameters
file_nameThe name of the file to parse

Member Function Documentation

bool marley::RootConfigurationFile::process_extra_keywords ( )
overrideprotectedvirtual

Helper function that allows extra configuration file keywords to be processed by derived classes (like RootConfigurationFile) without needing to override parse().

This method is overridden by the derived class RootConfigurationFile to handle keywords specifying details of the ROOT output when MARLEY is run as an executable.

Returns
If an extra keyword was successfully processed, then this function returns true. Otherwise, it returns false.

Reimplemented from marley::ConfigurationFile.

bool marley::RootConfigurationFile::process_extra_source_types ( const std::string &  type,
int  neutrino_pdg 
)
overrideprotectedvirtual

Helper function that allows extra NeutrinoSource types to be created by derived classes (like RootConfigurationFile) without needing to override parse().

This method is overridden by the derived class RootConfigurationFile to allow NeutrinoSource objects to be created that require ROOT libraries to load.

Returns
If a NeutrinoSource was successfully created using one of the extra types, then this function returns true. Otherwise, it returns false.
Parameters
typeString from the configuration file indicating what NeutrinoSource type is being requested
intneutrino_pdg PDG code for the neutrino type produced by the new source

Reimplemented from marley::ConfigurationFile.


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