17 #ifndef Pythia8_Settings_H
18 #define Pythia8_Settings_H
20 #include "Pythia8/Info.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() : isInit(false), readingFailedSave(false), lineSaved(false) {}
203 void initPtr(Info* infoPtrIn) {infoPtr = infoPtrIn;}
206 bool init(
string startFile =
"../share/Pythia8/xmldoc/Index.xml",
207 bool append =
false) ;
210 bool init(istream& is,
bool append =
false) ;
213 bool reInit(
string startFile =
"../share/Pythia8/xmldoc/Index.xml") ;
216 bool readString(
string line,
bool warn =
true) ;
219 bool writeFile(
string toFile,
bool writeAll =
false) ;
220 bool writeFile(ostream& os = cout,
bool writeAll =
false) ;
221 bool writeFileXML(ostream& os = cout) ;
225 void listAll() { list(
true,
false,
" "); }
226 void listChanged() { list (
false,
false,
" "); }
227 void list(
string match) { list (
false,
true, match); }
230 string output(
string keyIn,
bool fullLine =
true);
234 vector<string> getReadHistory(
int subrun=-999) {
235 if (subrun == -999)
return readStringHistory;
236 else if (readStringSubrun.find(subrun) != readStringSubrun.end())
237 return readStringSubrun[subrun];
238 else return vector<string>();
245 bool isFlag(
string keyIn) {
246 return (flags.find(toLower(keyIn)) != flags.end()); }
247 bool isMode(
string keyIn) {
248 return (modes.find(toLower(keyIn)) != modes.end()); }
249 bool isParm(
string keyIn) {
250 return (parms.find(toLower(keyIn)) != parms.end()); }
251 bool isWord(
string keyIn) {
252 return (words.find(toLower(keyIn)) != words.end()); }
253 bool isFVec(
string keyIn) {
254 return (fvecs.find(toLower(keyIn)) != fvecs.end()); }
255 bool isMVec(
string keyIn) {
256 return (mvecs.find(toLower(keyIn)) != mvecs.end()); }
257 bool isPVec(
string keyIn) {
258 return (pvecs.find(toLower(keyIn)) != pvecs.end()); }
259 bool isWVec(
string keyIn) {
260 return (wvecs.find(toLower(keyIn)) != wvecs.end()); }
263 void addFlag(
string keyIn,
bool defaultIn) {
264 flags[toLower(keyIn)] = Flag(keyIn, defaultIn); }
265 void addMode(
string keyIn,
int defaultIn,
bool hasMinIn,
266 bool hasMaxIn,
int minIn,
int maxIn,
bool optOnlyIn =
false) {
267 modes[toLower(keyIn)] = Mode(keyIn, defaultIn, hasMinIn, hasMaxIn,
268 minIn, maxIn, optOnlyIn); }
269 void addParm(
string keyIn,
double defaultIn,
bool hasMinIn,
270 bool hasMaxIn,
double minIn,
double maxIn) { parms[toLower(keyIn)]
271 = Parm(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
272 void addWord(
string keyIn,
string defaultIn) {
273 words[toLower(keyIn)] = Word(keyIn, defaultIn); }
274 void addFVec(
string keyIn, vector<bool> defaultIn) {
275 fvecs[toLower(keyIn)] = FVec(keyIn, defaultIn); }
276 void addMVec(
string keyIn, vector<int> defaultIn,
bool hasMinIn,
277 bool hasMaxIn,
int minIn,
int maxIn) { mvecs[toLower(keyIn)]
278 = MVec(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
279 void addPVec(
string keyIn, vector<double> defaultIn,
bool hasMinIn,
280 bool hasMaxIn,
double minIn,
double maxIn) { pvecs[toLower(keyIn)]
281 = PVec(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
282 void addWVec(
string keyIn, vector<string> defaultIn) {
283 wvecs[toLower(keyIn)] = WVec(keyIn, defaultIn); }
286 bool flag(
string keyIn);
287 int mode(
string keyIn);
288 double parm(
string keyIn);
289 string word(
string keyIn);
290 vector<bool> fvec(
string keyIn);
291 vector<int> mvec(
string keyIn);
292 vector<double> pvec(
string keyIn);
293 vector<string> wvec(
string keyIn);
296 bool flagDefault(
string keyIn);
297 int modeDefault(
string keyIn);
298 double parmDefault(
string keyIn);
299 string wordDefault(
string keyIn);
300 vector<bool> fvecDefault(
string keyIn);
301 vector<int> mvecDefault(
string keyIn);
302 vector<double> pvecDefault(
string keyIn);
303 vector<string> wvecDefault(
string keyIn);
306 map<string, Flag> getFlagMap(
string match);
307 map<string, Mode> getModeMap(
string match);
308 map<string, Parm> getParmMap(
string match);
309 map<string, Word> getWordMap(
string match);
310 map<string, FVec> getFVecMap(
string match);
311 map<string, MVec> getMVecMap(
string match);
312 map<string, PVec> getPVecMap(
string match);
313 map<string, WVec> getWVecMap(
string match);
316 void flag(
string keyIn,
bool nowIn,
bool force =
false);
317 bool mode(
string keyIn,
int nowIn,
bool force =
false);
318 void parm(
string keyIn,
double nowIn,
bool force =
false);
319 void word(
string keyIn,
string nowIn,
bool force =
false);
320 void fvec(
string keyIn, vector<bool> nowIn,
bool force =
false);
321 void mvec(
string keyIn, vector<int> nowIn,
bool force =
false);
322 void pvec(
string keyIn, vector<double> nowIn,
bool force =
false);
323 void wvec(
string keyIn, vector<string> nowIn,
bool force =
false);
327 void forceMode(
string keyIn,
int nowIn) {mode(keyIn,nowIn,
true);}
328 void forceParm(
string keyIn,
double nowIn) {parm(keyIn,nowIn,
true);}
329 void forceMVec(
string keyIn, vector<int> nowIn) {mvec(keyIn,nowIn,
true);}
330 void forcePVec(
string keyIn, vector<double> nowIn) {pvec(keyIn,nowIn,
true);}
333 void resetFlag(
string keyIn);
334 void resetMode(
string keyIn);
335 void resetParm(
string keyIn);
336 void resetWord(
string keyIn);
337 void resetFVec(
string keyIn);
338 void resetMVec(
string keyIn);
339 void resetPVec(
string keyIn);
340 void resetWVec(
string keyIn);
343 bool getIsInit() {
return isInit;}
346 bool readingFailed() {
return readingFailedSave;}
349 bool unfinishedInput() {
return lineSaved;}
357 map<string, Flag> flags;
360 map<string, Mode> modes;
363 map<string, Parm> parms;
366 map<string, Word> words;
369 map<string, FVec> fvecs;
372 map<string, MVec> mvecs;
375 map<string, PVec> pvecs;
378 map<string, WVec> wvecs;
381 bool isInit, readingFailedSave;
388 vector<string> readStringHistory;
389 map<int, vector<string> > readStringSubrun;
392 void list(
bool doListAll,
bool doListString,
string match);
395 void printQuiet(
bool quiet);
402 void initTuneEE(
int eeTune);
403 void initTunePP(
int ppTune);
406 bool boolString(
string tag);
407 string attributeValue(
string line,
string attribute);
408 bool boolAttributeValue(
string line,
string attribute);
409 int intAttributeValue(
string line,
string attribute);
410 double doubleAttributeValue(
string line,
string attribute);
411 vector<bool> boolVectorAttributeValue(
string line,
string attribute);
412 vector<int> intVectorAttributeValue(
string line,
string attribute);
413 vector<double> doubleVectorAttributeValue(
string line,
string attribute);
414 vector<string> stringVectorAttributeValue(
string line,
string attribute);
422 #endif // Pythia8_Settings_H