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() : infoPtr(), isInit(false), readingFailedSave(false),
204 void initPtrs(Info* infoPtrIn) {infoPtr = infoPtrIn;}
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 writeFile(
string toFile,
bool writeAll =
false) ;
221 bool writeFile(ostream& os = cout,
bool writeAll =
false) ;
222 bool writeFileXML(ostream& os = cout) ;
226 void listAll() { list(
true,
false,
" "); }
227 void listChanged() { list (
false,
false,
" "); }
228 void list(
string match) { list (
false,
true, match); }
231 string output(
string keyIn,
bool fullLine =
true);
235 vector<string> getReadHistory(
int subrun=-999) {
236 if (subrun == -999)
return readStringHistory;
237 else if (readStringSubrun.find(subrun) != readStringSubrun.end())
238 return readStringSubrun[subrun];
239 else return vector<string>();
246 bool isFlag(
string keyIn) {
247 return (flags.find(toLower(keyIn)) != flags.end()); }
248 bool isMode(
string keyIn) {
249 return (modes.find(toLower(keyIn)) != modes.end()); }
250 bool isParm(
string keyIn) {
251 return (parms.find(toLower(keyIn)) != parms.end()); }
252 bool isWord(
string keyIn) {
253 return (words.find(toLower(keyIn)) != words.end()); }
254 bool isFVec(
string keyIn) {
255 return (fvecs.find(toLower(keyIn)) != fvecs.end()); }
256 bool isMVec(
string keyIn) {
257 return (mvecs.find(toLower(keyIn)) != mvecs.end()); }
258 bool isPVec(
string keyIn) {
259 return (pvecs.find(toLower(keyIn)) != pvecs.end()); }
260 bool isWVec(
string keyIn) {
261 return (wvecs.find(toLower(keyIn)) != wvecs.end()); }
264 void addFlag(
string keyIn,
bool defaultIn) {
265 flags[toLower(keyIn)] = Flag(keyIn, defaultIn); }
266 void addMode(
string keyIn,
int defaultIn,
bool hasMinIn,
267 bool hasMaxIn,
int minIn,
int maxIn,
bool optOnlyIn =
false) {
268 modes[toLower(keyIn)] = Mode(keyIn, defaultIn, hasMinIn, hasMaxIn,
269 minIn, maxIn, optOnlyIn); }
270 void addParm(
string keyIn,
double defaultIn,
bool hasMinIn,
271 bool hasMaxIn,
double minIn,
double maxIn) { parms[toLower(keyIn)]
272 = Parm(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
273 void addWord(
string keyIn,
string defaultIn) {
274 words[toLower(keyIn)] = Word(keyIn, defaultIn); }
275 void addFVec(
string keyIn, vector<bool> defaultIn) {
276 fvecs[toLower(keyIn)] = FVec(keyIn, defaultIn); }
277 void addMVec(
string keyIn, vector<int> defaultIn,
bool hasMinIn,
278 bool hasMaxIn,
int minIn,
int maxIn) { mvecs[toLower(keyIn)]
279 = MVec(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
280 void addPVec(
string keyIn, vector<double> defaultIn,
bool hasMinIn,
281 bool hasMaxIn,
double minIn,
double maxIn) { pvecs[toLower(keyIn)]
282 = PVec(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
283 void addWVec(
string keyIn, vector<string> defaultIn) {
284 wvecs[toLower(keyIn)] = WVec(keyIn, defaultIn); }
287 bool flag(
string keyIn);
288 int mode(
string keyIn);
289 double parm(
string keyIn);
290 string word(
string keyIn);
291 vector<bool> fvec(
string keyIn);
292 vector<int> mvec(
string keyIn);
293 vector<double> pvec(
string keyIn);
294 vector<string> wvec(
string keyIn);
297 bool flagDefault(
string keyIn);
298 int modeDefault(
string keyIn);
299 double parmDefault(
string keyIn);
300 string wordDefault(
string keyIn);
301 vector<bool> fvecDefault(
string keyIn);
302 vector<int> mvecDefault(
string keyIn);
303 vector<double> pvecDefault(
string keyIn);
304 vector<string> wvecDefault(
string keyIn);
307 map<string, Flag> getFlagMap(
string match);
308 map<string, Mode> getModeMap(
string match);
309 map<string, Parm> getParmMap(
string match);
310 map<string, Word> getWordMap(
string match);
311 map<string, FVec> getFVecMap(
string match);
312 map<string, MVec> getMVecMap(
string match);
313 map<string, PVec> getPVecMap(
string match);
314 map<string, WVec> getWVecMap(
string match);
317 void flag(
string keyIn,
bool nowIn,
bool force =
false);
318 bool mode(
string keyIn,
int nowIn,
bool force =
false);
319 void parm(
string keyIn,
double nowIn,
bool force =
false);
320 void word(
string keyIn,
string nowIn,
bool force =
false);
321 void fvec(
string keyIn, vector<bool> nowIn,
bool force =
false);
322 void mvec(
string keyIn, vector<int> nowIn,
bool force =
false);
323 void pvec(
string keyIn, vector<double> nowIn,
bool force =
false);
324 void wvec(
string keyIn, vector<string> nowIn,
bool force =
false);
328 void forceMode(
string keyIn,
int nowIn) {mode(keyIn,nowIn,
true);}
329 void forceParm(
string keyIn,
double nowIn) {parm(keyIn,nowIn,
true);}
330 void forceMVec(
string keyIn, vector<int> nowIn) {mvec(keyIn,nowIn,
true);}
331 void forcePVec(
string keyIn, vector<double> nowIn) {pvec(keyIn,nowIn,
true);}
334 void resetFlag(
string keyIn);
335 void resetMode(
string keyIn);
336 void resetParm(
string keyIn);
337 void resetWord(
string keyIn);
338 void resetFVec(
string keyIn);
339 void resetMVec(
string keyIn);
340 void resetPVec(
string keyIn);
341 void resetWVec(
string keyIn);
344 bool getIsInit() {
return isInit;}
347 bool readingFailed() {
return readingFailedSave;}
350 bool unfinishedInput() {
return lineSaved;}
361 map<string, Flag> flags;
364 map<string, Mode> modes;
367 map<string, Parm> parms;
370 map<string, Word> words;
373 map<string, FVec> fvecs;
376 map<string, MVec> mvecs;
379 map<string, PVec> pvecs;
382 map<string, WVec> wvecs;
385 bool isInit, readingFailedSave;
392 vector<string> readStringHistory;
393 map<int, vector<string> > readStringSubrun;
396 void list(
bool doListAll,
bool doListString,
string match);
399 void printQuiet(
bool quiet);
406 void initTuneEE(
int eeTune);
407 void initTunePP(
int ppTune);
410 bool boolString(
string tag);
411 string attributeValue(
string line,
string attribute);
412 bool boolAttributeValue(
string line,
string attribute);
413 int intAttributeValue(
string line,
string attribute);
414 double doubleAttributeValue(
string line,
string attribute);
415 vector<bool> boolVectorAttributeValue(
string line,
string attribute);
416 vector<int> intVectorAttributeValue(
string line,
string attribute);
417 vector<double> doubleVectorAttributeValue(
string line,
string attribute);
418 vector<string> stringVectorAttributeValue(
string line,
string attribute);
426 #endif // Pythia8_Settings_H