-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathSimConfig.h
More file actions
130 lines (114 loc) · 6.61 KB
/
SimConfig.h
File metadata and controls
130 lines (114 loc) · 6.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef O2_SIM_CONFIGURATION
#define O2_SIM_CONFIGURATION
#include <Rtypes.h>
#include <boost/program_options.hpp>
namespace o2
{
namespace conf
{
// configuration struct (which can be passed around)
struct SimConfigData {
std::vector<std::string> mActiveDetectors; // list of active detectors
std::string mMCEngine; // chosen VMC engine
std::string mGenerator; // chosen VMC generator
std::string mTrigger; // chosen VMC generator trigger
unsigned int mNEvents; // number of events to be simulated
std::string mExtKinFileName; // file name of external kinematics file (needed for ext kinematics generator)
std::string mExtGenFileName; // file name containing the external generator configuration
std::string mExtGenFuncName; // function call to retrieve the external generator configuration
std::string mExtTrgFileName; // file name containing the external trigger configuration
std::string mExtTrgFuncName; // function call to retrieve the external trigger configuration
std::string mEmbedIntoFileName; // filename containing the reference events to be used for the embedding
unsigned int mStartEvent; // index of first event to be taken
float mBMax; // maximum for impact parameter sampling
bool mIsMT; // chosen MT mode (Geant4 only)
std::string mOutputPrefix; // prefix to be used for output files
std::string mLogSeverity; // severity for FairLogger
std::string mLogVerbosity; // loglevel for FairLogger
std::string mKeyValueTokens; // a string holding arbitrary sequence of key-value tokens
// Foo.parameter1=x,Bar.parameter2=y,Baz.paramter3=hello
// (can be used to **loosely** change any configuration parameter from command-line)
std::string mConfigFile; // path to a JSON or INI config file (file extension is required to determine type).
// values within the config file will override values set in code by the param classes
// but will themselves be overridden by any values given in mKeyValueTokens.
int mPrimaryChunkSize; // defining max granularity for input primaries of a sim job
int mInternalChunkSize; //
int mStartSeed; // base for random number seeds
int mSimWorkers = 1; // number of parallel sim workers (when it applies)
bool mFilterNoHitEvents = false; // whether to filter out events not leaving any response
std::string mCCDBUrl; // the URL where to find CCDB
long mTimestamp; // timestamp to anchor transport simulation to
int mField; // L3 field setting in kGauss: +-2,+-5 and 0
ClassDefNV(SimConfigData, 3);
};
// A singleton class which can be used
// to centrally parse command line arguments and which can be queried
// from the various algorithms that need access to this information
// This is a quick/dirty solution allowing for some external configurability; A proper configuration scheme is currently
// being worked out;
class SimConfig
{
private:
SimConfig()
{
// activate from default parameters
char* argv[] = {};
resetFromArguments(1, argv);
};
public:
static SimConfig& Instance()
{
static SimConfig conf;
return conf;
}
static void initOptions(boost::program_options::options_description&);
// initializes the configuration from command line arguments
// returns true of correctly initialized and not --help called
bool resetFromArguments(int argc, char* argv[]);
// initializes from existing parsed map
bool resetFromParsedMap(boost::program_options::variables_map const&);
void resetFromConfigData(SimConfigData const& data) { mConfigData = data; }
SimConfigData const& getConfigData() const { return mConfigData; }
// get MC engine
std::string getMCEngine() const { return mConfigData.mMCEngine; }
// get selected active detectors
std::vector<std::string> const& getActiveDetectors() const { return mConfigData.mActiveDetectors; }
// get selected generator (to be used to select a genconfig)
std::string getGenerator() const { return mConfigData.mGenerator; }
std::string getTrigger() const { return mConfigData.mTrigger; }
unsigned int getNEvents() const { return mConfigData.mNEvents; }
std::string getExtKinematicsFileName() const { return mConfigData.mExtKinFileName; }
std::string getExtGeneratorFileName() const { return mConfigData.mExtGenFileName; }
std::string getExtGeneratorFuncName() const { return mConfigData.mExtGenFuncName; }
std::string getExtTriggerFileName() const { return mConfigData.mExtTrgFileName; }
std::string getExtTriggerFuncName() const { return mConfigData.mExtTrgFuncName; }
std::string getEmbedIntoFileName() const { return mConfigData.mEmbedIntoFileName; }
unsigned int getStartEvent() const { return mConfigData.mStartEvent; }
float getBMax() const { return mConfigData.mBMax; }
bool getIsMT() const { return mConfigData.mIsMT; }
std::string getOutPrefix() const { return mConfigData.mOutputPrefix; }
std::string getLogVerbosity() const { return mConfigData.mLogVerbosity; }
std::string getLogSeverity() const { return mConfigData.mLogSeverity; }
std::string getKeyValueString() const { return mConfigData.mKeyValueTokens; }
std::string getConfigFile() const { return mConfigData.mConfigFile; }
int getPrimChunkSize() const { return mConfigData.mPrimaryChunkSize; }
int getInternalChunkSize() const { return mConfigData.mInternalChunkSize; }
int getStartSeed() const { return mConfigData.mStartSeed; }
int getNSimWorkers() const { return mConfigData.mSimWorkers; }
bool isFilterOutNoHitEvents() const { return mConfigData.mFilterNoHitEvents; }
private:
SimConfigData mConfigData; //!
ClassDefNV(SimConfig, 1);
};
} // namespace conf
} // namespace o2
#endif