9 #include "Pythia8/MultipartonInteractions.h"
12 #include "Pythia8/SigmaQCD.h"
13 #include "Pythia8/SigmaEW.h"
14 #include "Pythia8/SigmaOnia.h"
28 const double SigmaMultiparton::MASSMARGIN = 0.1;
31 const double SigmaMultiparton::OTHERFRAC = 0.2;
37 bool SigmaMultiparton::init(
int inState,
int processLevel, Info* infoPtr,
38 Settings* settingsPtr, ParticleData* particleDataPtr, Rndm* rndmPtrIn,
39 BeamParticle* beamAPtr, BeamParticle* beamBPtr, Couplings* couplingsPtr) {
45 if (sigmaT.size() > 0) {
46 for (
int i = 0; i < int(sigmaT.size()); ++i)
delete sigmaT[i];
49 if (sigmaU.size() > 0) {
50 for (
int i = 0; i < int(sigmaU.size()); ++i)
delete sigmaU[i];
58 sigmaT.push_back(
new Sigma2gg2gg() );
59 sigmaU.push_back(
new Sigma2gg2gg() );
62 }
else if (inState == 1) {
63 sigmaT.push_back(
new Sigma2qg2qg() );
64 sigmaU.push_back(
new Sigma2qg2qg() );
68 sigmaT.push_back(
new Sigma2qq2qq() );
69 sigmaU.push_back(
new Sigma2qq2qq() );
73 if (processLevel > 0) {
75 sigmaT.push_back(
new Sigma2gg2qqbar() );
76 sigmaU.push_back(
new Sigma2gg2qqbar() );
77 sigmaT.push_back(
new Sigma2gg2QQbar(4, 121) );
78 sigmaU.push_back(
new Sigma2gg2QQbar(4, 121) );
79 sigmaT.push_back(
new Sigma2gg2QQbar(5, 123) );
80 sigmaU.push_back(
new Sigma2gg2QQbar(5, 123) );
81 }
else if (inState == 2) {
82 sigmaT.push_back(
new Sigma2qqbar2gg() );
83 sigmaU.push_back(
new Sigma2qqbar2gg() );
84 sigmaT.push_back(
new Sigma2qqbar2qqbarNew() );
85 sigmaU.push_back(
new Sigma2qqbar2qqbarNew() );
86 sigmaT.push_back(
new Sigma2qqbar2QQbar(4, 122) );
87 sigmaU.push_back(
new Sigma2qqbar2QQbar(4, 122) );
88 sigmaT.push_back(
new Sigma2qqbar2QQbar(5, 124) );
89 sigmaU.push_back(
new Sigma2qqbar2QQbar(5, 124) );
94 if (processLevel > 1) {
96 sigmaT.push_back(
new Sigma2gg2ggamma() );
97 sigmaU.push_back(
new Sigma2gg2ggamma() );
98 sigmaT.push_back(
new Sigma2gg2gammagamma() );
99 sigmaU.push_back(
new Sigma2gg2gammagamma() );
100 }
else if (inState == 1) {
101 sigmaT.push_back(
new Sigma2qg2qgamma() );
102 sigmaU.push_back(
new Sigma2qg2qgamma() );
103 }
else if (inState == 2) {
104 sigmaT.push_back(
new Sigma2qqbar2ggamma() );
105 sigmaU.push_back(
new Sigma2qqbar2ggamma() );
106 sigmaT.push_back(
new Sigma2ffbar2gammagamma() );
107 sigmaU.push_back(
new Sigma2ffbar2gammagamma() );
108 sigmaT.push_back(
new Sigma2ffbar2ffbarsgm() );
109 sigmaU.push_back(
new Sigma2ffbar2ffbarsgm() );
112 sigmaT.push_back(
new Sigma2ff2fftgmZ() );
113 sigmaU.push_back(
new Sigma2ff2fftgmZ() );
114 sigmaT.push_back(
new Sigma2ff2fftW() );
115 sigmaU.push_back(
new Sigma2ff2fftW() );
120 if (processLevel > 2) {
121 SigmaOniaSetup charmonium(infoPtr, settingsPtr, particleDataPtr, 4);
122 SigmaOniaSetup bottomonium(infoPtr, settingsPtr, particleDataPtr, 5);
124 charmonium.setupSigma2gg(sigmaT,
true);
125 charmonium.setupSigma2gg(sigmaU,
true);
126 bottomonium.setupSigma2gg(sigmaT,
true);
127 bottomonium.setupSigma2gg(sigmaU,
true);
128 }
else if (inState == 1) {
129 charmonium.setupSigma2qg(sigmaT,
true);
130 charmonium.setupSigma2qg(sigmaU,
true);
131 bottomonium.setupSigma2qg(sigmaT,
true);
132 bottomonium.setupSigma2qg(sigmaU,
true);
133 }
else if (inState == 2) {
134 charmonium.setupSigma2qq(sigmaT,
true);
135 charmonium.setupSigma2qq(sigmaU,
true);
136 bottomonium.setupSigma2qq(sigmaT,
true);
137 bottomonium.setupSigma2qq(sigmaU,
true);
142 nChan = sigmaT.size();
143 needMasses.resize(nChan);
146 sHatMin.resize(nChan);
147 sigmaTval.resize(nChan);
148 sigmaUval.resize(nChan);
151 for (
int i = 0; i < nChan; ++i) {
152 sigmaT[i]->init( infoPtr, settingsPtr, particleDataPtr, rndmPtr,
153 beamAPtr, beamBPtr, couplingsPtr);
154 sigmaT[i]->initProc();
155 sigmaU[i]->init( infoPtr, settingsPtr, particleDataPtr, rndmPtr,
156 beamAPtr, beamBPtr, couplingsPtr);
157 sigmaU[i]->initProc();
160 needMasses[i] =
false;
161 int id3Mass = sigmaT[i]->id3Mass();
162 int id4Mass = sigmaT[i]->id4Mass();
165 if (id3Mass > 0 || id4Mass > 0) {
166 needMasses[i] =
true;
167 m3Fix[i] = particleDataPtr->m0(id3Mass);
168 m4Fix[i] = particleDataPtr->m0(id4Mass);
170 sHatMin[i] = pow2( m3Fix[i] + m4Fix[i] + MASSMARGIN);
182 double SigmaMultiparton::sigma(
int id1,
int id2,
double x1,
double x2,
183 double sHat,
double tHat,
double uHat,
double alpS,
double alpEM,
184 bool restore,
bool pickOtherIn) {
187 if (restore) pickOther = pickOtherIn;
188 else pickOther = (rndmPtr->flat() < OTHERFRAC);
193 for (
int i = 0; i < nChan; ++i) {
198 if (i == 0 && pickOther)
continue;
199 if (i > 0 && !pickOther)
continue;
202 if (sHat > sHatMin[i]) {
203 sigmaT[i]->set2KinMPI( x1, x2, sHat, tHat, uHat,
204 alpS, alpEM, needMasses[i], m3Fix[i], m4Fix[i]);
205 sigmaTval[i] = sigmaT[i]->sigmaHatWrap(id1, id2);
206 sigmaT[i]->pickInState(id1, id2);
208 if (needMasses[i]) sigmaTval[i] *= sigmaT[i]->sHBetaMPI() / sHat;
209 sigmaTsum += sigmaTval[i];
213 if (sHat > sHatMin[i]) {
214 sigmaU[i]->set2KinMPI( x1, x2, sHat, uHat, tHat,
215 alpS, alpEM, needMasses[i], m3Fix[i], m4Fix[i]);
216 sigmaUval[i] = sigmaU[i]->sigmaHatWrap( id1, id2);
217 sigmaU[i]->pickInState(id1, id2);
219 if (needMasses[i]) sigmaUval[i] *= sigmaU[i]->sHBetaMPI() / sHat;
220 sigmaUsum += sigmaUval[i];
225 double sigmaAvg = 0.5 * (sigmaTsum + sigmaUsum);
226 if (pickOther) sigmaAvg /= OTHERFRAC;
227 if (!pickOther) sigmaAvg /= (1. - OTHERFRAC);
236 SigmaProcess* SigmaMultiparton::sigmaSel() {
239 pickedU = (rndmPtr->flat() * (sigmaTsum + sigmaUsum) < sigmaUsum);
243 double sigmaRndm = sigmaTsum * rndmPtr->flat();
245 do sigmaRndm -= sigmaTval[++iPick];
246 while (sigmaRndm > 0.);
247 return sigmaT[iPick];
251 double sigmaRndm = sigmaUsum * rndmPtr->flat();
253 do sigmaRndm -= sigmaUval[++iPick];
254 while (sigmaRndm > 0.);
255 return sigmaU[iPick];
271 const bool MultipartonInteractions::SHIFTFACSCALE =
false;
274 const bool MultipartonInteractions::PREPICKRESCATTER =
true;
277 const double MultipartonInteractions::SIGMAFUDGE = 0.8;
280 const double MultipartonInteractions::RPT20 = 0.25;
283 const double MultipartonInteractions::PT0STEP = 0.9;
284 const double MultipartonInteractions::SIGMASTEP = 1.1;
287 const double MultipartonInteractions::PT0MIN = 0.2;
290 const double MultipartonInteractions::EXPPOWMIN = 0.4;
293 const double MultipartonInteractions::PROBATLOWB = 0.6;
296 const double MultipartonInteractions::BSTEP = 0.01;
299 const double MultipartonInteractions::BMAX = 1e-8;
302 const double MultipartonInteractions::EXPMAX = 50.;
305 const double MultipartonInteractions::KCONVERGE = 1e-7;
308 const double MultipartonInteractions::CONVERT2MB = 0.389380;
311 const double MultipartonInteractions::ROOTMIN = 0.01;
314 const double MultipartonInteractions::ECMDEV = 0.01;
319 const int MultipartonInteractions::XDEP_BBIN = 500;
321 const double MultipartonInteractions::XDEP_A0 = 1.0;
323 const double MultipartonInteractions::XDEP_A1 = 1.0;
325 const double MultipartonInteractions::XDEP_BSTEP = 0.02;
326 const double MultipartonInteractions::XDEP_BSTEPINC = 0.01;
329 const double MultipartonInteractions::XDEP_CUTOFF = 1e-4;
331 const double MultipartonInteractions::XDEP_SMB2FM = sqrt(0.1);
334 const double MultipartonInteractions::WTACCWARN = 1.1;
337 const double MultipartonInteractions::SIGMAMBLIMIT = 1.;
343 bool MultipartonInteractions::init(
bool doMPIinit,
int iDiffSysIn,
344 Info* infoPtrIn, Settings& settings, ParticleData* particleDataPtr,
345 Rndm* rndmPtrIn, BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
346 Couplings* couplingsPtrIn, PartonSystems* partonSystemsPtrIn,
347 SigmaTotal* sigmaTotPtrIn, UserHooks* userHooksPtrIn,
348 PartonVertex* partonVertexPtrIn,
bool hasGammaIn) {
351 iDiffSys = iDiffSysIn;
354 beamAPtr = beamAPtrIn;
355 beamBPtr = beamBPtrIn;
356 couplingsPtr = couplingsPtrIn;
357 partonSystemsPtr = partonSystemsPtrIn;
358 sigmaTotPtr = sigmaTotPtrIn;
359 userHooksPtr = userHooksPtrIn;
360 partonVertexPtr = partonVertexPtrIn;
361 hasGamma = hasGammaIn;
362 if (!doMPIinit)
return false;
365 hasBaryonBeams = ( beamAPtr->isBaryon() && beamBPtr->isBaryon() );
366 hasPomeronBeams = ( beamAPtr->id() == 990 || beamBPtr->id() == 990 );
369 pTmaxMatch = settings.mode(
"MultipartonInteractions:pTmaxMatch");
372 alphaSvalue = settings.parm(
"MultipartonInteractions:alphaSvalue");
373 alphaSorder = settings.mode(
"MultipartonInteractions:alphaSorder");
374 alphaSnfmax = settings.mode(
"StandardModel:alphaSnfmax");
377 alphaEMorder = settings.mode(
"MultipartonInteractions:alphaEMorder");
380 Kfactor = settings.parm(
"MultipartonInteractions:Kfactor");
383 isGammaGamma = beamAPtr->isGamma() && beamBPtr->isGamma();
384 isGammaHadron = beamAPtr->isGamma() && beamBPtr->isHadron();
385 isHadronGamma = beamAPtr->isHadron() && beamBPtr->isGamma();
390 pT0paramMode = settings.mode(
"PhotonPhoton:pT0parametrization");
391 pT0Ref = settings.parm(
"PhotonPhoton:pT0Ref");
392 ecmRef = settings.parm(
"PhotonPhoton:ecmRef");
393 ecmPow = settings.parm(
"PhotonPhoton:ecmPow");
394 pTmin = settings.parm(
"PhotonPhoton:pTmin");
396 pT0paramMode = settings.mode(
"MultipartonInteractions:pT0parametrization");
397 pT0Ref = settings.parm(
"MultipartonInteractions:pT0Ref");
398 ecmRef = settings.parm(
"MultipartonInteractions:ecmRef");
399 ecmPow = settings.parm(
"MultipartonInteractions:ecmPow");
400 pTmin = settings.parm(
"MultipartonInteractions:pTmin");
405 bProfile = settings.mode(
"MultipartonInteractions:bProfile");
406 coreRadius = settings.parm(
"MultipartonInteractions:coreRadius");
407 coreFraction = settings.parm(
"MultipartonInteractions:coreFraction");
408 expPow = settings.parm(
"MultipartonInteractions:expPow");
409 expPow = max(EXPPOWMIN, expPow);
411 a1 = settings.parm(
"MultipartonInteractions:a1");
415 bProfile = settings.mode(
"Diffraction:bProfile");
416 coreRadius = settings.parm(
"Diffraction:coreRadius");
417 coreFraction = settings.parm(
"Diffraction:coreFraction");
418 expPow = settings.parm(
"Diffraction:expPow");
419 expPow = max(EXPPOWMIN, expPow);
423 if ((iDiffSys > 0 || settings.flag(
"Diffraction:doHard")) && bProfile == 4) {
424 infoPtr->errorMsg(
"Error in MultipartonInteractions::init:"
425 " chosen b profile not allowed for diffraction");
430 bSelScale = settings.mode(
"MultipartonInteractions:bSelScale");
433 processLevel = settings.mode(
"MultipartonInteractions:processLevel");
436 allowRescatter = settings.flag(
"MultipartonInteractions:allowRescatter");
438 = settings.flag(
"MultipartonInteractions:allowDoubleRescatter");
439 rescatterMode = settings.mode(
"MultipartonInteractions:rescatterMode");
440 ySepResc = settings.parm(
"MultipartonInteractions:ySepRescatter");
441 deltaYResc = settings.parm(
"MultipartonInteractions:deltaYRescatter");
444 if (bProfile == 4) allowRescatter =
false;
447 globalRecoilFSR = settings.flag(
"TimeShower:globalRecoil");
448 nMaxGlobalRecoilFSR = settings.mode(
"TimeShower:nMaxGlobalRecoil");
451 nQuarkIn = settings.mode(
"MultipartonInteractions:nQuarkIn");
452 nSample = settings.mode(
"MultipartonInteractions:nSample");
455 enhanceScreening = settings.mode(
"MultipartonInteractions:enhanceScreening");
458 sigmaPomP = settings.parm(
"Diffraction:sigmaRefPomP");
459 mPomP = settings.parm(
"Diffraction:mRefPomP");
460 pPomP = settings.parm(
"Diffraction:mPowPomP");
461 mMinPertDiff = settings.parm(
"Diffraction:mMinPert");
462 bSelHard = settings.mode(
"Diffraction:bSelHard");
468 canVetoMPI = (userHooksPtr != 0) ? userHooksPtr->canVetoMPIEmission()
472 doPartonVertex = settings.flag(
"PartonVertex:setVertex")
473 && (partonVertexPtr != 0);
477 fracA = pow2(1. - coreFraction);
478 fracB = 2. * coreFraction * (1. - coreFraction);
479 fracC = pow2(coreFraction);
480 radius2B = 0.5 * (1. + pow2(coreRadius));
481 radius2C = pow2(coreRadius);
484 }
else if (bProfile == 3) {
485 hasLowPow = (expPow < 2.);
486 expRev = 2. / expPow - 1.;
491 alphaS.init( alphaSvalue, alphaSorder, alphaSnfmax,
false);
492 double Lambda3 = alphaS.Lambda3();
495 alphaEM.init( alphaEMorder, &settings);
498 sigma2gg.init( 0, processLevel, infoPtr, &settings, particleDataPtr,
499 rndmPtr, beamAPtr, beamBPtr, couplingsPtr);
500 sigma2qg.init( 1, processLevel, infoPtr, &settings, particleDataPtr,
501 rndmPtr, beamAPtr, beamBPtr, couplingsPtr);
502 sigma2qqbarSame.init( 2, processLevel, infoPtr, &settings, particleDataPtr,
503 rndmPtr, beamAPtr, beamBPtr, couplingsPtr);
504 sigma2qq.init( 3, processLevel, infoPtr, &settings, particleDataPtr,
505 rndmPtr, beamAPtr, beamBPtr, couplingsPtr);
508 eCM = infoPtr->eCM();
514 mGmGmMin = settings.parm(
"Photon:Wmin");
515 mGmGmMax = settings.parm(
"Photon:Wmax");
516 if ( mGmGmMax < mGmGmMin ) mGmGmMax = eCM;
520 if (infoPtr->isVMDstateA() || infoPtr->isVMDstateB())
521 sigmaTotPtr->calc(infoPtr->idA(), infoPtr->idB(), infoPtr->eCM());
523 else if ( (isGammaGamma || isGammaHadron || isHadronGamma) && !hasGamma)
524 sigmaTotPtr->calc(infoPtr->idA(), infoPtr->idB(), infoPtr->eCM());
525 if (!sigmaTotPtr->hasSigmaTot())
return false;
526 bool isNonDiff = (iDiffSys == 0);
527 sigmaND = sigmaTotPtr->sigmaND();
528 double sigmaMaxViol = 0.;
531 bool showMPI = settings.flag(
"Init:showMultipartonInteractions");
533 cout <<
"\n *------- PYTHIA Multiparton Interactions Initialization "
537 if (isNonDiff && !hasGamma)
538 cout <<
" | sigmaNonDiffractive = " << setprecision(2)
539 << ((sigmaND > 1.) ? fixed : scientific) << setw(8) << sigmaND
541 else if (iDiffSys == 1)
542 cout <<
" | diffraction XB "
544 else if (iDiffSys == 2)
545 cout <<
" | diffraction AX "
547 else if (iDiffSys == 3)
548 cout <<
" | diffraction AXB "
550 else if ( hasGamma && isGammaGamma )
551 cout <<
" | l+l- -> gamma+gamma -> X "
553 else if ( hasGamma && isGammaHadron )
554 cout <<
" | lepton+hadron -> gamma+hadron -> X "
556 else if ( hasGamma && isHadronGamma )
557 cout <<
" | hadron+lepton -> hadron+gamma -> X "
564 nStep = (iDiffSys == 0) ? 1 : 5;
565 eStepSize = (nStep < 2) ? 1.
566 : log(mMaxPertDiff / mMinPertDiff) / (nStep - 1.);
571 eStepSize = log(mGmGmMax / mGmGmMin) / (nStep - 1.);
574 for (
int iStep = 0; iStep < nStep; ++iStep) {
579 if (!hasGamma) eCM = mMinPertDiff * pow( mMaxPertDiff / mMinPertDiff,
580 iStep / (nStep - 1.) );
581 else eCM = mGmGmMin * pow( mGmGmMax / mGmGmMin, iStep / (nStep - 1.) );
586 if (hasPomeronBeams) {
587 double gamPomRatio = 1.;
589 sigmaTotPtr->calc(22, 2212, eCM);
590 double sigGamP = sigmaTotPtr->sigmaTot();
591 sigmaTotPtr->calc(2212, 2212, eCM);
592 double sigPP = sigmaTotPtr->sigmaTot();
593 gamPomRatio = sigGamP / sigPP;
595 sigmaND = gamPomRatio * sigmaPomP * pow( eCM / mPomP, pPomP);
596 if (showMPI) cout <<
" | diffractive mass = " << scientific
597 << setprecision(2) << setw(8) << eCM <<
" GeV and sigmaNorm = "
598 << ((sigmaND > SIGMAMBLIMIT) ? fixed : scientific)
599 << setw(8) << sigmaND <<
" mb | \n";
602 if ( beamAPtr->id() == 990 && beamBPtr->id() == 990 ) {
603 beamAPtr->xPom(eCM/eCMsave);
604 beamBPtr->xPom(eCM/eCMsave);
606 else if ( beamAPtr->id() == 990 )
607 beamAPtr->xPom(pow2(eCM/eCMsave));
608 else if ( beamBPtr->id() == 990 )
609 beamBPtr->xPom(pow2(eCM/eCMsave));
614 if ( isHadronGamma ) {
615 sigmaTotPtr->calc( beamAPtr->id(), 22, eCM );
616 sigmaND = sigmaTotPtr->sigmaND();
617 if (showMPI) cout <<
" | hadron+gamma eCM = " << scientific
618 << setprecision(2) << setw(8) << eCM <<
" GeV and sigmaNorm = "
619 << ((sigmaND > SIGMAMBLIMIT) ? fixed : scientific)
620 << setw(8) << sigmaND <<
" mb | \n";
623 }
else if ( isGammaHadron ) {
624 sigmaTotPtr->calc( 22, beamBPtr->id(), eCM );
625 sigmaND = sigmaTotPtr->sigmaND();
626 if (showMPI) cout <<
" | gamma+hadron eCM = " << scientific
627 << setprecision(2) << setw(8) << eCM <<
" GeV and sigmaNorm = "
628 << ((sigmaND > SIGMAMBLIMIT) ? fixed : scientific)
629 << setw(8) << sigmaND <<
" mb | \n";
633 sigmaTotPtr->calc( 22, 22, eCM );
634 sigmaND = sigmaTotPtr->sigmaND();
635 if (showMPI) cout <<
" | gamma+gamma eCM = " << scientific
636 << setprecision(2) << setw(8) << eCM <<
" GeV and sigmaNorm = "
637 << ((sigmaND > SIGMAMBLIMIT) ? fixed : scientific)
638 << setw(8) << sigmaND <<
" mb | \n";
645 if (pT0paramMode == 0) pT0 = pT0Ref * pow(eCM / ecmRef, ecmPow);
646 else pT0 = pT0Ref + ecmPow * log (eCM / ecmRef);
649 double pT4dSigmaMaxBeg = 0.;
654 pT2min = pTmin*pTmin;
656 pT2max = pTmax*pTmax;
657 pT20R = RPT20 * pT20;
658 pT20minR = pT2min + pT20R;
659 pT20maxR = pT2max + pT20R;
660 pT20min0maxR = pT20minR * pT20maxR;
661 pT2maxmin = pT2max - pT2min;
668 sigmaIntWgt.resize(XDEP_BBIN);
669 sigmaSumWgt.resize(XDEP_BBIN);
670 bstepNow = XDEP_BSTEP;
674 pT4dSigmaMaxBeg = pT4dSigmaMax;
680 && sigmaIntWgt[XDEP_BBIN - 1] > XDEP_CUTOFF * sigmaInt) {
681 bstepNow += XDEP_BSTEPINC;
686 if (sigmaInt > SIGMASTEP * sigmaND)
break;
687 if (showMPI) cout << fixed << setprecision(2) <<
" | pT0 = "
688 << setw(5) << pT0 <<
" gives sigmaInteraction = " << setw(8)
689 << ((sigmaInt > SIGMAMBLIMIT) ? fixed : scientific) << sigmaInt
690 <<
" mb: rejected | \n";
691 if (pTmin > pT0) pTmin *= PT0STEP;
695 if ( max(pT0, pTmin) < max(PT0MIN, Lambda3) ) {
696 infoPtr->errorMsg(
"Error in MultipartonInteractions::init:"
697 " failed to find acceptable pT0 and pTmin");
698 infoPtr->setTooLowPTmin(
true);
704 if (showMPI) cout << fixed << setprecision(2) <<
" | pT0 = "
705 << setw(5) << pT0 <<
" gives sigmaInteraction = "<< setw(8)
706 << ((sigmaInt > SIGMAMBLIMIT) ? fixed : scientific) << sigmaInt
707 <<
" mb: accepted | \n";
713 sigmaMaxViol = max( sigmaMaxViol, pT4dSigmaMax / pT4dSigmaMaxBeg);
717 pT0Save[iStep] = pT0;
718 pT4dSigmaMaxSave[iStep] = pT4dSigmaMax;
719 pT4dProbMaxSave[iStep] = pT4dProbMax;
720 sigmaIntSave[iStep] = sigmaInt;
721 for (
int j = 0; j <= 100; ++j) sudExpPTSave[iStep][j] = sudExpPT[j];
722 zeroIntCorrSave[iStep] = zeroIntCorr;
723 normOverlapSave[iStep] = normOverlap;
724 kNowSave[iStep] = kNow;
725 bAvgSave[iStep] = bAvg;
726 bDivSave[iStep] = bDiv;
727 probLowBSave[iStep] = probLowB;
728 fracAhighSave[iStep] = fracAhigh;
729 fracBhighSave[iStep] = fracBhigh;
730 fracChighSave[iStep] = fracBhigh;
731 fracABChighSave[iStep] = fracABChigh;
732 cDivSave[iStep] = cDiv;
733 cMaxSave[iStep] = cMax;
744 if (bProfile == 4 && showMPI)
747 << fixed << setprecision(2)
748 <<
" | x-dependent matter profile: a1 = " << a1 <<
", "
749 <<
"a0 = " << a0now * XDEP_SMB2FM <<
", bStep = "
750 << bstepNow <<
" | \n";
753 if (showMPI) cout <<
" | "
755 <<
" *------- End PYTHIA Multiparton Interactions Initialization"
756 <<
" -----* " << endl;
759 if (sigmaMaxViol > 1.) {
760 ostringstream osWarn;
761 osWarn <<
"by factor " << fixed << setprecision(3) << sigmaMaxViol;
762 infoPtr->errorMsg(
"Warning in MultipartonInteractions::init:"
763 " maximum increased", osWarn.str());
767 SigmaMultiparton* dSigma;
768 for (
int i = 0; i < 4; ++i) {
769 if (i == 0) dSigma = &sigma2gg;
770 else if (i == 1) dSigma = &sigma2qg;
771 else if (i == 2) dSigma = &sigma2qqbarSame;
772 else dSigma = &sigma2qq;
773 int nProc = dSigma->nProc();
774 for (
int iProc = 0; iProc < nProc; ++iProc)
775 nGen[ dSigma->codeProc(iProc) ] = 0;
796 void MultipartonInteractions::reset( ) {
803 eCM = infoPtr->eCM();
805 if (nStep == 1 || abs( eCM / eCMsave - 1.) < ECMDEV)
return;
808 if (!hasGamma) sigmaND = sigmaPomP * pow( eCM / mPomP, pPomP);
811 sigmaTotPtr->calc( beamAPtr->id(), beamBPtr->id(), eCM );
812 sigmaND = sigmaTotPtr->sigmaND();
817 if (!hasGamma) eStepSave = log(eCM / mMinPertDiff) / eStepSize;
818 else eStepSave = log(eCM / mGmGmMin) / eStepSize;
819 iStepFrom = max( 0, min( nStep - 2,
int( eStepSave) ) );
820 iStepTo = iStepFrom + 1;
821 eStepTo = max( 0., min( 1., eStepSave - iStepFrom) );
822 eStepFrom = 1. - eStepTo;
825 pT0 = eStepFrom * pT0Save[iStepFrom]
826 + eStepTo * pT0Save[iStepTo];
828 pT2min = pTmin*pTmin;
830 pT2max = pTmax*pTmax;
831 pT20R = RPT20 * pT20;
832 pT20minR = pT2min + pT20R;
833 pT20maxR = pT2max + pT20R;
834 pT20min0maxR = pT20minR * pT20maxR;
835 pT2maxmin = pT2max - pT2min;
838 pT4dSigmaMax = eStepFrom * pT4dSigmaMaxSave[iStepFrom]
839 + eStepTo * pT4dSigmaMaxSave[iStepTo];
840 pT4dProbMax = eStepFrom * pT4dProbMaxSave[iStepFrom]
841 + eStepTo * pT4dProbMaxSave[iStepTo];
842 sigmaInt = eStepFrom * sigmaIntSave[iStepFrom]
843 + eStepTo * sigmaIntSave[iStepTo];
844 for (
int j = 0; j <= 100; ++j)
845 sudExpPT[j] = eStepFrom * sudExpPTSave[iStepFrom][j]
846 + eStepTo * sudExpPTSave[iStepTo][j];
849 zeroIntCorr = eStepFrom * zeroIntCorrSave[iStepFrom]
850 + eStepTo * zeroIntCorrSave[iStepTo];
851 normOverlap = eStepFrom * normOverlapSave[iStepFrom]
852 + eStepTo * normOverlapSave[iStepTo];
853 kNow = eStepFrom * kNowSave[iStepFrom]
854 + eStepTo * kNowSave[iStepTo];
855 bAvg = eStepFrom * bAvgSave[iStepFrom]
856 + eStepTo * bAvgSave[iStepTo];
857 bDiv = eStepFrom * bDivSave[iStepFrom]
858 + eStepTo * bDivSave[iStepTo];
859 probLowB = eStepFrom * probLowBSave[iStepFrom]
860 + eStepTo * probLowBSave[iStepTo];
861 fracAhigh = eStepFrom * fracAhighSave[iStepFrom]
862 + eStepTo * fracAhighSave[iStepTo];
863 fracBhigh = eStepFrom * fracBhighSave[iStepFrom]
864 + eStepTo * fracBhighSave[iStepTo];
865 fracChigh = eStepFrom * fracChighSave[iStepFrom]
866 + eStepTo * fracChighSave[iStepTo];
867 fracABChigh = eStepFrom * fracABChighSave[iStepFrom]
868 + eStepTo * fracABChighSave[iStepTo];
869 cDiv = eStepFrom * cDivSave[iStepFrom]
870 + eStepTo * cDivSave[iStepTo];
871 cMax = eStepFrom * cMaxSave[iStepFrom]
872 + eStepTo * cMaxSave[iStepTo];
881 void MultipartonInteractions::pTfirst() {
886 if (bProfile == 4) isAtLowB =
false;
906 WTacc = sigmaPT2scatter(
true) / dSigmaApprox;
907 if (WTacc > WTACCWARN) infoPtr->errorMsg(
"Warning in "
908 "MultipartonInteractions::pTfirst: weight above unity");
912 }
while (WTacc < rndmPtr->flat() || !dSigmaDtSel->final2KinMPI());
919 pT2 = pT20min0maxR / (pT20minR + rndmPtr->flat() * pT2maxmin) - pT20R;
922 dSigmaApprox = pT4dSigmaMax / pow2(pT2 + pT20R);
925 WTacc = sigmaPT2scatter(
true) / dSigmaApprox;
928 if (bProfile != 4) WTacc *= sudakov( pT2, enhanceB);
931 if (WTacc > WTACCWARN) infoPtr->errorMsg(
"Warning in "
932 "MultipartonInteractions::pTfirst: weight above unity");
935 }
while (WTacc < rndmPtr->flat() || !dSigmaDtSel->final2KinMPI());
939 if (bProfile != 4)
break;
954 xPDF1nowSave = xPDF1now;
955 xPDF2nowSave = xPDF2now;
957 dSigmaDtSel->saveKin();
958 dSigmaDtSelSave = dSigmaDtSel;
963 beamAPtr->append( 0, id1, x1);
964 beamAPtr->xfISR( 0, id1, x1, pT2Fac * pT2Fac);
965 vsc1 = beamAPtr->pickValSeaComp();
966 beamBPtr->append( 0, id2, x2);
967 beamBPtr->xfISR( 0, id2, x2, pT2Fac * pT2Fac);
968 vsc2 = beamBPtr->pickValSeaComp();
971 double w1 = XDEP_A1 + a1 * log(1. / x1);
972 double w2 = XDEP_A1 + a1 * log(1. / x2);
973 double fac = a02now * (w1 * w1 + w2 * w2);
975 if ( userHooksPtr && userHooksPtr->canSetImpactParameter() ) {
976 bNow = userHooksPtr->doSetImpactParameter() * bAvg;
978 expb2 = exp(-b2now / fac);
980 expb2 = rndmPtr->flat();
981 b2now = - fac * log(expb2);
988 enhanceB = sigmaND / M_PI / fac * expb2;
989 enhanceBmax = sigmaND / 2. / M_PI / a02now *
990 exp( -b2now / 2. / a2max );
994 double pTtrial = pTnext(pTmax, pTmin, evDummy);
1001 if (pTtrial < sqrt(pT2FacSave)) {
1004 swap(pT2Fac, pT2FacSave);
1005 swap(pT2Ren, pT2RenSave);
1010 swap(sHat, sHatSave);
1011 swap(tHat, tHatSave);
1012 swap(uHat, uHatSave);
1013 swap(alpS, alpSsave);
1014 swap(alpEM, alpEMsave);
1015 swap(xPDF1now, xPDF1nowSave);
1016 swap(xPDF2now, xPDF2nowSave);
1017 if (dSigmaDtSel == dSigmaDtSelSave) dSigmaDtSel->swapKin();
1018 else swap(dSigmaDtSel, dSigmaDtSelSave);
1037 void MultipartonInteractions::setupFirstSys(
Event& process) {
1040 int sizeProc = process.size();
1042 for (
int i = 3; i < sizeProc; ++i)
1043 if (process[i].statusAbs() < 20) nBeams = i + 1;
1044 int nOffset = nBeams - 3;
1047 if (sizeProc > nBeams) {
1048 process.popBack( sizeProc - nBeams);
1049 process.initColTag();
1053 process[1 + nOffset].daughter1(3 + nOffset);
1054 process[2 + nOffset].daughter1(4 + nOffset);
1057 process[1 + nOffset].statusNeg();
1058 process[2 + nOffset].statusNeg();
1061 int colOffset = process.lastColTag();
1062 for (
int i = 1; i <= 4; ++i) {
1063 Particle parton = dSigmaDtSel->getParton(i);
1064 if (i <= 2) parton.status(-21);
1065 else parton.status(23);
1066 if (i <= 2) parton.mothers( i + nOffset, 0);
1067 else parton.mothers( 3 + nOffset, 4 + nOffset);
1068 if (i <= 2) parton.daughters( 5 + nOffset, 6 + nOffset);
1069 else parton.daughters( 0, 0);
1070 int col = parton.col();
1071 if (col > 0) parton.col( col + colOffset);
1072 int acol = parton.acol();
1073 if (acol > 0) parton.acol( acol + colOffset);
1076 process.append(parton);
1080 process.scale( sqrt(pT2Fac) );
1083 string nameSub = dSigmaDtSel->name();
1084 int codeSub = dSigmaDtSel->code();
1085 int nFinalSub = dSigmaDtSel->nFinal();
1086 double pTMPI = dSigmaDtSel->pTMPIFin();
1087 infoPtr->setSubType( iDiffSys, nameSub, codeSub, nFinalSub);
1088 if (iDiffSys == 0) infoPtr->setTypeMPI( codeSub, pTMPI, 0, 0,
1089 enhanceB / zeroIntCorr);
1092 infoPtr->setPDFalpha( iDiffSys, id1, id2, x1, x2,
1093 (id1 == 21 ? 4./9. : 1.) * xPDF1now, (id2 == 21 ? 4./9. : 1.) * xPDF2now,
1094 pT2Fac, alpEM, alpS, pT2Ren, 0.);
1095 double m3 = dSigmaDtSel->m(3);
1096 double m4 = dSigmaDtSel->m(4);
1097 double theta = dSigmaDtSel->thetaMPI();
1098 double phi = dSigmaDtSel->phiMPI();
1099 infoPtr->setKin( iDiffSys, id1, id2, x1, x2, sHat, tHat, uHat, sqrt(pT2),
1100 m3, m4, theta, phi);
1108 bool MultipartonInteractions::limitPTmax(
Event& event) {
1111 if (pTmaxMatch == 1)
return true;
1112 if (pTmaxMatch == 2)
return false;
1115 if (infoPtr->isNonDiffractive() || infoPtr->isDiffractiveA()
1116 || infoPtr->isDiffractiveB() || infoPtr->isDiffractiveC() )
return true;
1119 bool onlyQGP1 =
true;
1120 bool onlyQGP2 =
true;
1121 double scaleLimit1 = 0.;
1122 double scaleLimit2 = 0.;
1124 int iBegin = 5 + beamOffset;
1125 for (
int i = iBegin; i <
event.size(); ++i) {
1126 if (event[i].status() == -21) ++n21;
1127 else if (n21 == 0) {
1128 scaleLimit1 += 0.5 *
event[i].pT();
1129 int idAbs =
event[i].idAbs();
1130 if (idAbs > 5 && idAbs != 21 && idAbs != 22) onlyQGP1 =
false;
1131 }
else if (n21 == 2) {
1132 scaleLimit2 += 0.5 *
event[i].pT();
1133 int idAbs =
event[i].idAbs();
1134 if (idAbs > 5 && idAbs != 21 && idAbs != 22) onlyQGP2 =
false;
1139 scaleLimitPTsave = (n21 == 2) ? min( scaleLimit1, scaleLimit2) : scaleLimit1;
1140 bool onlyQGP = (n21 == 2) ? (onlyQGP1 || onlyQGP2) : onlyQGP1;
1149 double MultipartonInteractions::pTnext(
double pTbegAll,
double pTendAll,
1153 bool pickRescatter, acceptKin;
1154 double dSigmaScatter, dSigmaRescatter, WTacc;
1155 double pT2end = pow2( max(pTmin, pTendAll) );
1162 if (bProfile == 4 && bIsSet && bSetInFirst && infoPtr->getCounter(21) == 1
1163 && infoPtr->getCounter(22) == 1) {
1164 if (pT2Save < pT2end)
return 0.;
1166 pT2Fac = pT2FacSave;
1167 pT2Ren = pT2RenSave;
1177 xPDF1now = xPDF1nowSave;
1178 xPDF2now = xPDF2nowSave;
1179 if (dSigmaDtSel == dSigmaDtSelSave) dSigmaDtSel->swapKin();
1180 else dSigmaDtSel = dSigmaDtSelSave;
1185 bool allowRescatterNow = allowRescatter;
1186 if (globalRecoilFSR && partonSystemsPtr->sizeOut(0) <= nMaxGlobalRecoilFSR)
1187 allowRescatterNow =
false;
1190 pT2 = pow2(pTbegAll);
1193 if (allowRescatterNow) findScatteredPartons( event);
1199 if (pT2 < pT2end)
return 0.;
1205 pickRescatter =
false;
1208 dSigmaScatter = sigmaPT2scatter(
false);
1211 dSigmaRescatter = (allowRescatterNow) ? sigmaPT2rescatter( event) : 0.;
1214 WTacc = (dSigmaScatter + dSigmaRescatter) / dSigmaApprox;
1215 if (WTacc > WTACCWARN) infoPtr->errorMsg(
"Warning in "
1216 "MultipartonInteractions::pTnext: weight above unity");
1220 if (enhanceScreening > 0) {
1221 int nSysNow = infoPtr->nMPI() + 1;
1222 if (enhanceScreening == 2) nSysNow += infoPtr->nISR();
1223 double WTscreen = pow2( (pT2 + pT20) / (pT2 + nSysNow * pT20) );
1228 if (bProfile == 4) {
1229 double w1 = XDEP_A1 + a1 * log(1. / x1);
1230 double w2 = XDEP_A1 + a1 * log(1. / x2);
1231 double fac = a02now * (w1 * w1 + w2 * w2);
1233 enhanceBnow = sigmaND / M_PI / fac * exp( - b2now / fac);
1234 double oWgt = enhanceBnow / enhanceBmax;
1235 if (oWgt > 1.0000000001) infoPtr->errorMsg(
"Warning in Multiparton"
1236 "Interactions::pTnext: overlap weight above unity");
1241 }
while (WTacc < rndmPtr->flat());
1244 if (allowRescatterNow) {
1245 pickRescatter = (i1Sel > 0 || i2Sel > 0);
1255 sigma2Sel->sigma( id1, id2, x1, x2, sHat, tHat, uHat, alpS, alpEM,
1256 true, pickOtherSel);
1260 dSigmaDtSel = sigma2Sel->sigmaSel();
1261 if (sigma2Sel->swapTU()) swap( tHat, uHat);
1265 if (pickRescatter) {
1266 Vec4 p1Res = (i1Sel == 0) ? 0.5 * eCM * x1Sel * Vec4( 0., 0., 1., 1.)
1268 Vec4 p2Res = (i2Sel == 0) ? 0.5 * eCM * x2Sel * Vec4( 0., 0., -1., 1.)
1270 double m1Res = (i1Sel == 0) ? 0. : event[i1Sel].m();
1271 double m2Res = (i2Sel == 0) ? 0. : event[i2Sel].m();
1272 acceptKin = dSigmaDtSel->final2KinMPI( i1Sel, i2Sel, p1Res, p2Res,
1275 }
else acceptKin = dSigmaDtSel->final2KinMPI();
1276 }
while (!acceptKin);
1288 bool MultipartonInteractions::scatter(
Event& event) {
1291 int sizeProc =
event.size();
1293 for (
int i = 3; i < sizeProc; ++i)
1294 if (event[i].statusAbs() < 20) nBeams = i + 1;
1295 int nOffset = nBeams - 3;
1298 int motherOffset =
event.size();
1299 int colOffset =
event.lastColTag();
1300 for (
int i = 1; i <= 4; ++i) {
1301 Particle parton = dSigmaDtSel->getParton(i);
1302 if (i <= 2 ) parton.mothers( i + nOffset, 0);
1303 else parton.mothers( motherOffset, motherOffset + 1);
1304 if (i <= 2 ) parton.daughters( motherOffset + 2, motherOffset + 3);
1305 else parton.daughters( 0, 0);
1306 int col = parton.col();
1307 if (col > 0) parton.col( col + colOffset);
1308 int acol = parton.acol();
1309 if (acol > 0) parton.acol( acol + colOffset);
1312 event.append(parton);
1317 partonVertexPtr->vertexMPI( sizeProc, 4, bNow, event);
1320 if (canVetoMPI && userHooksPtr->doVetoMPIEmission(sizeProc, event)) {
1321 event.popBack(event.size() - sizeProc);
1326 int iSys = partonSystemsPtr->addSys();
1327 partonSystemsPtr->setInA(iSys, motherOffset);
1328 partonSystemsPtr->setInB(iSys, motherOffset + 1);
1329 partonSystemsPtr->addOut(iSys, motherOffset + 2);
1330 partonSystemsPtr->addOut(iSys, motherOffset + 3);
1331 partonSystemsPtr->setSHat(iSys, sHat);
1334 bool annihil1 =
false;
1335 bool annihil2 =
false;
1336 if (i1Sel > 0 && i2Sel > 0) {
1337 if (event[motherOffset].col() == event[motherOffset + 1].acol()
1338 && event[motherOffset].col() > 0) annihil1 =
true;
1339 if (event[motherOffset].acol() == event[motherOffset + 1].col()
1340 && event[motherOffset].acol() > 0) annihil2 =
true;
1344 BeamParticle& beamA = *beamAPtr;
1345 int iA = beamA.append( motherOffset, id1, x1);
1349 beamA.xfISR( iA, id1, x1, pT2);
1350 beamA.pickValSeaComp();
1355 beamA[iA].companion(-10);
1356 event[i1Sel].statusNeg();
1357 event[i1Sel].daughters( motherOffset, motherOffset);
1358 event[motherOffset].mothers( i1Sel, i1Sel);
1359 int colOld =
event[i1Sel].col();
1361 int colNew =
event[motherOffset].col();
1362 for (
int i = motherOffset; i < motherOffset + 4; ++i) {
1363 if (event[i].col() == colNew)
event[i].col( colOld);
1364 if (event[i].acol() == colNew)
event[i].acol( colOld);
1367 int acolOld =
event[i1Sel].acol();
1369 int acolNew =
event[motherOffset].acol();
1370 for (
int i = motherOffset; i < motherOffset + 4; ++i) {
1371 if (event[i].col() == acolNew)
event[i].col( acolOld);
1372 if (event[i].acol() == acolNew)
event[i].acol( acolOld);
1378 BeamParticle& beamB = *beamBPtr;
1379 int iB = beamB.append( motherOffset + 1, id2, x2);
1383 beamB.xfISR( iB, id2, x2, pT2);
1384 beamB.pickValSeaComp();
1389 beamB[iB].companion(-10);
1390 event[i2Sel].statusNeg();
1391 event[i2Sel].daughters( motherOffset + 1, motherOffset + 1);
1392 event[motherOffset + 1].mothers( i2Sel, i2Sel);
1393 int colOld =
event[i2Sel].col();
1395 int colNew =
event[motherOffset + 1].col();
1396 for (
int i = motherOffset; i < motherOffset + 4; ++i) {
1397 if (event[i].col() == colNew)
event[i].col( colOld);
1398 if (event[i].acol() == colNew)
event[i].acol( colOld);
1401 int acolOld =
event[i2Sel].acol();
1403 int acolNew =
event[motherOffset + 1].acol();
1404 for (
int i = motherOffset; i < motherOffset + 4; ++i) {
1405 if (event[i].col() == acolNew)
event[i].col( acolOld);
1406 if (event[i].acol() == acolNew)
event[i].acol( acolOld);
1413 if (annihil1 || annihil2) {
1414 int colLeft = (annihil1) ? event[motherOffset].col()
1415 :
event[motherOffset].acol();
1416 int mother1 =
event[motherOffset].mother1();
1417 int mother2 =
event[motherOffset + 1].mother1();
1418 int colLost = (annihil1)
1419 ? event[mother1].col() +
event[mother2].acol() - colLeft
1420 :
event[mother1].acol() +
event[mother2].col() - colLeft;
1421 for (
int i = 0; i < motherOffset; ++i) {
1422 if (event[i].col() == colLost)
event[i].col( colLeft );
1423 if (event[i].acol() == colLost)
event[i].acol( colLeft );
1430 if ( beamAPtr->isGamma() || beamBPtr->isGamma() ) {
1431 if ( !beamAPtr->roomForRemnants(*beamBPtr) ) {
1435 beamAPtr->popBack();
1436 beamBPtr->popBack();
1437 partonSystemsPtr->popBack();
1439 infoPtr->errorMsg(
"Warning in MultipartonInteractions::scatter:"
1440 " No room for remnants for given scattering");
1446 beamA.pTMPI(sqrtpos(pT2));
1447 beamB.pTMPI(sqrtpos(pT2));
1450 int codeMPI = dSigmaDtSel->code();
1451 double pTMPI = dSigmaDtSel->pTMPIFin();
1452 if (iDiffSys == 0) infoPtr->setTypeMPI( codeMPI, pTMPI, i1Sel, i2Sel,
1453 enhanceBnow / zeroIntCorr);
1454 partonSystemsPtr->setPTHat(iSys, pTMPI);
1464 void MultipartonInteractions::upperEnvelope() {
1471 for (
int iPT = 0; iPT < 100; ++iPT) {
1472 double pT = pTmin * pow( pTmax/pTmin, 0.01 * (iPT + 0.5) );
1474 pT2shift = pT2 + pT20;
1476 pT2Fac = (SHIFTFACSCALE) ? pT2shift : pT2;
1480 double xPDF1sumMax = (9./4.) * beamAPtr->xf(21, xT, pT2Fac);
1481 for (
int id = 1;
id <= nQuarkIn; ++id)
1482 xPDF1sumMax += beamAPtr->xf(
id, xT, pT2Fac)
1483 + beamAPtr->xf(-
id, xT, pT2Fac);
1484 double xPDF2sumMax = (9./4.) * beamBPtr->xf(21, xT, pT2Fac);
1485 for (
int id = 1;
id <= nQuarkIn; ++id)
1486 xPDF2sumMax += beamBPtr->xf(
id, xT, pT2Fac)
1487 + beamBPtr->xf(-
id, xT, pT2Fac);
1490 alpS = alphaS.alphaS(pT2Ren);
1491 alpEM = alphaEM.alphaEM(pT2Ren);
1492 double dSigmaPartonApprox = CONVERT2MB * Kfactor * 0.5 * M_PI
1493 * pow2(alpS / pT2shift);
1494 double yMax = log(1./xT + sqrt(1./(xT*xT) - 1.));
1495 double volumePhSp = pow2(2. * yMax);
1498 double dSigmaApproxNow = SIGMAFUDGE * xPDF1sumMax * xPDF2sumMax
1499 * dSigmaPartonApprox * volumePhSp;
1500 double pT4dSigmaNow = pow2(pT2 + pT20R) * dSigmaApproxNow;
1501 if ( pT4dSigmaNow > pT4dSigmaMax) pT4dSigmaMax = pT4dSigmaNow;
1505 pT4dProbMax = pT4dSigmaMax / sigmaND;
1515 void MultipartonInteractions::jetCrossSection() {
1518 double sigmaFactor = (1. / pT20minR - 1. / pT20maxR) / (100. * nSample);
1521 if (bProfile == 4)
for (
int bBin = 0; bBin < XDEP_BBIN; bBin++)
1522 sigmaIntWgt[bBin] = 0.;
1526 double dSigmaMax = 0.;
1529 for (
int iPT = 99; iPT >= 0; --iPT) {
1530 double sigmaSum = 0.;
1533 if (bProfile == 4)
for (
int bBin = 0; bBin < XDEP_BBIN; bBin++)
1534 sigmaSumWgt[bBin] = 0.;
1537 for (
int iSample = 0; iSample < nSample; ++iSample) {
1538 double mappedPT2 = 1. - 0.01 * (iPT + rndmPtr->flat());
1539 pT2 = pT20min0maxR / (pT20minR + mappedPT2 * pT2maxmin) - pT20R;
1542 double dSigma = sigmaPT2scatter(
true);
1545 dSigma *= pow2(pT2 + pT20R);
1547 if (dSigma > dSigmaMax) dSigmaMax = dSigma;
1551 if (bProfile == 4 && dSigma > 0.) {
1552 double w1 = XDEP_A1 + a1 * log(1. / x1);
1553 double w2 = XDEP_A1 + a1 * log(1. / x2);
1554 double fac = XDEP_A0 * XDEP_A0 * (w1 * w1 + w2 * w2);
1555 double b = 0.5 * bstepNow;
1556 for (
int bBin = 0; bBin < XDEP_BBIN; bBin++) {
1557 double wgt = exp( - b * b / fac ) / fac / M_PI;
1558 sigmaSumWgt[bBin] += dSigma * wgt;
1565 sigmaSum *= sigmaFactor;
1566 sigmaInt += sigmaSum;
1567 sudExpPT[iPT] = sudExpPT[iPT + 1] + sigmaSum / sigmaND;
1570 if (bProfile == 4)
for (
int bBin = 0; bBin < XDEP_BBIN; bBin++) {
1571 sigmaSumWgt[bBin] *= sigmaFactor;
1572 sigmaIntWgt[bBin] += sigmaSumWgt[bBin];
1579 if (dSigmaMax > pT4dSigmaMax) {
1580 pT4dSigmaMax = dSigmaMax;
1581 pT4dProbMax = dSigmaMax / sigmaND;
1591 double MultipartonInteractions::sudakov(
double pT2sud,
double enhance) {
1594 double xBin = (pT2sud - pT2min) * pT20maxR
1595 / (pT2maxmin * (pT2sud + pT20R));
1596 xBin = max(1e-6, min(100. - 1e-6, 100. * xBin) );
1597 int iBin = int(xBin);
1600 double sudExp = sudExpPT[iBin] + (xBin - iBin)
1601 * (sudExpPT[iBin + 1] - sudExpPT[iBin]);
1602 return exp( -enhance * sudExp);
1611 double MultipartonInteractions::fastPT2(
double pT2beg) {
1614 double pT20begR = pT2beg + pT20R;
1615 double pT4dProbMaxNow = pT4dProbMax * enhanceBmax;
1616 double pT2try = pT4dProbMaxNow * pT20begR
1617 / (pT4dProbMaxNow - pT20begR * log(rndmPtr->flat())) - pT20R;
1619 if ( pT2try + pT20R <= 0.0 )
return 0.0;
1622 dSigmaApprox = pT4dSigmaMax / pow2(pT2try + pT20R);
1633 double MultipartonInteractions::sigmaPT2scatter(
bool isFirst) {
1636 pT2shift = pT2 + pT20;
1638 pT2Fac = (SHIFTFACSCALE) ? pT2shift : pT2;
1639 alpS = alphaS.alphaS(pT2Ren);
1640 alpEM = alphaEM.alphaEM(pT2Ren);
1643 xT = 2. * sqrt(pT2) / eCM;
1644 if (xT >= 1.)
return 0.;
1646 double yMax = log(1./xT + sqrt(1./xT2 - 1.));
1649 double y3 = yMax * (2. * rndmPtr->flat() - 1.);
1650 double y4 = yMax * (2. * rndmPtr->flat() - 1.);
1651 y = 0.5 * (y3 + y4);
1654 x1 = 0.5 * xT * (exp(y3) + exp(y4));
1655 x2 = 0.5 * xT * (exp(-y3) + exp(-y4));
1656 if (isFirst && iDiffSys == 0) {
1657 if (x1 > 1. || x2 > 1.)
return 0.;
1659 if (x1 > beamAPtr->xMax() || x2 > beamBPtr->xMax())
return 0.;
1665 double xPDF1sum = 0.;
1667 double xPDF2sum = 0.;
1671 for (
int id = -nQuarkIn;
id <= nQuarkIn; ++id) {
1672 if (
id == 0) xPDF1[10] = (9./4.) * beamAPtr->xf(21, x1, pT2Fac);
1673 else xPDF1[
id+10] = beamAPtr->xf(
id, x1, pT2Fac);
1674 xPDF1sum += xPDF1[
id+10];
1676 for (
int id = -nQuarkIn;
id <= nQuarkIn; ++id) {
1677 if (
id == 0) xPDF2[10] = (9./4.) * beamBPtr->xf(21, x2, pT2Fac);
1678 else xPDF2[
id+10] = beamBPtr->xf(
id, x2, pT2Fac);
1679 xPDF2sum += xPDF2[
id+10];
1684 for (
int id = -nQuarkIn;
id <= nQuarkIn; ++id) {
1685 if (
id == 0) xPDF1[10] = (9./4.) * beamAPtr->xfMPI(21, x1, pT2Fac);
1686 else xPDF1[
id+10] = beamAPtr->xfMPI(
id, x1, pT2Fac);
1687 xPDF1sum += xPDF1[
id+10];
1689 for (
int id = -nQuarkIn;
id <= nQuarkIn; ++id) {
1690 if (
id == 0) xPDF2[10] = (9./4.) * beamBPtr->xfMPI(21, x2, pT2Fac);
1691 else xPDF2[
id+10] = beamBPtr->xfMPI(
id, x2, pT2Fac);
1692 xPDF2sum += xPDF2[
id+10];
1697 id1 = -nQuarkIn - 1;
1698 double temp = xPDF1sum * rndmPtr->flat();
1699 do { xPDF1now = xPDF1[(++id1) + 10]; temp -= xPDF1now; }
1700 while (temp > 0. && id1 < nQuarkIn);
1701 if (id1 == 0) id1 = 21;
1703 temp = xPDF2sum * rndmPtr->flat();
1704 do { xPDF2now = xPDF2[(++id2) + 10]; temp -= xPDF2now;}
1705 while (temp > 0. && id2 < nQuarkIn);
1706 if (id2 == 0) id2 = 21;
1709 if ( isFirst && ( beamAPtr->isGamma() || beamBPtr->isGamma() ) ) {
1710 double mTRem = eCM * sqrt( (1 - x1) * (1 - x2) );
1711 double m1 = beamAPtr->remnantMass(id1);
1712 double m2 = beamBPtr->remnantMass(id2);
1713 if (mTRem < m1 + m2)
return 0.;
1719 SigmaMultiparton* sigma2Tmp;
1721 if (id1 == 21 && id2 == 21) {
1722 sigma2Tmp = &sigma2gg;
1724 }
else if (id1 == 21 || id2 == 21) {
1725 sigma2Tmp = &sigma2qg;
1727 }
else if (id1 == -id2) sigma2Tmp = &sigma2qqbarSame;
1728 else sigma2Tmp = &sigma2qq;
1732 double root = sqrtpos(1. - xT2 / tau);
1733 tHat = -0.5 * sHat * (1. - root);
1734 uHat = -0.5 * sHat * (1. + root);
1739 double dSigmaPartonCorr = Kfactor * gluFac
1740 * sigma2Tmp->sigma( id1, id2, x1, x2, sHat, tHat, uHat, alpS, alpEM);
1743 double volumePhSp = pow2(2. * yMax);
1744 double dSigmaScat = dSigmaPartonCorr * xPDF1sum * xPDF2sum * volumePhSp;
1749 double pT2massive = pT2;
1750 dSigmaScat *= pow2( pT2massive / (pT2massive + pT20) );
1753 dSigmaSum += dSigmaScat;
1765 sigma2Sel = sigma2Tmp;
1766 pickOtherSel = sigma2Tmp->pickedOther();
1770 dSigmaDtSel = sigma2Tmp->sigmaSel();
1771 if (sigma2Tmp->swapTU()) swap( tHat, uHat);
1782 void MultipartonInteractions::findScatteredPartons(
Event& event) {
1785 scatteredA.resize(0);
1786 scatteredB.resize(0);
1787 double yTmp, probA, probB;
1790 for (
int i = 0; i <
event.size(); ++i)
1791 if (event[i].isFinal() && (
event[i].idAbs() <= nQuarkIn
1792 ||
event[i].id() == 21)) {
1793 yTmp =
event[i].y();
1796 switch(rescatterMode) {
1800 if ( yTmp > 0.) scatteredA.push_back( i);
1801 if (-yTmp > 0.) scatteredB.push_back( i);
1806 if ( yTmp > ySepResc) scatteredA.push_back( i);
1807 if (-yTmp > ySepResc) scatteredB.push_back( i);
1812 probA = 0.5 * (1. + ( yTmp - ySepResc) / deltaYResc);
1813 if (probA > rndmPtr->flat()) scatteredA.push_back( i);
1814 probB = 0.5 * (1. + (-yTmp - ySepResc) / deltaYResc);
1815 if (probB > rndmPtr->flat()) scatteredB.push_back( i);
1821 probA = 1. / (1. + exp(-2. * ( yTmp - ySepResc) / deltaYResc));
1822 if (probA > rndmPtr->flat()) scatteredA.push_back( i);
1823 probB = 1. / (1. + exp(-2. * (-yTmp - ySepResc) / deltaYResc));
1824 if (probB > rndmPtr->flat()) scatteredB.push_back( i);
1829 scatteredA.push_back( i);
1830 scatteredB.push_back( i);
1845 double MultipartonInteractions::sigmaPT2rescatter(
Event& event) {
1848 xT = 2. * sqrt(pT2) / eCM;
1849 if (xT >= 1.)
return 0.;
1853 SigmaMultiparton* sigma2Tmp;
1854 double dSigmaResc = 0.;
1857 int nScatA = scatteredA.size();
1859 if (PREPICKRESCATTER && nScatA > 0) iScatA = min( nScatA - 1,
1860 int( rndmPtr->flat() * double(nScatA) ) );
1863 for (
int iScat = 0; iScat < nScatA; ++iScat) {
1864 if (PREPICKRESCATTER && iScat != iScatA)
continue;
1865 int iA = scatteredA[iScat];
1866 int id1Tmp =
event[iA].id();
1869 double x1Tmp =
event[iA].pPos() / eCM;
1870 double sHatMax = x1Tmp * beamBPtr->xMax() * sCM;
1871 if (sHatMax < 4. * pT2)
continue;
1874 double dyMax = log( sqrt(0.25 * sHatMax / pT2)
1875 * (1. + sqrtpos(1. - 4. * pT2 / sHatMax)) );
1876 double dy = dyMax * (2. * rndmPtr->flat() - 1.);
1880 double m2Tmp =
event[iA].m2();
1881 double sHatTmp = m2Tmp + 4. * pT2 * pow2(cosh(dy));
1882 double x2Tmp = (sHatTmp - m2Tmp) /(x1Tmp * sCM);
1883 double tauTmp = sHatTmp / sCM;
1884 double root = sqrtpos(1. - xT2 / tauTmp);
1885 double tHatTmp = -0.5 * sHatTmp * (1. - root);
1886 double uHatTmp = -0.5 * sHatTmp * (1. + root);
1890 double xPDF2sum = 0.;
1893 for (
int id = -nQuarkIn;
id <= nQuarkIn; ++id) {
1894 if (
id == 0) xPDF2[10] = (9./4.) * beamBPtr->xfMPI(21, x2Tmp, pT2Fac);
1895 else xPDF2[
id+10] = beamBPtr->xfMPI(
id, x2Tmp, pT2Fac);
1896 xPDF2sum += xPDF2[
id+10];
1900 int id2Tmp = -nQuarkIn - 1;
1901 double temp = xPDF2sum * rndmPtr->flat();
1902 do { xPDF2now = xPDF2[(++id2Tmp) + 10]; temp -= xPDF2now;}
1903 while (temp > 0. && id2Tmp < nQuarkIn);
1904 if (id2Tmp == 0) id2Tmp = 21;
1909 if (id1Tmp == 21 && id2Tmp == 21) sigma2Tmp = &sigma2gg;
1910 else if (id1Tmp == 21 || id2Tmp == 21) sigma2Tmp = &sigma2qg;
1911 else if (id1Tmp == -id2Tmp) sigma2Tmp = &sigma2qqbarSame;
1912 else sigma2Tmp = &sigma2qq;
1913 double gluFac = (id2Tmp == 21) ? 4. / 9. : 1.;
1918 double dSigmaPartonCorr = Kfactor * gluFac
1919 * sigma2Tmp->sigma( id1Tmp, id2Tmp, x1Tmp, x2Tmp, sHatTmp, tHatTmp,
1920 uHatTmp, alpS, alpEM);
1923 double volumePhSp = 4. *dyMax;
1924 double dSigmaCorr = dSigmaPartonCorr * xPDF2sum * volumePhSp;
1929 double pT2massive = pT2;
1930 dSigmaCorr *= pow2( pT2massive / (pT2massive + pT20) );
1933 if (PREPICKRESCATTER) dSigmaCorr *= nScatA;
1936 dSigmaSum += dSigmaCorr;
1937 dSigmaResc += dSigmaCorr;
1940 if (dSigmaCorr > rndmPtr->flat() * dSigmaSum) {
1950 sigma2Sel = sigma2Tmp;
1951 pickOtherSel = sigma2Tmp->pickedOther();
1956 int nScatB = scatteredB.size();
1958 if (PREPICKRESCATTER && nScatB > 0) iScatB = min( nScatB - 1,
1959 int( rndmPtr->flat() * double(nScatB) ) );
1962 for (
int iScat = 0; iScat < nScatB; ++iScat) {
1963 if (PREPICKRESCATTER && iScat != iScatB)
continue;
1964 int iB = scatteredB[iScat];
1965 int id2Tmp =
event[iB].id();
1968 double x2Tmp =
event[iB].pNeg() / eCM;
1969 double sHatMax = beamAPtr->xMax() * x2Tmp * sCM;
1970 if (sHatMax < 4. * pT2)
continue;
1973 double dyMax = log( sqrt(0.25 * sHatMax / pT2)
1974 * (1. + sqrtpos(1. - 4. * pT2 / sHatMax)) );
1975 double dy = dyMax * (2. * rndmPtr->flat() - 1.);
1979 double m2Tmp =
event[iB].m2();
1980 double sHatTmp = m2Tmp + 4. * pT2 * pow2(cosh(dy));
1981 double x1Tmp = (sHatTmp - m2Tmp) /(x2Tmp * sCM);
1982 double tauTmp = sHatTmp / sCM;
1983 double root = sqrtpos(1. - xT2 / tauTmp);
1984 double tHatTmp = -0.5 * sHatTmp * (1. - root);
1985 double uHatTmp = -0.5 * sHatTmp * (1. + root);
1989 double xPDF1sum = 0.;
1992 for (
int id = -nQuarkIn;
id <= nQuarkIn; ++id) {
1993 if (
id == 0) xPDF1[10] = (9./4.) * beamAPtr->xfMPI(21, x1Tmp, pT2Fac);
1994 else xPDF1[
id+10] = beamAPtr->xfMPI(
id, x1Tmp, pT2Fac);
1995 xPDF1sum += xPDF1[
id+10];
1999 int id1Tmp = -nQuarkIn - 1;
2000 double temp = xPDF1sum * rndmPtr->flat();
2001 do { xPDF1now = xPDF1[(++id1Tmp) + 10]; temp -= xPDF1now;}
2002 while (temp > 0. && id1Tmp < nQuarkIn);
2003 if (id1Tmp == 0) id1Tmp = 21;
2008 if (id1Tmp == 21 && id2Tmp == 21) sigma2Tmp = &sigma2gg;
2009 else if (id1Tmp == 21 || id2Tmp == 21) sigma2Tmp = &sigma2qg;
2010 else if (id1Tmp == -id2Tmp) sigma2Tmp = &sigma2qqbarSame;
2011 else sigma2Tmp = &sigma2qq;
2012 double gluFac = (id1Tmp == 21) ? 4. / 9. : 1.;
2017 double dSigmaPartonCorr = Kfactor * gluFac
2018 * sigma2Tmp->sigma( id1Tmp, id2Tmp, x1Tmp, x2Tmp, sHatTmp, tHatTmp,
2019 uHatTmp, alpS, alpEM);
2022 double volumePhSp = 4. *dyMax;
2023 double dSigmaCorr = dSigmaPartonCorr * xPDF1sum * volumePhSp;
2028 double pT2massive = pT2;
2029 dSigmaCorr *= pow2( pT2massive / (pT2massive + pT20) );
2032 if (PREPICKRESCATTER) dSigmaCorr *= nScatB;
2035 dSigmaSum += dSigmaCorr;
2036 dSigmaResc += dSigmaCorr;
2039 if (dSigmaCorr > rndmPtr->flat() * dSigmaSum) {
2049 sigma2Sel = sigma2Tmp;
2050 pickOtherSel = sigma2Tmp->pickedOther();
2056 if (allowDoubleRes) {
2057 for (
int iScat1 = 0; iScat1 < nScatA; ++iScat1) {
2058 if (PREPICKRESCATTER && iScat1 != iScatA)
continue;
2059 int iA = scatteredA[iScat1];
2060 int id1Tmp =
event[iA].id();
2061 for (
int iScat2 = 0; iScat2 < nScatB; ++iScat2) {
2062 if (PREPICKRESCATTER && iScat2 != iScatB)
continue;
2063 int iB = scatteredB[iScat2];
2064 int id2Tmp =
event[iB].id();
2067 double sHatTmp = (
event[iA].p() +
event[iB].p()).m2Calc();
2068 if (sHatTmp < 4. * pT2)
continue;
2071 double x1Tmp =
event[iA].pPos() / eCM;
2072 double x2Tmp =
event[iB].pNeg() / eCM;
2073 double tauTmp = sHatTmp / sCM;
2074 double root = sqrtpos(1. - xT2 / tauTmp);
2075 double tHatTmp = -0.5 * sHatTmp * (1. - root);
2076 double uHatTmp = -0.5 * sHatTmp * (1. + root);
2080 if (id1Tmp == 21 && id2Tmp == 21) sigma2Tmp = &sigma2gg;
2081 else if (id1Tmp == 21 || id2Tmp == 21) sigma2Tmp = &sigma2qg;
2082 else if (id1Tmp == -id2Tmp) sigma2Tmp = &sigma2qqbarSame;
2083 else sigma2Tmp = &sigma2qq;
2088 double dSigmaPartonCorr = Kfactor
2089 * sigma2Tmp->sigma( id1Tmp, id2Tmp, x1Tmp, x2Tmp, sHatTmp, tHatTmp,
2090 uHatTmp, alpS, alpEM);
2094 double dSigmaCorr = dSigmaPartonCorr / max(ROOTMIN, root);
2099 double pT2massive = pT2;
2100 dSigmaCorr *= pow2( pT2massive / (pT2massive + pT20) );
2103 if (PREPICKRESCATTER) dSigmaCorr *= nScatA * nScatB;
2106 dSigmaSum += dSigmaCorr;
2107 dSigmaResc += dSigmaCorr;
2110 if (dSigmaCorr > rndmPtr->flat() * dSigmaSum) {
2120 sigma2Sel = sigma2Tmp;
2121 pickOtherSel = sigma2Tmp->pickedOther();
2138 void MultipartonInteractions::overlapInit() {
2141 nAvg = sigmaInt / sigmaND;
2144 double deltaB = BSTEP;
2145 if (bProfile == 2) deltaB *= min( 0.5, 2.5 * coreRadius);
2146 if (bProfile == 3) deltaB *= max(1., pow(2. / expPow, 1. / expPow));
2154 double overlapNow = 0.;
2155 double probNow = 0.;
2156 double overlapInt = 0.5;
2157 double overlap2Int = 0.;
2158 double probInt = 0.;
2159 double probOverlapInt = 0.;
2160 double bProbInt = 0.;
2161 normPi = 1. / (2. * M_PI);
2164 bool pastBDiv =
false;
2165 double overlapHighB = 0.;
2172 double rescale2 = 1.;
2173 if (bProfile == 4) {
2175 kNow = XDEP_A0 / 2.0;
2181 if (stepDir == 1) kNow *= 2.;
2182 else if (stepDir == -1) kNow *= 0.5;
2183 else kNow = kLow + (nAvg - nLow) * (kHigh - kLow) / (nHigh - nLow);
2186 if (bProfile <= 0 || bProfile > 4) {
2187 probInt = 0.5 * M_PI * (1. - exp(-kNow));
2188 probOverlapInt = probInt / M_PI;
2192 nNow = M_PI * kNow * overlapInt / probInt;
2195 }
else if (bProfile < 4) {
2198 overlapInt = (bProfile == 3) ? 0. : 0.5;
2201 probOverlapInt = 0.;
2207 double b = -0.5 * deltaB;
2211 bArea = 2. * M_PI * b * deltaB;
2214 if (bProfile == 1) {
2215 overlapNow = normPi * exp( -b*b);
2216 }
else if (bProfile == 2) {
2217 overlapNow = normPi * ( fracA * exp( -min(EXPMAX, b*b))
2218 + fracB * exp( -min(EXPMAX, b*b / radius2B)) / radius2B
2219 + fracC * exp( -min(EXPMAX, b*b / radius2C)) / radius2C );
2221 overlapNow = normPi * exp( -pow( b, expPow));
2222 overlapInt += bArea * overlapNow;
2224 if (pastBDiv) overlapHighB += bArea * overlapNow;
2227 probNow = 1. - exp( -min(EXPMAX, M_PI * kNow * overlapNow));
2228 overlap2Int += bArea * pow2(overlapNow);
2229 probInt += bArea * probNow;
2230 probOverlapInt += bArea * overlapNow * probNow;
2231 bProbInt += b * bArea * probNow;
2234 if (!pastBDiv && probNow < PROBATLOWB) {
2235 bDiv = b + 0.5 * deltaB;
2240 }
while (b < 1. || b * probNow > BMAX);
2243 nNow = M_PI * kNow * overlapInt / probInt;
2246 }
else if (bProfile == 4) {
2247 rescale2 = pow2(kNow / XDEP_A0);
2249 double b = 0.5 * bstepNow;
2250 for (
int bBin = 0; bBin < XDEP_BBIN; bBin++) {
2251 double bArea = 2. * M_PI * b * bstepNow;
2252 double pIntNow = 1 - exp( -min(EXPMAX, sigmaIntWgt[bBin] / rescale2) );
2253 probInt += bArea * rescale2 * pIntNow;
2263 if (stepDir == -1) stepDir = 0;
2267 if (stepDir == 1) stepDir = -1;
2271 }
while (abs(nNow - nAvg) > KCONVERGE * nAvg);
2274 if (bProfile >= 0 && bProfile < 4) {
2275 double avgOverlap = probOverlapInt / probInt;
2276 zeroIntCorr = probOverlapInt / overlapInt;
2277 normOverlap = normPi * zeroIntCorr / avgOverlap;
2278 bAvg = bProbInt / probInt;
2279 enhanceBavg = (overlap2Int * probInt) / pow2(overlapInt);
2282 }
else if (bProfile == 4) {
2287 double b = 0.5 * bstepNow;
2288 for (
int bBin = 0; bBin < XDEP_BBIN; bBin++) {
2289 double bArea = 2. * M_PI * b * bstepNow;
2290 double pIntNow = 1. - exp( -min(EXPMAX, sigmaIntWgt[bBin] / rescale2) );
2291 bAvg += sqrt(rescale2) * b * bArea * rescale2 * pIntNow;
2292 zeroIntCorr += bArea * sigmaIntWgt[bBin] * pIntNow;
2296 zeroIntCorr /= sigmaInt;
2300 infoPtr->seta0MPI(a0now * XDEP_SMB2FM);
2301 a02now = a0now * a0now;
2302 double xMin = 2. * pTmin / infoPtr->eCM();
2303 a2max = a0now * (XDEP_A1 + a1 * log(1. / xMin));
2309 if (bProfile > 0 && bProfile <= 3) {
2310 probLowB = M_PI * bDiv*bDiv;
2311 double probHighB = M_PI * kNow * overlapHighB;
2312 if (bProfile == 1) probHighB = M_PI * kNow * 0.5 * exp( -bDiv*bDiv);
2313 else if (bProfile == 2) {
2314 fracAhigh = fracA * exp( -bDiv*bDiv);
2315 fracBhigh = fracB * exp( -bDiv*bDiv / radius2B);
2316 fracChigh = fracC * exp( -bDiv*bDiv / radius2C);
2317 fracABChigh = fracAhigh + fracBhigh + fracChigh;
2318 probHighB = M_PI * kNow * 0.5 * fracABChigh;
2320 cDiv = pow( bDiv, expPow);
2321 cMax = max(2. * expRev, cDiv);
2323 probLowB /= (probLowB + probHighB);
2333 void MultipartonInteractions::overlapFirst() {
2336 if (bProfile <= 0 || bProfile > 4) {
2338 enhanceB = enhanceBmax = enhanceBnow = zeroIntCorr;
2345 double overlapNow = 0.;
2346 if ( userHooksPtr && userHooksPtr->canSetImpactParameter() ) {
2347 bNow = userHooksPtr->doSetImpactParameter() * bAvg;
2348 isAtLowB = ( bNow < bDiv );
2350 if (bProfile == 1) overlapNow = normPi * exp( -min(EXPMAX, bNow*bNow));
2351 else if (bProfile == 2) overlapNow = normPi *
2352 ( fracA * exp( -min(EXPMAX, bNow*bNow))
2353 + fracB * exp( -min(EXPMAX, bNow*bNow / radius2B)) / radius2B
2354 + fracC * exp( -min(EXPMAX, bNow*bNow / radius2C)) / radius2C );
2355 else overlapNow = normPi * exp( -pow( bNow, expPow));
2357 enhanceB = enhanceBmax = enhanceBnow = (normOverlap / normPi) * overlapNow;
2366 double probAccept = 0.;
2370 if (rndmPtr->flat() < probLowB) {
2372 bNow = bDiv * sqrt(rndmPtr->flat());
2375 if (bProfile == 1) overlapNow = normPi * exp( -bNow*bNow);
2376 else if (bProfile == 2) overlapNow = normPi *
2377 ( fracA * exp( -bNow*bNow)
2378 + fracB * exp( -bNow*bNow / radius2B) / radius2B
2379 + fracC * exp( -bNow*bNow / radius2C) / radius2C );
2380 else overlapNow = normPi * exp( -pow( bNow, expPow));
2381 probAccept = 1. - exp( -min(EXPMAX, M_PI * kNow * overlapNow));
2388 if (bProfile == 1) {
2389 bNow = sqrt(bDiv*bDiv - log(rndmPtr->flat()));
2390 overlapNow = normPi * exp( -min(EXPMAX, bNow*bNow));
2391 }
else if (bProfile == 2) {
2392 double pickFrac = rndmPtr->flat() * fracABChigh;
2393 if (pickFrac < fracAhigh)
2394 bNow = sqrt(bDiv*bDiv - log(rndmPtr->flat()));
2395 else if (pickFrac < fracAhigh + fracBhigh)
2396 bNow = sqrt(bDiv*bDiv - radius2B * log(rndmPtr->flat()));
2397 else bNow = sqrt(bDiv*bDiv - radius2C * log(rndmPtr->flat()));
2398 overlapNow = normPi * ( fracA * exp( -min(EXPMAX, bNow*bNow))
2399 + fracB * exp( -min(EXPMAX, bNow*bNow / radius2B)) / radius2B
2400 + fracC * exp( -min(EXPMAX, bNow*bNow / radius2C)) / radius2C );
2406 }
else if (hasLowPow) {
2407 double cNow, acceptC;
2409 cNow = cDiv - 2. * log(rndmPtr->flat());
2410 acceptC = pow(cNow / cMax, expRev) * exp( -0.5 * (cNow - cMax));
2411 }
while (acceptC < rndmPtr->flat());
2412 bNow = pow( cNow, 1. / expPow);
2413 overlapNow = normPi * exp( -cNow);
2418 double cNow, acceptC;
2420 cNow = cDiv - log(rndmPtr->flat());
2421 acceptC = pow(cNow / cDiv, expRev);
2422 }
while (acceptC < rndmPtr->flat());
2423 bNow = pow( cNow, 1. / expPow);
2424 overlapNow = normPi * exp( -cNow);
2426 double temp = M_PI * kNow *overlapNow;
2427 probAccept = (1. - exp( -min(EXPMAX, temp))) / temp;
2431 }
while (probAccept < rndmPtr->flat());
2434 enhanceB = enhanceBmax = enhanceBnow = (normOverlap / normPi) * overlapNow;
2447 void MultipartonInteractions::overlapNext(
Event& event,
double pTscale,
2451 if (rehashB && bSelHard < 3) {
2454 bNow = infoPtr->bMPI();
2455 if (bSelHard == 2) bNow = sqrt(bNow);
2457 double b2 = bNow * bNow;
2460 if (bProfile == 1) {
2461 double expb2 = exp( -min(EXPMAX, b2));
2462 enhanceB = enhanceBmax = enhanceBnow = normOverlap * expb2;
2463 }
else if (bProfile == 2) {
2464 enhanceB = enhanceBmax = enhanceBnow = normOverlap *
2465 ( fracA * exp( -min(EXPMAX, b2))
2466 + fracB * exp( -min(EXPMAX, b2 / radius2B)) / radius2B
2467 + fracC * exp( -min(EXPMAX, b2 / radius2C)) / radius2C );
2469 double cNow = pow( bNow, expPow);
2470 enhanceB = enhanceBmax = enhanceBnow = normOverlap * exp(-cNow);
2480 enhanceB = enhanceBmax = enhanceBnow = zeroIntCorr;
2481 if (bProfile <= 0 || bProfile > 4)
return;
2484 if (bSelScale == 1) {
2486 for (
int i = 5; i <
event.size(); ++i)
if (event[i].isFinal()) {
2487 mmT.push_back( event[i].m() + event[i].mT() );
2488 for (
int j =
int(mmT.size()) - 1; j > 0; --j)
2489 if (mmT[j] > mmT[j - 1]) swap( mmT[j], mmT[j - 1] );
2491 pTscale = 0.5 * mmT[0];
2492 for (
int j = 1; j < int(mmT.size()); ++j) pTscale += mmT[j] / (j + 1.);
2493 }
else if (bSelScale == 2) pTscale =
event.scale();
2494 double pT2scale = pTscale*pTscale;
2497 if (bProfile == 4) {
2498 double pTtrial = 0.;
2501 double expb2 = rndmPtr->flat();
2502 double w1 = XDEP_A1 + a1 * log(1. / infoPtr->x1());
2503 double w2 = XDEP_A1 + a1 * log(1. / infoPtr->x2());
2504 double fac = a02now * (w1 * w1 + w2 * w2);
2505 b2now = - fac * log(expb2);
2511 enhanceB = sigmaND / M_PI / fac * expb2;
2512 enhanceBmax = sigmaND / 2. / M_PI / a02now
2513 * exp( -b2now / 2. / a2max );
2516 pTtrial = pTnext(pTmax, pTmin, event);
2517 }
while (pTtrial > pTscale);
2527 if (bProfile == 1) {
2528 double expb2 = rndmPtr->flat();
2530 enhanceB = enhanceBmax = enhanceBnow = normOverlap * expb2;
2531 bNow = sqrt( -log(expb2));
2534 }
else if (bProfile == 2) {
2535 double bType = rndmPtr->flat();
2536 double b2 = -log( rndmPtr->flat() );
2537 if (bType < fracA) ;
2538 else if (bType < fracA + fracB) b2 *= radius2B;
2539 else b2 *= radius2C;
2541 enhanceB = enhanceBmax = enhanceBnow = normOverlap *
2542 ( fracA * exp( -min(EXPMAX, b2))
2543 + fracB * exp( -min(EXPMAX, b2 / radius2B)) / radius2B
2544 + fracC * exp( -min(EXPMAX, b2 / radius2C)) / radius2C );
2551 }
else if (bProfile == 3 && hasLowPow) {
2552 double cNow, acceptC;
2553 double probLowC = expRev / (expRev + pow(2., expRev) * exp( - expRev));
2555 if (rndmPtr->flat() < probLowC) {
2556 cNow = 2. * expRev * rndmPtr->flat();
2557 acceptC = pow( cNow / expRev, expRev) * exp(expRev - cNow);
2559 cNow = 2. * (expRev - log( rndmPtr->flat() ));
2560 acceptC = pow(0.5 * cNow / expRev, expRev)
2561 * exp(expRev - 0.5 * cNow);
2563 }
while (acceptC < rndmPtr->flat());
2565 enhanceB = enhanceBmax = enhanceBnow = normOverlap *exp(-cNow);
2566 bNow = pow( cNow, 1. / expPow);
2570 }
else if (bProfile == 3 && !hasLowPow) {
2571 double cNow, acceptC;
2572 double probLowC = expPow / (2. * exp(-1.) + expPow);
2574 if (rndmPtr->flat() < probLowC) {
2575 cNow = pow( rndmPtr->flat(), 0.5 * expPow);
2576 acceptC = exp(-cNow);
2578 cNow = 1. - log( rndmPtr->flat() );
2579 acceptC = pow( cNow, expRev);
2581 }
while (acceptC < rndmPtr->flat());
2583 enhanceB = enhanceBmax = enhanceBnow = normOverlap * exp(-cNow);
2584 bNow = pow( cNow, 1. / expPow);
2588 }
while (sudakov(pT2scale, enhanceB) < rndmPtr->flat());
2599 void MultipartonInteractions::statistics(
bool resetStat) {
2602 cout <<
"\n *------- PYTHIA Multiparton Interactions Statistics -----"
2606 <<
" | Note: excludes hardest subprocess if already listed above "
2610 <<
" | Subprocess Code | Times"
2614 <<
" |------------------------------------------------------------"
2621 for ( map<int, int>::iterator iter = nGen.begin(); iter != nGen.end();
2623 int code = iter -> first;
2624 int number = iter->second;
2625 numberSum += number;
2629 bool foundName =
false;
2630 SigmaMultiparton* dSigma;
2631 for (
int i = 0; i < 4; ++i) {
2632 if (i == 0) dSigma = &sigma2gg;
2633 else if (i == 1) dSigma = &sigma2qg;
2634 else if (i == 2) dSigma = &sigma2qqbarSame;
2635 else dSigma = &sigma2qq;
2636 int nProc = dSigma->nProc();
2637 for (
int iProc = 0; iProc < nProc; ++iProc)
2638 if (dSigma->codeProc(iProc) == code) {
2639 name = dSigma->nameProc(iProc);
2642 if (foundName)
break;
2646 cout <<
" | " << left << setw(40) << name << right << setw(5) << code
2647 <<
" | " << setw(11) << number <<
" |\n";
2653 <<
" | " << left << setw(45) <<
"sum" << right <<
" | " << setw(11)
2654 << numberSum <<
" |\n";
2659 <<
" *------- End PYTHIA Multiparton Interactions Statistics ----"
2663 if (resetStat) resetStatistics();