15 #ifndef Pythia8_Settings_H
16 #define Pythia8_Settings_H
18 #include "Pythia8/Info.h"
19 #include "Pythia8/PythiaStdlib.h"
32 Flag(
string nameIn =
" ",
bool defaultIn =
false) : name(nameIn),
33 valNow(defaultIn) , valDefault(defaultIn) { }
37 bool valNow, valDefault;
50 Mode(
string nameIn =
" ",
int defaultIn = 0,
bool hasMinIn =
false,
51 bool hasMaxIn =
false,
int minIn = 0,
int maxIn = 0) : name(nameIn),
52 valNow(defaultIn), valDefault(defaultIn), hasMin(hasMinIn),
53 hasMax(hasMaxIn), valMin(minIn), valMax(maxIn) { }
57 int valNow, valDefault;
72 Parm(
string nameIn =
" ",
double defaultIn = 0.,
73 bool hasMinIn =
false,
bool hasMaxIn =
false,
double minIn = 0.,
74 double maxIn = 0.) : name(nameIn), valNow(defaultIn),
75 valDefault(defaultIn), hasMin(hasMinIn), hasMax(hasMaxIn),
76 valMin(minIn), valMax(maxIn) { }
80 double valNow, valDefault;
82 double valMin, valMax;
95 Word(
string nameIn =
" ",
string defaultIn =
" ") : name(nameIn),
96 valNow(defaultIn) , valDefault(defaultIn) { }
99 string name, valNow, valDefault;
112 FVec(
string nameIn =
" ", vector<bool> defaultIn = vector<bool>(1,
false)) :
113 name(nameIn), valNow(defaultIn) , valDefault(defaultIn) { }
117 vector<bool> valNow, valDefault;
130 MVec(
string nameIn =
" ", vector<int> defaultIn = vector<int>(1, 0),
131 bool hasMinIn =
false,
bool hasMaxIn =
false,
int minIn = 0,
132 int maxIn = 0) : name(nameIn), valNow(defaultIn),
133 valDefault(defaultIn), hasMin(hasMinIn), hasMax(hasMaxIn),
134 valMin(minIn), valMax(maxIn) { }
138 vector<int> valNow, valDefault;
153 PVec(
string nameIn =
" ", vector<double> defaultIn = vector<double>(1, 0.),
154 bool hasMinIn =
false,
bool hasMaxIn =
false,
double minIn = 0.,
155 double maxIn = 0.) : name(nameIn), valNow(defaultIn),
156 valDefault(defaultIn), hasMin(hasMinIn), hasMax(hasMaxIn),
157 valMin(minIn), valMax(maxIn) { }
161 vector<double> valNow, valDefault;
163 double valMin, valMax;
178 Settings() : isInit(false), readingFailedSave(false) {}
181 void initPtr(Info* infoPtrIn) {infoPtr = infoPtrIn;}
184 bool init(
string startFile =
"../xmldoc/Index.xml",
bool append =
false,
185 ostream& os = cout) ;
188 bool reInit(
string startFile =
"../xmldoc/Index.xml", ostream& os = cout) ;
191 bool readString(
string line,
bool warn =
true, ostream& os = cout) ;
194 bool readingFailed() {
return readingFailedSave;}
197 bool writeFile(
string toFile,
bool writeAll =
false) ;
198 bool writeFile(ostream& os = cout,
bool writeAll =
false) ;
202 void listAll(ostream& os = cout) {
203 list(
true,
false,
" ", os); }
204 void listChanged(ostream& os = cout) {
205 list (
false,
false,
" ", os); }
206 void list(
string match, ostream& os = cout) {
207 list (
false,
true, match, os); }
213 bool isFlag(
string keyIn) {
214 return (flags.find(toLower(keyIn)) != flags.end()); }
215 bool isMode(
string keyIn) {
216 return (modes.find(toLower(keyIn)) != modes.end()); }
217 bool isParm(
string keyIn) {
218 return (parms.find(toLower(keyIn)) != parms.end()); }
219 bool isWord(
string keyIn) {
220 return (words.find(toLower(keyIn)) != words.end()); }
221 bool isFVec(
string keyIn) {
222 return (fvecs.find(toLower(keyIn)) != fvecs.end()); }
223 bool isMVec(
string keyIn) {
224 return (mvecs.find(toLower(keyIn)) != mvecs.end()); }
225 bool isPVec(
string keyIn) {
226 return (pvecs.find(toLower(keyIn)) != pvecs.end()); }
229 void addFlag(
string keyIn,
bool defaultIn) {
230 flags[toLower(keyIn)] = Flag(keyIn, defaultIn); }
231 void addMode(
string keyIn,
int defaultIn,
bool hasMinIn,
232 bool hasMaxIn,
int minIn,
int maxIn) { modes[toLower(keyIn)]
233 = Mode(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
234 void addParm(
string keyIn,
double defaultIn,
bool hasMinIn,
235 bool hasMaxIn,
double minIn,
double maxIn) { parms[toLower(keyIn)]
236 = Parm(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
237 void addWord(
string keyIn,
string defaultIn) {
238 words[toLower(keyIn)] = Word(keyIn, defaultIn); }
239 void addFVec(
string keyIn, vector<bool> defaultIn) {
240 fvecs[toLower(keyIn)] = FVec(keyIn, defaultIn); }
241 void addMVec(
string keyIn, vector<int> defaultIn,
bool hasMinIn,
242 bool hasMaxIn,
int minIn,
int maxIn) { mvecs[toLower(keyIn)]
243 = MVec(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
244 void addPVec(
string keyIn, vector<double> defaultIn,
bool hasMinIn,
245 bool hasMaxIn,
double minIn,
double maxIn) { pvecs[toLower(keyIn)]
246 = PVec(keyIn, defaultIn, hasMinIn, hasMaxIn, minIn, maxIn); }
249 bool flag(
string keyIn);
250 int mode(
string keyIn);
251 double parm(
string keyIn);
252 string word(
string keyIn);
253 vector<bool> fvec(
string keyIn);
254 vector<int> mvec(
string keyIn);
255 vector<double> pvec(
string keyIn);
258 bool flagDefault(
string keyIn);
259 int modeDefault(
string keyIn);
260 double parmDefault(
string keyIn);
261 string wordDefault(
string keyIn);
262 vector<bool> fvecDefault(
string keyIn);
263 vector<int> mvecDefault(
string keyIn);
264 vector<double> pvecDefault(
string keyIn);
267 map<string, Flag> getFlagMap(
string match);
268 map<string, Mode> getModeMap(
string match);
269 map<string, Parm> getParmMap(
string match);
270 map<string, Word> getWordMap(
string match);
271 map<string, FVec> getFVecMap(
string match);
272 map<string, MVec> getMVecMap(
string match);
273 map<string, PVec> getPVecMap(
string match);
276 void flag(
string keyIn,
bool nowIn);
277 void mode(
string keyIn,
int nowIn);
278 void parm(
string keyIn,
double nowIn);
279 void word(
string keyIn,
string nowIn);
280 void fvec(
string keyIn, vector<bool> nowIn);
281 void mvec(
string keyIn, vector<int> nowIn);
282 void pvec(
string keyIn, vector<double> nowIn);
285 void forceMode(
string keyIn,
int nowIn);
286 void forceParm(
string keyIn,
double nowIn);
287 void forceMVec(
string keyIn, vector<int> nowIn);
288 void forcePVec(
string keyIn, vector<double> nowIn);
291 void resetFlag(
string keyIn);
292 void resetMode(
string keyIn);
293 void resetParm(
string keyIn);
294 void resetWord(
string keyIn);
295 void resetFVec(
string keyIn);
296 void resetMVec(
string keyIn);
297 void resetPVec(
string keyIn);
305 map<string, Flag> flags;
308 map<string, Mode> modes;
311 map<string, Parm> parms;
314 map<string, Word> words;
317 map<string, FVec> fvecs;
320 map<string, MVec> mvecs;
323 map<string, PVec> pvecs;
326 bool isInit, readingFailedSave;
329 void list(
bool doListAll,
bool doListString,
string match,
333 void printQuiet(
bool quiet);
340 void initTuneEE(
int eeTune);
341 void initTunePP(
int ppTune);
344 string toLower(
const string& name);
345 bool boolString(
string tag);
346 string attributeValue(
string line,
string attribute);
347 bool boolAttributeValue(
string line,
string attribute);
348 int intAttributeValue(
string line,
string attribute);
349 double doubleAttributeValue(
string line,
string attribute);
350 vector<bool> boolVectorAttributeValue(
string line,
string attribute);
351 vector<int> intVectorAttributeValue(
string line,
string attribute);
352 vector<double> doubleVectorAttributeValue(
string line,
string attribute);
360 #endif // Pythia8_Settings_H