17 #ifndef Pythia8_Settings_H 18 #define Pythia8_Settings_H 20 #include "Pythia8/Logger.h" 21 #include "Pythia8/PythiaStdlib.h" 34 Flag(
string nameIn =
" ",
bool defaultIn =
false) :
name(nameIn),
35 valNow(defaultIn) , valDefault(defaultIn) { }
39 bool valNow, valDefault;
52 Mode(
string nameIn =
" ",
int defaultIn = 0,
bool hasMinIn =
false,
53 bool hasMaxIn =
false,
int minIn = 0,
int maxIn = 0,
54 bool optOnlyIn =
false) :
name(nameIn), valNow(defaultIn),
55 valDefault(defaultIn), hasMin(hasMinIn), hasMax(hasMaxIn),
56 valMin(minIn), valMax(maxIn), optOnly(optOnlyIn) { }
60 int valNow, valDefault;
76 Parm(
string nameIn =
" ",
double defaultIn = 0.,
77 bool hasMinIn =
false,
bool hasMaxIn =
false,
double minIn = 0.,
78 double maxIn = 0.) :
name(nameIn), valNow(defaultIn),
79 valDefault(defaultIn), hasMin(hasMinIn), hasMax(hasMaxIn),
80 valMin(minIn), valMax(maxIn) { }
84 double valNow, valDefault;
86 double valMin, valMax;
99 Word(
string nameIn =
" ",
string defaultIn =
" ") :
name(nameIn),
100 valNow(defaultIn) , valDefault(defaultIn) { }
103 string name, valNow, valDefault;
116 FVec(
string nameIn =
" ", vector<bool> defaultIn = vector<bool>(1,
false)) :
117 name(nameIn), valNow(defaultIn) , valDefault(defaultIn) { }
121 vector<bool> valNow, valDefault;
134 MVec(
string nameIn =
" ", vector<int> defaultIn = vector<int>(1, 0),
135 bool hasMinIn =
false,
bool hasMaxIn =
false,
int minIn = 0,
136 int maxIn = 0) :
name(nameIn), valNow(defaultIn),
137 valDefault(defaultIn), hasMin(hasMinIn), hasMax(hasMaxIn),
138 valMin(minIn), valMax(maxIn) { }
142 vector<int> valNow, valDefault;
157 PVec(
string nameIn =
" ", vector<double> defaultIn = vector<double>(1, 0.),
158 bool hasMinIn =
false,
bool hasMaxIn =
false,
double minIn = 0.,
159 double maxIn = 0.) :
name(nameIn), valNow(defaultIn),
160 valDefault(defaultIn), hasMin(hasMinIn), hasMax(hasMaxIn),
161 valMin(minIn), valMax(maxIn) { }
165 vector<double> valNow, valDefault;
167 double valMin, valMax;
180 WVec(
string nameIn =
" ", vector<string> defaultIn = vector<string>(1,
" "))
181 :
name(nameIn), valNow(defaultIn) , valDefault(defaultIn) { }
185 vector<string> valNow, valDefault;
200 Settings() : loggerPtr(), isInit(false), readingFailedSave(false),
207 bool init(
string startFile =
"../share/Pythia8/xmldoc/Index.xml",
208 bool append =
false) ;
211 bool init(istream& is,
bool append =
false) ;
214 bool reInit(
string startFile =
"../share/Pythia8/xmldoc/Index.xml") ;
217 bool readString(
string line,
bool warn =
true) ;
220 bool registerPluginLibrary(
string libName,
string startFile =
"");
223 bool writeFile(
string toFile,
bool writeAll =
false) ;
224 bool writeFile(ostream& os = cout,
bool writeAll =
false) ;
225 bool writeFileXML(ostream& os = cout) ;
230 void listChanged() { list (
false,
false,
" "); }
231 void list(
string match) { list (
false,
true, match); }
234 string output(
string keyIn,
bool fullLine =
true);
239 if (subrun == -999)
return readStringHistory;
240 else if (readStringSubrun.find(subrun) != readStringSubrun.end())
241 return readStringSubrun[subrun];
242 else return vector<string>();
250 return (flags.find(
toLower(keyIn)) != flags.end()); }
251 bool isMode(
string keyIn) {
252 return (modes.find(
toLower(keyIn)) != modes.end()); }
253 bool isParm(
string keyIn) {
254 return (parms.find(
toLower(keyIn)) != parms.end()); }
255 bool isWord(
string keyIn) {
256 return (words.find(
toLower(keyIn)) != words.end()); }
257 bool isFVec(
string keyIn) {
258 return (fvecs.find(
toLower(keyIn)) != fvecs.end()); }
259 bool isMVec(
string keyIn) {
260 return (mvecs.find(
toLower(keyIn)) != mvecs.end()); }
261 bool isPVec(
string keyIn) {
262 return (pvecs.find(
toLower(keyIn)) != pvecs.end()); }
263 bool isWVec(
string keyIn) {
264 return (wvecs.find(
toLower(keyIn)) != wvecs.end()); }
269 void addMode(
string keyIn,
int defaultIn,
bool hasMinIn,
270 bool hasMaxIn,
int minIn,
int maxIn,
bool optOnlyIn =
false) {
271 modes[
toLower(keyIn)] =
Mode(keyIn, defaultIn, hasMinIn, hasMaxIn,
272 minIn, maxIn, optOnlyIn); }
273 void addParm(
string keyIn,
double defaultIn,
bool hasMinIn,
274 bool hasMaxIn,
double minIn,
double maxIn) { parms[
toLower(keyIn)]
275 =
Parm(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
276 void addWord(
string keyIn,
string defaultIn) {
278 void addFVec(
string keyIn, vector<bool> defaultIn) {
280 void addMVec(
string keyIn, vector<int> defaultIn,
bool hasMinIn,
281 bool hasMaxIn,
int minIn,
int maxIn) { mvecs[
toLower(keyIn)]
282 =
MVec(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
283 void addPVec(
string keyIn, vector<double> defaultIn,
bool hasMinIn,
284 bool hasMaxIn,
double minIn,
double maxIn) { pvecs[
toLower(keyIn)]
285 =
PVec(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
286 void addWVec(
string keyIn, vector<string> defaultIn) {
290 bool flag(
string keyIn);
291 int mode(
string keyIn);
292 double parm(
string keyIn);
293 string word(
string keyIn);
294 vector<bool> fvec(
string keyIn);
295 vector<int> mvec(
string keyIn);
296 vector<double> pvec(
string keyIn);
297 vector<string> wvec(
string keyIn);
300 bool flagDefault(
string keyIn);
301 int modeDefault(
string keyIn);
302 double parmDefault(
string keyIn);
303 string wordDefault(
string keyIn);
304 vector<bool> fvecDefault(
string keyIn);
305 vector<int> mvecDefault(
string keyIn);
306 vector<double> pvecDefault(
string keyIn);
307 vector<string> wvecDefault(
string keyIn);
310 map<string, Flag> getFlagMap(
string match);
311 map<string, Mode> getModeMap(
string match);
312 map<string, Parm> getParmMap(
string match);
313 map<string, Word> getWordMap(
string match);
314 map<string, FVec> getFVecMap(
string match);
315 map<string, MVec> getMVecMap(
string match);
316 map<string, PVec> getPVecMap(
string match);
317 map<string, WVec> getWVecMap(
string match);
320 void flag(
string keyIn,
bool nowIn,
bool force =
false);
321 bool mode(
string keyIn,
int nowIn,
bool force =
false);
322 bool parm(
string keyIn,
double nowIn,
bool force =
false);
323 void word(
string keyIn,
string nowIn,
bool force =
false);
324 void fvec(
string keyIn, vector<bool> nowIn,
bool force =
false);
325 bool mvec(
string keyIn, vector<int> nowIn,
bool force =
false);
326 bool pvec(
string keyIn, vector<double> nowIn,
bool force =
false);
327 void wvec(
string keyIn, vector<string> nowIn,
bool force =
false);
331 void forceMode(
string keyIn,
int nowIn) {mode(keyIn,nowIn,
true);}
332 void forceParm(
string keyIn,
double nowIn) {parm(keyIn,nowIn,
true);}
333 void forceMVec(
string keyIn, vector<int> nowIn) {mvec(keyIn,nowIn,
true);}
334 void forcePVec(
string keyIn, vector<double> nowIn) {pvec(keyIn,nowIn,
true);}
337 void resetFlag(
string keyIn);
338 void resetMode(
string keyIn);
339 void resetParm(
string keyIn);
340 void resetWord(
string keyIn);
341 void resetFVec(
string keyIn);
342 void resetMVec(
string keyIn);
343 void resetPVec(
string keyIn);
344 void resetWVec(
string keyIn);
364 map<string, Flag> flags;
367 map<string, Mode> modes;
370 map<string, Parm> parms;
373 map<string, Word> words;
376 map<string, FVec> fvecs;
379 map<string, MVec> mvecs;
382 map<string, PVec> pvecs;
385 map<string, WVec> wvecs;
388 set<string> pluginLibraries;
391 bool isInit, readingFailedSave;
398 vector<string> readStringHistory;
399 map<int, vector<string> > readStringSubrun;
402 void list(
bool doListAll,
bool doListString,
string match);
405 void printQuiet(
bool quiet);
412 void initTuneEE(
int eeTune);
413 void initTunePP(
int ppTune);
416 bool boolString(
string tag);
417 string attributeValue(
string line,
string attribute);
418 bool boolAttributeValue(
string line,
string attribute);
419 int intAttributeValue(
string line,
string attribute);
420 double doubleAttributeValue(
string line,
string attribute);
421 vector<bool> boolVectorAttributeValue(
string line,
string attribute);
422 vector<int> intVectorAttributeValue(
string line,
string attribute);
423 vector<double> doubleVectorAttributeValue(
string line,
string attribute);
424 vector<string> stringVectorAttributeValue(
string line,
string attribute);
void initPtrs(Logger *loggerPtrIn)
Initialize Logger pointer.
Definition: Settings.h:204
void forceMode(string keyIn, int nowIn)
Definition: Settings.h:331
string name
Data members.
Definition: Settings.h:184
Class for double parms (where parm is shorthand for parameter).
Definition: Settings.h:71
Mode(string nameIn=" ", int defaultIn=0, bool hasMinIn=false, bool hasMaxIn=false, int minIn=0, int maxIn=0, bool optOnlyIn=false)
Constructor.
Definition: Settings.h:52
FVec(string nameIn=" ", vector< bool > defaultIn=vector< bool >(1, false))
Constructor.
Definition: Settings.h:116
Word(string nameIn=" ", string defaultIn=" ")
Constructor.
Definition: Settings.h:99
PVec(string nameIn=" ", vector< double > defaultIn=vector< double >(1, 0.), bool hasMinIn=false, bool hasMaxIn=false, double minIn=0., double maxIn=0.)
Constructor.
Definition: Settings.h:157
string name
Data members.
Definition: Settings.h:164
Class for integer modes.
Definition: Settings.h:47
Class for string words.
Definition: Settings.h:94
Class for bool flags.
Definition: Settings.h:29
string name
Data members.
Definition: Settings.h:103
string toLower(const string &name, bool trim=true)
Definition: PythiaStdlib.cc:17
bool isFlag(string keyIn)
Query existence of an entry.
Definition: Settings.h:249
string name
Data members.
Definition: Settings.h:83
Class for vector of integers.
Definition: Settings.h:129
WVec(string nameIn=" ", vector< string > defaultIn=vector< string >(1," "))
Constructor.
Definition: Settings.h:180
Flag(string nameIn=" ", bool defaultIn=false)
Constructor.
Definition: Settings.h:34
bool getIsInit()
Check initialisation status.
Definition: Settings.h:347
Class for vector of doubles.
Definition: Settings.h:152
string name
Data members.
Definition: Settings.h:120
string name
Data members.
Definition: Settings.h:141
vector< string > getReadHistory(int subrun=-999)
Definition: Settings.h:238
MVec(string nameIn=" ", vector< int > defaultIn=vector< int >(1, 0), bool hasMinIn=false, bool hasMaxIn=false, int minIn=0, int maxIn=0)
Constructor.
Definition: Settings.h:134
Parm(string nameIn=" ", double defaultIn=0., bool hasMinIn=false, bool hasMaxIn=false, double minIn=0., double maxIn=0.)
Constructor.
Definition: Settings.h:76
bool readingFailed()
Keep track whether any readings have failed, invalidating run setup.
Definition: Settings.h:350
Class for vector of strings.
Definition: Settings.h:175
void listAll()
Definition: Settings.h:229
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
Settings()
Constructor.
Definition: Settings.h:200
string name
Data members.
Definition: Settings.h:38
bool unfinishedInput()
Check whether input openend with { not yet closed with }.
Definition: Settings.h:353
string name
Data members.
Definition: Settings.h:59
Class for vector of bool flags.
Definition: Settings.h:111
Definition: Settings.h:195
void addFlag(string keyIn, bool defaultIn)
Add new entry.
Definition: Settings.h:267