GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RunOpt.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::RunOpt
5 
6 \brief Some common run-time GENIE options.
7 
8 \author Costas Andreopoulos <c.andreopoulos \at cern.ch>
9  University of Liverpool
10 
11 \created January 29, 2013
12 
13 \cpright Copyright (c) 2003-2024, The GENIE Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15 */
16 //____________________________________________________________________________
17 
18 #ifndef _RUN_OPT_H_
19 #define _RUN_OPT_H_
20 
21 #include <iostream>
22 #include <string>
23 
24 #include "Framework/Utils/TuneId.h"
25 
26 class TBits;
27 
28 using std::ostream;
29 
30 namespace genie {
31 
32 class RunOpt;
33 ostream & operator << (ostream & stream, const RunOpt & opt);
34 
35 class RunOpt
36 {
37 public:
38  static RunOpt * Instance(void);
39 
40  // Read options from the command line. Call from all GENIE command-line apps.
41  void ReadFromCommandLine(int argc, char ** argv);
42  // Centralized printout of what ReadFromCommandLine() will look for
43  static std::string RunOptSyntaxString(bool include_generator_specific);
44 
45  // Get options set.
46  TuneId * Tune (void) const { return fTune; }
47  string EventGeneratorList (void) const { return fEventGeneratorList; }
48  string CacheFile (void) const { return fCacheFile; }
49  string MesgThresholdFiles (void) const { return fMesgThresholds; }
50  TBits* UnphysEventMask (void) const { return fUnphysEventMask; }
51  int EventRecordPrintLevel (void) const { return fEventRecordPrintLevel; }
52  int MCJobStatusRefreshRate (void) const { return fMCJobStatusRefreshRate; }
53  bool BareXSecPreCalc (void) const { return fEnableBareXSecPreCalc; }
54  string XMLPath (void) const { return fXMLPath; }
55 
56  // If a user accesses the GENIE objects directly, then most of the options above
57  // can be set directly to the relevant objects (Messenger, Cache, etc).
58  //
59  void SetTuneName(string tuneName="Default");
60  void BuildTune(); ///< build tune and inform XSecSplineList
61  void SetEventGeneratorList(string evgenlist) { fEventGeneratorList = evgenlist; }
62  void EnableBareXSecPreCalc(bool flag) { fEnableBareXSecPreCalc = flag; }
63 
64  // Print
65  void Print (ostream & stream) const;
66  friend ostream & operator << (ostream & stream, const RunOpt & opt);
67 
68 private:
69 
70  void Init (void);
71 
72  // options
73  TuneId * fTune; ///< GENIE comprehensive neutrino interaction model tune.
74  string fEventGeneratorList; ///< Name of event generator list to be loaded by the event generation drivers.
75  string fCacheFile; ///< Name of cache file, is cache is to be re-used.
76  string fMesgThresholds; ///< List of files (delimited with : if more than one) with custom mesg stream thresholds.
77  TBits* fUnphysEventMask; ///< Unphysical event mask.
78  int fEventRecordPrintLevel; ///< GHEP event r ecord print level.
79  int fMCJobStatusRefreshRate; ///< MC job status file refresh rate.
80  bool fEnableBareXSecPreCalc; ///< Cache calcs relevant to free-nucleon xsecs before any nuclear xsec computation?
81  ///< The option switches on/off cacheing calculations which interfere with event reweighting.
82  string fXMLPath; ///< An path to look for XML in. Higher priority than GXMLPATH
83 
84  // Self
85  static RunOpt * fInstance;
86 
87  // Singleton class: constructors are private
88  RunOpt();
89  RunOpt(const RunOpt & opt);
90  virtual ~RunOpt();
91 
92  // Clean-up
93  struct Cleaner {
96  if (RunOpt::fInstance !=0) {
97  delete RunOpt::fInstance;
99  }
100  }
101  };
102  friend struct Cleaner;
103 };
104 
105 } // genie namespace
106 #endif // _RUN_OPT_H_
string EventGeneratorList(void) const
Definition: RunOpt.h:47
TuneId * Tune(void) const
Definition: RunOpt.h:46
static RunOpt * fInstance
Definition: RunOpt.h:85
string CacheFile(void) const
Definition: RunOpt.h:48
string fMesgThresholds
List of files (delimited with : if more than one) with custom mesg stream thresholds.
Definition: RunOpt.h:76
void ReadFromCommandLine(int argc, char **argv)
Definition: RunOpt.cxx:99
string fCacheFile
Name of cache file, is cache is to be re-used.
Definition: RunOpt.h:75
TBits * UnphysEventMask(void) const
Definition: RunOpt.h:50
int fEventRecordPrintLevel
GHEP event r ecord print level.
Definition: RunOpt.h:78
string MesgThresholdFiles(void) const
Definition: RunOpt.h:49
void SetEventGeneratorList(string evgenlist)
Definition: RunOpt.h:61
void Init(void)
Definition: RunOpt.cxx:64
Some common run-time GENIE options.
Definition: RunOpt.h:35
TBits * fUnphysEventMask
Unphysical event mask.
Definition: RunOpt.h:77
bool BareXSecPreCalc(void) const
Definition: RunOpt.h:53
friend ostream & operator<<(ostream &stream, const RunOpt &opt)
Definition: RunOpt.cxx:32
static std::string RunOptSyntaxString(bool include_generator_specific)
Definition: RunOpt.cxx:157
int fMCJobStatusRefreshRate
MC job status file refresh rate.
Definition: RunOpt.h:79
TuneId * fTune
GENIE comprehensive neutrino interaction model tune.
Definition: RunOpt.h:73
string XMLPath(void) const
Definition: RunOpt.h:54
void BuildTune()
build tune and inform XSecSplineList
Definition: RunOpt.cxx:92
bool fEnableBareXSecPreCalc
Definition: RunOpt.h:80
string fEventGeneratorList
Name of event generator list to be loaded by the event generation drivers.
Definition: RunOpt.h:74
virtual ~RunOpt()
Definition: RunOpt.cxx:47
static RunOpt * Instance(void)
Definition: RunOpt.cxx:54
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
GENIE tune ID.
Definition: TuneId.h:37
int EventRecordPrintLevel(void) const
Definition: RunOpt.h:51
void DummyMethodAndSilentCompiler()
Definition: RunOpt.h:94
void EnableBareXSecPreCalc(bool flag)
Definition: RunOpt.h:62
void Print(ostream &stream) const
Definition: RunOpt.cxx:185
void SetTuneName(string tuneName="Default")
Definition: RunOpt.cxx:81
int MCJobStatusRefreshRate(void) const
Definition: RunOpt.h:52
string fXMLPath
An path to look for XML in. Higher priority than GXMLPATH.
Definition: RunOpt.h:82