24 bool Settings::init(
string startFile,
bool append, ostream& os) {
27 if (isInit && !append)
return true;
32 files.push_back(startFile);
36 if (startFile.rfind(
"/") != string::npos)
37 pathName = startFile.substr(0, startFile.rfind(
"/") + 1);
40 for (
int i = 0; i < int(files.size()); ++i) {
41 const char* cstring = files[i].c_str();
46 os <<
"\n PYTHIA Error: settings file " << files[i]
47 <<
" not found" << endl;
53 while ( getline(is, line) ) {
56 istringstream getfirst(line);
61 if (tag !=
"<flag" && tag !=
"<flagfix" && tag !=
"<mode"
62 && tag !=
"<modeopen" && tag !=
"<modepick" && tag !=
"<modefix"
63 && tag !=
"<parm" && tag !=
"<parmfix" && tag !=
"<word"
64 && tag !=
"<wordfix" && tag !=
"<aidx")
continue;
67 while (line.find(
">") == string::npos) {
70 line +=
" " + addLine;
74 while (line.find(
" =") != string::npos) line.erase( line.find(
" ="), 1);
78 string name = attributeValue( line,
"href");
80 os <<
" PYTHIA Error: failed to find name attribute in line "
85 files.push_back(pathName + name +
".xml");
90 string name = attributeValue( line,
"name=");
92 os <<
" PYTHIA Error: failed to find name attribute in line "
99 if (line.find(
"default=") == string::npos) {
100 os <<
" PYTHIA Error: failed to find default value token in line "
105 bool hasMin = (line.find(
"min=") != string::npos);
106 bool hasMax = (line.find(
"max=") != string::npos);
109 if (tag ==
"<flag" || tag ==
"<flagfix") {
110 bool value = boolAttributeValue( line,
"default=");
111 addFlag( name, value);
114 }
else if (tag ==
"<mode" || tag ==
"<modeopen"
115 || tag ==
"<modepick" || tag ==
"<modefix") {
116 int value = intAttributeValue( line,
"default=");
117 int minVal = intAttributeValue( line,
"min=");
118 int maxVal = intAttributeValue( line,
"max=");
119 addMode( name, value, hasMin, hasMax, minVal, maxVal);
122 }
else if (tag ==
"<parm" || tag ==
"<parmfix") {
123 double value = doubleAttributeValue( line,
"default=");
124 double minVal = doubleAttributeValue( line,
"min=");
125 double maxVal = doubleAttributeValue( line,
"max=");
126 addParm( name, value, hasMin, hasMax, minVal, maxVal);
129 }
else if (tag ==
"<word" || tag ==
"<wordfix") {
130 string value = attributeValue( line,
"default=");
131 addWord( name, value);
139 int eeTune = mode(
"Tune:ee");
140 if (eeTune > 0) initTuneEE( eeTune);
141 int ppTune = mode(
"Tune:pp");
142 if (ppTune > 0) initTunePP( ppTune);
145 if (nError > 0)
return false;
155 bool Settings::reInit(
string startFile, ostream& os) {
165 return init(startFile,
false, os);
174 bool Settings::readString(
string line,
bool warn, ostream& os) {
177 if (line.find_first_not_of(
" \n\t\v\b\r\f\a") == string::npos)
return true;
180 string lineNow = line;
181 int firstChar = lineNow.find_first_not_of(
" \n\t\v\b\r\f\a");
182 if (!isalpha(lineNow[firstChar]))
return true;
185 while (lineNow.find(
"=") != string::npos) {
186 int firstEqual = lineNow.find_first_of(
"=");
187 lineNow.replace(firstEqual, 1,
" ");
191 istringstream splitLine(lineNow);
196 while (name.find(
"::") != string::npos) {
197 int firstColonColon = name.find_first_of(
"::");
198 name.replace(firstColonColon, 2,
":");
203 if (isFlag(name)) inDataBase = 1;
204 else if (isMode(name)) inDataBase = 2;
205 else if (isParm(name)) inDataBase = 3;
206 else if (isWord(name)) inDataBase = 4;
209 if (inDataBase == 0) {
211 string nameLower = toLower(name);
212 if (nameLower.find(
"multiple") != string::npos) {
213 int firstMI = nameLower.find_first_of(
"multiple");
214 name.replace(firstMI, 8,
"Multiparton");
217 if (!retry && nameLower.find(
"mi") != string::npos) {
218 int firstMI = nameLower.find_first_of(
"mi");
219 name.replace(firstMI, 2,
"MPI");
223 if (isFlag(name)) inDataBase = 1;
224 else if (isMode(name)) inDataBase = 2;
225 else if (isParm(name)) inDataBase = 3;
226 else if (isWord(name)) inDataBase = 4;
231 if (inDataBase == 0) {
232 if (warn) os <<
"\n PYTHIA Warning: input string not found in settings"
233 <<
" databases; skip:\n " << line << endl;
239 splitLine >> valueString;
241 if (warn) os <<
"\n PYTHIA Warning: variable recognized, but its value"
242 <<
" not meaningful; skip:\n " << line << endl;
247 if (inDataBase == 1) {
248 bool value = boolString(valueString);
252 }
else if (inDataBase == 2) {
253 istringstream modeData(valueString);
257 if (warn) os <<
"\n PYTHIA Warning: variable recognized, but its value"
258 <<
" not meaningful; skip:\n " << line << endl;
264 }
else if (inDataBase == 3) {
265 istringstream parmData(valueString);
269 if (warn) os <<
"\n PYTHIA Warning: variable recognized, but its value"
270 <<
" not meaningful; skip:\n " << line << endl;
277 word(name, valueString);
288 bool Settings::writeFile(
string toFile,
bool writeAll) {
291 const char* cstring = toFile.c_str();
292 ofstream os(cstring);
294 infoPtr->errorMsg(
"Error in Settings::writeFile:"
295 " could not open file", toFile);
300 return writeFile( os, writeAll);
308 bool Settings::writeFile(ostream& os,
bool writeAll) {
311 if (writeAll) os <<
"! List of all current PYTHIA ";
312 else os <<
"! List of all modified PYTHIA ";
313 os << fixed << setprecision(3) << parm(
"Pythia:versionNumber")
317 map<string, Flag>::iterator flagEntry = flags.begin();
318 map<string, Mode>::iterator modeEntry = modes.begin();
319 map<string, Parm>::iterator parmEntry = parms.begin();
320 map<string, Word>::iterator wordEntry = words.begin();
323 while (flagEntry != flags.end() || modeEntry != modes.end()
324 || parmEntry != parms.end() || wordEntry != words.end()) {
327 if ( flagEntry != flags.end()
328 && ( modeEntry == modes.end() || flagEntry->first < modeEntry->first )
329 && ( parmEntry == parms.end() || flagEntry->first < parmEntry->first )
330 && ( wordEntry == words.end() || flagEntry->first < wordEntry->first )
332 string state[2] = {
"off",
"on"};
333 bool valNow = flagEntry->second.valNow;
334 bool valDefault = flagEntry->second.valDefault;
335 if ( writeAll || valNow != valDefault )
336 os << flagEntry->second.name <<
" = " << state[valNow] <<
"\n";
340 }
else if ( modeEntry != modes.end()
341 && ( parmEntry == parms.end() || modeEntry->first < parmEntry->first )
342 && ( wordEntry == words.end() || modeEntry->first < wordEntry->first )
344 int valNow = modeEntry->second.valNow;
345 int valDefault = modeEntry->second.valDefault;
346 if ( writeAll || valNow != valDefault )
347 os << modeEntry->second.name <<
" = " << valNow <<
"\n";
352 }
else if ( parmEntry != parms.end()
353 && ( wordEntry == words.end() || parmEntry->first < wordEntry->first )
355 double valNow = parmEntry->second.valNow;
356 double valDefault = parmEntry->second.valDefault;
357 if ( writeAll || valNow != valDefault ) {
358 os << parmEntry->second.name <<
" = ";
359 if ( valNow == 0. ) os << fixed << setprecision(1);
360 else if ( abs(valNow) < 0.001 ) os << scientific << setprecision(4);
361 else if ( abs(valNow) < 0.1 ) os << fixed << setprecision(7);
362 else if ( abs(valNow) < 1000. ) os << fixed << setprecision(5);
363 else if ( abs(valNow) < 1000000. ) os << fixed << setprecision(3);
364 else os << scientific << setprecision(4);
365 os << valNow <<
"\n";
371 string valNow = wordEntry->second.valNow;
372 string valDefault = wordEntry->second.valDefault;
373 if ( writeAll || valNow != valDefault )
374 os << wordEntry->second.name <<
" = " << valNow <<
"\n";
387 void Settings::list(
bool doListAll,
bool doListString,
string match,
392 os <<
"\n *------- PYTHIA Flag + Mode + Parm + Word Settings (all) "
393 <<
" -------------------------------------------------------* \n";
394 else if (!doListString)
395 os <<
"\n *------- PYTHIA Flag + Mode + Parm + Word Settings (chang"
396 <<
"es only) ----------------------------------------------* \n" ;
398 os <<
"\n *------- PYTHIA Flag + Mode + Parm + Word Settings (with "
399 <<
"requested string) -------------------------------------* \n" ;
403 <<
" Now | Default Min Max | \n"
408 match = toLower(match);
409 if (match ==
"") match =
" ";
412 map<string, Flag>::iterator flagEntry = flags.begin();
413 map<string, Mode>::iterator modeEntry = modes.begin();
414 map<string, Parm>::iterator parmEntry = parms.begin();
415 map<string, Word>::iterator wordEntry = words.begin();
418 while (flagEntry != flags.end() || modeEntry != modes.end()
419 || parmEntry != parms.end() || wordEntry != words.end()) {
422 if ( flagEntry != flags.end()
423 && ( modeEntry == modes.end() || flagEntry->first < modeEntry->first )
424 && ( parmEntry == parms.end() || flagEntry->first < parmEntry->first )
425 && ( wordEntry == words.end() || flagEntry->first < wordEntry->first )
427 string state[2] = {
"off",
"on"};
428 bool valNow = flagEntry->second.valNow;
429 bool valDefault = flagEntry->second.valDefault;
430 if ( doListAll || (!doListString && valNow != valDefault)
431 || (doListString && flagEntry->first.find(match) != string::npos) )
432 os <<
" | " << setw(45) << left
433 << flagEntry->second.name <<
" | " << setw(24) << right
434 << state[valNow] <<
" | " << setw(12) << state[valDefault]
439 }
else if ( modeEntry != modes.end()
440 && ( parmEntry == parms.end() || modeEntry->first < parmEntry->first )
441 && ( wordEntry == words.end() || modeEntry->first < wordEntry->first )
443 int valNow = modeEntry->second.valNow;
444 int valDefault = modeEntry->second.valDefault;
445 if ( doListAll || (!doListString && valNow != valDefault)
446 || (doListString && modeEntry->first.find(match) != string::npos) ) {
447 os <<
" | " << setw(45) << left
448 << modeEntry->second.name <<
" | " << setw(24) << right
449 << valNow <<
" | " << setw(12) << valDefault;
450 if (modeEntry->second.hasMin)
451 os << setw(12) << modeEntry->second.valMin;
453 if (modeEntry->second.hasMax)
454 os << setw(12) << modeEntry->second.valMax;
462 }
else if ( parmEntry != parms.end()
463 && ( wordEntry == words.end() || parmEntry->first < wordEntry->first )
465 double valNow = parmEntry->second.valNow;
466 double valDefault = parmEntry->second.valDefault;
467 if ( doListAll || (!doListString && valNow != valDefault )
468 || (doListString && parmEntry->first.find(match) != string::npos) ) {
469 os <<
" | " << setw(45) << left
470 << parmEntry->second.name << right <<
" | ";
471 for (
int i = 0; i < 4; ++i) {
472 if (i == 1) valNow = valDefault;
473 if (i == 2) valNow = parmEntry->second.valMin;
474 if (i == 3) valNow = parmEntry->second.valMax;
475 if ( (i == 2 && !parmEntry->second.hasMin)
476 || (i == 3 && !parmEntry->second.hasMax) )
478 else if ( valNow == 0. )
479 os << fixed << setprecision(1) << setw(12) << valNow;
480 else if ( abs(valNow) < 0.001 )
481 os << scientific << setprecision(4) << setw(12) << valNow;
482 else if ( abs(valNow) < 0.1 )
483 os << fixed << setprecision(7) << setw(12) << valNow;
484 else if ( abs(valNow) < 1000. )
485 os << fixed << setprecision(5) << setw(12) << valNow;
486 else if ( abs(valNow) < 1000000. )
487 os << fixed << setprecision(3) << setw(12) << valNow;
489 os << scientific << setprecision(4) << setw(12) << valNow;
490 if (i == 0) os <<
" | ";
498 string valNow = wordEntry->second.valNow;
499 string valDefault = wordEntry->second.valDefault;
500 int blankLeft = max(0, 60 - max(24,
int(valNow.length()) )
501 - max(12,
int(valDefault.length()) ) );
502 string blankPad( blankLeft,
' ');
503 if ( doListAll || (!doListString && valNow != valDefault)
504 || (doListString && wordEntry->first.find(match) != string::npos) )
505 os <<
" | " << setw(45) << left
506 << wordEntry->second.name <<
" | " << setw(24) << right
507 << valNow <<
" | " << setw(12) << valDefault << blankPad
516 <<
" *------- End PYTHIA Flag + Mode + Parm + Word Settings ---"
517 <<
"------------------------------------------------------* " << endl;
525 void Settings::resetAll() {
528 for (map<string, Flag>::iterator flagEntry = flags.begin();
529 flagEntry != flags.end(); ++flagEntry) {
530 string name = flagEntry->first;
535 for (map<string, Mode>::iterator modeEntry = modes.begin();
536 modeEntry != modes.end(); ++modeEntry) {
537 string name = modeEntry->first;
542 for (map<string, Parm>::iterator parmEntry = parms.begin();
543 parmEntry != parms.end(); ++parmEntry) {
544 string name = parmEntry->first;
549 for (map<string, Word>::iterator wordEntry = words.begin();
550 wordEntry != words.end(); ++wordEntry) {
551 string name = wordEntry->first;
561 bool Settings::flag(
string keyIn) {
562 if (isFlag(keyIn))
return flags[toLower(keyIn)].valNow;
563 infoPtr->errorMsg(
"Error in Settings::flag: unknown key", keyIn);
567 int Settings::mode(
string keyIn) {
568 if (isMode(keyIn))
return modes[toLower(keyIn)].valNow;
569 infoPtr->errorMsg(
"Error in Settings::mode: unknown key", keyIn);
573 double Settings::parm(
string keyIn) {
574 if (isParm(keyIn))
return parms[toLower(keyIn)].valNow;
575 infoPtr->errorMsg(
"Error in Settings::parm: unknown key", keyIn);
579 string Settings::word(
string keyIn) {
580 if (isWord(keyIn))
return words[toLower(keyIn)].valNow;
581 infoPtr->errorMsg(
"Error in Settings::word: unknown key", keyIn);
589 map<string, Flag> Settings::getFlagMap(
string match) {
591 match = toLower(match);
592 map<string, Flag> flagMap;
594 for (map<string,Flag>::iterator flagEntry = flags.begin();
595 flagEntry != flags.end(); ++flagEntry)
596 if (flagEntry->first.find(match) != string::npos)
597 flagMap[flagEntry->first] = flagEntry->second;
601 map<string, Mode> Settings::getModeMap(
string match) {
603 match = toLower(match);
604 map<string, Mode> modeMap;
606 for (map<string,Mode>::iterator modeEntry = modes.begin();
607 modeEntry != modes.end(); ++modeEntry)
608 if (modeEntry->first.find(match) != string::npos)
609 modeMap[modeEntry->first] = modeEntry->second;
613 map<string, Parm> Settings::getParmMap(
string match) {
615 match = toLower(match);
616 map<string, Parm> parmMap;
618 for (map<string,Parm>::iterator parmEntry = parms.begin();
619 parmEntry != parms.end(); ++parmEntry)
620 if (parmEntry->first.find(match) != string::npos)
621 parmMap[parmEntry->first] = parmEntry->second;
625 map<string, Word> Settings::getWordMap(
string match) {
627 match = toLower(match);
628 map<string, Word> wordMap;
630 for (map<string,Word>::iterator wordEntry = words.begin();
631 wordEntry != words.end(); ++wordEntry)
632 if (wordEntry->first.find(match) != string::npos)
633 wordMap[wordEntry->first] = wordEntry->second;
641 void Settings::flag(
string keyIn,
bool nowIn) {
642 if (isFlag(keyIn)) flags[toLower(keyIn)].valNow = nowIn;
645 void Settings:: mode(
string keyIn,
int nowIn) {
647 string keyLower = toLower(keyIn);
648 Mode& modeNow = modes[keyLower];
649 if (modeNow.hasMin && nowIn < modeNow.valMin)
650 modeNow.valNow = modeNow.valMin;
651 else if (modeNow.hasMax && nowIn > modeNow.valMax)
652 modeNow.valNow = modeNow.valMax;
653 else modeNow.valNow = nowIn;
655 if (keyLower ==
"tune:ee") initTuneEE( modeNow.valNow);
656 if (keyLower ==
"tune:pp") initTunePP( modeNow.valNow);
660 void Settings::parm(
string keyIn,
double nowIn) {
662 Parm& parmNow = parms[toLower(keyIn)];
663 if (parmNow.hasMin && nowIn < parmNow.valMin)
664 parmNow.valNow = parmNow.valMin;
665 else if (parmNow.hasMax && nowIn > parmNow.valMax)
666 parmNow.valNow = parmNow.valMax;
667 else parmNow.valNow = nowIn;
671 void Settings::word(
string keyIn,
string nowIn) {
672 if (isWord(keyIn)) words[toLower(keyIn)].valNow = nowIn;
679 void Settings::forceMode(
string keyIn,
int nowIn) {
681 string keyLower = toLower(keyIn);
682 Mode& modeNow = modes[keyLower];
683 modeNow.valNow = nowIn;
685 if (keyLower ==
"tune:ee") initTuneEE( modeNow.valNow);
686 if (keyLower ==
"tune:pp") initTunePP( modeNow.valNow);
690 void Settings::forceParm(
string keyIn,
double nowIn) {
691 if (isParm(keyIn)) parms[toLower(keyIn)].valNow = nowIn;
698 void Settings::resetFlag(
string keyIn) {
699 if (isFlag(keyIn)) flags[toLower(keyIn)].valNow
700 = flags[toLower(keyIn)].valDefault ;
703 void Settings::resetMode(
string keyIn) {
704 string keyLower = toLower(keyIn);
705 if (isMode(keyIn)) modes[keyLower].valNow
706 = modes[toLower(keyIn)].valDefault ;
709 if (keyLower ==
"tune:ee") {
710 resetParm(
"StringFlav:probStoUD");
711 resetParm(
"StringFlav:probQQtoQ");
712 resetParm(
"StringFlav:probSQtoQQ");
713 resetParm(
"StringFlav:probQQ1toQQ0");
714 resetParm(
"StringFlav:mesonUDvector");
715 resetParm(
"StringFlav:mesonSvector");
716 resetParm(
"StringFlav:mesonCvector");
717 resetParm(
"StringFlav:mesonBvector");
718 resetParm(
"StringFlav:etaSup");
719 resetParm(
"StringFlav:etaPrimeSup");
720 resetParm(
"StringFlav:popcornSpair");
721 resetParm(
"StringFlav:popcornSmeson");
722 resetParm(
"StringZ:aLund");
723 resetParm(
"StringZ:bLund");
724 resetParm(
"StringZ:rFactB");
725 resetParm(
"StringPT:sigma");
726 resetParm(
"TimeShower:alphaSvalue");
727 resetParm(
"TimeShower:pTmin");
728 resetParm(
"TimeShower:pTminChgQ");
732 if (keyLower ==
"tune:pp") {
733 resetMode(
"PDF:pSet");
734 resetParm(
"SigmaProcess:alphaSvalue");
735 resetFlag(
"SigmaDiffractive:dampen");
736 resetFlag(
"TimeShower:dampenBeamRecoil");
737 resetFlag(
"TimeShower:phiPolAsym");
738 resetParm(
"SpaceShower:alphaSvalue");
739 resetFlag(
"SpaceShower:samePTasMPI");
740 resetParm(
"SpaceShower:pT0Ref");
741 resetParm(
"SpaceShower:ecmRef");
742 resetParm(
"SpaceShower:ecmPow");
743 resetFlag(
"SpaceShower:rapidityOrder");
744 resetFlag(
"SpaceShower:phiPolAsym");
745 resetFlag(
"SpaceShower:phiIntAsym");
746 resetParm(
"MultipartonInteractions:alphaSvalue");
747 resetParm(
"MultipartonInteractions:pT0Ref");
748 resetParm(
"MultipartonInteractions:ecmRef");
749 resetParm(
"MultipartonInteractions:ecmPow");
750 resetMode(
"MultipartonInteractions:bProfile");
751 resetParm(
"BeamRemnants:primordialKTsoft");
752 resetParm(
"BeamRemnants:primordialKThard");
753 resetParm(
"BeamRemnants:halfScaleForKT");
754 resetParm(
"BeamRemnants:halfMassForKT");
755 resetParm(
"BeamRemnants:reconnectRange");
760 void Settings::resetParm(
string keyIn) {
761 if (isParm(keyIn)) parms[toLower(keyIn)].valNow
762 = parms[toLower(keyIn)].valDefault ;
765 void Settings::resetWord(
string keyIn) {
766 if (isWord(keyIn)) words[toLower(keyIn)].valNow
767 = words[toLower(keyIn)].valDefault ;
775 void Settings::initTuneEE(
int eeTune) {
780 resetParm(
"StringFlav:probStoUD");
781 resetParm(
"StringFlav:probQQtoQ");
782 resetParm(
"StringFlav:probSQtoQQ");
783 resetParm(
"StringFlav:probQQ1toQQ0");
784 resetParm(
"StringFlav:mesonUDvector");
785 resetParm(
"StringFlav:mesonSvector");
786 resetParm(
"StringFlav:mesonCvector");
787 resetParm(
"StringFlav:mesonBvector");
788 resetParm(
"StringFlav:etaSup");
789 resetParm(
"StringFlav:etaPrimeSup");
790 resetParm(
"StringFlav:popcornSpair");
791 resetParm(
"StringFlav:popcornSmeson");
792 resetParm(
"StringZ:aLund");
793 resetParm(
"StringZ:bLund");
794 resetParm(
"StringZ:rFactB");
795 resetParm(
"StringPT:sigma");
796 resetParm(
"TimeShower:alphaSvalue");
797 resetParm(
"TimeShower:pTmin");
798 resetParm(
"TimeShower:pTminChgQ");
804 parm(
"StringFlav:probStoUD", 0.30 );
805 parm(
"StringFlav:probQQtoQ", 0.10 );
806 parm(
"StringFlav:probSQtoQQ", 0.40 );
807 parm(
"StringFlav:probQQ1toQQ0", 0.05 );
808 parm(
"StringFlav:mesonUDvector", 1.00 );
809 parm(
"StringFlav:mesonSvector", 1.50 );
810 parm(
"StringFlav:mesonCvector", 2.50 );
811 parm(
"StringFlav:mesonBvector", 3.00 );
812 parm(
"StringFlav:etaSup", 1.00 );
813 parm(
"StringFlav:etaPrimeSup", 0.40 );
814 parm(
"StringFlav:popcornSpair", 0.50 );
815 parm(
"StringFlav:popcornSmeson", 0.50 );
816 parm(
"StringZ:aLund", 0.30 );
817 parm(
"StringZ:bLund", 0.58 );
818 parm(
"StringZ:rFactB", 1.00 );
819 parm(
"StringPT:sigma", 0.36 );
820 parm(
"TimeShower:alphaSvalue", 0.137 );
821 parm(
"TimeShower:pTmin", 0.5 );
822 parm(
"TimeShower:pTminChgQ", 0.5 );
826 else if (eeTune == 2) {
827 parm(
"StringFlav:probStoUD", 0.22 );
828 parm(
"StringFlav:probQQtoQ", 0.08 );
829 parm(
"StringFlav:probSQtoQQ", 0.75 );
830 parm(
"StringFlav:probQQ1toQQ0", 0.025 );
831 parm(
"StringFlav:mesonUDvector", 0.5 );
832 parm(
"StringFlav:mesonSvector", 0.6 );
833 parm(
"StringFlav:mesonCvector", 1.5 );
834 parm(
"StringFlav:mesonBvector", 2.5 );
835 parm(
"StringFlav:etaSup", 0.60 );
836 parm(
"StringFlav:etaPrimeSup", 0.15 );
837 parm(
"StringFlav:popcornSpair", 1.0 );
838 parm(
"StringFlav:popcornSmeson", 1.0 );
839 parm(
"StringZ:aLund", 0.76 );
840 parm(
"StringZ:bLund", 0.58 );
841 parm(
"StringZ:rFactB", 1.00 );
842 parm(
"StringPT:sigma", 0.36 );
843 parm(
"TimeShower:alphaSvalue", 0.137 );
844 parm(
"TimeShower:pTmin", 0.5 );
845 parm(
"TimeShower:pTminChgQ", 0.5 );
850 else if (eeTune == 3) {
851 parm(
"StringFlav:probStoUD", 0.19 );
852 parm(
"StringFlav:probQQtoQ", 0.09 );
853 parm(
"StringFlav:probSQtoQQ", 1.00 );
854 parm(
"StringFlav:probQQ1toQQ0", 0.027 );
855 parm(
"StringFlav:mesonUDvector", 0.62 );
856 parm(
"StringFlav:mesonSvector", 0.725 );
857 parm(
"StringFlav:mesonCvector", 1.06 );
858 parm(
"StringFlav:mesonBvector", 3.0 );
859 parm(
"StringFlav:etaSup", 0.63 );
860 parm(
"StringFlav:etaPrimeSup", 0.12 );
861 parm(
"StringFlav:popcornSpair", 0.5 );
862 parm(
"StringFlav:popcornSmeson", 0.5 );
863 parm(
"StringZ:aLund", 0.3 );
864 parm(
"StringZ:bLund", 0.8 );
865 parm(
"StringZ:rFactB", 0.67 );
866 parm(
"StringPT:sigma", 0.304 );
867 parm(
"TimeShower:alphaSvalue", 0.1383);
868 parm(
"TimeShower:pTmin", 0.4 );
869 parm(
"TimeShower:pTminChgQ", 0.4 );
879 void Settings::initTunePP(
int ppTune) {
884 resetMode(
"PDF:pSet");
885 resetParm(
"SigmaProcess:alphaSvalue");
886 resetFlag(
"SigmaDiffractive:dampen");
887 resetParm(
"SigmaDiffractive:maxXB");
888 resetParm(
"SigmaDiffractive:maxAX");
889 resetParm(
"SigmaDiffractive:maxXX");
890 resetFlag(
"TimeShower:dampenBeamRecoil");
891 resetFlag(
"TimeShower:phiPolAsym");
892 resetParm(
"SpaceShower:alphaSvalue");
893 resetFlag(
"SpaceShower:samePTasMPI");
894 resetParm(
"SpaceShower:pT0Ref");
895 resetParm(
"SpaceShower:ecmRef");
896 resetParm(
"SpaceShower:ecmPow");
897 resetFlag(
"SpaceShower:rapidityOrder");
898 resetFlag(
"SpaceShower:phiPolAsym");
899 resetFlag(
"SpaceShower:phiIntAsym");
900 resetParm(
"MultipartonInteractions:alphaSvalue");
901 resetParm(
"MultipartonInteractions:pT0Ref");
902 resetParm(
"MultipartonInteractions:ecmRef");
903 resetParm(
"MultipartonInteractions:ecmPow");
904 resetMode(
"MultipartonInteractions:bProfile");
905 resetParm(
"MultipartonInteractions:expPow");
906 resetParm(
"MultipartonInteractions:a1");
907 resetParm(
"BeamRemnants:primordialKTsoft");
908 resetParm(
"BeamRemnants:primordialKThard");
909 resetParm(
"BeamRemnants:halfScaleForKT");
910 resetParm(
"BeamRemnants:halfMassForKT");
911 resetParm(
"BeamRemnants:reconnectRange");
916 mode(
"PDF:pSet", 2 );
917 parm(
"SigmaProcess:alphaSvalue", 0.1265);
918 flag(
"SigmaDiffractive:dampen",
false );
919 flag(
"TimeShower:dampenBeamRecoil",
false );
920 flag(
"TimeShower:phiPolAsym",
false );
921 parm(
"SpaceShower:alphaSvalue", 0.127 );
922 flag(
"SpaceShower:samePTasMPI",
true );
923 parm(
"SpaceShower:pT0Ref", 2.2 );
924 parm(
"SpaceShower:ecmRef", 1800.0);
925 parm(
"SpaceShower:ecmPow", 0.16 );
926 flag(
"SpaceShower:rapidityOrder",
false );
927 flag(
"SpaceShower:phiPolAsym",
false );
928 flag(
"SpaceShower:phiIntAsym",
false );
929 parm(
"MultipartonInteractions:alphaSvalue", 0.127 );
930 parm(
"MultipartonInteractions:pT0Ref", 2.15 );
931 parm(
"MultipartonInteractions:ecmRef", 1800. );
932 parm(
"MultipartonInteractions:ecmPow", 0.16 );
933 mode(
"MultipartonInteractions:bProfile", 2 );
934 parm(
"BeamRemnants:primordialKTsoft", 0.4 );
935 parm(
"BeamRemnants:primordialKThard", 2.1 );
936 parm(
"BeamRemnants:halfScaleForKT", 7.0 );
937 parm(
"BeamRemnants:halfMassForKT", 2.0 );
938 parm(
"BeamRemnants:reconnectRange", 2.5 );
942 else if (ppTune == 2) {
943 mode(
"PDF:pSet", 2 );
944 parm(
"SigmaProcess:alphaSvalue", 0.1265);
945 flag(
"SigmaDiffractive:dampen",
false );
946 flag(
"TimeShower:dampenBeamRecoil",
false );
947 flag(
"TimeShower:phiPolAsym",
false );
948 parm(
"SpaceShower:alphaSvalue", 0.137 );
949 flag(
"SpaceShower:samePTasMPI",
false );
950 parm(
"SpaceShower:pT0Ref", 2.0 );
951 parm(
"SpaceShower:ecmRef", 1800.0);
952 parm(
"SpaceShower:ecmPow", 0.0 );
953 flag(
"SpaceShower:rapidityOrder",
false );
954 flag(
"SpaceShower:phiPolAsym",
false );
955 flag(
"SpaceShower:phiIntAsym",
false );
956 parm(
"MultipartonInteractions:alphaSvalue", 0.127 );
957 parm(
"MultipartonInteractions:pT0Ref", 2.25 );
958 parm(
"MultipartonInteractions:ecmRef", 1800. );
959 parm(
"MultipartonInteractions:ecmPow", 0.24 );
960 mode(
"MultipartonInteractions:bProfile", 1 );
961 parm(
"BeamRemnants:primordialKTsoft", 0.5 );
962 parm(
"BeamRemnants:primordialKThard", 2.0 );
963 parm(
"BeamRemnants:halfScaleForKT", 1.0 );
964 parm(
"BeamRemnants:halfMassForKT", 1.0 );
965 parm(
"BeamRemnants:reconnectRange", 10.0 );
969 else if (ppTune == 3) {
970 mode(
"PDF:pSet", 8 );
971 parm(
"SigmaProcess:alphaSvalue", 0.135 );
972 flag(
"SigmaDiffractive:dampen",
false );
973 flag(
"TimeShower:dampenBeamRecoil",
true );
974 flag(
"TimeShower:phiPolAsym",
true );
975 parm(
"SpaceShower:alphaSvalue", 0.137 );
976 flag(
"SpaceShower:samePTasMPI",
false );
977 parm(
"SpaceShower:pT0Ref", 2.0 );
978 parm(
"SpaceShower:ecmRef", 1800.0);
979 parm(
"SpaceShower:ecmPow", 0.0 );
980 flag(
"SpaceShower:rapidityOrder",
true );
981 flag(
"SpaceShower:phiPolAsym",
true );
982 flag(
"SpaceShower:phiIntAsym",
true );
983 parm(
"MultipartonInteractions:alphaSvalue", 0.135 );
984 parm(
"MultipartonInteractions:pT0Ref", 2.32 );
985 parm(
"MultipartonInteractions:ecmRef", 1800. );
986 parm(
"MultipartonInteractions:ecmPow", 0.21 );
987 mode(
"MultipartonInteractions:bProfile", 3 );
988 parm(
"MultipartonInteractions:expPow", 1.6 );
989 parm(
"BeamRemnants:primordialKTsoft", 0.5 );
990 parm(
"BeamRemnants:primordialKThard", 2.0 );
991 parm(
"BeamRemnants:halfScaleForKT", 1.0 );
992 parm(
"BeamRemnants:halfMassForKT", 1.0 );
993 parm(
"BeamRemnants:reconnectRange", 3.0 );
997 else if (ppTune == 4) {
998 mode(
"PDF:pSet", 4 );
999 parm(
"SigmaProcess:alphaSvalue", 0.1265);
1000 flag(
"SigmaDiffractive:dampen",
false );
1001 flag(
"TimeShower:dampenBeamRecoil",
true );
1002 flag(
"TimeShower:phiPolAsym",
true );
1003 parm(
"SpaceShower:alphaSvalue", 0.130 );
1004 flag(
"SpaceShower:samePTasMPI",
false );
1005 parm(
"SpaceShower:pT0Ref", 2.0 );
1006 parm(
"SpaceShower:ecmRef", 1800.0);
1007 parm(
"SpaceShower:ecmPow", 0.0 );
1008 flag(
"SpaceShower:rapidityOrder",
true );
1009 flag(
"SpaceShower:phiPolAsym",
true );
1010 flag(
"SpaceShower:phiIntAsym",
true );
1011 parm(
"MultipartonInteractions:alphaSvalue", 0.127 );
1012 parm(
"MultipartonInteractions:pT0Ref", 2.455 );
1013 parm(
"MultipartonInteractions:ecmRef", 1800. );
1014 parm(
"MultipartonInteractions:ecmPow", 0.26 );
1015 mode(
"MultipartonInteractions:bProfile", 3 );
1016 parm(
"MultipartonInteractions:expPow", 1.15 );
1017 parm(
"BeamRemnants:primordialKTsoft", 0.5 );
1018 parm(
"BeamRemnants:primordialKThard", 2.0 );
1019 parm(
"BeamRemnants:halfScaleForKT", 1.0 );
1020 parm(
"BeamRemnants:halfMassForKT", 1.0 );
1021 parm(
"BeamRemnants:reconnectRange", 3.0 );
1025 else if (ppTune == 5) {
1026 mode(
"PDF:pSet", 8 );
1027 parm(
"SigmaProcess:alphaSvalue", 0.135 );
1028 flag(
"SigmaDiffractive:dampen",
true );
1029 parm(
"SigmaDiffractive:maxXB", 65.0 );
1030 parm(
"SigmaDiffractive:maxAX", 65.0 );
1031 parm(
"SigmaDiffractive:maxXX", 65.0 );
1032 flag(
"TimeShower:dampenBeamRecoil",
true );
1033 flag(
"TimeShower:phiPolAsym",
true );
1034 parm(
"SpaceShower:alphaSvalue", 0.137 );
1035 flag(
"SpaceShower:samePTasMPI",
false );
1036 parm(
"SpaceShower:pT0Ref", 2.0 );
1037 parm(
"SpaceShower:ecmRef", 1800.0);
1038 parm(
"SpaceShower:ecmPow", 0.0 );
1039 flag(
"SpaceShower:rapidityOrder",
true );
1040 flag(
"SpaceShower:phiPolAsym",
true );
1041 flag(
"SpaceShower:phiIntAsym",
true );
1042 parm(
"MultipartonInteractions:alphaSvalue", 0.135 );
1043 parm(
"MultipartonInteractions:pT0Ref", 2.085 );
1044 parm(
"MultipartonInteractions:ecmRef", 1800. );
1045 parm(
"MultipartonInteractions:ecmPow", 0.19 );
1046 mode(
"MultipartonInteractions:bProfile", 3 );
1047 parm(
"MultipartonInteractions:expPow", 2.0 );
1048 parm(
"BeamRemnants:primordialKTsoft", 0.5 );
1049 parm(
"BeamRemnants:primordialKThard", 2.0 );
1050 parm(
"BeamRemnants:halfScaleForKT", 1.0 );
1051 parm(
"BeamRemnants:halfMassForKT", 1.0 );
1052 parm(
"BeamRemnants:reconnectRange", 1.5 );
1056 else if (ppTune == 6) {
1057 mode(
"PDF:pSet", 8 );
1058 parm(
"SigmaProcess:alphaSvalue", 0.135 );
1059 flag(
"SigmaDiffractive:dampen",
true );
1060 parm(
"SigmaDiffractive:maxXB", 65.0 );
1061 parm(
"SigmaDiffractive:maxAX", 65.0 );
1062 parm(
"SigmaDiffractive:maxXX", 65.0 );
1063 flag(
"TimeShower:dampenBeamRecoil",
true );
1064 flag(
"TimeShower:phiPolAsym",
true );
1065 parm(
"SpaceShower:alphaSvalue", 0.137 );
1066 flag(
"SpaceShower:samePTasMPI",
false );
1067 parm(
"SpaceShower:pT0Ref", 2.0 );
1068 parm(
"SpaceShower:ecmRef", 1800.0);
1069 parm(
"SpaceShower:ecmPow", 0.0 );
1070 flag(
"SpaceShower:rapidityOrder",
true );
1071 flag(
"SpaceShower:phiPolAsym",
true );
1072 flag(
"SpaceShower:phiIntAsym",
true );
1073 parm(
"MultipartonInteractions:alphaSvalue", 0.135 );
1074 parm(
"MultipartonInteractions:pT0Ref", 2.15 );
1075 parm(
"MultipartonInteractions:ecmRef", 1800. );
1076 parm(
"MultipartonInteractions:ecmPow", 0.19 );
1077 mode(
"MultipartonInteractions:bProfile", 4 );
1078 parm(
"MultipartonInteractions:a1", 0.15 );
1079 parm(
"BeamRemnants:primordialKTsoft", 0.5 );
1080 parm(
"BeamRemnants:primordialKThard", 2.0 );
1081 parm(
"BeamRemnants:halfScaleForKT", 1.0 );
1082 parm(
"BeamRemnants:halfMassForKT", 1.0 );
1083 parm(
"BeamRemnants:reconnectRange", 1.5 );
1087 else if (ppTune == 7) {
1088 mode(
"PDF:pSet", 8 );
1089 parm(
"SigmaProcess:alphaSvalue", 0.135 );
1090 flag(
"SigmaDiffractive:dampen",
true );
1091 parm(
"SigmaDiffractive:maxXB", 65.0 );
1092 parm(
"SigmaDiffractive:maxAX", 65.0 );
1093 parm(
"SigmaDiffractive:maxXX", 65.0 );
1094 flag(
"TimeShower:dampenBeamRecoil",
true );
1095 flag(
"TimeShower:phiPolAsym",
true );
1096 parm(
"SpaceShower:alphaSvalue", 0.137 );
1097 flag(
"SpaceShower:samePTasMPI",
false );
1098 parm(
"SpaceShower:pT0Ref", 2.0 );
1099 parm(
"SpaceShower:ecmRef", 1800.0);
1100 parm(
"SpaceShower:ecmPow", 0.0 );
1101 flag(
"SpaceShower:rapidityOrder",
false );
1102 flag(
"SpaceShower:phiPolAsym",
true );
1103 flag(
"SpaceShower:phiIntAsym",
true );
1104 parm(
"MultipartonInteractions:alphaSvalue", 0.135 );
1105 parm(
"MultipartonInteractions:pT0Ref", 2.18 );
1106 parm(
"MultipartonInteractions:ecmRef", 1800. );
1107 parm(
"MultipartonInteractions:ecmPow", 0.22 );
1108 mode(
"MultipartonInteractions:bProfile", 4 );
1109 parm(
"MultipartonInteractions:a1", 0.06 );
1110 parm(
"BeamRemnants:primordialKTsoft", 0.5 );
1111 parm(
"BeamRemnants:primordialKThard", 2.0 );
1112 parm(
"BeamRemnants:halfScaleForKT", 1.0 );
1113 parm(
"BeamRemnants:halfMassForKT", 1.0 );
1114 parm(
"BeamRemnants:reconnectRange", 1.55 );
1124 string Settings::toLower(
const string& name) {
1127 if (name.find_first_not_of(
" \n\t\v\b\r\f\a") == string::npos)
return "";
1128 int firstChar = name.find_first_not_of(
" \n\t\v\b\r\f\a");
1129 int lastChar = name.find_last_not_of(
" \n\t\v\b\r\f\a");
1130 string temp = name.substr( firstChar, lastChar + 1 - firstChar);
1133 for (
int i = 0; i < int(temp.length()); ++i)
1134 temp[i] = std::tolower(temp[i]);
1143 bool Settings::boolString(
string tag) {
1145 string tagLow = toLower(tag);
1146 return ( tagLow ==
"true" || tagLow ==
"1" || tagLow ==
"on"
1147 || tagLow ==
"yes" || tagLow ==
"ok" );
1155 string Settings::attributeValue(
string line,
string attribute) {
1157 if (line.find(attribute) == string::npos)
return "";
1158 int iBegAttri = line.find(attribute);
1159 int iBegQuote = line.find(
"\"", iBegAttri + 1);
1160 int iEndQuote = line.find(
"\"", iBegQuote + 1);
1161 return line.substr(iBegQuote + 1, iEndQuote - iBegQuote - 1);
1169 bool Settings::boolAttributeValue(
string line,
string attribute) {
1171 string valString = attributeValue(line, attribute);
1172 if (valString ==
"")
return false;
1173 return boolString(valString);
1181 int Settings::intAttributeValue(
string line,
string attribute) {
1182 string valString = attributeValue(line, attribute);
1183 if (valString ==
"")
return 0;
1184 istringstream valStream(valString);
1186 valStream >> intVal;
1195 double Settings::doubleAttributeValue(
string line,
string attribute) {
1196 string valString = attributeValue(line, attribute);
1197 if (valString ==
"")
return 0.;
1198 istringstream valStream(valString);
1200 valStream >> doubleVal;