17 #ifndef Pythia8_Settings_H 18 #define Pythia8_Settings_H 20 #include "Pythia8/Logger.h" 21 #include "Pythia8/ParticleData.h" 22 #include "Pythia8/PythiaStdlib.h" 35 Flag(
string nameIn =
" ",
bool defaultIn =
false) :
name(nameIn),
36 valNow(defaultIn) , valDefault(defaultIn) { }
40 bool valNow, valDefault;
53 Mode(
string nameIn =
" ",
int defaultIn = 0,
bool hasMinIn =
false,
54 bool hasMaxIn =
false,
int minIn = 0,
int maxIn = 0,
55 bool optOnlyIn =
false) :
name(nameIn), valNow(defaultIn),
56 valDefault(defaultIn), hasMin(hasMinIn), hasMax(hasMaxIn),
57 valMin(minIn), valMax(maxIn), optOnly(optOnlyIn) { }
61 int valNow, valDefault;
77 Parm(
string nameIn =
" ",
double defaultIn = 0.,
78 bool hasMinIn =
false,
bool hasMaxIn =
false,
double minIn = 0.,
79 double maxIn = 0.) :
name(nameIn), valNow(defaultIn),
80 valDefault(defaultIn), hasMin(hasMinIn), hasMax(hasMaxIn),
81 valMin(minIn), valMax(maxIn) { }
85 double valNow, valDefault;
87 double valMin, valMax;
100 Word(
string nameIn =
" ",
string defaultIn =
" ") :
name(nameIn),
101 valNow(defaultIn) , valDefault(defaultIn) { }
104 string name, valNow, valDefault;
117 FVec(
string nameIn =
" ", vector<bool> defaultIn = vector<bool>(1,
false)) :
118 name(nameIn), valNow(defaultIn) , valDefault(defaultIn) { }
122 vector<bool> valNow, valDefault;
135 MVec(
string nameIn =
" ", vector<int> defaultIn = vector<int>(1, 0),
136 bool hasMinIn =
false,
bool hasMaxIn =
false,
int minIn = 0,
137 int maxIn = 0) :
name(nameIn), valNow(defaultIn),
138 valDefault(defaultIn), hasMin(hasMinIn), hasMax(hasMaxIn),
139 valMin(minIn), valMax(maxIn) { }
143 vector<int> valNow, valDefault;
158 PVec(
string nameIn =
" ", vector<double> defaultIn = vector<double>(1, 0.),
159 bool hasMinIn =
false,
bool hasMaxIn =
false,
double minIn = 0.,
160 double maxIn = 0.) :
name(nameIn), valNow(defaultIn),
161 valDefault(defaultIn), hasMin(hasMinIn), hasMax(hasMaxIn),
162 valMin(minIn), valMax(maxIn) { }
166 vector<double> valNow, valDefault;
168 double valMin, valMax;
181 WVec(
string nameIn =
" ", vector<string> defaultIn = vector<string>(1,
" "))
182 :
name(nameIn), valNow(defaultIn) , valDefault(defaultIn) { }
186 vector<string> valNow, valDefault;
201 Settings() : loggerPtr(), isInit(false), readingFailedSave(false),
206 stringstream* pdbPtrIn =
nullptr) {
207 loggerPtr = loggerPtrIn; pdPtr = pdPtrIn; pdbPtr = pdbPtrIn;}
210 bool init(
string startFile =
"../share/Pythia8/xmldoc/Index.xml",
211 bool append =
false) ;
214 bool init(istream& is,
bool append =
false) ;
217 bool reInit(
string startFile =
"../share/Pythia8/xmldoc/Index.xml");
220 bool readString(
string line,
bool warn =
true,
int subrun = SUBRUNDEFAULT);
223 bool readFile(
string fileName,
bool warn =
true,
224 int subrun = SUBRUNDEFAULT);
225 bool readFile(
string fileName,
int subrun) {
226 return readFile(fileName,
true, subrun);}
227 bool readFile(istream& is = cin,
bool warn =
true,
228 int subrun = SUBRUNDEFAULT);
229 bool readFile(istream& is,
int subrun) {
230 return readFile(is,
true, subrun);}
233 bool registerPluginLibrary(
string libName,
string startFile =
"");
236 bool writeFile(
string toFile,
bool writeAll =
false) ;
237 bool writeFile(ostream& os = cout,
bool writeAll =
false) ;
238 bool writeFileXML(ostream& os = cout) ;
243 void listChanged() { list (
false,
false,
" "); }
244 void list(
string match) { list (
false,
true, match); }
247 string output(
string keyIn,
bool fullLine =
true);
252 if (subrun == -999)
return readStringHistory;
253 else if (readStringSubrun.find(subrun) != readStringSubrun.end())
254 return readStringSubrun[subrun];
255 else return vector<string>();
263 return (flags.find(
toLower(keyIn)) != flags.end()); }
264 bool isMode(
string keyIn) {
265 return (modes.find(
toLower(keyIn)) != modes.end()); }
266 bool isParm(
string keyIn) {
267 return (parms.find(
toLower(keyIn)) != parms.end()); }
268 bool isWord(
string keyIn) {
269 return (words.find(
toLower(keyIn)) != words.end()); }
270 bool isFVec(
string keyIn) {
271 return (fvecs.find(
toLower(keyIn)) != fvecs.end()); }
272 bool isMVec(
string keyIn) {
273 return (mvecs.find(
toLower(keyIn)) != mvecs.end()); }
274 bool isPVec(
string keyIn) {
275 return (pvecs.find(
toLower(keyIn)) != pvecs.end()); }
276 bool isWVec(
string keyIn) {
277 return (wvecs.find(
toLower(keyIn)) != wvecs.end()); }
282 void addMode(
string keyIn,
int defaultIn,
bool hasMinIn,
283 bool hasMaxIn,
int minIn,
int maxIn,
bool optOnlyIn =
false) {
284 modes[
toLower(keyIn)] =
Mode(keyIn, defaultIn, hasMinIn, hasMaxIn,
285 minIn, maxIn, optOnlyIn); }
286 void addParm(
string keyIn,
double defaultIn,
bool hasMinIn,
287 bool hasMaxIn,
double minIn,
double maxIn) { parms[
toLower(keyIn)]
288 =
Parm(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
289 void addWord(
string keyIn,
string defaultIn) {
291 void addFVec(
string keyIn, vector<bool> defaultIn) {
293 void addMVec(
string keyIn, vector<int> defaultIn,
bool hasMinIn,
294 bool hasMaxIn,
int minIn,
int maxIn) { mvecs[
toLower(keyIn)]
295 =
MVec(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
296 void addPVec(
string keyIn, vector<double> defaultIn,
bool hasMinIn,
297 bool hasMaxIn,
double minIn,
double maxIn) { pvecs[
toLower(keyIn)]
298 =
PVec(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
299 void addWVec(
string keyIn, vector<string> defaultIn) {
303 bool flag(
string keyIn);
304 int mode(
string keyIn);
305 double parm(
string keyIn);
306 string word(
string keyIn);
307 vector<bool> fvec(
string keyIn);
308 vector<int> mvec(
string keyIn);
309 vector<double> pvec(
string keyIn);
310 vector<string> wvec(
string keyIn);
313 bool flagDefault(
string keyIn);
314 int modeDefault(
string keyIn);
315 double parmDefault(
string keyIn);
316 string wordDefault(
string keyIn);
317 vector<bool> fvecDefault(
string keyIn);
318 vector<int> mvecDefault(
string keyIn);
319 vector<double> pvecDefault(
string keyIn);
320 vector<string> wvecDefault(
string keyIn);
323 map<string, Flag> getFlagMap(
string match);
324 map<string, Mode> getModeMap(
string match);
325 map<string, Parm> getParmMap(
string match);
326 map<string, Word> getWordMap(
string match);
327 map<string, FVec> getFVecMap(
string match);
328 map<string, MVec> getMVecMap(
string match);
329 map<string, PVec> getPVecMap(
string match);
330 map<string, WVec> getWVecMap(
string match);
333 void flag(
string keyIn,
bool nowIn,
bool force =
false);
334 bool mode(
string keyIn,
int nowIn,
bool force =
false);
335 bool parm(
string keyIn,
double nowIn,
bool force =
false);
336 void word(
string keyIn,
string nowIn,
bool force =
false);
337 void fvec(
string keyIn, vector<bool> nowIn,
bool force =
false);
338 bool mvec(
string keyIn, vector<int> nowIn,
bool force =
false);
339 bool pvec(
string keyIn, vector<double> nowIn,
bool force =
false);
340 void wvec(
string keyIn, vector<string> nowIn,
bool force =
false);
344 void forceMode(
string keyIn,
int nowIn) {mode(keyIn,nowIn,
true);}
345 void forceParm(
string keyIn,
double nowIn) {parm(keyIn,nowIn,
true);}
346 void forceMVec(
string keyIn, vector<int> nowIn) {mvec(keyIn,nowIn,
true);}
347 void forcePVec(
string keyIn, vector<double> nowIn) {pvec(keyIn,nowIn,
true);}
350 void resetFlag(
string keyIn);
351 void resetMode(
string keyIn);
352 void resetParm(
string keyIn);
353 void resetWord(
string keyIn);
354 void resetFVec(
string keyIn);
355 void resetMVec(
string keyIn);
356 void resetPVec(
string keyIn);
357 void resetWVec(
string keyIn);
378 stringstream* pdbPtr{};
381 map<string, Flag> flags;
384 map<string, Mode> modes;
387 map<string, Parm> parms;
390 map<string, Word> words;
393 map<string, FVec> fvecs;
396 map<string, MVec> mvecs;
399 map<string, PVec> pvecs;
402 map<string, WVec> wvecs;
405 set<string> pluginLibraries;
408 bool isInit, readingFailedSave;
415 vector<string> readStringHistory;
416 map<int, vector<string> > readStringSubrun;
419 void list(
bool doListAll,
bool doListString,
string match);
422 void printQuiet(
bool quiet);
425 void initTuneEE(
int eeTune);
426 void initTunePP(
int ppTune);
427 void initTuneVincia(
int vinciaTune);
430 bool boolString(
string tag);
431 string attributeValue(
string line,
string attribute);
432 bool boolAttributeValue(
string line,
string attribute);
433 int intAttributeValue(
string line,
string attribute);
434 double doubleAttributeValue(
string line,
string attribute);
435 vector<bool> boolVectorAttributeValue(
string line,
string attribute);
436 vector<int> intVectorAttributeValue(
string line,
string attribute);
437 vector<double> doubleVectorAttributeValue(
string line,
string attribute);
438 vector<string> stringVectorAttributeValue(
string line,
string attribute);
441 int subrunNow{SUBRUNDEFAULT};
void forceMode(string keyIn, int nowIn)
Definition: Settings.h:344
string name
Data members.
Definition: Settings.h:185
Class for double parms (where parm is shorthand for parameter).
Definition: Settings.h:72
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:53
FVec(string nameIn=" ", vector< bool > defaultIn=vector< bool >(1, false))
Constructor.
Definition: Settings.h:117
Word(string nameIn=" ", string defaultIn=" ")
Constructor.
Definition: Settings.h:100
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:158
string name
Data members.
Definition: Settings.h:165
void initPtrs(Logger *loggerPtrIn, ParticleData *pdPtrIn=nullptr, stringstream *pdbPtrIn=nullptr)
Initialize pointers.
Definition: Settings.h:205
Class for integer modes.
Definition: Settings.h:48
Class for string words.
Definition: Settings.h:95
Class for bool flags.
Definition: Settings.h:30
string name
Data members.
Definition: Settings.h:104
string toLower(const string &name, bool trim=true)
Definition: PythiaStdlib.cc:17
bool isFlag(string keyIn)
Query existence of an entry.
Definition: Settings.h:262
string name
Data members.
Definition: Settings.h:84
Class for vector of integers.
Definition: Settings.h:130
WVec(string nameIn=" ", vector< string > defaultIn=vector< string >(1," "))
Constructor.
Definition: Settings.h:181
Flag(string nameIn=" ", bool defaultIn=false)
Constructor.
Definition: Settings.h:35
bool getIsInit()
Check initialisation status.
Definition: Settings.h:360
Class for vector of doubles.
Definition: Settings.h:153
string name
Data members.
Definition: Settings.h:121
string name
Data members.
Definition: Settings.h:142
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:135
Parm(string nameIn=" ", double defaultIn=0., bool hasMinIn=false, bool hasMaxIn=false, double minIn=0., double maxIn=0.)
Constructor.
Definition: Settings.h:77
bool readingFailed()
Keep track whether any readings have failed, invalidating run setup.
Definition: Settings.h:363
Class for vector of strings.
Definition: Settings.h:176
void listAll()
Definition: Settings.h:242
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
Settings()
Constructor.
Definition: Settings.h:201
string name
Data members.
Definition: Settings.h:39
bool unfinishedInput()
Check whether input openend with { not yet closed with }.
Definition: Settings.h:366
vector< string > getReadHistory(int subrun=SUBRUNDEFAULT)
Definition: Settings.h:251
string name
Data members.
Definition: Settings.h:60
This class holds a map of all ParticleDataEntries.
Definition: ParticleData.h:422
Class for vector of bool flags.
Definition: Settings.h:112
Definition: Settings.h:196
void addFlag(string keyIn, bool defaultIn)
Add new entry.
Definition: Settings.h:280