8 #include "Pythia8/Pythia.h"
9 #include "Pythia8/BeamShape.h"
10 #include "Pythia8/ColourReconnection.h"
11 #include "Pythia8/Dire.h"
12 #include "Pythia8/HeavyIons.h"
13 #include "Pythia8/History.h"
14 #include "Pythia8/StringInteractions.h"
15 #include "Pythia8/Vincia.h"
32 const double Pythia::VERSIONNUMBERHEAD = PYTHIA_VERSION;
33 const double Pythia::VERSIONNUMBERCODE = 8.303;
39 Pythia::Pythia(
string xmlDir,
bool printBanner) {
47 const char* envPath = getenv(
"PYTHIA8DATA");
48 xmlPath = envPath ? envPath :
"";
50 if (xmlDir.length() && xmlDir[xmlDir.length() - 1] !=
'/') xmlDir +=
"/";
52 ifstream xmlFile((xmlPath +
"Index.xml").c_str());
53 if (!xmlFile.good()) xmlPath = XMLDIR;
56 if (xmlPath.empty() || (xmlPath.length() && xmlPath[xmlPath.length() - 1]
57 !=
'/')) xmlPath +=
"/";
60 settings.initPtrs( &infoPrivate);
61 string initFile = xmlPath +
"Index.xml";
62 isConstructed = settings.init( initFile);
64 infoPrivate.errorMsg(
"Abort from Pythia::Pythia: settings unavailable");
69 settings.addWord(
"xmlPath", xmlPath);
72 if (!checkVersion())
return;
75 particleData.initPtrs( &infoPrivate);
76 string dataFile = xmlPath +
"ParticleData.xml";
77 isConstructed = particleData.init( dataFile);
80 (
"Abort from Pythia::Pythia: particle data unavailable");
85 if (printBanner) banner();
89 infoPrivate.addCounter(0);
99 Pythia::Pythia(Settings& settingsIn, ParticleData& particleDataIn,
106 xmlPath = settingsIn.word(
"xmlPath");
109 settings = settingsIn;
110 settings.initPtrs( &infoPrivate);
111 isConstructed = settings.getIsInit();
112 if (!isConstructed) {
113 infoPrivate.errorMsg(
"Abort from Pythia::Pythia: settings unavailable");
118 if (!checkVersion())
return;
121 particleData = particleDataIn;
122 particleData.initPtrs( &infoPrivate);
123 isConstructed = particleData.getIsInit();
124 if (!isConstructed) {
126 (
"Abort from Pythia::Pythia: particle data unavailable");
131 if (printBanner) banner();
135 infoPrivate.addCounter(0);
143 Pythia::Pythia( istream& settingsStrings, istream& particleDataStrings,
150 settings.init( settingsStrings );
153 settings.initPtrs( &infoPrivate);
154 isConstructed = settings.getIsInit();
155 if (!isConstructed) {
156 infoPrivate.errorMsg(
"Abort from Pythia::Pythia: settings unavailable");
161 if (!checkVersion())
return;
164 particleData.initPtrs( &infoPrivate);
165 isConstructed = particleData.init( particleDataStrings );
166 if (!isConstructed) {
168 (
"Abort from Pythia::Pythia: particle data unavailable");
173 if (printBanner) banner();
177 infoPrivate.addCounter(0);
185 void Pythia::initPtrs() {
188 infoPrivate.setPtrs( &settings, &particleData, &rndm, &coupSM, &coupSUSY,
189 &beamA, &beamB, &beamPomA, &beamPomB, &beamGamA, &beamGamB, &beamVMDA,
190 &beamVMDB, &partonSystems, &sigmaTot, &hadronWidths, &weightContainer);
191 registerPhysicsBase(processLevel);
192 registerPhysicsBase(partonLevel);
193 registerPhysicsBase(trialPartonLevel);
194 registerPhysicsBase(hadronLevel);
195 registerPhysicsBase(sigmaTot);
196 registerPhysicsBase(hadronWidths);
197 registerPhysicsBase(junctionSplitting);
198 registerPhysicsBase(rHadrons);
199 registerPhysicsBase(beamA);
200 registerPhysicsBase(beamB);
201 registerPhysicsBase(beamPomA);
202 registerPhysicsBase(beamPomB);
203 registerPhysicsBase(beamGamA);
204 registerPhysicsBase(beamGamB);
205 registerPhysicsBase(beamVMDA);
206 registerPhysicsBase(beamVMDB);
214 bool Pythia::checkVersion() {
217 double versionNumberXML = parm(
"Pythia:versionNumber");
218 isConstructed = (abs(versionNumberXML - VERSIONNUMBERCODE) < 0.0005);
219 if (!isConstructed) {
220 ostringstream errCode;
221 errCode << fixed << setprecision(3) <<
": in code " << VERSIONNUMBERCODE
222 <<
" but in XML " << versionNumberXML;
224 (
"Abort from Pythia::Pythia: unmatched version numbers", errCode.str());
229 isConstructed = (abs(VERSIONNUMBERHEAD - VERSIONNUMBERCODE) < 0.0005);
230 if (!isConstructed) {
231 ostringstream errCode;
232 errCode << fixed << setprecision(3) <<
": in code " << VERSIONNUMBERCODE
233 <<
" but in header " << VERSIONNUMBERHEAD;
235 (
"Abort from Pythia::Pythia: unmatched version numbers", errCode.str());
248 bool Pythia::readString(
string line,
bool warn) {
251 if (!isConstructed)
return false;
254 if (line.find_first_not_of(
" \n\t\v\b\r\f\a") == string::npos)
return true;
257 if (settings.unfinishedInput())
return settings.readString(line, warn);
260 int firstChar = line.find_first_not_of(
" \n\t\v\b\r\f\a");
261 if (!isalnum(line[firstChar]))
return true;
264 if (isdigit(line[firstChar])) {
265 bool passed = particleData.readString(line, warn);
266 if (passed) particleDataBuffer << line << endl;
271 return settings.readString(line, warn);
279 bool Pythia::readFile(
string fileName,
bool warn,
int subrun) {
282 if (!isConstructed)
return false;
285 const char* cstring = fileName.c_str();
286 ifstream is(cstring);
289 (
"Error in Pythia::readFile: did not find file", fileName);
294 return readFile( is, warn, subrun);
303 bool Pythia::readFile(istream& is,
bool warn,
int subrun) {
306 if (!isConstructed)
return false;
310 bool isCommented =
false;
311 bool accepted =
true;
312 int subrunNow = SUBRUNDEFAULT;
313 while ( getline(is, line) ) {
316 int commentLine = readCommented( line);
317 if (commentLine == +1) isCommented =
true;
318 else if (commentLine == -1) isCommented =
false;
319 else if (isCommented) ;
323 int subrunLine = readSubrun( line, warn);
324 if (subrunLine >= 0) subrunNow = subrunLine;
327 if ( (subrunNow == subrun || subrunNow == SUBRUNDEFAULT)
328 && !readString( line, warn) ) accepted =
false;
341 bool Pythia::setPDFPtr( PDFPtr pdfAPtrIn, PDFPtr pdfBPtrIn,
342 PDFPtr pdfHardAPtrIn, PDFPtr pdfHardBPtrIn, PDFPtr pdfPomAPtrIn,
343 PDFPtr pdfPomBPtrIn, PDFPtr pdfGamAPtrIn, PDFPtr pdfGamBPtrIn,
344 PDFPtr pdfHardGamAPtrIn, PDFPtr pdfHardGamBPtrIn, PDFPtr pdfUnresAPtrIn,
345 PDFPtr pdfUnresBPtrIn, PDFPtr pdfUnresGamAPtrIn, PDFPtr pdfUnresGamBPtrIn,
346 PDFPtr pdfVMDAPtrIn, PDFPtr pdfVMDBPtrIn) {
348 pdfAPtr = pdfBPtr = pdfHardAPtr = pdfHardBPtr = pdfPomAPtr = pdfPomBPtr
349 = pdfGamAPtr = pdfGamBPtr = pdfHardGamAPtr = pdfHardGamBPtr = pdfUnresAPtr
350 = pdfUnresBPtr = pdfUnresGamAPtr = pdfUnresGamBPtr = pdfVMDAPtr
351 = pdfVMDBPtr =
nullptr;
354 if ( !pdfAPtrIn && !pdfBPtrIn)
return true;
357 if (pdfAPtrIn == pdfBPtrIn)
return false;
364 pdfHardAPtr = pdfAPtrIn;
365 pdfHardBPtr = pdfBPtrIn;
368 if (pdfHardAPtrIn && pdfHardBPtrIn) {
369 if (pdfHardAPtrIn == pdfHardBPtrIn)
return false;
370 pdfHardAPtr = pdfHardAPtrIn;
371 pdfHardBPtr = pdfHardBPtrIn;
375 if (pdfPomAPtrIn && pdfPomBPtrIn) {
376 if (pdfPomAPtrIn == pdfPomBPtrIn)
return false;
377 pdfPomAPtr = pdfPomAPtrIn;
378 pdfPomBPtr = pdfPomBPtrIn;
382 if (pdfGamAPtrIn && pdfGamBPtrIn) {
383 if (pdfGamAPtrIn == pdfGamBPtrIn)
return false;
384 pdfGamAPtr = pdfGamAPtrIn;
385 pdfGamBPtr = pdfGamBPtrIn;
389 if (pdfHardGamAPtrIn && pdfHardGamBPtrIn) {
390 if (pdfHardGamAPtrIn == pdfHardGamBPtrIn)
return false;
391 pdfHardGamAPtr = pdfHardGamAPtrIn;
392 pdfHardGamBPtr = pdfHardGamBPtrIn;
396 if (pdfUnresAPtrIn && pdfUnresBPtrIn) {
397 if (pdfUnresAPtrIn == pdfUnresBPtrIn)
return false;
398 pdfUnresAPtr = pdfUnresAPtrIn;
399 pdfUnresBPtr = pdfUnresBPtrIn;
403 if (pdfUnresGamAPtrIn && pdfUnresGamBPtrIn) {
404 if (pdfUnresGamAPtrIn == pdfUnresGamBPtrIn)
return false;
405 pdfUnresGamAPtr = pdfUnresGamAPtrIn;
406 pdfUnresGamBPtr = pdfUnresGamBPtrIn;
410 if (pdfVMDAPtrIn && pdfVMDBPtrIn) {
411 if (pdfVMDAPtrIn == pdfVMDBPtrIn)
return false;
412 pdfVMDAPtr = pdfVMDAPtrIn;
413 pdfVMDBPtr = pdfVMDBPtrIn;
424 bool Pythia::setPDFAPtr( PDFPtr pdfAPtrIn ) {
427 pdfAPtr = pdfBPtr = pdfHardAPtr = pdfHardBPtr = pdfPomAPtr = pdfPomBPtr
428 = pdfGamAPtr = pdfGamBPtr = pdfHardGamAPtr = pdfHardGamBPtr = pdfUnresAPtr
429 = pdfUnresBPtr = pdfUnresGamAPtr = pdfUnresGamBPtr = pdfVMDAPtr
430 = pdfVMDBPtr =
nullptr;
433 if (!pdfAPtrIn)
return true;
438 pdfHardAPtr = pdfAPtrIn;
448 bool Pythia::setPDFBPtr( PDFPtr pdfBPtrIn ) {
451 pdfAPtr = pdfBPtr = pdfHardAPtr = pdfHardBPtr = pdfPomAPtr = pdfPomBPtr
452 = pdfGamAPtr = pdfGamBPtr = pdfHardGamAPtr = pdfHardGamBPtr = pdfUnresAPtr
453 = pdfUnresBPtr = pdfUnresGamAPtr = pdfUnresGamBPtr = pdfVMDAPtr
454 = pdfVMDBPtr =
nullptr;
457 if (!pdfBPtrIn)
return true;
462 pdfHardBPtr = pdfBPtrIn;
472 bool Pythia::init() {
476 if (!isConstructed) {
477 infoPrivate.errorMsg(
"Abort from Pythia::init: constructor "
478 "initialization failed");
484 settings.mode(
"HeavyIon:mode") == 2;
486 if ( !heavyIonsPtr ) heavyIonsPtr = make_shared<Angantyr>(*this);
487 registerPhysicsBase(*heavyIonsPtr);
489 if ( !heavyIonsPtr->
init() ) doHeavyIons =
false;
493 int showerModel = settings.mode(
"PartonShowers:model");
496 doProcessLevel = settings.flag(
"ProcessLevel:all");
499 if (settings.unfinishedInput()) {
500 infoPrivate.errorMsg(
"Abort from Pythia::init: opening { not matched by "
504 if (settings.readingFailed()) {
505 infoPrivate.errorMsg(
"Abort from Pythia::init: some user settings "
506 "did not make sense");
509 if (particleData.readingFailed()) {
510 infoPrivate.errorMsg(
"Abort from Pythia::init: some user particle data "
511 "did not make sense");
516 if ( settings.flag(
"Random:setSeed") )
517 rndm.init( settings.mode(
"Random:seed") );
520 infoPrivate.addCounter(1);
521 frameType = mode(
"Beams:frameType");
525 string lhef = word(
"Beams:LHEF");
528 bool doUserMerging = settings.flag(
"Merging:doUserMerging");
529 bool doMGMerging = settings.flag(
"Merging:doMGMerging");
530 bool doKTMerging = settings.flag(
"Merging:doKTMerging");
531 bool doPTLundMerging = settings.flag(
"Merging:doPTLundMerging");
532 bool doCutBasedMerging = settings.flag(
"Merging:doCutBasedMerging");
534 bool doUMEPSTree = settings.flag(
"Merging:doUMEPSTree");
535 bool doUMEPSSubt = settings.flag(
"Merging:doUMEPSSubt");
537 bool doNL3Tree = settings.flag(
"Merging:doNL3Tree");
538 bool doNL3Loop = settings.flag(
"Merging:doNL3Loop");
539 bool doNL3Subt = settings.flag(
"Merging:doNL3Subt");
541 bool doUNLOPSTree = settings.flag(
"Merging:doUNLOPSTree");
542 bool doUNLOPSLoop = settings.flag(
"Merging:doUNLOPSLoop");
543 bool doUNLOPSSubt = settings.flag(
"Merging:doUNLOPSSubt");
544 bool doUNLOPSSubtNLO = settings.flag(
"Merging:doUNLOPSSubtNLO");
545 bool doXSectionEst = settings.flag(
"Merging:doXSectionEstimate");
546 doMerging = doUserMerging || doMGMerging || doKTMerging
547 || doPTLundMerging || doCutBasedMerging || doUMEPSTree || doUMEPSSubt
548 || doNL3Tree || doNL3Loop || doNL3Subt || doUNLOPSTree
549 || doUNLOPSLoop || doUNLOPSSubt || doUNLOPSSubtNLO || doXSectionEst;
550 doMerging = doMerging || settings.flag(
"Merging:doMerging");
553 weightContainer.initPtrs(&infoPrivate);
554 weightContainer.init(doMerging);
557 if (doMerging && showerModel == 1) {
558 if (!mergingHooksPtr) mergingHooksPtr = make_shared<MergingHooks>();
559 registerPhysicsBase(*mergingHooksPtr);
560 mergingHooksPtr->setLHEInputFile(
"");
564 if ( doMerging && showerModel == 1 && !mergingPtr ) {
565 mergingPtr = make_shared<Merging>();
566 registerPhysicsBase(*mergingPtr);
570 if (frameType < 4 ) {
572 boostType = frameType;
573 idA = mode(
"Beams:idA");
574 idB = mode(
"Beams:idB");
575 eCM = parm(
"Beams:eCM");
576 eA = parm(
"Beams:eA");
577 eB = parm(
"Beams:eB");
578 pxA = parm(
"Beams:pxA");
579 pyA = parm(
"Beams:pyA");
580 pzA = parm(
"Beams:pzA");
581 pxB = parm(
"Beams:pxB");
582 pyB = parm(
"Beams:pyB");
583 pzB = parm(
"Beams:pzB");
589 string lhefHeader = word(
"Beams:LHEFheader");
590 bool readHeaders = flag(
"Beams:readLHEFheaders");
591 bool setScales = flag(
"Beams:setProductionScalesFromLHEF");
592 bool skipInit = flag(
"Beams:newLHEFsameInit");
593 int nSkipAtInit = mode(
"Beams:nSkipLHEFatInit");
596 if (frameType == 4) {
597 const char* cstring1 = lhef.c_str();
598 bool useExternal = (lhaUpPtr && !useNewLHA && lhaUpPtr->useExternal());
599 if (!useExternal && useNewLHA && skipInit)
600 lhaUpPtr->newEventFile(cstring1);
601 else if (!useExternal) {
603 const char* cstring2 = (lhefHeader ==
"void")
604 ? NULL : lhefHeader.c_str();
605 lhaUpPtr = make_shared<LHAupLHEF>(&infoPrivate, cstring1, cstring2,
606 readHeaders, setScales);
610 if (!lhaUpPtr->fileFound()) {
611 infoPrivate.errorMsg(
"Abort from Pythia::init: "
612 "Les Houches Event File not found");
619 infoPrivate.errorMsg(
"Abort from Pythia::init: "
620 "LHAup object not found");
625 if (!lhaUpPtr->fileFound()) {
626 infoPrivate.errorMsg(
"Abort from Pythia::init: "
627 "LHAup initialisation error");
633 lhaUpPtr->setPtr( &infoPrivate);
634 processLevel.setLHAPtr( lhaUpPtr);
640 infoPrivate.addCounter(2);
641 if (nSkipAtInit > 0) lhaUpPtr->skipEvent(nSkipAtInit);
646 if (frameType == 4 || frameType == 5) {
649 if (doMerging && showerModel == 1 ) {
650 string lhefIn = (frameType == 4) ? lhef :
"";
651 mergingHooksPtr->setLHEInputFile( lhefIn);
657 if ( !lhaUpPtr->setInit()) {
658 infoPrivate.errorMsg(
"Abort from Pythia::init: "
659 "Les Houches initialization failed");
664 idA = lhaUpPtr->idBeamA();
665 idB = lhaUpPtr->idBeamB();
666 int idRenameBeams = settings.mode(
"LesHouches:idRenameBeams");
667 if (abs(idA) == idRenameBeams) idA = 16;
668 if (abs(idB) == idRenameBeams) idB = -16;
669 if (idA == 0 || idB == 0) doProcessLevel =
false;
670 eA = lhaUpPtr->eBeamA();
671 eB = lhaUpPtr->eBeamB();
674 if (nSkipAtInit > 0) lhaUpPtr->skipEvent(nSkipAtInit);
678 doVetoProcess =
false;
679 doVetoPartons =
false;
680 retryPartonLevel =
false;
682 if ( userHooksPtr ) {
683 infoPrivate.userHooksPtr = userHooksPtr;
684 registerPhysicsBase(*userHooksPtr);
686 if (!userHooksPtr->initAfterBeams()) {
687 infoPrivate.errorMsg(
"Abort from Pythia::init: could not initialise"
691 doVetoProcess = userHooksPtr->canVetoProcessLevel();
692 doVetoPartons = userHooksPtr->canVetoPartonLevel();
693 retryPartonLevel = userHooksPtr->retryPartonLevel();
698 if ( !stringInteractionsPtr ) {
699 if ( flag(
"Ropewalk:RopeHadronization") )
700 stringInteractionsPtr = make_shared<Ropewalk>();
702 stringInteractionsPtr = make_shared<StringInteractions>();
703 registerPhysicsBase(*stringInteractionsPtr);
706 stringInteractionsPtr->init();
710 infoPrivate.setTooLowPTmin(
false);
711 infoPrivate.sigmaReset();
714 doPartonLevel = settings.flag(
"PartonLevel:all");
715 doHadronLevel = settings.flag(
"HadronLevel:all");
716 doCentralDiff = settings.flag(
"SoftQCD:centralDiffractive");
717 doSoftQCDall = settings.flag(
"SoftQCD:all");
718 doSoftQCDinel = settings.flag(
"SoftQCD:inelastic");
719 doDiffraction = settings.flag(
"SoftQCD:singleDiffractive")
720 || settings.flag(
"SoftQCD:doubleDiffractive")
721 || doSoftQCDall || doSoftQCDinel || doCentralDiff;
722 doSoftQCD = doDiffraction ||
723 settings.flag(
"SoftQCD:nonDiffractive") ||
724 settings.flag(
"SoftQCD:elastic");
725 doHardDiff = settings.flag(
"Diffraction:doHard");
726 doResDec = settings.flag(
"ProcessLevel:resonanceDecays");
727 doFSRinRes = doPartonLevel && settings.flag(
"PartonLevel:FSR")
728 && settings.flag(
"PartonLevel:FSRinResonances");
729 decayRHadrons = settings.flag(
"RHadrons:allowDecay");
730 doMomentumSpread = settings.flag(
"Beams:allowMomentumSpread");
731 doVertexSpread = settings.flag(
"Beams:allowVertexSpread");
732 doVarEcm = settings.flag(
"Beams:allowVariableEnergy");
733 doPartonVertex = settings.flag(
"PartonVertex:setVertex");
734 doVertexPlane = settings.flag(
"PartonVertex:randomPlane");
735 eMinPert = settings.parm(
"Beams:eMinPert");
736 eWidthPert = settings.parm(
"Beams:eWidthPert");
737 abortIfVeto = settings.flag(
"Check:abortIfVeto");
738 checkEvent = settings.flag(
"Check:event");
739 checkHistory = settings.flag(
"Check:history");
740 nErrList = settings.mode(
"Check:nErrList");
741 epTolErr = settings.parm(
"Check:epTolErr");
742 epTolWarn = settings.parm(
"Check:epTolWarn");
743 mTolErr = settings.parm(
"Check:mTolErr");
744 mTolWarn = settings.parm(
"Check:mTolWarn");
747 bool doHardProc = settings.hasHardProc() || doLHA;
748 if (doSoftQCD && doHardProc) {
749 infoPrivate.errorMsg(
"Warning from Pythia::init: "
750 "should not combine softQCD processes with hard ones");
752 if (doVarEcm) doMomentumSpread =
false;
753 if (doVarEcm && doHardProc) {
754 infoPrivate.errorMsg(
"Abort from Pythia::init: "
755 "variable energy only works for softQCD processes");
762 bool lepton2gamma = settings.flag(
"PDF:lepton2gamma");
763 if (lepton2gamma && ( abs(idA) == 11 || abs(idA) == 13 || abs(idA) == 15 ))
764 settings.flag(
"PDF:beamA2gamma",
true);
765 if (lepton2gamma && ( abs(idB) == 11 || abs(idB) == 13 || abs(idB) == 15 ))
766 settings.flag(
"PDF:beamB2gamma",
true);
767 beamA2gamma = settings.flag(
"PDF:beamA2gamma");
768 beamB2gamma = settings.flag(
"PDF:beamB2gamma");
769 gammaMode = settings.mode(
"Photon:ProcessType");
772 beamAResGamma = (beamA2gamma || idA == 22)
773 && ( (gammaMode == 1) || (gammaMode == 2) || (gammaMode == 0) );
774 beamBResGamma = (beamB2gamma || idB == 22)
775 && ( (gammaMode == 1) || (gammaMode == 3) || (gammaMode == 0) );
778 beamAUnresGamma = (beamA2gamma || idA == 22)
779 && ( (gammaMode == 4) || (gammaMode == 3) || (gammaMode == 0) );
780 beamBUnresGamma = (beamB2gamma || idB == 22)
781 && ( (gammaMode == 4) || (gammaMode == 2) || (gammaMode == 0) );
784 doVMDsideA = doSoftQCD && beamAResGamma;
785 doVMDsideB = doSoftQCD && beamBResGamma;
788 if (doVMDsideA || doVMDsideB) {
790 infoPrivate.errorMsg(
"Warning in Pythia::init: "
791 "Central diffractive events not implemented for gamma + p/gamma");
795 infoPrivate.errorMsg(
"Warning in Pythia::init: "
796 "Central diffractive events not implemented for gamma + p/gamma");
797 settings.flag(
"SoftQCD:all",
false);
798 settings.flag(
"SoftQCD:elastic",
true);
799 settings.flag(
"SoftQCD:nonDiffractive",
true);
800 settings.flag(
"SoftQCD:singleDiffractive",
true);
801 settings.flag(
"SoftQCD:doubleDiffractive",
true);
804 infoPrivate.errorMsg(
"Warning in Pythia::init: "
805 "Central diffractive events not implemented for gamma + p/gamma");
806 settings.flag(
"SoftQCD:inelastic",
false);
807 settings.flag(
"SoftQCD:nonDiffractive",
true);
808 settings.flag(
"SoftQCD:singleDiffractive",
true);
809 settings.flag(
"SoftQCD:doubleDiffractive",
true);
814 if ( doMerging && mergingHooksPtr ) mergingHooksPtr->init();
820 coupSM.init( settings, &rndm );
823 bool useSLHAcouplings =
false;
824 slhaInterface = SLHAinterface();
825 slhaInterface.setPtr( &infoPrivate);
826 slhaInterface.init( useSLHAcouplings, particleDataBuffer );
829 particleData.initPtrs( &infoPrivate);
832 int startColTag = settings.mode(
"Event:startColTag");
833 process.init(
"(hard process)", &particleData, startColTag);
834 event.init(
"(complete event)", &particleData, startColTag);
837 particleData.initWidths( resonancePtrs);
840 string dataFile = xmlPath +
"HadronWidths.dat";
841 if (!hadronWidths.init(dataFile)) {
842 infoPrivate.errorMsg(
"Abort from Pythia::init: hadron widths unavailable");
845 if (!hadronWidths.check()) {
846 infoPrivate.errorMsg(
"Abort from Pythia::init: hadron widths are invalid");
854 if (doPartonVertex) {
855 if (!partonVertexPtr) partonVertexPtr = make_shared<PartonVertex>();
856 registerPhysicsBase(*partonVertexPtr);
857 partonVertexPtr->init();
861 doNonPert = hadronLevel.initLowEnergyProcesses();
862 if (doNonPert && !doSoftQCD && !doHardProc) doProcessLevel =
false;
865 if ( !showerModelPtr ) {
866 if ( showerModel == 2 )
867 showerModelPtr = make_shared<Vincia>();
868 else if (showerModel == 3 )
869 showerModelPtr = make_shared<Dire>();
871 showerModelPtr = make_shared<SimpleShowerModel>();
873 registerPhysicsBase(*showerModelPtr);
877 if ( !showerModelPtr->init(mergingPtr, mergingHooksPtr,
878 partonVertexPtr, &weightContainer) ) {
879 infoPrivate.errorMsg(
"Abort from Pythia::init: "
880 "Shower model failed to initialise.");
885 if (doMerging && showerModel != 1) {
886 mergingPtr = showerModelPtr->getMerging();
887 mergingHooksPtr = showerModelPtr->getMergingHooks();
889 timesPtr = showerModelPtr->getTimeShower();
890 timesDecPtr = showerModelPtr->getTimeDecShower();
891 spacePtr = showerModelPtr->getSpaceShower();
894 if (showerModel == 1 || showerModel == 3) {
896 timesPtr->initPtrs( mergingHooksPtr, partonVertexPtr,
898 if ( timesDecPtr && timesDecPtr != timesPtr )
899 timesDecPtr->initPtrs( mergingHooksPtr, partonVertexPtr,
902 spacePtr->initPtrs( mergingHooksPtr, partonVertexPtr,
908 if (doMerging && !mergingPtr) {
909 infoPrivate.errorMsg(
"Abort from Pythia::init: "
910 "Merging requested, but merging class not correctly created");
915 if (!beamShapePtr) beamShapePtr = make_shared<BeamShape>();
916 beamShapePtr->init( settings, &rndm);
920 infoPrivate.errorMsg(
"Abort from Pythia::init: "
921 "checkBeams initialization failed");
926 if (doNonPert && !doSoftQCD) {
927 if (!initKinematics()) {
928 infoPrivate.errorMsg(
"Abort from Pythia::init: "
929 "kinematics initialization failed");
933 else if (!doProcessLevel) boostType = 1;
937 if (!initKinematics()) {
938 infoPrivate.errorMsg(
"Abort from Pythia::init: "
939 "kinematics initialization failed");
946 (
"Abort from Pythia::init: PDF initialization failed");
951 StringFlav* flavSelPtr = hadronLevel.getStringFlavPtr();
952 beamA.init( idA, pzAcm, eA, mA, pdfAPtr, pdfHardAPtr,
953 isUnresolvedA, flavSelPtr);
954 beamB.init( idB, pzBcm, eB, mB, pdfBPtr, pdfHardBPtr,
955 isUnresolvedB, flavSelPtr);
958 if (beamA2gamma) beamA.initGammaInBeam();
959 if (beamB2gamma) beamB.initGammaInBeam();
962 if (beamAUnresGamma) beamA.initUnres( pdfUnresAPtr);
963 if (beamBUnresGamma) beamB.initUnres( pdfUnresBPtr);
966 if ( doDiffraction || doHardDiff ) {
967 beamPomA.init( 990, 0.5 * eCM, 0.5 * eCM, 0., pdfPomAPtr, pdfPomAPtr,
969 beamPomB.init( 990, -0.5 * eCM, 0.5 * eCM, 0., pdfPomBPtr, pdfPomBPtr,
975 beamVMDA.init( 111, 0.5 * eCM, 0.5 * eCM, 0., pdfVMDAPtr, pdfVMDAPtr,
978 beamVMDB.init( 111, 0.5 * eCM, 0.5 * eCM, 0., pdfVMDBPtr, pdfVMDBPtr,
982 if ( !(beamA.isGamma()) && beamA2gamma) {
983 if ( gammaMode < 4 ) {
984 beamGamA.init( 22, 0.5 * eCM, 0.5 * eCM, 0.,
985 pdfGamAPtr, pdfHardGamAPtr,
false, flavSelPtr);
987 if ( beamAUnresGamma ) beamGamA.initUnres( pdfUnresGamAPtr);
989 if ( !(beamB.isGamma()) && beamB2gamma) {
990 if ( gammaMode < 4 ) {
991 beamGamB.init( 22, -0.5 * eCM, 0.5 * eCM, 0.,
992 pdfGamBPtr, pdfHardGamBPtr,
false, flavSelPtr);
994 if ( beamBUnresGamma ) beamGamB.initUnres( pdfUnresGamBPtr);
1000 if ( doProcessLevel ) {
1002 if (!processLevel.init(doLHA, &slhaInterface, sigmaPtrs, phaseSpacePtrs)) {
1003 infoPrivate.errorMsg(
"Abort from Pythia::init: "
1004 "processLevel initialization failed");
1010 if (!showerModelPtr->initAfterBeams()) {
1011 string message =
"Abort in Pythia::init: Fail to initialize ";
1012 if (showerModel==1) message +=
"default";
1013 else if (showerModel==2) message +=
"Vincia";
1014 else if (showerModel==3) message +=
"Dire";
1015 message +=
" shower.";
1016 infoPrivate.errorMsg(message);
1022 timesDecPtr->init( &beamA, &beamB);
1025 if ( !doProcessLevel) processLevel.initDecays(lhaUpPtr);
1028 if ( doPartonLevel && doProcessLevel && !partonLevel.init(timesDecPtr,
1029 timesPtr, spacePtr, &rHadrons, mergingHooksPtr,
1030 partonVertexPtr, stringInteractionsPtr,
false) ) {
1031 infoPrivate.errorMsg(
"Abort from Pythia::init: "
1032 "partonLevel initialization failed" );
1037 if ( doMerging && mergingHooksPtr )
1038 mergingHooksPtr->setShowerPointer(&partonLevel);
1041 if ( !doProcessLevel || !doPartonLevel) partonLevel.init(
1042 timesDecPtr,
nullptr,
nullptr, &rHadrons,
nullptr,
1043 partonVertexPtr, stringInteractionsPtr,
false);
1046 bool doVariations = flag(
"UncertaintyBands:doVariations");
1047 if ( doVariations && showerModel==1 ) weightContainer.weightsPS.
1048 initAutomatedVariationGroups(
true);
1051 if ( doMerging && !trialPartonLevel.init( timesDecPtr, timesPtr,
1052 spacePtr, &rHadrons, mergingHooksPtr, partonVertexPtr,
1053 stringInteractionsPtr,
true) ) {
1054 infoPrivate.errorMsg(
"Abort from Pythia::init: "
1055 "trialPartonLevel initialization failed");
1060 if (doMerging && mergingPtr && mergingHooksPtr) {
1061 mergingPtr->initPtrs( mergingHooksPtr, &trialPartonLevel);
1067 if ( !hadronLevel.init( timesDecPtr, &rHadrons, decayHandlePtr,
1068 handledParticles, stringInteractionsPtr, partonVertexPtr) ) {
1069 infoPrivate.errorMsg(
"Abort from Pythia::init: "
1070 "hadronLevel initialization failed");
1075 if ( settings.flag(
"Check:particleData") )
1076 particleData.checkTable( settings.mode(
"Check:levelParticleData") );
1079 bool showCS = settings.flag(
"Init:showChangedSettings");
1080 bool showAS = settings.flag(
"Init:showAllSettings");
1081 bool showCPD = settings.flag(
"Init:showChangedParticleData");
1082 bool showCRD = settings.flag(
"Init:showChangedResonanceData");
1083 bool showAPD = settings.flag(
"Init:showAllParticleData");
1084 int show1PD = settings.mode(
"Init:showOneParticleData");
1085 bool showPro = settings.flag(
"Init:showProcesses");
1086 if (showCS) settings.listChanged();
1087 if (showAS) settings.listAll();
1088 if (show1PD > 0) particleData.list(show1PD);
1089 if (showCPD) particleData.listChanged(showCRD);
1090 if (showAPD) particleData.listAll();
1093 nCount = settings.mode(
"Next:numberCount");
1094 nShowLHA = settings.mode(
"Next:numberShowLHA");
1095 nShowInfo = settings.mode(
"Next:numberShowInfo");
1096 nShowProc = settings.mode(
"Next:numberShowProcess");
1097 nShowEvt = settings.mode(
"Next:numberShowEvent");
1098 showSaV = settings.flag(
"Next:showScaleAndVertex");
1099 showMaD = settings.flag(
"Next:showMothersAndDaughters");
1102 junctionSplitting.init();
1105 doReconnect = settings.flag(
"ColourReconnection:reconnect");
1106 reconnectMode = settings.mode(
"ColourReconnection:mode");
1107 forceHadronLevelCR = settings.flag(
"ColourReconnection:forceHadronLevelCR");
1108 if ( doReconnect ) colourReconnectionPtr =
1109 stringInteractionsPtr->getColourReconnections();
1113 infoPrivate.addCounter(2);
1114 if (useNewLHA && showPro) lhaUpPtr->listInit();
1123 void Pythia::checkSettings() {
1126 if ((settings.flag(
"PartonLevel:ISR") || settings.flag(
"PartonLevel:FSR"))
1127 && settings.flag(
"MultipartonInteractions:allowDoubleRescatter")) {
1128 infoPrivate.errorMsg(
"Warning in Pythia::checkSettings: "
1129 "double rescattering switched off since showering is on");
1130 settings.flag(
"MultipartonInteractions:allowDoubleRescatter",
false);
1134 if ( beamA2gamma || beamB2gamma || (idA == 22) || (idB == 22) ) {
1135 if ( settings.flag(
"PartonLevel:MPI") && (gammaMode > 1) ) {
1136 infoPrivate.errorMsg(
"Warning in Pythia::checkSettings: "
1137 "MPIs turned off for collision with unresolved photon");
1138 settings.flag(
"PartonLevel:MPI",
false);
1140 if ( settings.flag(
"SoftQCD:nonDiffractive") && (gammaMode > 1) ) {
1141 infoPrivate.errorMsg(
"Warning in Pythia::checkSettings: "
1142 "Soft QCD processes turned off for collision with unresolved photon");
1143 settings.flag(
"SoftQCD:nonDiffractive",
false);
1153 bool Pythia::checkBeams() {
1156 int idAabs = abs(idA);
1157 int idBabs = abs(idB);
1158 if (!doProcessLevel)
return true;
1162 if (!particleData.isHadron(idA) || !particleData.isHadron(idB)) {
1163 infoPrivate.errorMsg(
"Error in Pythia::checkBeams: non-perturbative "
1164 "processes are defined only for hadron-hadron collisions.");
1167 if (particleData.m0(idA) + particleData.m0(idB) > eCM) {
1168 infoPrivate.errorMsg(
"Error in Pythia::checkBeams: beam particles "
1169 "have higher mass than eCM");
1176 bool isLeptonA = (idAabs > 10 && idAabs < 17);
1177 bool isLeptonB = (idBabs > 10 && idBabs < 17);
1178 bool isUnresLep = !settings.flag(
"PDF:lepton");
1179 bool isGammaA = idAabs == 22;
1180 bool isGammaB = idBabs == 22;
1181 isUnresolvedA = (isLeptonA && isUnresLep);
1182 isUnresolvedB = (isLeptonB && isUnresLep);
1185 if ( idAabs == 22 && !beamAResGamma ) isUnresolvedA =
true;
1186 if ( idBabs == 22 && !beamBResGamma ) isUnresolvedB =
true;
1189 if ( beamAResGamma ) isUnresolvedA =
false;
1190 if ( beamBResGamma ) isUnresolvedB =
false;
1193 if (idAabs > 50 && idAabs < 61) isLeptonA = isUnresolvedA =
true;
1194 if (idBabs > 50 && idBabs < 61) isLeptonB = isUnresolvedB =
true;
1197 if ( beamA2gamma || beamB2gamma || isGammaA || isGammaB ) {
1200 if ( (beamA2gamma && isGammaA) || (beamB2gamma && isGammaB) ) {
1201 infoPrivate.errorMsg
1202 (
"Error in Pythia::init: Not possible to have a photon sub-beam"
1203 " within a photon beam");
1208 if ( isLeptonA && isLeptonB && ( !beamA2gamma || !beamB2gamma ) ) {
1209 infoPrivate.errorMsg(
"Error in Pythia::init: DIS with resolved"
1210 " photons currently not supported");
1215 if ( ( beamA2gamma && isGammaB ) || ( beamB2gamma && isGammaA ) ) {
1216 infoPrivate.errorMsg(
"Error in Pythia::init: Photoproduction"
1217 " together with pure photon beam currently not supported");
1222 bool isSoft = settings.flag(
"SoftQCD:all")
1223 || settings.flag(
"SoftQCD:nonDiffractive")
1224 || settings.flag(
"SoftQCD:elastic")
1225 || settings.flag(
"SoftQCD:singleDiffractive")
1226 || settings.flag(
"SoftQCD:DoubleDiffractive")
1227 || settings.flag(
"SoftQCD:CentralDiffractive")
1228 || settings.flag(
"SoftQCD:inelastic");
1230 if ( ( (beamA2gamma || isGammaA) && !beamAResGamma )
1231 || ( (beamB2gamma || isGammaB) && !beamBResGamma ) ) {
1232 infoPrivate.errorMsg(
"Error in Pythia::init: Soft QCD only with"
1233 " resolved photons");
1248 if (isLeptonA && isLeptonB ) {
1251 if (isUnresolvedA == isUnresolvedB)
return true;
1255 int PomFlux = settings.mode(
"SigmaDiffractive:PomFlux");
1257 bool ispp = (idAabs == 2212 && idBabs == 2212);
1258 bool ispbarpbar = (idA == -2212 && idB == -2212);
1259 if (ispp && !ispbarpbar)
return true;
1260 infoPrivate.errorMsg(
"Error in Pythia::init: cannot handle this beam"
1261 " combination with PomFlux == 5");
1266 bool isHadronA = (idAabs == 2212) || (idAabs == 2112) || (idA == 111)
1267 || (idAabs == 211) || (idA == 990);
1268 bool isHadronB = (idBabs == 2212) || (idBabs == 2112) || (idB == 111)
1269 || (idBabs == 211) || (idB == 990);
1270 int modeUnresolvedHadron = settings.mode(
"BeamRemnants:unresolvedHadron");
1271 if (isHadronA && modeUnresolvedHadron%2 == 1) isUnresolvedA =
true;
1272 if (isHadronB && modeUnresolvedHadron > 1) isUnresolvedB =
true;
1273 if (isHadronA && isHadronB)
return true;
1277 if ( (isLeptonA && isHadronB) || (isHadronA && isLeptonB) ) {
1278 bool doDIS = settings.flag(
"WeakBosonExchange:all")
1279 || settings.flag(
"WeakBosonExchange:ff2ff(t:gmZ)")
1280 || settings.flag(
"WeakBosonExchange:ff2ff(t:W)")
1281 || !settings.flag(
"Check:beams")
1282 || (frameType == 4);
1283 if (doDIS)
return true;
1287 if ( settings.mode(
"Beams:frameType") == 4
1288 && !settings.flag(
"Check:beams"))
return true;
1291 infoPrivate.errorMsg(
"Error in Pythia::init: cannot handle this beam"
1301 bool Pythia::initKinematics() {
1304 mA = particleData.m0(idA);
1305 mB = particleData.m0(idB);
1310 if (boostType == 2) {
1313 pzA = sqrt(eA*eA - mA*mA);
1314 pzB = -sqrt(eB*eB - mB*mB);
1315 pAinit = Vec4( 0., 0., pzA, eA);
1316 pBinit = Vec4( 0., 0., pzB, eB);
1317 eCM = sqrt( pow2(eA + eB) - pow2(pzA + pzB) );
1320 betaZ = (pzA + pzB) / (eA + eB);
1321 gammaZ = (eA + eB) / eCM;
1322 if (abs(betaZ) < 1e-10) boostType = 1;
1326 else if (boostType == 3) {
1327 eA = sqrt( pxA*pxA + pyA*pyA + pzA*pzA + mA*mA);
1328 eB = sqrt( pxB*pxB + pyB*pyB + pzB*pzB + mB*mB);
1329 pAinit = Vec4( pxA, pyA, pzA, eA);
1330 pBinit = Vec4( pxB, pyB, pzB, eB);
1331 eCM = (pAinit + pBinit).mCalc();
1335 MfromCM.fromCMframe( pAinit, pBinit);
1341 if (eCM < mA + mB) {
1342 infoPrivate.errorMsg(
"Error in Pythia::initKinematics: too low energy");
1347 pzAcm = 0.5 * sqrtpos( (eCM + mA + mB) * (eCM - mA - mB)
1348 * (eCM - mA + mB) * (eCM + mA - mB) ) / eCM;
1350 eA = sqrt(mA*mA + pzAcm*pzAcm);
1351 eB = sqrt(mB*mB + pzBcm*pzBcm);
1354 if (boostType != 2 && boostType != 3) {
1355 pAinit = Vec4( 0., 0., pzAcm, eA);
1356 pBinit = Vec4( 0., 0., pzBcm, eB);
1360 infoPrivate.setBeamA( idA, pzAcm, eA, mA);
1361 infoPrivate.setBeamB( idB, pzBcm, eB, mB);
1362 infoPrivate.setECM( eCM);
1365 if (doMomentumSpread) boostType = 3;
1376 bool Pythia::initPDFs() {
1381 bool setupGammaBeams = ( (beamA2gamma || beamB2gamma) && (gammaMode < 4) );
1382 if (setupGammaBeams) {
1383 if ( beamA2gamma && pdfGamAPtr == 0 ) {
1384 pdfGamAPtr = getPDFPtr(22, 1,
"A");
1385 if (!pdfGamAPtr->isSetup())
return false;
1388 if (gammaMode != 1) {
1389 pdfUnresGamAPtr = getPDFPtr(22, 1,
"A",
false);
1390 if (!pdfUnresGamAPtr->isSetup())
return false;
1394 if (settings.flag(
"PDF:useHard")) {
1395 pdfHardGamAPtr = getPDFPtr(22, 2);
1396 if (!pdfHardGamAPtr->isSetup())
return false;
1397 }
else pdfHardGamAPtr = pdfGamAPtr;
1399 if ( beamB2gamma && pdfGamBPtr == 0 ) {
1400 pdfGamBPtr = getPDFPtr(22, 1,
"B");
1401 if (!pdfGamBPtr->isSetup())
return false;
1404 if (gammaMode != 1) {
1405 pdfUnresGamBPtr = getPDFPtr(22, 1,
"B",
false);
1406 if (!pdfUnresGamBPtr->isSetup())
return false;
1410 if (settings.flag(
"PDF:useHard")) {
1411 pdfHardGamBPtr = getPDFPtr(22, 2,
"B");
1412 if (!pdfHardGamBPtr->isSetup())
return false;
1413 }
else pdfHardGamBPtr = pdfGamBPtr;
1419 pdfAPtr = getPDFPtr(idA);
1420 if (pdfAPtr == 0 || !pdfAPtr->isSetup()) {
1421 infoPrivate.errorMsg(
"Error in Pythia::init: "
1422 "could not set up PDF for beam A");
1425 pdfHardAPtr = pdfAPtr;
1428 pdfBPtr = getPDFPtr(idB, 1,
"B");
1429 if (pdfBPtr == 0 || !pdfBPtr->isSetup()) {
1430 infoPrivate.errorMsg(
"Error in Pythia::init: "
1431 "could not set up PDF for beam B");
1434 pdfHardBPtr = pdfBPtr;
1438 if (settings.flag(
"PDF:useHard")) {
1439 pdfHardAPtr = getPDFPtr(idA, 2);
1440 if (!pdfHardAPtr->isSetup())
return false;
1441 pdfHardBPtr = getPDFPtr(idB, 2,
"B");
1442 if (!pdfHardBPtr->isSetup())
return false;
1446 if (settings.flag(
"PDF:useHardNPDFA")) {
1447 int idANucleus = settings.mode(
"PDF:nPDFBeamA");
1448 pdfHardAPtr = getPDFPtr(idANucleus, 2,
"A");
1449 if (!pdfHardAPtr->isSetup()) {
1450 infoPrivate.errorMsg(
"Error in Pythia::init: "
1451 "could not set up nuclear PDF for beam A");
1455 if (settings.flag(
"PDF:useHardNPDFB")) {
1456 int idBNucleus = settings.mode(
"PDF:nPDFBeamB");
1457 pdfHardBPtr = getPDFPtr(idBNucleus, 2,
"B");
1458 if (!pdfHardBPtr->isSetup()) {
1459 infoPrivate.errorMsg(
"Error in Pythia::init: "
1460 "could not set up nuclear PDF for beam B");
1466 if ( (idA == 22 || beamA2gamma) && (gammaMode != 1 && gammaMode != 2) ) {
1467 if ( pdfUnresAPtr == 0 ) {
1468 pdfUnresAPtr = getPDFPtr(idA, 1,
"A",
false);
1469 if (!pdfUnresAPtr->isSetup())
return false;
1472 if ( (idB == 22 || beamB2gamma) && (gammaMode != 1 && gammaMode != 3) ) {
1473 if ( pdfUnresBPtr == 0 ) {
1474 pdfUnresBPtr = getPDFPtr(idB, 1,
"B",
false);
1475 if (!pdfUnresBPtr->isSetup())
return false;
1480 if ( doDiffraction || doHardDiff) {
1481 if (pdfPomAPtr == 0) {
1482 pdfPomAPtr = getPDFPtr(990);
1484 if (pdfPomBPtr == 0) {
1485 pdfPomBPtr = getPDFPtr(990);
1490 if ( doSoftQCD && (doVMDsideA || doVMDsideB)) {
1491 if (pdfVMDAPtr == 0) {
1492 pdfVMDAPtr = getPDFPtr(111);
1494 if (pdfVMDBPtr == 0) {
1495 pdfVMDBPtr = getPDFPtr(111);
1508 bool Pythia::next() {
1511 if (!isConstructed) {
1512 endEvent(PhysicsBase::CONSTRUCTOR_FAILED);
1522 if ( doHeavyIons ) {
1523 doHeavyIons =
false;
1524 bool ok = heavyIonsPtr->
next();
1526 endEvent(ok ? PhysicsBase::COMPLETE : PhysicsBase::HEAVYION_FAILED);
1531 int nPrevious = infoPrivate.getCounter(3);
1532 if (nCount > 0 && nPrevious > 0 && nPrevious%nCount == 0)
1533 cout <<
"\n Pythia::next(): " << nPrevious
1534 <<
" events have been generated " << endl;
1537 infoPrivate.addCounter(3);
1538 for (
int i = 10; i < 13; ++i) infoPrivate.setCounter(i);
1541 if (!doProcessLevel && !doNonPert) {
1543 if (doLHA && !processLevel.nextLHAdec( event)) {
1544 if (infoPrivate.atEndOfFile()) infoPrivate.errorMsg
1545 (
"Abort from Pythia::next:"
1546 " reached end of Les Houches Events File");
1547 endEvent(PhysicsBase::LHEF_END);
1552 infoPrivate.clear();
1553 weightContainer.clear();
1554 partonSystems.clear();
1558 for (
int i = 1; i <
event.size(); ++i)
1559 if (event[i].isFinal()) pSum += event[i].p();
1561 event[0].m( pSum.mCalc() );
1566 process.init(
"(hard process)", &particleData);
1567 partonLevel.setupShowerSys( process, event);
1568 partonLevel.resonanceShowers( process, event,
true);
1572 bool status = (doHadronLevel) ? forceHadronLevel() :
true;
1573 if (status) infoPrivate.addCounter(4);
1574 if (doLHA && nPrevious < nShowLHA) lhaUpPtr->listEvent();
1575 if (doFSRinRes && nPrevious < nShowProc) process.list(showSaV, showMaD);
1576 if (status && nPrevious < nShowEvt)
event.list(showSaV, showMaD);
1577 endEvent(status ? PhysicsBase::COMPLETE : PhysicsBase::HADRONLEVEL_FAILED);
1582 infoPrivate.clear();
1583 weightContainer.clear();
1586 partonSystems.clear();
1597 beamA.newValenceContent();
1598 beamB.newValenceContent();
1599 if ( doDiffraction || doHardDiff) {
1600 beamPomA.newValenceContent();
1601 beamPomB.newValenceContent();
1603 if (doVMDsideA) beamVMDA.newValenceContent();
1604 if (doVMDsideB) beamVMDB.newValenceContent();
1608 infoPrivate.errorMsg(
"Abort from Pythia::next: "
1609 "not properly initialized so cannot generate events");
1610 endEvent(PhysicsBase::INIT_FAILED);
1615 if (doMomentumSpread || doVertexSpread) beamShapePtr->pick();
1618 if (doMomentumSpread || doVarEcm) nextKinematics();
1621 double pertRate = (eCM - eMinPert) / eWidthPert;
1622 if ( (doNonPert && !doSoftQCD)
1623 || ( doVarEcm && pertRate < 10
1624 && (pertRate <= 0 || exp( -pertRate ) > rndm.flat())) ) {
1625 bool nextNP = nextNonPert();
1628 if (nextNP && checkEvent && !check()) {
1629 infoPrivate.errorMsg(
"Error in Pythia::next: "
1630 "check of event revealed problems");
1631 endEvent(PhysicsBase::CHECK_FAILED);
1634 endEvent(nextNP ? PhysicsBase::COMPLETE : PhysicsBase::LOWENERGY_FAILED);
1641 infoPrivate.addCounter(10);
1642 bool hasVetoed =
false;
1643 bool hasVetoedDiff =
false;
1646 infoPrivate.clear();
1648 partonSystems.clear();
1652 infoPrivate.setLHEF3EventInfo();
1654 if ( !processLevel.next( process) ) {
1655 if (doLHA && infoPrivate.atEndOfFile()) infoPrivate.errorMsg
1657 "Pythia::next: reached end of Les Houches Events File");
1658 else infoPrivate.errorMsg(
"Abort from Pythia::next: "
1659 "processLevel failed; giving up");
1660 endEvent(PhysicsBase::PROCESSLEVEL_FAILED);
1664 infoPrivate.addCounter(11);
1668 processLevel.accumulate(
false);
1671 if (doVetoProcess) {
1672 hasVetoed = userHooksPtr->doVetoProcessLevel( process);
1675 endEvent(PhysicsBase::PROCESSLEVEL_USERVETO);
1683 if (doMerging && mergingPtr) {
1684 int veto = mergingPtr->mergeProcess( process );
1689 endEvent(PhysicsBase::MERGING_FAILED);
1694 }
else if (veto == 0) {
1701 if (veto == 2 && doResDec) processLevel.nextDecays( process);
1705 if (!doPartonLevel) {
1706 boostAndVertex(
true,
true);
1707 processLevel.accumulate();
1708 event.scale( process.scale() );
1709 event.scaleSecond( process.scaleSecond() );
1710 infoPrivate.addCounter(4);
1711 if (doLHA && nPrevious < nShowLHA) lhaUpPtr->listEvent();
1712 if (nPrevious < nShowInfo) infoPrivate.list();
1713 if (nPrevious < nShowProc) process.list(showSaV, showMaD);
1714 endEvent(PhysicsBase::COMPLETE);
1719 Event processSave = process;
1720 int sizeMPI = infoPrivate.sizeMPIarrays();
1721 infoPrivate.addCounter(12);
1722 for (
int i = 14; i < 19; ++i) infoPrivate.setCounter(i);
1725 bool physical =
true;
1726 for (
int iTry = 0; iTry < NTRY; ++iTry) {
1728 infoPrivate.addCounter(14);
1734 process = processSave;
1735 infoPrivate.resizeMPIarrays( sizeMPI);
1748 partonSystems.clear();
1751 if ( !partonLevel.next( process, event) ) {
1754 if (infoPrivate.getAbortPartonLevel()) {
1755 endEvent(PhysicsBase::PARTONLEVEL_FAILED);
1761 hasVetoed = partonLevel.hasVetoed();
1763 if (retryPartonLevel) {
1768 endEvent(PhysicsBase::PARTONLEVEL_FAILED);
1775 hasVetoedDiff = partonLevel.hasVetoedDiff();
1776 if (hasVetoedDiff) {
1777 infoPrivate.errorMsg(
"Warning in Pythia::next: "
1778 "discarding hard diffractive event from partonLevel; try again");
1783 infoPrivate.errorMsg(
"Error in Pythia::next: "
1784 "partonLevel failed; try again");
1788 infoPrivate.addCounter(15);
1791 if (doVetoPartons) {
1792 hasVetoed = userHooksPtr->doVetoPartonLevel( event);
1795 endEvent(PhysicsBase::PARTONLEVEL_USERVETO);
1803 boostAndVertex(
true,
true);
1806 if (!doHadronLevel) {
1807 processLevel.accumulate();
1808 partonLevel.accumulate();
1809 event.scale( process.scale() );
1810 event.scaleSecond( process.scaleSecond() );
1812 if (checkEvent && !check()) {
1813 infoPrivate.errorMsg(
"Abort from Pythia::next: "
1814 "check of event revealed problems");
1815 endEvent(PhysicsBase::CHECK_FAILED);
1818 infoPrivate.addCounter(4);
1819 if (doLHA && nPrevious < nShowLHA) lhaUpPtr->listEvent();
1820 if (nPrevious < nShowInfo) infoPrivate.list();
1821 if (nPrevious < nShowProc) process.list(showSaV, showMaD);
1822 if (nPrevious < nShowEvt)
event.list(showSaV, showMaD);
1823 endEvent(PhysicsBase::COMPLETE);
1828 infoPrivate.addCounter(16);
1829 if ( !hadronLevel.next( event) ) {
1830 infoPrivate.errorMsg(
"Error in Pythia::next: "
1831 "hadronLevel failed; try again");
1837 if (decayRHadrons && rHadrons.exist() && !doRHadronDecays()) {
1838 infoPrivate.errorMsg(
"Error in Pythia::next: "
1839 "decayRHadrons failed; try again");
1843 infoPrivate.addCounter(17);
1846 if (checkEvent && !check()) {
1847 infoPrivate.errorMsg(
"Error in Pythia::next: "
1848 "check of event revealed problems");
1854 infoPrivate.addCounter(18);
1859 if (hasVetoed || hasVetoedDiff) {
1861 endEvent(PhysicsBase::PARTONLEVEL_USERVETO);
1869 infoPrivate.errorMsg(
"Abort from Pythia::next: "
1870 "parton+hadronLevel failed; giving up");
1871 endEvent(PhysicsBase::OTHER_UNPHYSICAL);
1876 processLevel.accumulate();
1877 partonLevel.accumulate();
1878 event.scale( process.scale() );
1879 event.scaleSecond( process.scaleSecond() );
1882 infoPrivate.addCounter(13);
1887 if (doLHA && nPrevious < nShowLHA) lhaUpPtr->listEvent();
1888 if (nPrevious < nShowInfo) infoPrivate.list();
1889 if (nPrevious < nShowProc) process.list(showSaV,showMaD);
1890 if (nPrevious < nShowEvt)
event.list(showSaV, showMaD);
1893 infoPrivate.addCounter(4);
1894 endEvent(PhysicsBase::COMPLETE);
1903 bool Pythia::next(
double eCMin) {
1906 if (!isConstructed)
return false;
1910 infoPrivate.errorMsg(
"Abort from Pythia::next: "
1911 "generation not initialized for variable energies");
1916 if (frameType != 1) {
1917 infoPrivate.errorMsg(
"Abort from Pythia::next: "
1918 "input parameters do not match frame type");
1934 bool Pythia::next(
double eAin,
double eBin) {
1937 if (!isConstructed)
return false;
1941 infoPrivate.errorMsg(
"Abort from Pythia::next: "
1942 "generation not initialized for variable energies");
1947 if (frameType != 2) {
1948 infoPrivate.errorMsg(
"Abort from Pythia::next: "
1949 "input parameters do not match frame type");
1966 bool Pythia::next(
double pxAin,
double pyAin,
double pzAin,
1967 double pxBin,
double pyBin,
double pzBin) {
1970 if (!isConstructed)
return false;
1974 infoPrivate.errorMsg(
"Abort from Pythia::next: "
1975 "generation not initialized for variable energies");
1980 if (frameType != 3) {
1981 infoPrivate.errorMsg(
"Abort from Pythia::next: "
1982 "input parameters do not match frame type");
2003 void Pythia::beginEvent() {
2006 for (
auto physicsPtr : physicsPtrs ) physicsPtr->beginEvent();
2017 void Pythia::endEvent(PhysicsBase::Status status) {
2020 for (
auto physicsPtr : physicsPtrs ) physicsPtr->endEvent(status);
2044 void Pythia::pushInfo() {
2045 for (
auto physicsPtr : physicsPtrs ) physicsPtr->initInfoPtr(infoPrivate);
2053 bool Pythia::forceHadronLevel(
bool findJunctions) {
2057 infoPrivate.errorMsg(
"Abort from Pythia::forceHadronLevel: "
2058 "not properly initialized so cannot generate events");
2064 if (findJunctions) {
2065 event.clearJunctions();
2066 for (
int i = 0; i <
event.size(); ++i)
2067 if (event[i].isFinal()
2068 && (
event[i].col() != 0 ||
event[i].acol() != 0)) {
2069 processLevel.findJunctions( event);
2075 if (forceHadronLevelCR) {
2079 if (reconnectMode == 3 || reconnectMode == 4) {
2080 partonSystems.clear();
2081 partonSystems.addSys();
2082 partonSystems.addSys();
2083 partonSystems.setInRes(0, 3);
2084 partonSystems.setInRes(1, 4);
2085 for (
int i = 5; i <
event.size(); ++i) {
2086 if (event[i].mother1() - 3 < 0 ||
event[i].mother1() - 3 > 1) {
2087 infoPrivate.errorMsg(
"Error in Pythia::forceHadronLevel: "
2088 " Event is not setup correctly for SK-I or SK-II CR");
2091 partonSystems.addOut(event[i].mother1() - 3,i);
2096 Event spareEvent = event;
2097 bool colCorrect =
false;
2100 for (
int iTry = 0; iTry < NTRY; ++ iTry) {
2101 if ( colourReconnectionPtr ) colourReconnectionPtr->next(event, 0);
2102 if (junctionSplitting.checkColours(event)) {
2106 else event = spareEvent;
2110 infoPrivate.errorMsg(
"Error in Pythia::forceHadronLevel: "
2111 "Colour reconnection failed.");
2117 Event spareEvent = event;
2120 bool physical =
true;
2121 for (
int iTry = 0; iTry < NTRY; ++ iTry) {
2127 processLevel.nextDecays( process);
2130 if (process.size() >
event.size()) {
2132 partonLevel.setupShowerSys( process, event);
2133 partonLevel.resonanceShowers( process, event,
false);
2134 }
else event = process;
2139 if (hadronLevel.next( event))
break;
2142 infoPrivate.errorMsg(
"Error in Pythia::forceHadronLevel: "
2143 "hadronLevel failed; try again");
2150 infoPrivate.errorMsg(
"Abort from Pythia::forceHadronLevel: "
2151 "hadronLevel failed; giving up");
2156 if (checkEvent && !check()) {
2157 infoPrivate.errorMsg(
"Abort from Pythia::forceHadronLevel: "
2158 "check of event revealed problems");
2171 void Pythia::nextKinematics() {
2174 if (doMomentumSpread) {
2175 pAnow = pAinit + beamShapePtr->deltaPA();
2176 pAnow.e( sqrt(pAnow.pAbs2() + mA*mA) );
2177 pBnow = pBinit + beamShapePtr->deltaPB();
2178 pBnow.e( sqrt(pBnow.pAbs2() + mB*mB) );
2179 eCM = (pAnow + pBnow).mCalc();
2182 }
else if (frameType == 1) {
2185 }
else if (frameType == 2) {
2186 pAnow = Vec4( 0., 0., sqrtpos( eA*eA - mA*mA), eA);
2187 pBnow = Vec4( 0., 0., -sqrtpos( eB*eB - mB*mB), eB);
2188 eCM = (pAnow + pBnow).mCalc();
2191 }
else if (frameType == 3) {
2192 pAnow = Vec4( pxA, pyA, pzA, sqrt(pxA*pxA + pyA*pyA + pzA*pzA + mA*mA) );
2193 pBnow = Vec4( pxB, pyB, pzB, sqrt(pxB*pxB + pyB*pyB + pzB*pzB + mB*mB) );
2194 eCM = (pAnow + pBnow).mCalc();
2198 infoPrivate.errorMsg(
"Error from Pythia::nextKinematics: unsupported"
2204 pzAcm = 0.5 * sqrtpos( (eCM + mA + mB) * (eCM - mA - mB)
2205 * (eCM - mA + mB) * (eCM + mA - mB) ) / eCM;
2207 eA = sqrt(mA*mA + pzAcm*pzAcm);
2208 eB = sqrt(mB*mB + pzBcm*pzBcm);
2211 infoPrivate.setBeamA( idA, pzAcm, eA, mA);
2212 infoPrivate.setBeamB( idB, pzBcm, eB, mB);
2213 infoPrivate.setECM( eCM);
2214 beamA.newPzE( pzAcm, eA);
2215 beamB.newPzE( pzBcm, eB);
2218 if (frameType != 1) {
2220 MfromCM.fromCMframe( pAnow, pBnow);
2231 bool Pythia::nextNonPert() {
2234 process.append( 90, -11, 0, 0, 0, 0, 0, 0, Vec4(0., 0., 0., eCM), eCM, 0. );
2235 process.append(idA, -12, 0, 0, 0, 0, 0, 0, Vec4(0., 0., pzAcm, eA), mA, 0. );
2236 process.append(idB, -12, 0, 0, 0, 0, 0, 0, Vec4(0., 0., pzBcm, eB), mB, 0. );
2237 for (
int i = 0; i < 3; ++i) event.append( process[i] );
2240 int procType = hadronLevel.pickLowEnergyProcess(idA, idB, eCM, mA, mB);
2241 int procCode = 150 + min( 9, abs(procType));
2243 if (procType == 0) {
2244 infoPrivate.errorMsg(
"Error in Pythia::nextNonPert: "
2245 "unable to pick process");
2250 if (!doLowEnergyProcess( 1, 2, procType)) {
2251 infoPrivate.errorMsg(
"Error in Pythia::nextNonPert: "
2252 "low energy process failed");
2257 if (doHadronLevel) {
2258 if (!hadronLevel.next(event)) {
2259 infoPrivate.errorMsg(
"Error in Pythia::nextNonPert: "
2260 "Further hadron level processes failed");
2266 string procName =
"Low-energy ";
2267 if (procCode == 151) procName +=
"nonDiffractive";
2268 else if (procCode == 152) procName +=
"elastic";
2269 else if (procCode == 153) procName +=
"single diffractive (XB)";
2270 else if (procCode == 154) procName +=
"single diffractive (AX)";
2271 else if (procCode == 155) procName +=
"double diffractive";
2272 else if (procCode == 157) procName +=
"excitation";
2273 else if (procCode == 158) procName +=
"annihilation";
2274 else if (procCode == 159) procName +=
"resonant";
2275 infoPrivate.setType( procName, procCode, 0, (procCode == 151),
false,
2276 (procCode == 153 || procCode == 155),
2277 (procCode == 154 || procCode == 155));
2280 int nPrevious = infoPrivate.getCounter(3) - 1;
2281 if (doLHA && nPrevious < nShowLHA) lhaUpPtr->listEvent();
2282 if (nPrevious < nShowInfo) infoPrivate.list();
2283 if (nPrevious < nShowProc) process.list(showSaV,showMaD);
2284 if (nPrevious < nShowEvt)
event.list(showSaV, showMaD);
2287 infoPrivate.addCounter(4);
2296 void Pythia::boostAndVertex(
bool toLab,
bool setVertex) {
2299 if (toLab && doPartonVertex && event.size() > 2) {
2300 if (process.size() > 2) {
2301 process[1].vProd( event[1].vProd() );
2302 process[2].vProd( event[2].vProd() );
2304 if (doVertexPlane) {
2305 double phiVert = 2. * M_PI * rndm.flat();
2306 process.rot( 0., phiVert);
2307 event.rot( 0., phiVert);
2313 if (boostType == 2) process.bst(0., 0., betaZ, gammaZ);
2314 else if (boostType == 3) process.rotbst(MfromCM);
2317 if (event.size() > 0) {
2318 if (boostType == 2)
event.bst(0., 0., betaZ, gammaZ);
2319 else if (boostType == 3)
event.rotbst(MfromCM);
2324 if (boostType == 2) process.bst(0., 0., -betaZ, gammaZ);
2325 else if (boostType == 3) process.rotbst(MtoCM);
2328 if (event.size() > 0) {
2329 if (boostType == 2)
event.bst(0., 0., -betaZ, gammaZ);
2330 else if (boostType == 3)
event.rotbst(MtoCM);
2335 if (setVertex && doVertexSpread) {
2336 Vec4
vertex = beamShapePtr->vertex();
2337 for (
int i = 0; i < process.size(); ++i) process[i].vProdAdd( vertex);
2338 for (
int i = 0; i <
event.size(); ++i) event[i].vProdAdd( vertex);
2347 bool Pythia::doRHadronDecays( ) {
2350 if ( !rHadrons.exist() )
return true;
2353 if ( !rHadrons.decay( event) )
return false;
2356 if ( !partonLevel.resonanceShowers( process, event,
false) )
return false;
2359 if ( !hadronLevel.next( event) )
return false;
2370 void Pythia::stat() {
2372 if ( doHeavyIons ) {
2373 heavyIonsPtr->stat();
2378 bool showPrL = settings.flag(
"Stat:showProcessLevel");
2379 bool showPaL = settings.flag(
"Stat:showPartonLevel");
2380 bool showErr = settings.flag(
"Stat:showErrors");
2381 bool reset = settings.flag(
"Stat:reset");
2384 if (doProcessLevel) {
2385 if (showPrL) processLevel.statistics(
false);
2386 if (reset) processLevel.resetStatistics();
2390 if (showPaL) partonLevel.statistics(
false);
2391 if (reset) partonLevel.resetStatistics();
2394 if (doMerging && mergingPtr ) mergingPtr->statistics();
2397 if (showErr) infoPrivate.errorStatistics();
2398 if (reset) infoPrivate.errorReset();
2401 for (
auto physicsPtr : physicsPtrs ) physicsPtr->stat();
2409 void Pythia::banner() {
2412 double versionNumber = settings.parm(
"Pythia:versionNumber");
2413 int versionDate = settings.mode(
"Pythia:versionDate");
2414 string month[12] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
2415 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"};
2420 strftime(dateNow,12,
"%d %b %Y",localtime(&t));
2422 strftime(timeNow,9,
"%H:%M:%S",localtime(&t));
2425 <<
" *-------------------------------------------"
2426 <<
"-----------------------------------------* \n"
2429 <<
" | *----------------------------------------"
2430 <<
"--------------------------------------* | \n"
2435 <<
" | | PPP Y Y TTTTT H H III A "
2436 <<
" Welcome to the Lund Monte Carlo! | | \n"
2437 <<
" | | P P Y Y T H H I A A "
2438 <<
" This is PYTHIA version " << fixed << setprecision(3)
2439 << setw(5) << versionNumber <<
" | | \n"
2440 <<
" | | PPP Y T HHHHH I AAAAA"
2441 <<
" Last date of change: " << setw(2) << versionDate%100
2442 <<
" " << month[ min(11, (versionDate/100)%100 - 1) ]
2443 <<
" " << setw(4) << versionDate/10000 <<
" | | \n"
2444 <<
" | | P Y T H H I A A"
2446 <<
" | | P Y T H H III A A"
2447 <<
" Now is " << dateNow <<
" at " << timeNow <<
" | | \n"
2450 <<
" | | Christian Bierlich; Department of As"
2451 <<
"tronomy and Theoretical Physics, | | \n"
2452 <<
" | | Lund University, Solvegatan 14A, S"
2453 <<
"E-223 62 Lund, Sweden; | | \n"
2454 <<
" | | e-mail: christian.bierlich@thep.lu"
2456 <<
" | | Nishita Desai; Department of Theoret"
2457 <<
"ical Physics, Tata Institute, | | \n"
2458 <<
" | | Homi Bhabha Road, Mumbai 400005, I"
2460 <<
" | | e-mail: desai@theory.tifr.res.in "
2462 <<
" | | Leif Gellersen; Department of Astron"
2463 <<
"omy and Theoretical Physics, | | \n"
2464 <<
" | | Lund University, Solvegatan 14A, S"
2465 <<
"E-223 62 Lund, Sweden; | | \n"
2466 <<
" | | e-mail: leif.gellersen@thep.lu.se "
2468 <<
" | | Ilkka Helenius; Department of Physic"
2469 <<
"s, University of Jyvaskyla, | | \n"
2470 <<
" | | P.O. Box 35, FI-40014 University o"
2471 <<
"f Jyvaskyla, Finland; | | \n"
2472 <<
" | | e-mail: ilkka.m.helenius@jyu.fi "
2474 <<
" | | Philip Ilten; Department of Physics,"
2476 <<
" | | University of Cincinnati, Cincinna"
2477 <<
"ti, OH 45221, USA; | | \n"
2478 <<
" | | School of Physics and Astronomy, "
2480 <<
" | | University of Birmingham, Birmingh"
2481 <<
"am, B152 2TT, UK; | | \n"
2482 <<
" | | e-mail: philten@cern.ch "
2484 <<
" | | Leif Lonnblad; Department of Astrono"
2485 <<
"my and Theoretical Physics, | | \n"
2486 <<
" | | Lund University, Solvegatan 14A, S"
2487 <<
"E-223 62 Lund, Sweden; | | \n"
2488 <<
" | | e-mail: leif.lonnblad@thep.lu.se "
2490 <<
" | | Stephen Mrenna; Computing Division, "
2491 <<
"Simulations Group, | | \n"
2492 <<
" | | Fermi National Accelerator Laborat"
2493 <<
"ory, MS 234, Batavia, IL 60510, USA; | | \n"
2494 <<
" | | e-mail: mrenna@fnal.gov "
2496 <<
" | | Stefan Prestel; Department of Astron"
2497 <<
"omy and Theoretical Physics, | | \n"
2498 <<
" | | Lund University, Solvegatan 14A, S"
2499 <<
"E-223 62 Lund, Sweden; | | \n"
2500 <<
" | | e-mail: stefan.prestel@thep.lu.se "
2502 <<
" | | Christine O. Rasmussen; Department o"
2503 <<
"f Astronomy and Theoretical Physics, | | \n"
2504 <<
" | | Lund University, Solvegatan 14A, S"
2505 <<
"E-223 62 Lund, Sweden; | | \n"
2506 <<
" | | e-mail: christine.rasmussen@thep.l"
2508 <<
" | | Torbjorn Sjostrand; Department of As"
2509 <<
"tronomy and Theoretical Physics, | | \n"
2510 <<
" | | Lund University, Solvegatan 14A, S"
2511 <<
"E-223 62 Lund, Sweden; | | \n"
2512 <<
" | | e-mail: torbjorn@thep.lu.se "
2514 <<
" | | Peter Skands; School of Physics and "
2515 <<
"Astronomy, | | \n"
2516 <<
" | | Monash University, PO Box 27, 3800"
2517 <<
" Melbourne, Australia; | | \n"
2518 <<
" | | e-mail: peter.skands@monash.edu "
2520 <<
" | | Marius Utheim; Department of Astrono"
2521 <<
"my and Theoretical Physics, | | \n"
2522 <<
" | | Lund University, Solvegatan 14A, S"
2523 <<
"E-223 62 Lund, Sweden; | | \n"
2524 <<
" | | e-mail: marius.utheim@thep.lu.se "
2528 <<
" | | The main program reference is 'An Int"
2529 <<
"roduction to PYTHIA 8.2', | | \n"
2530 <<
" | | T. Sjostrand et al, Comput. Phys. Com"
2531 <<
"mun. 191 (2015) 159 | | \n"
2532 <<
" | | [arXiv:1410.3012 [hep-ph]] "
2536 <<
" | | The main physics reference is the 'PY"
2537 <<
"THIA 6.4 Physics and Manual', | | \n"
2538 <<
" | | T. Sjostrand, S. Mrenna and P. Skands"
2539 <<
", JHEP05 (2006) 026 [hep-ph/0603175] | | \n"
2542 <<
" | | An archive of program versions and do"
2543 <<
"cumentation is found on the web: | | \n"
2544 <<
" | | http://www.thep.lu.se/Pythia "
2548 <<
" | | This program is released under the GN"
2549 <<
"U General Public Licence version 2. | | \n"
2550 <<
" | | Please respect the MCnet Guidelines f"
2551 <<
"or Event Generator Authors and Users. | | \n"
2554 <<
" | | Disclaimer: this program comes withou"
2555 <<
"t any guarantees. | | \n"
2556 <<
" | | Beware of errors and use common sense"
2557 <<
" when interpreting results. | | \n"
2560 <<
" | | Copyright (C) 2020 Torbjorn Sjostrand"
2566 <<
" | *----------------------------------------"
2567 <<
"--------------------------------------* | \n"
2570 <<
" *-------------------------------------------"
2571 <<
"-----------------------------------------* \n" << endl;
2579 int Pythia::readSubrun(
string line,
bool warn) {
2582 int subrunLine = SUBRUNDEFAULT;
2583 if (line.find_first_not_of(
" \n\t\v\b\r\f\a") == string::npos)
2587 string lineNow = line;
2588 int firstChar = lineNow.find_first_not_of(
" \n\t\v\b\r\f\a");
2589 if (!isalpha(lineNow[firstChar]))
return subrunLine;
2592 while (lineNow.find(
"=") != string::npos) {
2593 int firstEqual = lineNow.find_first_of(
"=");
2594 lineNow.replace(firstEqual, 1,
" ");
2598 istringstream splitLine(lineNow);
2603 while (name.find(
"::") != string::npos) {
2604 int firstColonColon = name.find_first_of(
"::");
2605 name.replace(firstColonColon, 2,
":");
2609 if (toLower(name) !=
"main:subrun")
return subrunLine;
2612 splitLine >> subrunLine;
2614 if (warn) cout <<
"\n PYTHIA Warning: Main:subrun number not"
2615 <<
" recognized; skip:\n " << line << endl;
2616 subrunLine = SUBRUNDEFAULT;
2627 int Pythia::readCommented(
string line) {
2630 if (line.find_first_not_of(
" \n\t\v\b\r\f\a") == string::npos)
return 0;
2631 int firstChar = line.find_first_not_of(
" \n\t\v\b\r\f\a");
2632 if (
int(line.size()) < firstChar + 2)
return 0;
2635 if (line.substr(firstChar, 2) ==
"/*")
return +1;
2636 if (line.substr(firstChar, 2) ==
"*/")
return -1;
2648 bool Pythia::check() {
2651 bool physical =
true;
2652 bool listVertices =
false;
2653 bool listHistory =
false;
2654 bool listSystems =
false;
2655 bool listBeams =
false;
2660 iErrNanVtx.resize(0);
2662 double chargeSum = 0.;
2665 if (doProcessLevel || doNonPert) {
2672 if (!(beamA2gamma || beamB2gamma)) {
2673 if (beamA.isLepton() && beamB.isHadron())
2674 { iA = beamA[0].iPos(); iB = 2; }
2675 if (beamB.isLepton() && beamA.isHadron())
2676 { iB = beamB[0].iPos(); iA = 1; }
2678 while ( beamA.isHadron() && iPos < beamB.size()
2679 && beamA.id() == beamB[iPos].id() )
2680 { iA = beamA[iPos].iPos(); iPos++;}
2682 while ( beamB.isHadron() && iPos < beamB.size()
2683 && beamB.id() == beamB[iPos].id() )
2684 { iB = beamB[iPos].iPos(); iPos++; }
2687 pSum = - (
event[iA].p() +
event[iB].p());
2688 chargeSum = - (
event[1].charge() +
event[2].charge());
2691 }
else if (process.size() > 0) {
2692 pSum = - process[0].p();
2693 for (
int i = 0; i < process.size(); ++i)
2694 if (process[i].isFinal()) chargeSum -= process[i].charge();
2698 pSum = -
event[0].p();
2699 for (
int i = 1; i <
event.size(); ++i)
2700 if (event[i].statusAbs() < 10 ||
event[i].statusAbs() == 23)
2701 chargeSum -= event[i].charge();
2703 double eLab = abs(pSum.e());
2706 for (
int i = 0; i <
event.size(); ++i) {
2709 int id =
event[i].id();
2710 if (
id == 0 || !particleData.isParticle(
id)) {
2711 ostringstream errCode;
2712 errCode <<
", i = " << i <<
", id = " << id;
2713 infoPrivate.errorMsg(
"Error in Pythia::check: "
2714 "unknown particle code", errCode.str());
2716 iErrId.push_back(i);
2720 int colType =
event[i].colType();
2721 int col =
event[i].col();
2722 int acol =
event[i].acol();
2723 if ( event[i].statusAbs() / 10 == 8 ) acol = col = 0;
2724 if ( (colType == 0 && (col > 0 || acol > 0))
2725 || (colType == 1 && (col <= 0 || acol > 0))
2726 || (colType == -1 && (col > 0 || acol <= 0))
2727 || (colType == 2 && (col <= 0 || acol <= 0)) ) {
2728 ostringstream errCode;
2729 errCode <<
", i = " << i <<
", id = " <<
id <<
" cols = " << col
2731 infoPrivate.errorMsg(
"Error in Pythia::check: "
2732 "incorrect colours", errCode.str());
2734 iErrCol.push_back(i);
2739 bool checkMass =
event[i].statusAbs() != 49 &&
event[i].statusAbs() != 59;
2742 if (isfinite(event[i].p()) && isfinite(event[i].m())) {
2743 double errMass = abs(event[i].mCalc() - event[i].m())
2744 / max( 1.0, event[i].e());
2745 if (checkMass && errMass > mTolErr) {
2746 infoPrivate.errorMsg(
"Error in Pythia::check: "
2747 "unmatched particle energy/momentum/mass");
2749 iErrEpm.push_back(i);
2750 }
else if (checkMass && errMass > mTolWarn) {
2751 infoPrivate.errorMsg(
"Warning in Pythia::check: "
2752 "not quite matched particle energy/momentum/mass");
2755 infoPrivate.errorMsg(
"Error in Pythia::check: "
2756 "not-a-number energy/momentum/mass");
2758 iErrNan.push_back(i);
2762 if (isfinite(event[i].vProd()) && isfinite(event[i].tau())) ;
2764 infoPrivate.errorMsg(
"Error in Pythia::check: "
2765 "not-a-number vertex/lifetime");
2767 listVertices =
true;
2768 iErrNanVtx.push_back(i);
2772 if (event[i].isFinal()) {
2773 pSum +=
event[i].p();
2774 chargeSum +=
event[i].charge();
2781 double epDev = abs(pSum.e()) + abs(pSum.px()) + abs(pSum.py())
2783 if (epDev > epTolErr * eLab) {
2784 infoPrivate.errorMsg
2785 (
"Error in Pythia::check: energy-momentum not conserved");
2787 }
else if (epDev > epTolWarn * eLab) {
2788 infoPrivate.errorMsg(
"Warning in Pythia::check: "
2789 "energy-momentum not quite conserved");
2791 if (abs(chargeSum) > 0.1) {
2792 infoPrivate.errorMsg(
"Error in Pythia::check: charge not conserved");
2798 if (infoPrivate.isResolved() && !info.hasUnresolvedBeams())
2799 for (
int iSys = 0; iSys < beamA.sizeInit(); ++iSys) {
2800 int eventANw = partonSystems.getInA(iSys);
2801 int eventBNw = partonSystems.getInB(iSys);
2803 int beamANw = ( beamA.getGammaMode() == 0 || !beamA2gamma
2804 || (beamA.getGammaMode() == 2 && beamB.getGammaMode() == 2)) ?
2805 beamA[iSys].iPos() : beamGamA[iSys].iPos();
2806 int beamBNw = ( beamB.getGammaMode() == 0 || !beamB2gamma
2807 || (beamB.getGammaMode() == 2 && beamA.getGammaMode() == 2)) ?
2808 beamB[iSys].iPos() : beamGamB[iSys].iPos();
2809 if (eventANw != beamANw || eventBNw != beamBNw) {
2810 infoPrivate.errorMsg(
"Error in Pythia::check: "
2811 "event and beams records disagree");
2821 vector< pair<int,int> > noMotDau;
2825 bool hasBeams =
false;
2826 for (
int i = 0; i <
event.size(); ++i) {
2827 int status =
event[i].status();
2828 if (abs(status) == 12) hasBeams =
true;
2831 vector<int> mList =
event[i].motherList();
2832 vector<int> dList =
event[i].daughterList();
2833 if (mList.size() == 0 && abs(status) != 11 && abs(status) != 12)
2835 if (dList.size() == 0 && status < 0 && status != -11)
2839 for (
int j = 0; j < int(mList.size()); ++j) {
2840 if ( event[mList[j]].daughter1() <= i
2841 &&
event[mList[j]].daughter2() >= i )
continue;
2842 vector<int> dmList =
event[mList[j]].daughterList();
2843 bool foundMatch =
false;
2844 for (
int k = 0; k < int(dmList.size()); ++k)
2845 if (dmList[k] == i) {
2849 if (!hasBeams && mList.size() == 1 && mList[0] == 0) foundMatch =
true;
2851 bool oldPair =
false;
2852 for (
int k = 0; k < int(noMotDau.size()); ++k)
2853 if (noMotDau[k].first == mList[j] && noMotDau[k].second == i) {
2857 if (!oldPair) noMotDau.push_back( make_pair( mList[j], i) );
2862 for (
int j = 0; j < int(dList.size()); ++j) {
2863 if ( event[dList[j]].statusAbs() > 80
2864 &&
event[dList[j]].statusAbs() < 90
2865 &&
event[dList[j]].mother1() <= i
2866 &&
event[dList[j]].mother2() >= i)
continue;
2867 vector<int> mdList =
event[dList[j]].motherList();
2868 bool foundMatch =
false;
2869 for (
int k = 0; k < int(mdList.size()); ++k)
2870 if (mdList[k] == i) {
2875 bool oldPair =
false;
2876 for (
int k = 0; k < int(noMotDau.size()); ++k)
2877 if (noMotDau[k].first == i && noMotDau[k].second == dList[j]) {
2881 if (!oldPair) noMotDau.push_back( make_pair( i, dList[j]) );
2887 if (noMot.size() > 0 || noDau.size() > 0 || noMotDau.size() > 0) {
2888 infoPrivate.errorMsg(
"Error in Pythia::check: "
2889 "mismatch in daughter and mother lists");
2896 if (physical)
return true;
2899 if (nErrEvent < nErrList) {
2900 cout <<
"\n PYTHIA erroneous event info: \n";
2901 if (iErrId.size() > 0) {
2902 cout <<
" unknown particle codes in lines ";
2903 for (
int i = 0; i < int(iErrId.size()); ++i)
2904 cout << iErrId[i] <<
" ";
2907 if (iErrCol.size() > 0) {
2908 cout <<
" incorrect colour assignments in lines ";
2909 for (
int i = 0; i < int(iErrCol.size()); ++i)
2910 cout << iErrCol[i] <<
" ";
2913 if (iErrEpm.size() > 0) {
2914 cout <<
" mismatch between energy/momentum/mass in lines ";
2915 for (
int i = 0; i < int(iErrEpm.size()); ++i)
2916 cout << iErrEpm[i] <<
" ";
2919 if (iErrNan.size() > 0) {
2920 cout <<
" not-a-number energy/momentum/mass in lines ";
2921 for (
int i = 0; i < int(iErrNan.size()); ++i)
2922 cout << iErrNan[i] <<
" ";
2925 if (iErrNanVtx.size() > 0) {
2926 cout <<
" not-a-number vertex/lifetime in lines ";
2927 for (
int i = 0; i < int(iErrNanVtx.size()); ++i)
2928 cout << iErrNanVtx[i] <<
" ";
2931 if (epDev > epTolErr * eLab) cout << scientific << setprecision(3)
2932 <<
" total energy-momentum non-conservation = " << epDev <<
"\n";
2933 if (abs(chargeSum) > 0.1) cout << fixed << setprecision(2)
2934 <<
" total charge non-conservation = " << chargeSum <<
"\n";
2935 if (noMot.size() > 0) {
2936 cout <<
" missing mothers for particles ";
2937 for (
int i = 0; i < int(noMot.size()); ++i) cout << noMot[i] <<
" ";
2940 if (noDau.size() > 0) {
2941 cout <<
" missing daughters for particles ";
2942 for (
int i = 0; i < int(noDau.size()); ++i) cout << noDau[i] <<
" ";
2945 if (noMotDau.size() > 0) {
2946 cout <<
" inconsistent history for (mother,daughter) pairs ";
2947 for (
int i = 0; i < int(noMotDau.size()); ++i)
2948 cout <<
"(" << noMotDau[i].first <<
"," << noMotDau[i].second <<
") ";
2954 event.list(listVertices, listHistory);
2955 if (listSystems) partonSystems.list();
2956 if (listBeams) {beamA.list(); beamB.list();}
2969 PDFPtr Pythia::getPDFPtr(
int idIn,
int sequence,
string beam,
bool resolved) {
2972 PDFPtr tempPDFPtr = 0;
2975 string pdfdataPath = xmlPath.substr(0, xmlPath.length() - 7) +
"pdfdata/";
2978 if (idIn == 990 && settings.word(
"PDF:PomSet") ==
"2") idIn = 111;
2981 bool proton2gamma = (abs(idIn) == 2212) && ( ( beamA2gamma && (beam ==
"A") )
2982 || ( beamB2gamma && (beam ==
"B") ) );
2985 if ( (abs(idIn) == 2212 || abs(idIn) == 2112) && !proton2gamma ) {
2986 string pWord = settings.word(
"PDF:p"
2987 +
string(sequence == 1 ?
"" :
"Hard") +
"Set"
2988 +
string(beam ==
"A" ?
"" :
"B") ) ;
2989 if (pWord ==
"void" && sequence != 1 && beam ==
"B")
2990 pWord = settings.word(
"PDF:pHardSet");
2991 if (pWord ==
"void") pWord = settings.word(
"PDF:pSet");
2992 istringstream pStream(pWord);
2997 if (pSet == 0 && pWord.length() > 9
2998 && toLower(pWord).substr(0,9) ==
"lhagrid1:")
2999 tempPDFPtr = make_shared<LHAGrid1>
3000 (idIn, pWord, pdfdataPath, &infoPrivate);
3004 tempPDFPtr = make_shared<LHAPDF>(idIn, pWord, &infoPrivate);
3007 else if (pSet == 1) tempPDFPtr = make_shared<GRV94L>(idIn);
3008 else if (pSet == 2) tempPDFPtr = make_shared<CTEQ5L>(idIn);
3010 tempPDFPtr = make_shared<MSTWpdf>
3011 (idIn, pSet - 2, pdfdataPath, &infoPrivate);
3012 else if (pSet <= 12)
3013 tempPDFPtr = make_shared<CTEQ6pdf>(idIn, pSet - 6, 1.,
3014 pdfdataPath, &infoPrivate);
3015 else if (pSet <= 22)
3016 tempPDFPtr = make_shared<LHAGrid1>
3017 (idIn, pWord, pdfdataPath, &infoPrivate);
3018 else tempPDFPtr = 0;
3022 else if (proton2gamma) {
3025 PDFPtr tempGammaPDFPtr =
nullptr;
3032 tempGammaPDFPtr = (sequence == 1) ? pdfGamAPtr : pdfHardGamAPtr;
3034 tempGammaPDFPtr = (sequence == 1) ? pdfGamBPtr : pdfHardGamBPtr;
3040 PDFPtr tempGammaFluxPtr =
nullptr;
3041 double m2beam = pow2(particleData.m0(idIn));
3044 if (settings.mode(
"PDF:proton2gammaSet") == 0) {
3047 tempGammaFluxPtr = (beam ==
"A") ? pdfGamFluxAPtr : pdfGamFluxBPtr;
3050 if (tempGammaFluxPtr == 0) {
3052 infoPrivate.errorMsg(
"Error in Pythia::getPDFPtr: "
3053 "No external photon flux provided with PDF:proton2gammaSet == 0 "
3054 "for beam " + beam );
3058 }
else if (settings.mode(
"PDF:proton2gammaSet") == 1) {
3061 if (settings.flag(
"Photon:sampleQ2") == true ) {
3062 settings.flag(
"Photon:sampleQ2",
false);
3063 infoPrivate.errorMsg(
"Warning in Pythia::getPDFPtr: "
3064 "Photon virtuality sampling turned off as chosen flux "
3065 "is Q2 independent");
3067 tempGammaFluxPtr = make_shared<ProtonPoint>(idIn, &infoPrivate);
3070 }
else if (settings.mode(
"PDF:proton2gammaSet") == 2) {
3071 tempGammaFluxPtr = make_shared<Proton2gammaDZ>(idIn);
3073 infoPrivate.errorMsg(
"Error in Pythia::getPDFPtr: "
3074 "Invalid option for photon flux from proton");
3078 if ( tempGammaFluxPtr != 0) {
3079 tempPDFPtr = make_shared<EPAexternal>(idIn, m2beam, tempGammaFluxPtr,
3080 tempGammaPDFPtr, &infoPrivate);
3083 infoPrivate.errorMsg(
"Error in Pythia::getPDFPtr: "
3084 "Failed to set photon flux from protons");
3089 else if (abs(idIn) == 211 || idIn == 111) {
3090 string piWord = settings.word(
"PDF:piSet"
3091 +
string(beam ==
"A" ?
"" :
"B") ) ;
3092 if (piWord ==
"void" && beam ==
"B") piWord = settings.word(
"PDF:piSet");
3093 istringstream piStream(piWord);
3101 double rescale = (doVMDsideA || doVMDsideB) ? 0.0046549 : 1.;
3104 if (piSet == 0 && piWord.length() > 9
3105 && toLower(piWord).substr(0,9) ==
"lhagrid1:")
3106 tempPDFPtr = make_shared<LHAGrid1>
3107 (idIn, piWord, pdfdataPath, &infoPrivate);
3110 else if (piSet == 0)
3111 tempPDFPtr = make_shared<LHAPDF>(idIn, piWord, &infoPrivate);
3114 else if (piSet == 1) tempPDFPtr = make_shared<GRVpiL>(idIn, rescale);
3115 else tempPDFPtr =
nullptr;
3119 else if (idIn == 990) {
3120 string pomWord = settings.word(
"PDF:PomSet");
3121 double rescale = settings.parm(
"PDF:PomRescale");
3122 istringstream pomStream(pomWord);
3124 pomStream >> pomSet;
3127 if (pomSet == 0 && pomWord.length() > 9
3128 && toLower(pomWord).substr(0,9) ==
"lhagrid1:")
3129 tempPDFPtr = make_shared<LHAGrid1>
3130 (idIn, pomWord, pdfdataPath, &infoPrivate);
3133 else if (pomSet == 0)
3134 tempPDFPtr = make_shared<LHAPDF>(idIn, pomWord, &infoPrivate);
3137 else if (pomSet == 1) {
3138 double gluonA = settings.parm(
"PDF:PomGluonA");
3139 double gluonB = settings.parm(
"PDF:PomGluonB");
3140 double quarkA = settings.parm(
"PDF:PomQuarkA");
3141 double quarkB = settings.parm(
"PDF:PomQuarkB");
3142 double quarkFrac = settings.parm(
"PDF:PomQuarkFrac");
3143 double strangeSupp = settings.parm(
"PDF:PomStrangeSupp");
3144 tempPDFPtr = make_shared<PomFix>( 990, gluonA, gluonB, quarkA, quarkB,
3145 quarkFrac, strangeSupp);
3149 else if (pomSet == 3 || pomSet == 4) tempPDFPtr =
3150 make_shared<PomH1FitAB>( 990, pomSet - 2, rescale, pdfdataPath,
3152 else if (pomSet == 5) tempPDFPtr =
3153 make_shared<PomH1Jets>( 990, 1, rescale, pdfdataPath, &infoPrivate);
3154 else if (pomSet == 6) tempPDFPtr =
3155 make_shared<PomH1FitAB>( 990, 3, rescale, pdfdataPath, &infoPrivate);
3157 else if (pomSet > 6 && pomSet < 11) {
3158 tempPDFPtr = make_shared<CTEQ6pdf>( 990, pomSet + 4, rescale,
3159 pdfdataPath, &infoPrivate);
3160 infoPrivate.errorMsg(
"Warning: Pomeron flux parameters forced for"
3162 settings.mode(
"SigmaDiffractive:PomFlux", 4);
3163 double pomFluxEps = (pomSet == 10) ? 0.19 : 0.14;
3164 settings.parm(
"SigmaDiffractive:PomFluxEpsilon", pomFluxEps);
3165 settings.parm(
"SigmaDiffractive:PomFluxAlphaPrime", 0.25);
3167 else if (pomSet == 11 ) tempPDFPtr =
3168 make_shared<PomHISASD>(990, getPDFPtr(2212), settings, &infoPrivate);
3169 else if (pomSet >= 12 && pomSet <= 15) tempPDFPtr =
3170 make_shared<LHAGrid1>(idIn,
"1" + pomWord, pdfdataPath, &infoPrivate);
3171 else tempPDFPtr = 0;
3175 else if (idIn > 100000000) {
3178 int nPDFSet = (beam ==
"B") ? settings.mode(
"PDF:nPDFSetB")
3179 : settings.mode(
"PDF:nPDFSetA");
3182 PDFPtr tempProtonPDFPtr = (beam ==
"B") ? pdfHardBPtr : pdfHardAPtr;
3184 tempPDFPtr = make_shared<Isospin>(idIn, tempProtonPDFPtr);
3185 else if (nPDFSet == 1 || nPDFSet == 2)
3186 tempPDFPtr = make_shared<EPS09>(idIn, nPDFSet, 1, pdfdataPath,
3187 tempProtonPDFPtr, &infoPrivate);
3188 else if (nPDFSet == 3)
3189 tempPDFPtr = make_shared<EPPS16>(idIn, 1, pdfdataPath,
3190 tempProtonPDFPtr, &infoPrivate);
3191 else tempPDFPtr = 0;
3195 else if (abs(idIn) == 22) {
3199 tempPDFPtr = make_shared<GammaPoint>(idIn);
3201 int gammaSet = settings.mode(
"PDF:GammaSet");
3205 = ( !beamAResGamma && beamAUnresGamma && !(beam ==
"B") )
3206 || ( !beamBResGamma && beamBUnresGamma && (beam ==
"B") );
3209 if ( sequence == 2) {
3212 string gmWord = settings.word(
"PDF:GammaHardSet");
3214 if (gmWord ==
"void") gmSet = settings.mode(
"PDF:GammaSet");
3216 istringstream gmStream(gmWord);
3221 if (gmSet == 0 && !beamIsPoint) {
3222 tempPDFPtr = make_shared<LHAPDF>(idIn, gmWord, &infoPrivate);
3231 if (beamIsPoint) tempPDFPtr = make_shared<GammaPoint>(idIn);
3232 else if (gammaSet == 1) tempPDFPtr = make_shared<CJKL>(idIn, &rndm);
3233 else tempPDFPtr = 0;
3239 else if (abs(idIn) > 10 && abs(idIn) < 17) {
3240 if (abs(idIn)%2 == 0) tempPDFPtr = make_shared<NeutrinoPoint>(idIn);
3243 if ( beamAResGamma && (beam ==
"A") && resolved ) {
3246 PDFPtr tempGammaPDFPtr = 0;
3247 if ( sequence == 2) tempGammaPDFPtr = pdfHardGamAPtr;
3248 else tempGammaPDFPtr = pdfGamAPtr;
3251 double m2beam = pow2(particleData.m0(idIn));
3252 double Q2maxGamma = settings.parm(
"Photon:Q2max");
3255 if (settings.mode(
"PDF:lepton2gammaSet") == 1) {
3256 tempPDFPtr = make_shared<Lepton2gamma>(idIn, m2beam, Q2maxGamma,
3257 tempGammaPDFPtr, &infoPrivate);
3261 }
else if ( settings.mode(
"PDF:lepton2gammaSet") == 0 ) {
3262 PDFPtr tempGammaFluxPtr = pdfGamFluxAPtr;
3263 if ( tempGammaFluxPtr != 0)
3264 tempPDFPtr = make_shared<EPAexternal>(idIn, m2beam,
3265 tempGammaFluxPtr, tempGammaPDFPtr, &infoPrivate);
3268 infoPrivate.errorMsg(
"Error in Pythia::getPDFPtr: "
3269 "No external photon flux provided with PDF:lepton2gammaSet == 0");
3271 }
else tempPDFPtr = 0;
3274 }
else if ( beamBResGamma && (beam ==
"B") && resolved ) {
3277 PDFPtr tempGammaPDFPtr = 0;
3278 if ( sequence == 2) tempGammaPDFPtr = pdfHardGamBPtr;
3279 else tempGammaPDFPtr = pdfGamBPtr;
3282 double m2beam = pow2(particleData.m0(idIn));
3283 double Q2maxGamma = settings.parm(
"Photon:Q2max");
3286 if (settings.mode(
"PDF:lepton2gammaSet") == 1) {
3287 tempPDFPtr = make_shared<Lepton2gamma>(idIn, m2beam, Q2maxGamma,
3288 tempGammaPDFPtr, &infoPrivate);
3291 }
else if ( settings.mode(
"PDF:lepton2gammaSet") == 0 ) {
3292 PDFPtr tempGammaFluxPtr = pdfGamFluxBPtr;
3293 if ( tempGammaFluxPtr != 0)
3294 tempPDFPtr = make_shared<EPAexternal>(idIn, m2beam,
3295 tempGammaFluxPtr, tempGammaPDFPtr, &infoPrivate );
3298 infoPrivate.errorMsg(
"Error in Pythia::getPDFPtr: "
3299 "No external photon flux provided with PDF:lepton2gammaSet == 0");
3301 }
else tempPDFPtr = 0;
3304 }
else if (settings.flag(
"PDF:lepton")) {
3305 double m2beam = pow2(particleData.m0(idIn));
3306 double Q2maxGamma = settings.parm(
"Photon:Q2max");
3307 if (settings.mode(
"PDF:lepton2gammaSet") == 1 ) {
3308 tempPDFPtr = make_shared<Lepton>(idIn, Q2maxGamma, &infoPrivate);
3311 }
else if (settings.mode(
"PDF:lepton2gammaSet") == 0 ) {
3312 PDFPtr tempGammaPDFPtr;
3313 PDFPtr tempGammaFluxPtr = (beam ==
"B") ?
3314 pdfGamFluxBPtr : pdfGamFluxAPtr;
3315 if ( tempGammaFluxPtr != 0) tempPDFPtr =
3316 make_shared<EPAexternal>(idIn, m2beam,
3317 tempGammaFluxPtr, tempGammaPDFPtr, &infoPrivate);
3320 infoPrivate.errorMsg(
"Error in Pythia::getPDFPtr: "
3321 "No external photon flux provided with PDF:lepton2gammaSet == 0");
3323 }
else tempPDFPtr = 0;
3325 else tempPDFPtr = make_shared<LeptonPoint>(idIn);
3328 }
else if (abs(idIn) > 50 && abs(idIn) < 60) {
3329 tempPDFPtr = make_shared<LeptonPoint>(idIn);
3334 tempPDFPtr->setExtrapolate( settings.flag(
"PDF:extrapolate") );
bool setHIUserHooksPtr(HIUserHooks *userHooksPtrIn)
Possibility to pass in pointer for special heavy ion user hooks.
static void addSpecialSettings(Settings &settings)
static bool isHeavyIon(Settings &settings)