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 <constantinos.andreopoulos \at cern.ch>
9  University of Liverpool & STFC Rutherford Appleton Laboratory
10 
11 \created January 29, 2013
12 
13 \cpright Copyright (c) 2003-2020, 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 
43  // Get options set.
44  TuneId * Tune (void) const { return fTune; }
45  string EventGeneratorList (void) const { return fEventGeneratorList; }
46  string CacheFile (void) const { return fCacheFile; }
47  string MesgThresholdFiles (void) const { return fMesgThresholds; }
48  TBits* UnphysEventMask (void) const { return fUnphysEventMask; }
49  int EventRecordPrintLevel (void) const { return fEventRecordPrintLevel; }
50  int MCJobStatusRefreshRate (void) const { return fMCJobStatusRefreshRate; }
51  bool BareXSecPreCalc (void) const { return fEnableBareXSecPreCalc; }
52  string XMLPath (void) const { return fXMLPath; }
53 
54  // If a user accesses the GENIE objects directly, then most of the options above
55  // can be set directly to the relevant objects (Messenger, Cache, etc).
56  //
57  void SetTuneName(string tuneName="Default");
58  void BuildTune(); ///< build tune and inform XSecSplineList
59  void SetEventGeneratorList(string evgenlist) { fEventGeneratorList = evgenlist; }
60  void EnableBareXSecPreCalc(bool flag) { fEnableBareXSecPreCalc = flag; }
61 
62  // Print
63  void Print (ostream & stream) const;
64  friend ostream & operator << (ostream & stream, const RunOpt & opt);
65 
66 private:
67 
68  void Init (void);
69 
70  // options
71  TuneId * fTune; ///< GENIE comprehensive neutrino interaction model tune.
72  string fEventGeneratorList; ///< Name of event generator list to be loaded by the event generation drivers.
73  string fCacheFile; ///< Name of cache file, is cache is to be re-used.
74  string fMesgThresholds; ///< List of files (delimited with : if more than one) with custom mesg stream thresholds.
75  TBits* fUnphysEventMask; ///< Unphysical event mask.
76  int fEventRecordPrintLevel; ///< GHEP event r ecord print level.
77  int fMCJobStatusRefreshRate; ///< MC job status file refresh rate.
78  bool fEnableBareXSecPreCalc; ///< Cache calcs relevant to free-nucleon xsecs before any nuclear xsec computation?
79  ///< The option switches on/off cacheing calculations which interfere with event reweighting.
80  string fXMLPath; ///< An path to look for XML in. Higher priority than GXMLPATH
81 
82  // Self
83  static RunOpt * fInstance;
84 
85  // Singleton class: constructors are private
86  RunOpt();
87  RunOpt(const RunOpt & opt);
88  virtual ~RunOpt();
89 
90  // Clean-up
91  struct Cleaner {
94  if (RunOpt::fInstance !=0) {
95  delete RunOpt::fInstance;
97  }
98  }
99  };
100  friend struct Cleaner;
101 };
102 
103 } // genie namespace
104 #endif // _RUN_OPT_H_
string EventGeneratorList(void) const
Definition: RunOpt.h:45
TuneId * Tune(void) const
Definition: RunOpt.h:44
static RunOpt * fInstance
Definition: RunOpt.h:83
string CacheFile(void) const
Definition: RunOpt.h:46
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
string fMesgThresholds
List of files (delimited with : if more than one) with custom mesg stream thresholds.
Definition: RunOpt.h:74
void ReadFromCommandLine(int argc, char **argv)
Definition: RunOpt.cxx:99
opt
Definition: train.py:196
string fCacheFile
Name of cache file, is cache is to be re-used.
Definition: RunOpt.h:73
TBits * UnphysEventMask(void) const
Definition: RunOpt.h:48
int fEventRecordPrintLevel
GHEP event r ecord print level.
Definition: RunOpt.h:76
string MesgThresholdFiles(void) const
Definition: RunOpt.h:47
void SetEventGeneratorList(string evgenlist)
Definition: RunOpt.h:59
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:75
bool BareXSecPreCalc(void) const
Definition: RunOpt.h:51
friend ostream & operator<<(ostream &stream, const RunOpt &opt)
Definition: RunOpt.cxx:32
int fMCJobStatusRefreshRate
MC job status file refresh rate.
Definition: RunOpt.h:77
TuneId * fTune
GENIE comprehensive neutrino interaction model tune.
Definition: RunOpt.h:71
string XMLPath(void) const
Definition: RunOpt.h:52
void BuildTune()
build tune and inform XSecSplineList
Definition: RunOpt.cxx:92
bool fEnableBareXSecPreCalc
Definition: RunOpt.h:78
string fEventGeneratorList
Name of event generator list to be loaded by the event generation drivers.
Definition: RunOpt.h:72
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:49
void DummyMethodAndSilentCompiler()
Definition: RunOpt.h:92
void EnableBareXSecPreCalc(bool flag)
Definition: RunOpt.h:60
void Print(ostream &stream) const
Definition: RunOpt.cxx:157
void SetTuneName(string tuneName="Default")
Definition: RunOpt.cxx:81
int MCJobStatusRefreshRate(void) const
Definition: RunOpt.h:50
string fXMLPath
An path to look for XML in. Higher priority than GXMLPATH.
Definition: RunOpt.h:80