8 #include "Pythia8/TimeShower.h"
22 const double TimeShower::MCMIN = 1.2;
23 const double TimeShower::MBMIN = 4.0;
26 const double TimeShower::SIMPLIFYROOT = 1e-8;
31 const double TimeShower::XMARGIN = 1e-12;
32 const double TimeShower::XMARGINCOMB = 1e-4;
35 const double TimeShower::TINYPDF = 1e-10;
38 const double TimeShower::LARGEM2 = 1e20;
41 const double TimeShower::THRESHM2 = 4.004;
44 const double TimeShower::LAMBDA3MARGIN = 1.1;
49 const bool TimeShower::FIXRESCATTER =
true;
51 const bool TimeShower::VETONEGENERGY =
false;
53 const double TimeShower::MAXVIRTUALITYFRACTION = 0.5;
55 const double TimeShower::MAXNEGENERGYFRACTION = 0.7;
58 const double TimeShower::WEAKPSWEIGHT = 5.;
61 const double TimeShower::WG2QEXTRA = 20.;
67 void TimeShower::init( BeamParticle* beamAPtrIn,
68 BeamParticle* beamBPtrIn) {
71 beamAPtr = beamAPtrIn;
72 beamBPtr = beamBPtrIn;
75 doQCDshower = settingsPtr->flag(
"TimeShower:QCDshower");
76 doQEDshowerByQ = settingsPtr->flag(
"TimeShower:QEDshowerByQ");
77 doQEDshowerByL = settingsPtr->flag(
"TimeShower:QEDshowerByL");
78 doQEDshowerByGamma = settingsPtr->flag(
"TimeShower:QEDshowerByGamma");
79 doWeakShower = settingsPtr->flag(
"TimeShower:weakShower");
80 doMEcorrections = settingsPtr->flag(
"TimeShower:MEcorrections");
81 doMEafterFirst = settingsPtr->flag(
"TimeShower:MEafterFirst");
82 doPhiPolAsym = settingsPtr->flag(
"TimeShower:phiPolAsym");
83 doInterleave = settingsPtr->flag(
"TimeShower:interleave");
84 allowBeamRecoil = settingsPtr->flag(
"TimeShower:allowBeamRecoil");
85 dampenBeamRecoil = settingsPtr->flag(
"TimeShower:dampenBeamRecoil");
86 recoilToColoured = settingsPtr->flag(
"TimeShower:recoilToColoured");
89 pTmaxMatch = settingsPtr->mode(
"TimeShower:pTmaxMatch");
90 pTdampMatch = settingsPtr->mode(
"TimeShower:pTdampMatch");
91 pTmaxFudge = settingsPtr->parm(
"TimeShower:pTmaxFudge");
92 pTmaxFudgeMPI = settingsPtr->parm(
"TimeShower:pTmaxFudgeMPI");
93 pTdampFudge = settingsPtr->parm(
"TimeShower:pTdampFudge");
96 mc = max( MCMIN, particleDataPtr->m0(4));
97 mb = max( MBMIN, particleDataPtr->m0(5));
102 renormMultFac = settingsPtr->parm(
"TimeShower:renormMultFac");
103 factorMultFac = settingsPtr->parm(
"TimeShower:factorMultFac");
104 useFixedFacScale = settingsPtr->flag(
"TimeShower:useFixedFacScale");
105 fixedFacScale2 = pow2(settingsPtr->parm(
"TimeShower:fixedFacScale"));
108 alphaSvalue = settingsPtr->parm(
"TimeShower:alphaSvalue");
109 alphaSorder = settingsPtr->mode(
"TimeShower:alphaSorder");
110 alphaSnfmax = settingsPtr->mode(
"StandardModel:alphaSnfmax");
111 alphaSuseCMW = settingsPtr->flag(
"TimeShower:alphaSuseCMW");
112 alphaS2pi = 0.5 * alphaSvalue / M_PI;
115 alphaS.init( alphaSvalue, alphaSorder, alphaSnfmax, alphaSuseCMW);
118 Lambda3flav = alphaS.Lambda3();
119 Lambda4flav = alphaS.Lambda4();
120 Lambda5flav = alphaS.Lambda5();
121 Lambda5flav2 = pow2(Lambda5flav);
122 Lambda4flav2 = pow2(Lambda4flav);
123 Lambda3flav2 = pow2(Lambda3flav);
126 nGluonToQuark = settingsPtr->mode(
"TimeShower:nGluonToQuark");
127 weightGluonToQuark = settingsPtr->mode(
"TimeShower:weightGluonToQuark");
128 scaleGluonToQuark = settingsPtr->parm(
"TimeShower:scaleGluonToQuark");
129 extraGluonToQuark = (weightGluonToQuark%4 == 3) ? WG2QEXTRA : 1.;
130 pTcolCutMin = settingsPtr->parm(
"TimeShower:pTmin");
131 if (pTcolCutMin > LAMBDA3MARGIN * Lambda3flav / sqrt(renormMultFac))
132 pTcolCut = pTcolCutMin;
134 pTcolCut = LAMBDA3MARGIN * Lambda3flav / sqrt(renormMultFac);
135 ostringstream newPTcolCut;
136 newPTcolCut << fixed << setprecision(3) << pTcolCut;
137 infoPtr->errorMsg(
"Warning in TimeShower::init: pTmin too low",
138 ", raised to " + newPTcolCut.str() );
139 infoPtr->setTooLowPTmin(
true);
141 pT2colCut = pow2(pTcolCut);
144 alphaEMorder = settingsPtr->mode(
"TimeShower:alphaEMorder");
147 alphaEM.init( alphaEMorder, settingsPtr);
150 nGammaToQuark = settingsPtr->mode(
"TimeShower:nGammaToQuark");
151 nGammaToLepton = settingsPtr->mode(
"TimeShower:nGammaToLepton");
152 pTchgQCut = settingsPtr->parm(
"TimeShower:pTminChgQ");
153 pT2chgQCut = pow2(pTchgQCut);
154 pTchgLCut = settingsPtr->parm(
"TimeShower:pTminChgL");
155 pT2chgLCut = pow2(pTchgLCut);
156 mMaxGamma = settingsPtr->parm(
"TimeShower:mMaxGamma");
157 m2MaxGamma = pow2(mMaxGamma);
160 weakMode = settingsPtr->mode(
"TimeShower:weakShowerMode");
161 pTweakCut = settingsPtr->parm(
"TimeShower:pTminWeak");
162 pT2weakCut = pow2(pTweakCut);
163 weakEnhancement = settingsPtr->parm(
"WeakShower:enhancement");
164 singleWeakEmission = settingsPtr->flag(
"WeakShower:singleEmission");
165 vetoWeakJets = settingsPtr->flag(
"WeakShower:vetoWeakJets");
166 vetoWeakDeltaR2 = pow2(settingsPtr->parm(
"WeakShower:vetoWeakDeltaR"));
169 if (nGammaToQuark <= 0 && nGammaToLepton <= 0) doQEDshowerByGamma =
false;
172 globalRecoil = settingsPtr->flag(
"TimeShower:globalRecoil");
173 nMaxGlobalRecoil = settingsPtr->mode(
"TimeShower:nMaxGlobalRecoil");
175 nMaxGlobalBranch = settingsPtr->mode(
"TimeShower:nMaxGlobalBranch");
177 nFinalBorn = settingsPtr->mode(
"TimeShower:nPartonsInBorn");
179 globalRecoilMode = settingsPtr->mode(
"TimeShower:globalRecoilMode");
181 limitMUQ = settingsPtr->flag(
"TimeShower:limitPTmaxGlobal");
184 octetOniumFraction = settingsPtr->parm(
"TimeShower:octetOniumFraction");
185 octetOniumColFac = settingsPtr->parm(
"TimeShower:octetOniumColFac");
188 mZ = particleDataPtr->m0(23);
189 gammaZ = particleDataPtr->mWidth(23);
190 thetaWRat = 1. / (16. * coupSMPtr->sin2thetaW()
191 * coupSMPtr->cos2thetaW());
192 mW = particleDataPtr->m0(24);
193 gammaW = particleDataPtr->mWidth(24);
196 allowRescatter = settingsPtr->flag(
"PartonLevel:MPI")
197 && settingsPtr->flag(
"MultipartonInteractions:allowRescatter");
200 doHVshower = settingsPtr->flag(
"HiddenValley:FSR");
201 nCHV = settingsPtr->mode(
"HiddenValley:Ngauge");
202 alphaHVfix = settingsPtr->parm(
"HiddenValley:alphaFSR");
203 pThvCut = settingsPtr->parm(
"HiddenValley:pTminFSR");
204 pT2hvCut = pThvCut * pThvCut;
205 CFHV = (nCHV == 1) ? 1. : (nCHV * nCHV - 1.)/(2. * nCHV);
206 idHV = (nCHV == 1) ? 4900022 : 4900021;
207 mHV = particleDataPtr->m0(idHV);
208 brokenHVsym = (nCHV == 1 && mHV > 0.);
211 doSecondHard = settingsPtr->flag(
"SecondHard:generate");
214 canVetoEmission = (userHooksPtr != 0)
215 ? userHooksPtr->canVetoFSREmission() :
false;
222 hasWeaklyRadiated =
false;
231 bool TimeShower::limitPTmax(
Event& event,
double Q2Fac,
double Q2Ren) {
234 bool dopTlimit =
false;
235 dopTlimit1 = dopTlimit2 =
false;
236 if (pTmaxMatch == 1) dopTlimit = dopTlimit1 = dopTlimit2 =
true;
237 else if (pTmaxMatch == 2) dopTlimit = dopTlimit1 = dopTlimit2 =
false;
240 else if (infoPtr->isNonDiffractive() || infoPtr->isDiffractiveA()
241 || infoPtr->isDiffractiveB() || infoPtr->isDiffractiveC() )
242 dopTlimit = dopTlimit1 = dopTlimit2 =
true;
247 for (
int i = 5; i <
event.size(); ++i) {
248 if (event[i].status() == -21) ++n21;
250 int idAbs =
event[i].idAbs();
251 if (idAbs <= 5 || idAbs == 21 || idAbs == 22) dopTlimit1 =
true;
252 }
else if (n21 == 2) {
253 int idAbs =
event[i].idAbs();
254 if (idAbs <= 5 || idAbs == 21 || idAbs == 22) dopTlimit2 =
true;
257 dopTlimit = (doSecondHard) ? (dopTlimit1 && dopTlimit2) : dopTlimit1;
263 if ( !dopTlimit1 && (pTdampMatch == 1 || pTdampMatch == 2) ) {
265 pT2damp = pow2(pTdampFudge) * ((pTdampMatch == 1) ? Q2Fac : Q2Ren);
277 int TimeShower::shower(
int iBeg,
int iEnd,
Event& event,
double pTmax,
281 int iSys = partonSystemsPtr->addSys();
285 for (
int i = iBeg; i <= iEnd; ++i)
if (event[i].isFinal()) {
286 partonSystemsPtr->addOut( iSys, i);
287 pSum +=
event[i].p();
289 partonSystemsPtr->setSHat( iSys, pSum.m2Calc() );
295 hasWeaklyRadiated =
false;
296 prepare( iSys, event,
true);
302 double pTtimes = pTnext( event, pTmax, 0.);
306 if (branch( event)) {
308 pTLastBranch = pTtimes;
315 }
while (pTmax > 0. && (nBranchMax <= 0 || nBranch < nBranchMax));
327 int TimeShower::showerQED(
int i1,
int i2,
Event& event,
double pTmax) {
330 int iSys = partonSystemsPtr->addSys();
331 partonSystemsPtr->addOut( iSys, i1);
332 partonSystemsPtr->addOut( iSys, i2);
333 partonSystemsPtr->setSHat( iSys, m2(event[i1], event[i2]) );
336 int iChg1 =
event[i1].chargeType();
337 int iChg2 =
event[i2].chargeType();
338 int MEtype = (iChg1 + iChg2 == 0) ? 102 : 101;
342 if (iChg1 != 0) dipEnd.push_back( TimeDipoleEnd(i1, i2, pTmax,
343 0, iChg1, 0, 0, 0, iSys, MEtype, i2) );
344 if (iChg2 != 0) dipEnd.push_back( TimeDipoleEnd(i2, i1, pTmax,
345 0, iChg2, 0, 0, 0, iSys, MEtype, i1) );
356 for (
int iDip = 0; iDip < int(dipEnd.size()); ++iDip) {
357 TimeDipoleEnd& dip = dipEnd[iDip];
360 dip.mRad =
event[dip.iRadiator].m();
361 dip.mRec =
event[dip.iRecoiler].m();
362 dip.mDip = m( event[dip.iRadiator], event[dip.iRecoiler] );
363 dip.m2Rad = pow2(dip.mRad);
364 dip.m2Rec = pow2(dip.mRec);
365 dip.m2Dip = pow2(dip.mDip);
368 dip.m2DipCorr = pow2(dip.mDip - dip.mRec) - dip.m2Rad;
369 double pTbegDip = min( pTmax, dip.pTmax );
370 double pT2begDip = min( pow2(pTbegDip), 0.25 * dip.m2DipCorr);
374 if (pT2begDip > pT2sel) {
375 pT2nextQED( pT2begDip, pT2sel, dip, event);
378 if (dip.pT2 > pT2sel) {
385 double pTsel = (dipSel == 0) ? 0. : sqrt(pT2sel);
391 int iRadBef = dipSel->iRadiator;
392 int iRecBef = dipSel->iRecoiler;
393 Particle& radBef =
event[iRadBef];
394 Particle& recBef =
event[iRecBef];
395 Vec4 pRadBef =
event[iRadBef].p();
396 Vec4 pRecBef =
event[iRecBef].p();
399 double pTorig = sqrt( dipSel->pT2);
400 double eRadPlusEmt = 0.5 * (dipSel->m2Dip + dipSel->m2 - dipSel->m2Rec)
402 double e2RadPlusEmt = pow2(eRadPlusEmt);
403 double pzRadPlusEmt = 0.5 * sqrtpos( pow2(dipSel->m2Dip - dipSel->m2
404 - dipSel->m2Rec) - 4. * dipSel->m2 * dipSel->m2Rec ) / dipSel->mDip;
405 double pT2corr = dipSel->m2 * (e2RadPlusEmt * dipSel->z
406 * (1. - dipSel->z) - 0.25 * dipSel->m2) / pow2(pzRadPlusEmt);
407 double pTcorr = sqrtpos( pT2corr );
408 double pzRad = (e2RadPlusEmt * dipSel->z - 0.5 * dipSel->m2)
410 double pzEmt = (e2RadPlusEmt * (1. - dipSel->z)
411 - 0.5 * dipSel->m2) / pzRadPlusEmt;
412 double mRad = dipSel->mRad;
416 double m2Ratio = dipSel->m2Rad / dipSel->m2;
417 pTorig *= 1. - m2Ratio;
418 pTcorr *= 1. - m2Ratio;
419 pzRad += pzEmt * m2Ratio;
420 pzEmt *= 1. - m2Ratio;
423 double phi = 2. * M_PI * rndmPtr->flat();
424 Vec4 pRad = Vec4( pTcorr * cos(phi), pTcorr * sin(phi), pzRad,
425 sqrt( pow2(pTcorr) + pow2(pzRad) + pow2(mRad) ) );
426 Vec4 pEmt = Vec4( -pRad.px(), -pRad.py(), pzEmt,
427 sqrt( pow2(pTcorr) + pow2(pzEmt) + pow2(mEmt) ) );
428 Vec4 pRec = Vec4( 0., 0., -pzRadPlusEmt,
429 sqrt( pow2(pzRadPlusEmt) + dipSel->m2Rec ) );
433 M.fromCMframe(pRadBef, pRecBef);
439 Particle rad = Particle(radBef.id(), 51, iRadBef, 0, 0, 0,
440 radBef.col(), radBef.acol(), pRad, mRad, pTsel);
441 Particle emt = Particle(22, 51, iRadBef, 0, 0, 0,
442 0, 0, pEmt, mEmt, pTsel);
443 Particle rec = Particle(recBef.id(), 52, iRecBef, iRecBef, 0, 0,
444 recBef.col(), recBef.acol(), pRec, dipSel->mRec, pTsel);
447 if (dipSel->MEtype == 0
448 || findMEcorr( dipSel, rad, rec, emt,
false) > rndmPtr->flat() ) {
451 if (radBef.hasVertex()) {
452 rad.vProd( radBef.vProd() );
453 emt.vProd( radBef.vProd() );
455 if (recBef.hasVertex()) rec.vProd( recBef.vProd() );
456 rad.tau( event[iRadBef].tau() );
457 rec.tau( event[iRecBef].tau() );
460 int iRad =
event.append(rad);
461 int iEmt =
event.append(emt);
462 event[iRadBef].statusNeg();
463 event[iRadBef].daughters( iRad, iEmt);
464 int iRec =
event.append(rec);
465 event[iRecBef].statusNeg();
466 event[iRecBef].daughters( iRec, iRec);
469 dipSel->iRadiator = iRad;
470 dipSel->iRecoiler = iRec;
471 dipSel->pTmax = pTsel;
474 for (
int i = 0; i < int(dipEnd.size()); ++i)
if (i != iDipSel) {
475 if (dipEnd[i].iRadiator == iRadBef) dipEnd[i].iRadiator = iRad;
476 if (dipEnd[i].iRecoiler == iRadBef) dipEnd[i].iRecoiler = iRad;
477 if (dipEnd[i].iMEpartner == iRadBef) dipEnd[i].iMEpartner = iRad;
478 if (dipEnd[i].iRadiator == iRecBef) dipEnd[i].iRadiator = iRec;
479 if (dipEnd[i].iRecoiler == iRecBef) dipEnd[i].iRecoiler = iRec;
480 if (dipEnd[i].iMEpartner == iRecBef) dipEnd[i].iMEpartner = iRec;
485 pTLastBranch = pTsel;
492 }
while (pTmax > 0.);
503 void TimeShower::prepareGlobal(
Event& event) {
509 hardPartons.resize(0);
514 for (
int i = 0; i <
event.size(); ++i)
515 if (event[i].isFinal() &&
event[i].colType() != 0)
516 hardPartons.push_back(i);
517 nHard = hardPartons.size();
518 if (nFinalBorn > 0 && nHard > nFinalBorn) {
519 hardPartons.resize(0);
530 void TimeShower::prepare(
int iSys,
Event& event,
bool limitPTmaxIn) {
536 if (iSys == 0) hasWeaklyRadiated =
false;
539 int iInA = partonSystemsPtr->getInA(iSys);
540 int iInB = partonSystemsPtr->getInB(iSys);
541 if (iSys == 0 || iInA == 0) dipEnd.resize(0);
542 int dipEndSizeBeg = dipEnd.size();
545 if (partonSystemsPtr->sizeOut(iSys) < 2)
return;
548 if (doSecondHard && iSys == 0) limitPTmaxIn = dopTlimit1;
549 if (doSecondHard && iSys == 1) limitPTmaxIn = dopTlimit2;
552 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSys); ++i) {
553 int iRad = partonSystemsPtr->getOut( iSys, i);
554 if (event[iRad].isFinal() && event[iRad].scale() > 0.) {
557 int idRad =
event[iRad].id();
558 int idRadAbs = abs(idRad);
559 bool isOctetOnium = particleDataPtr->isOctetHadron(idRad);
560 bool doQCD = doQCDshower;
561 if (doQCD && isOctetOnium)
562 doQCD = (rndmPtr->flat() < octetOniumFraction);
565 int colTag =
event[iRad].col();
566 if (doQCD && colTag > 0) setupQCDdip( iSys, i, colTag, 1, event,
567 isOctetOnium, limitPTmaxIn);
570 int acolTag =
event[iRad].acol();
571 if (doQCD && acolTag > 0) setupQCDdip( iSys, i, acolTag, -1, event,
572 isOctetOnium, limitPTmaxIn);
575 int chgType =
event[iRad].chargeType();
576 bool doChgDip = (chgType != 0)
577 && ( ( doQEDshowerByQ && event[iRad].isQuark() )
578 || ( doQEDshowerByL &&
event[iRad].isLepton() ) );
579 int gamType = (idRad == 22) ? 1 : 0;
580 bool doGamDip = (gamType == 1) && doQEDshowerByGamma;
581 if (doChgDip || doGamDip) setupQEDdip( iSys, i, chgType, gamType,
582 event, limitPTmaxIn);
585 if (doWeakShower && (iSys == 0 || !partonSystemsPtr->hasInAB(iSys))
586 && (event[iRad].isQuark() ||
event[iRad].isLepton())) {
587 if (weakMode == 0 || weakMode == 1)
588 setupWeakdip( iSys, i, 1, event, limitPTmaxIn);
589 if (weakMode == 0 || weakMode == 2)
590 setupWeakdip( iSys, i, 2, event, limitPTmaxIn);
594 bool isHVrad = (idRadAbs > 4900000 && idRadAbs < 4900007)
595 || (idRadAbs > 4900010 && idRadAbs < 4900017)
596 || idRadAbs == 4900101;
597 if (doHVshower && isHVrad) setupHVdip( iSys, i, event, limitPTmaxIn);
604 for (
int iDip = dipEndSizeBeg; iDip < int(dipEnd.size()); ++iDip)
605 findMEtype( event, dipEnd[iDip]);
608 if (iSys > 0 && ( (iInA > 0 && event[iInA].status() == -34)
609 || (iInB > 0 &&
event[iInB].status() == -34) ) )
610 rescatterUpdate( iSys, event);
618 void TimeShower::rescatterUpdate(
int iSys,
Event& event) {
622 for (
int iResc = 0; iResc < 2; ++iResc) {
623 int iIn = (iResc == 0) ? partonSystemsPtr->getInA(iSys)
624 : partonSystemsPtr->getInB(iSys);
625 if (iIn == 0 || event[iIn].status() != -34)
continue;
626 int iOut =
event[iIn].mother1();
629 int dipEndSize = dipEnd.size();
630 for (
int iDip = 0; iDip < dipEndSize; ++iDip) {
631 TimeDipoleEnd& dipNow = dipEnd[iDip];
634 if (dipNow.iRadiator == iOut) {
641 if (dipNow.iMEpartner == iOut) {
643 dipNow.iMEpartner = -1;
647 if (dipNow.iRecoiler == iOut) {
648 int iRad = dipNow.iRadiator;
651 if (dipNow.colType > 0) {
652 int colTag =
event[iRad].col();
654 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSys); ++i) {
655 int iRecNow = partonSystemsPtr->getOut( iSys, i);
656 if (event[iRecNow].acol() == colTag) {
657 dipNow.iRecoiler = iRecNow;
658 dipNow.systemRec = iSys;
665 int iIn2 = (iResc == 0) ? partonSystemsPtr->getInB(iSys)
666 : partonSystemsPtr->getInA(iSys);
667 if (event[iIn2].col() == colTag) {
668 dipNow.iRecoiler = iIn2;
669 dipNow.systemRec = iSys;
671 int isrType =
event[iIn2].mother1();
673 while (isrType > 2 + beamOffset)
674 isrType =
event[isrType].mother1();
675 if (isrType > 2) isrType -= beamOffset;
676 dipNow.isrType = isrType;
682 int iRadNow = partonSystemsPtr->getIndexOfOut(dipNow.system, iRad);
684 setupQCDdip(dipNow.system, iRadNow, event[iRad].col(), 1,
685 event, dipNow.isOctetOnium,
true);
687 infoPtr->errorMsg(
"Warning in TimeShower::rescatterUpdate: "
688 "failed to locate radiator in system");
694 infoPtr->errorMsg(
"Warning in TimeShower::rescatterUpdate: "
695 "failed to locate new recoiling colour partner");
699 }
else if (dipNow.colType < 0) {
700 int acolTag =
event[iRad].acol();
702 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSys); ++i) {
703 int iRecNow = partonSystemsPtr->getOut( iSys, i);
704 if (event[iRecNow].col() == acolTag) {
705 dipNow.iRecoiler = iRecNow;
706 dipNow.systemRec = iSys;
713 int iIn2 = (iResc == 0) ? partonSystemsPtr->getInB(iSys)
714 : partonSystemsPtr->getInA(iSys);
715 if (event[iIn2].acol() == acolTag) {
716 dipNow.iRecoiler = iIn2;
717 dipNow.systemRec = iSys;
719 int isrType =
event[iIn2].mother1();
721 while (isrType > 2 + beamOffset)
722 isrType =
event[isrType].mother1();
723 if (isrType > 2) isrType -= beamOffset;
724 dipNow.isrType = isrType;
730 int iRadNow = partonSystemsPtr->getIndexOfOut(dipNow.system, iRad);
732 setupQCDdip(dipNow.system, iRadNow, event[iRad].acol(), -1,
733 event, dipNow.isOctetOnium,
true);
735 infoPtr->errorMsg(
"Warning in TimeShower::rescatterUpdate: "
736 "failed to locate radiator in system");
742 infoPtr->errorMsg(
"Warning in TimeShower::rescatterUpdate: "
743 "failed to locate new recoiling colour partner");
747 }
else if (dipNow.chgType != 0 || dipNow.gamType != 0) {
748 int idTag =
event[dipNow.iRecoiler].id();
750 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSys); ++i) {
751 int iRecNow = partonSystemsPtr->getOut( iSys, i);
752 if (event[iRecNow].
id() == idTag) {
753 dipNow.iRecoiler = iRecNow;
754 dipNow.systemRec = iSys;
761 int iIn2 = (iResc == 0) ? partonSystemsPtr->getInB(iSys)
762 : partonSystemsPtr->getInA(iSys);
763 if (event[iIn2].
id() == -idTag) {
764 dipNow.iRecoiler = iIn2;
765 dipNow.systemRec = iSys;
767 int isrType =
event[iIn2].mother1();
769 while (isrType > 2 + beamOffset)
770 isrType =
event[isrType].mother1();
771 if (isrType > 2) isrType -= beamOffset;
772 dipNow.isrType = isrType;
778 int iRadNow = partonSystemsPtr->getIndexOfOut(dipNow.system, iRad);
780 setupQEDdip(dipNow.system, iRadNow, dipNow.chgType,
781 dipNow.gamType, event,
true);
783 infoPtr->errorMsg(
"Warning in TimeShower::rescatterUpdate: "
784 "failed to locate radiator in system");
790 infoPtr->errorMsg(
"Warning in TimeShower::rescatterUpdate: "
791 "failed to locate new recoiling charge partner");
806 void TimeShower::update(
int iSys,
Event& event,
bool hasWeakRad) {
809 vector<int> iRescatterer;
812 vector<int> iNew, iOld;
813 iNew.push_back( partonSystemsPtr->getInA(iSys) );
814 iOld.push_back( event[iNew[0]].daughter2() );
815 iNew.push_back( partonSystemsPtr->getInB(iSys) );
816 iOld.push_back( event[iNew[1]].daughter2() );
819 int sizeOut = partonSystemsPtr->sizeOut(iSys) - 1;
820 for (
int i = 0; i < sizeOut; ++i) {
821 int iNow = partonSystemsPtr->getOut(iSys, i);
822 iNew.push_back( iNow );
823 iOld.push_back( event[iNow].mother1() );
825 if (!event[iNow].isFinal()) iRescatterer.push_back( iNow );
827 int iNewNew = partonSystemsPtr->getOut(iSys, sizeOut);
830 if (event[iNew[0]].status() != -41) {
831 swap( iNew[0], iNew[1]);
832 swap( iOld[0], iOld[1]);
837 for (
int iDip = 0; iDip < int(dipEnd.size()); ++iDip)
838 if (dipEnd[iDip].system == iSys || dipEnd[iDip].systemRec == iSys) {
839 TimeDipoleEnd& dipNow = dipEnd[iDip];
842 for (
int i = 2; i < 2 + sizeOut; ++i)
843 if (dipNow.iRadiator == iOld[i]) {
844 dipNow.iRadiator = iNew[i];
849 for (
int i = 2; i < 2 + sizeOut; ++i)
850 if (dipNow.iMEpartner == iOld[i]) {
851 dipNow.iMEpartner = iNew[i];
857 if (dipNow.systemRec == iSys) {
858 for (
int i = 1; i < 2 + sizeOut; ++i)
859 if (dipNow.iRecoiler == iOld[i]) {
865 if ( dipNow.colType > 0
866 && event[dipNow.iRadiator].col() ==
event[iNewNew].acol() ) {
870 if ( dipNow.colType < 0
871 && event[dipNow.iRadiator].acol() ==
event[iNewNew].col() ) {
877 if ( iRec == 0 && dipNow.colType > 0
878 && event[dipNow.iRadiator].col() ==
event[iNew[0]].col() )
880 if ( iRec == 0 && dipNow.colType < 0
881 && event[dipNow.iRadiator].acol() ==
event[iNew[0]].acol() )
885 if ( iRec == 0 && (dipNow.chgType != 0 || dipNow.gamType != 0) ) {
886 if ( event[iNew[0]].chargeType() == 0 ) {
895 }
else iRec = dipNow.iRecoiler;
898 dipNow.iRecoiler = iRec;
899 if ( iRec == 0 && (dipNow.colType != 0 || dipNow.chgType != 0
900 || dipNow.gamType != 0) ) {
904 infoPtr->errorMsg(
"Error in TimeShower::update: "
905 "failed to locate new recoiling partner");
910 if (hasWeakRad && singleWeakEmission && dipNow.weakType != 0)
915 if (hasWeakRad) hasWeaklyRadiated =
true;
918 int colTag =
event[iNewNew].col();
919 if (doQCDshower && colTag > 0)
920 setupQCDdip( iSys, sizeOut, colTag, 1, event,
false,
true);
923 int acolTag =
event[iNewNew].acol();
924 if (doQCDshower && acolTag > 0)
925 setupQCDdip( iSys, sizeOut, acolTag, -1, event,
false,
true);
929 int chgType =
event[iNewNew].chargeType();
930 bool doChgDip = (chgType != 0)
931 && ( ( doQEDshowerByQ && event[iNewNew].isQuark() )
932 || ( doQEDshowerByL &&
event[iNewNew].isLepton() ) );
933 int gamType = (
event[iNewNew].id() == 22) ? 1 : 0;
934 bool doGamDip = (gamType == 1) && doQEDshowerByGamma;
935 if (doChgDip || doGamDip)
936 setupQEDdip( iSys, sizeOut, chgType, gamType, event,
true);
940 unsigned int nDips = dipEnd.size();
941 if (doWeakShower && (event[iNewNew].isQuark() || event[iNewNew].isLepton())
942 && !(hasWeaklyRadiated && singleWeakEmission)
943 && (iSys == 0 || !partonSystemsPtr->hasInAB(iSys))) {
945 if (weakMode == 0 || weakMode == 1)
946 setupWeakdip( iSys, sizeOut, 1, event,
true);
948 if (nDips != dipEnd.size()) {
949 nDips = dipEnd.size();
950 dipEnd.back().MEtype = 200;
951 dipEnd.back().iMEpartner = dipEnd.back().iRecoiler;
954 if (weakMode == 0 || weakMode == 2)
955 setupWeakdip( iSys, sizeOut, 2, event,
true);
957 if (nDips != dipEnd.size()) {
958 nDips = dipEnd.size();
959 dipEnd.back().MEtype = 205;
960 dipEnd.back().iMEpartner = dipEnd.back().iRecoiler;
966 while (++iRescNow <
int(iRescatterer.size())) {
969 int iOutNew = iRescatterer[iRescNow];
970 int iInNew =
event[iOutNew].daughter1();
971 int iSysResc = partonSystemsPtr->getSystemOf(iInNew,
true);
976 iNew.push_back( partonSystemsPtr->getInA(iSysResc) );
977 iOld.push_back( event[iNew[0]].daughter1() );
978 iNew.push_back( partonSystemsPtr->getInB(iSysResc) );
979 iOld.push_back( event[iNew[1]].daughter1() );
982 sizeOut = partonSystemsPtr->sizeOut(iSysResc);
983 for (
int i = 0; i < sizeOut; ++i) {
984 int iNow = partonSystemsPtr->getOut(iSysResc, i);
985 iNew.push_back( iNow );
986 iOld.push_back( event[iNow].mother1() );
988 if (!event[iNow].isFinal()) iRescatterer.push_back( iNow );
993 for (
int iDip = 0; iDip < int(dipEnd.size()); ++iDip)
994 if (dipEnd[iDip].system == iSysResc
995 || dipEnd[iDip].systemRec == iSysResc) {
996 TimeDipoleEnd& dipNow = dipEnd[iDip];
999 for (
int i = 2; i < 2 + sizeOut; ++i)
1000 if (dipNow.iRadiator == iOld[i]) {
1001 dipNow.iRadiator = iNew[i];
1006 for (
int i = 2; i < 2 + sizeOut; ++i)
1007 if (dipNow.iMEpartner == iOld[i]) {
1008 dipNow.iMEpartner = iNew[i];
1013 for (
int i = 0; i < 2 + sizeOut; ++i)
1014 if (dipNow.iRecoiler == iOld[i]) {
1015 dipNow.iRecoiler = iNew[i];
1029 void TimeShower::setupQCDdip(
int iSys,
int i,
int colTag,
int colSign,
1030 Event& event,
bool isOctetOnium,
bool limitPTmaxIn) {
1033 int iRad = partonSystemsPtr->getOut(iSys, i);
1035 int sizeAllA = partonSystemsPtr->sizeAll(iSys);
1036 int sizeOut = partonSystemsPtr->sizeOut(iSys);
1037 int sizeAll = ( allowBeamRecoil ) ? sizeAllA : sizeOut;
1038 int sizeIn = sizeAll - sizeOut;
1039 int sizeInA = sizeAllA - sizeIn - sizeOut;
1040 int iOffset = i + sizeAllA - sizeOut;
1041 bool otherSystemRec =
false;
1042 bool allowInitial = (partonSystemsPtr->hasInAB(iSys)) ?
true :
false;
1045 bool isFlexible =
false;
1046 double flexFactor = 1.0;
1047 vector<int> iRecVec(0);
1052 for (
int j = 0; j < sizeAll; ++j)
if (j + sizeInA != iOffset) {
1053 int iRecNow = partonSystemsPtr->getAll(iSys, j + sizeInA);
1054 if ( ( j < sizeIn && event[iRecNow].col() == colTag
1055 && !event[iRecNow].isRescatteredIncoming() )
1056 || ( j >= sizeIn && event[iRecNow].acol() == colTag
1057 && event[iRecNow].isFinal() ) ) {
1066 for (
int j = 0; j < sizeAll; ++j)
if (j + sizeInA != iOffset) {
1067 int iRecNow = partonSystemsPtr->getAll(iSys, j + sizeInA);
1068 if ( ( j < sizeIn && event[iRecNow].acol() == colTag
1069 && !event[iRecNow].isRescatteredIncoming() )
1070 || ( j >= sizeIn && event[iRecNow].col() == colTag
1071 && event[iRecNow].isFinal() ) ) {
1081 bool hasJunction =
false;
1082 if (iRec == 0 && !allowInitial) {
1083 for (
int iJun = 0; iJun <
event.sizeJunction(); ++ iJun) {
1087 int iBeg = (
event.kindJunction(iJun)-1)/2;
1088 for (
int iLeg = iBeg; iLeg < 3; ++iLeg)
1089 if (event.endColJunction( iJun, iLeg) == colTag) hasJunction =
true;
1091 double ppMin = LARGEM2;
1092 for (
int j = 0; j < sizeOut; ++j)
if (j != i) {
1093 int iRecNow = partonSystemsPtr->getOut(iSys, j);
1094 if (!event[iRecNow].isFinal())
continue;
1095 double ppNow =
event[iRecNow].p() *
event[iRad].p()
1096 -
event[iRecNow].m() *
event[iRad].m();
1097 if (ppNow < ppMin) {
1105 if ( iRec == 0 || (!doInterleave && !event[iRec].isFinal()) ) {
1107 for (
int j = 0; j <
event.size(); ++j)
if (event[j].isFinal())
1108 if ( (colSign > 0 && event[j].acol() == colTag)
1109 || (colSign < 0 &&
event[j].col() == colTag) ) {
1111 otherSystemRec =
true;
1116 if (iRec == 0 && allowInitial) {
1117 for (
int iSysR = 0; iSysR < partonSystemsPtr->sizeSys(); ++iSysR)
1118 if (iSysR != iSys) {
1119 int j = partonSystemsPtr->getInA(iSysR);
1120 if (j > 0 && event[j].isRescatteredIncoming()) j = 0;
1121 if (j > 0 && ( (colSign > 0 && event[j].col() == colTag)
1122 || (colSign < 0 && event[j].acol() == colTag) ) ) {
1124 otherSystemRec =
true;
1127 j = partonSystemsPtr->getInB(iSysR);
1128 if (j > 0 && event[j].isRescatteredIncoming()) j = 0;
1129 if (j > 0 && ( (colSign > 0 && event[j].col() == colTag)
1130 || (colSign < 0 && event[j].acol() == colTag) ) ) {
1132 otherSystemRec =
true;
1148 for (
int iJun = 0; iJun <
event.sizeJunction(); ++ iJun) {
1149 int kindJun =
event.kindJunction(iJun);
1150 int iBeg = (kindJun-1)/2;
1151 for (
int iLeg = iBeg; iLeg < 3; ++iLeg) {
1152 if (event.endColJunction( iJun, iLeg) == colTag) {
1160 if (sizeOut == 1)
return;
1165 else if (kindJun >= 3) {
1166 int iLegRec = 3-iLeg;
1167 int colTagRec =
event.endColJunction( iJun, iLegRec);
1168 for (
int j = 0; j < sizeOut; ++j)
if (j != i) {
1169 int iRecNow = partonSystemsPtr->getOut(iSys, j);
1170 if (!event[iRecNow].isFinal())
continue;
1171 if ( (colSign > 0 && event[iRecNow].col() == colTagRec)
1172 || (colSign < 0 && event[iRecNow].acol() == colTagRec) ) {
1183 for (
int jLeg = 1; jLeg <= 2; jLeg++) {
1184 int iLegRec = (iLeg + jLeg) % 3;
1185 int colTagRec =
event.endColJunction( iJun, iLegRec);
1186 for (
int j = 0; j < sizeOut; ++j)
if (j != i) {
1187 int iRecNow = partonSystemsPtr->getOut(iSys, j);
1188 if (!event[iRecNow].isFinal())
continue;
1189 if ( (colSign > 0 && event[iRecNow].col() == colTagRec)
1190 || (colSign < 0 && event[iRecNow].acol() == colTagRec) ) {
1192 iRecVec.push_back(iRecNow);
1210 double ppMin = LARGEM2;
1211 for (
int j = 0; j < sizeOut; ++j)
if (j != i) {
1212 int iRecNow = partonSystemsPtr->getOut(iSys, j);
1213 if (!event[iRecNow].isFinal())
continue;
1214 double ppNow =
event[iRecNow].p() *
event[iRad].p()
1215 -
event[iRecNow].m() *
event[iRad].m();
1216 if (ppNow < ppMin) {
1226 double ppMin = LARGEM2;
1227 for (
int iRecNow = 0; iRecNow <
event.size(); ++iRecNow)
1228 if (iRecNow != iRad && event[iRecNow].isFinal()) {
1229 double ppNow =
event[iRecNow].p() *
event[iRad].p()
1230 -
event[iRecNow].m() *
event[iRad].m();
1231 if (ppNow < ppMin) {
1233 otherSystemRec =
true;
1240 if (iRecVec.size() == 0 && iRec != 0) iRecVec.push_back(iRec);
1243 int nRec = iRecVec.size();
1244 for (
unsigned int mRec = 0; mRec < iRecVec.size(); ++mRec)
1245 if (iRecVec[mRec] <= 0) nRec--;
1248 flexFactor = 1.0/nRec;
1253 infoPtr->errorMsg(
"Error in TimeShower::setupQCDdip: "
1254 "failed to locate any recoiling partner");
1259 for (
unsigned int mRec = 0; mRec < iRecVec.size(); ++mRec) {
1260 iRec = iRecVec[mRec];
1261 if (iRec <= 0)
continue;
1263 double pTmax =
event[iRad].scale();
1265 if (iSys == 0 || (iSys == 1 && doSecondHard)) pTmax *= pTmaxFudge;
1266 else if (sizeIn > 0) pTmax *= pTmaxFudgeMPI;
1267 }
else pTmax = 0.5 * m( event[iRad], event[iRec]);
1268 int colType = (
event[iRad].id() == 21) ? 2 * colSign : colSign;
1269 int isrType = (
event[iRec].isFinal()) ? 0 : event[iRec].mother1();
1271 while (isrType > 2 + beamOffset) isrType =
event[isrType].mother1();
1272 if (isrType > 2) isrType -= beamOffset;
1273 dipEnd.push_back( TimeDipoleEnd( iRad, iRec, pTmax,
1274 colType, 0, 0, 0, isrType, iSys, -1, -1, 0, isOctetOnium) );
1277 if (otherSystemRec) {
1278 int systemRec = partonSystemsPtr->getSystemOf(iRec,
true);
1279 if (systemRec >= 0) dipEnd.back().systemRec = systemRec;
1280 dipEnd.back().MEtype = 0;
1286 dipEnd.back().isFlexible =
true;
1287 dipEnd.back().flexFactor = flexFactor;
1298 void TimeShower::setupQEDdip(
int iSys,
int i,
int chgType,
int gamType,
1299 Event& event,
bool limitPTmaxIn) {
1302 int iRad = partonSystemsPtr->getOut(iSys, i);
1303 int idRad =
event[iRad].id();
1305 int sizeAllA = partonSystemsPtr->sizeAll(iSys);
1306 int sizeOut = partonSystemsPtr->sizeOut(iSys);
1307 int sizeAll = ( allowBeamRecoil ) ? sizeAllA : sizeOut;
1308 int sizeIn = sizeAll - sizeOut;
1309 int sizeInA = sizeAllA - sizeIn - sizeOut;
1310 int iOffset = i + sizeAllA - sizeOut;
1311 double ppMin = LARGEM2;
1312 bool hasRescattered =
false;
1313 bool otherSystemRec =
false;
1319 for (
int j = 0; j < sizeAll; ++j)
if (j + sizeInA != iOffset) {
1320 int iRecNow = partonSystemsPtr->getAll(iSys, j + sizeInA);
1321 if ( (j < sizeIn && !event[iRecNow].isRescatteredIncoming())
1322 || (j >= sizeIn && event[iRecNow].isFinal()) ) {
1323 if ( (j < sizeIn && event[iRecNow].
id() == idRad)
1324 || (j >= sizeIn && event[iRecNow].
id() == -idRad) ) {
1325 double ppNow =
event[iRecNow].p() *
event[iRad].p()
1326 -
event[iRecNow].m() *
event[iRad].m();
1327 if (ppNow < ppMin) {
1332 }
else hasRescattered =
true;
1337 if (iRec == 0 && hasRescattered) {
1338 for (
int iRecNow = 0; iRecNow <
event.size(); ++iRecNow)
1339 if (event[iRecNow].
id() == -idRad &&
event[iRecNow].isFinal()) {
1340 double ppNow =
event[iRecNow].p() *
event[iRad].p()
1341 -
event[iRecNow].m() *
event[iRad].m();
1342 if (ppNow < ppMin) {
1345 otherSystemRec =
true;
1353 for (
int j = 0; j < sizeAll; ++j)
if (j + sizeInA != iOffset) {
1354 int iRecNow = partonSystemsPtr->getAll(iSys, j + sizeInA);
1355 int chgTypeRecNow =
event[iRecNow].chargeType();
1356 if (chgTypeRecNow == 0)
continue;
1357 if ( (j < sizeIn && !event[iRecNow].isRescatteredIncoming())
1358 || (j >= sizeIn && event[iRecNow].isFinal()) ) {
1359 double ppNow = (
event[iRecNow].p() *
event[iRad].p()
1360 -
event[iRecNow].m() *
event[iRad].m())
1361 / pow2(chgTypeRecNow);
1362 if (ppNow < ppMin) {
1371 if (iRec == 0 && hasRescattered) {
1372 for (
int iRecNow = 0; iRecNow <
event.size(); ++iRecNow)
1373 if (iRecNow != iRad && event[iRecNow].isFinal()) {
1374 int chgTypeRecNow =
event[iRecNow].chargeType();
1375 if (chgTypeRecNow != 0 && event[iRecNow].isFinal()) {
1376 double ppNow = (
event[iRecNow].p() *
event[iRad].p()
1377 -
event[iRecNow].m() *
event[iRad].m())
1378 / pow2(chgTypeRecNow);
1379 if (ppNow < ppMin) {
1382 otherSystemRec =
true;
1390 for (
int j = 0; j < sizeOut; ++j)
if (j != i) {
1391 int iRecNow = partonSystemsPtr->getOut(iSys, j);
1392 double ppNow =
event[iRecNow].p() *
event[iRad].p()
1393 -
event[iRecNow].m() *
event[iRad].m();
1394 if (ppNow < ppMin) {
1402 for (
int iRecNow = 0; iRecNow <
event.size(); ++iRecNow)
1403 if (iRecNow != iRad && event[iRecNow].isFinal()) {
1404 double ppNow =
event[iRecNow].p() *
event[iRad].p()
1405 -
event[iRecNow].m() *
event[iRad].m();
1406 if (ppNow < ppMin) {
1409 otherSystemRec =
true;
1416 double pTmax =
event[iRad].scale();
1418 if (iSys == 0 || (iSys == 1 && doSecondHard)) pTmax *= pTmaxFudge;
1419 else if (sizeIn > 0) pTmax *= pTmaxFudgeMPI;
1420 }
else pTmax = 0.5 * m( event[iRad], event[iRec]);
1421 int isrType = (
event[iRec].isFinal()) ? 0 : event[iRec].mother1();
1423 while (isrType > 2 + beamOffset) isrType =
event[isrType].mother1();
1424 if (isrType > 2) isrType -= beamOffset;
1425 dipEnd.push_back( TimeDipoleEnd(iRad, iRec, pTmax,
1426 0, chgType, gamType, 0, isrType, iSys, -1) );
1429 if (otherSystemRec) {
1430 int systemRec = partonSystemsPtr->getSystemOf(iRec);
1431 if (systemRec >= 0) dipEnd.back().systemRec = systemRec;
1432 dipEnd.back().MEtype = 0;
1437 infoPtr->errorMsg(
"Error in TimeShower::setupQEDdip: "
1438 "failed to locate any recoiling partner");
1447 void TimeShower::setupWeakdip(
int iSys,
int i,
int weakType,
Event& event,
1448 bool limitPTmaxIn) {
1451 int iRad = partonSystemsPtr->getOut(iSys, i);
1452 int idRad =
event[iRad].id();
1454 int sizeAllA = partonSystemsPtr->sizeAll(iSys);
1455 int sizeOut = partonSystemsPtr->sizeOut(iSys);
1457 int sizeAll = sizeOut;
1458 int sizeIn = sizeAll - sizeOut;
1459 int sizeInA = sizeAllA - sizeIn - sizeOut;
1460 int iOffset = i + sizeAllA - sizeOut;
1461 double ppMin = LARGEM2;
1462 bool hasRescattered =
false;
1463 bool otherSystemRec =
false;
1469 for (
int j = 0; j < sizeAll; ++j)
1470 if (j + sizeInA != iOffset) {
1471 int iRecNow = partonSystemsPtr->getAll(iSys, j + sizeInA);
1472 if ( (j < sizeIn && !event[iRecNow].isRescatteredIncoming())
1473 || (j >= sizeIn && event[iRecNow].isFinal()) ) {
1474 if ( (j < sizeIn && event[iRecNow].
id() == idRad)
1475 || (j >= sizeIn && event[iRecNow].
id() == -idRad) ) {
1476 double ppNow =
event[iRecNow].p() *
event[iRad].p()
1477 -
event[iRecNow].m() *
event[iRad].m();
1478 if (ppNow < ppMin) {
1483 }
else hasRescattered =
true;
1488 if (iRec == 0 && hasRescattered) {
1489 for (
int iRecNow = 0; iRecNow <
event.size(); ++iRecNow)
1490 if (event[iRecNow].
id() == -idRad &&
event[iRecNow].isFinal()) {
1491 double ppNow =
event[iRecNow].p() *
event[iRad].p()
1492 -
event[iRecNow].m() *
event[iRad].m();
1493 if (ppNow < ppMin) {
1496 otherSystemRec =
true;
1504 for (
int j = 0; j < sizeAll; ++j)
if (j + sizeInA != iOffset) {
1505 int iRecNow = partonSystemsPtr->getAll(iSys, j + sizeInA);
1506 if (abs(event[iRecNow].
id()) >= 20 || weakType < 1
1507 || weakType > 2)
continue;
1508 double weakCoupNow = 1.;
1509 if (weakType == 2) weakCoupNow = coupSMPtr->vf2(event[iRecNow].idAbs())
1510 + coupSMPtr->af2(event[iRecNow].idAbs());
1511 if ( (j < sizeIn && !event[iRecNow].isRescatteredIncoming())
1512 || (j >= sizeIn && event[iRecNow].isFinal()) ) {
1513 double ppNow = (
event[iRecNow].p() *
event[iRad].p()
1514 -
event[iRecNow].m() *
event[iRad].m()) / weakCoupNow;
1515 if (ppNow < ppMin) {
1524 if (iRec == 0 && hasRescattered) {
1525 for (
int iRecNow = 0; iRecNow <
event.size(); ++iRecNow)
1526 if (iRecNow != iRad && event[iRecNow].isFinal()) {
1527 if (abs(event[iRecNow].
id()) >= 20 || weakType < 1
1528 || weakType > 2)
continue;
1529 double weakCoupNow = 1.;
1530 if (weakType == 2) weakCoupNow = coupSMPtr->vf2(event[iRecNow].idAbs())
1531 + coupSMPtr->af2(event[iRecNow].idAbs());
1532 double ppNow = (
event[iRecNow].p() *
event[iRad].p()
1533 -
event[iRecNow].m() *
event[iRad].m()) / weakCoupNow;
1534 if (ppNow < ppMin) {
1537 otherSystemRec =
true;
1544 for (
int j = 0; j < sizeOut; ++j)
if (j != i) {
1545 int iRecNow = partonSystemsPtr->getOut(iSys, j);
1546 double ppNow =
event[iRecNow].p() *
event[iRad].p()
1547 -
event[iRecNow].m() *
event[iRad].m();
1548 if (ppNow < ppMin) {
1556 for (
int iRecNow = 0; iRecNow <
event.size(); ++iRecNow)
1557 if (iRecNow != iRad && event[iRecNow].isFinal()) {
1558 double ppNow =
event[iRecNow].p() *
event[iRad].p()
1559 -
event[iRecNow].m() *
event[iRad].m();
1560 if (ppNow < ppMin) {
1563 otherSystemRec =
true;
1571 Vec4 p3weak =
event[3].p();
1572 Vec4 p4weak =
event[4].p();
1573 double tHat = (
event[iRad].p() - p3weak).m2Calc();
1574 double uHat = (
event[iRad].p() - p4weak).m2Calc();
1577 int weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
1579 if (event[iRad].pol() == 1 ||
event[iRad].pol() == -1)
1580 weakPol = event[iRad].pol();
1582 else if (event[iRad].statusAbs() > 40) {
1583 if (event[event[iRad].mother1()].idAbs() < 20)
1584 weakPol = event[event[iRad].mother1()].pol();
1585 else if ((
int)event[iRad].sisterList(
true).size() != 0)
1586 weakPol =
event[
event[iRad].sisterList(
true)[0]].pol();
1589 else if (infoPtr->nFinal() != 2) {
1590 if (event[iRec].pol() == 1 ||
event[iRec].pol() == -1)
1591 weakPol = event[iRec].pol();
1594 else if (idRad == - event[iRec].
id()) {
1595 if (event[iRec].pol() == 1 ||
event[iRec].pol() == -1)
1596 weakPol = event[iRec].pol();
1599 else if (event[event[iRad].mother1()].idAbs() == 24) weakPol = -1;
1601 else if (idRad == event[iRec].
id()) {
1602 if (uHat*uHat/(tHat*tHat + uHat*uHat) > 0.5) weakPol =
event[3].pol();
1603 else weakPol =
event[4].pol();
1606 else if (event[3].
id() == idRad) weakPol =
event[3].pol();
1607 else if (event[4].
id() == idRad) weakPol =
event[4].pol();
1610 if (weakPol > 1) weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
1611 event[iRad].pol(weakPol);
1614 double pTmax =
event[iRad].scale();
1616 if (iSys == 0) pTmax *= pTmaxFudge;
1617 if (iSys > 0 && sizeIn > 0) pTmax *= pTmaxFudgeMPI;
1618 }
else pTmax = 0.5 * m( event[iRad], event[iRec]);
1619 int isrType = (
event[iRec].isFinal()) ? 0 : event[iRec].mother1();
1621 while (isrType > 2 + beamOffset) isrType =
event[isrType].mother1();
1622 if (isrType > 2) isrType -= beamOffset;
1625 if (weakType == 1 && weakPol == 1)
return;
1626 dipEnd.push_back( TimeDipoleEnd(iRad, iRec, pTmax,
1627 0, 0, 0, weakType, isrType, iSys, -1, -1, weakPol) );
1630 if (otherSystemRec) {
1631 int systemRec = partonSystemsPtr->getSystemOf(iRec);
1632 if (systemRec >= 0) dipEnd.back().systemRec = systemRec;
1633 dipEnd.back().MEtype = 0;
1638 infoPtr->errorMsg(
"Error in TimeShower::setupWeakdip: "
1639 "failed to locate any recoiling partner");
1647 void TimeShower::setupHVdip(
int iSys,
int i,
Event& event,
1648 bool limitPTmaxIn) {
1651 int iRad = partonSystemsPtr->getOut(iSys, i);
1653 int idRad =
event[iRad].id();
1654 int sizeOut = partonSystemsPtr->sizeOut(iSys);
1658 for (
int j = 0; j < sizeOut; ++j)
if (j != i) {
1659 int iRecNow = partonSystemsPtr->getOut(iSys, j);
1660 int idRec =
event[iRecNow].id();
1661 if ( (abs(idRec) > 4900000 && abs(idRec) < 4900017)
1662 && idRad * idRec < 0) {
1670 double mMax = -sqrt(LARGEM2);
1672 for (
int j = 0; j < sizeOut; ++j)
if (j != i) {
1673 int iRecNow = partonSystemsPtr->getOut(iSys, j);
1674 if (event[iRecNow].m() > mMax) {
1676 mMax =
event[iRecNow].m();
1683 double pTmax =
event[iRad].scale();
1685 if (iSys == 0 || (iSys == 1 && doSecondHard)) pTmax *= pTmaxFudge;
1686 }
else pTmax = 0.5 * m( event[iRad], event[iRec]);
1687 int colvType = (
event[iRad].id() > 0) ? 1 : -1;
1688 dipEnd.push_back( TimeDipoleEnd( iRad, iRec, pTmax, 0, 0, 0, 0, 0,
1689 iSys, -1, -1, 0,
false,
true, colvType) );
1690 }
else infoPtr->errorMsg(
"Error in TimeShower::setupHVdip: "
1691 "failed to locate any recoiling partner");
1699 double TimeShower::pTnext(
Event& event,
double pTbegAll,
double pTendAll,
1700 bool isFirstTrial) {
1705 double pT2sel = pTendAll * pTendAll;
1707 for (
int iDip = 0; iDip < int(dipEnd.size()); ++iDip) {
1708 TimeDipoleEnd& dip = dipEnd[iDip];
1711 useLocalRecoilNow = !(globalRecoil && dip.system == 0
1712 && partonSystemsPtr->sizeOut(0) <= nMaxGlobalRecoil);
1715 if (globalRecoilMode == 1) {
1716 if (globalRecoil) useLocalRecoilNow =
true;
1717 for (
int iHard = 0; iHard < int(hardPartons.size()); ++iHard)
1718 if ( event[dip.iRadiator].isAncestor(hardPartons[iHard]) )
1719 useLocalRecoilNow =
false;
1721 if ( !globalRecoil || nGlobal >= nMaxGlobalBranch )
1722 useLocalRecoilNow =
true;
1725 }
else if (globalRecoilMode == 2) {
1726 useLocalRecoilNow = !(globalRecoil && dip.system == 0
1727 && nGlobal <= nMaxGlobalBranch);
1729 for (
int k = 0; k < int(event.size()); ++k)
1730 if ( event[k].isFinal() &&
event[k].colType() != 0) nFinal++;
1731 bool isFirst = (nHard == nFinal);
1733 if ( globalRecoil && doInterleave && !isFirst )
1734 useLocalRecoilNow =
true;
1735 if ( globalRecoil && nProposed > 0 )
1736 useLocalRecoilNow =
true;
1738 if ( nFinalBorn > 0 && nHard > nFinalBorn )
1739 useLocalRecoilNow =
true;
1743 dip.mRad =
event[dip.iRadiator].m();
1744 if (useLocalRecoilNow) {
1745 dip.mRec =
event[dip.iRecoiler].m();
1746 dip.mDip = m( event[dip.iRadiator], event[dip.iRecoiler] );
1751 for (
int i = 0; i < partonSystemsPtr->sizeOut( dip.system); ++i) {
1752 int ii = partonSystemsPtr->getOut( dip.system, i);
1753 if (ii != dip.iRadiator) pSumGlobal +=
event[ii].p();
1755 dip.mRec = pSumGlobal.mCalc();
1756 dip.mDip = m( event[dip.iRadiator].p(), pSumGlobal);
1758 dip.m2Rad = pow2(dip.mRad);
1759 dip.m2Rec = pow2(dip.mRec);
1760 dip.m2Dip = pow2(dip.mDip);
1763 dip.m2DipCorr = pow2(dip.mDip - dip.mRec) - dip.m2Rad;
1764 double pTbegDip = min( pTbegAll, dip.pTmax );
1765 double pT2begDip = min( pow2(pTbegDip), 0.25 * dip.m2DipCorr);
1768 bool isFirstWimpy = !useLocalRecoilNow && (pTmaxMatch == 1)
1769 && (nProposed == 0 || isFirstTrial);
1770 double muQ = (infoPtr->scalup() > 0.) ? infoPtr->scalup()
1772 if (isFirstWimpy && !limitMUQ) pT2begDip = pow2(muQ);
1773 else if (isFirstWimpy && limitMUQ) {
1775 double mS =
event[dip.iRecoiler].m();
1776 double mD = m( event[dip.iRadiator], event[dip.iRecoiler] );
1777 double m2DC = pow2(mD - mS) - pow2(dip.mRad);
1779 pT2begDip = min( pow2(muQ), min(pow2(pTbegDip), 0.25 * m2DC) );
1784 if (dip.m2DipCorr < 0.) {
1785 infoPtr->errorMsg(
"Warning in TimeShower::pTnext: "
1786 "negative dipole mass.");
1791 if (pT2begDip > pT2sel) {
1792 if (dip.colType != 0)
1793 pT2nextQCD(pT2begDip, pT2sel, dip, event);
1794 else if (dip.chgType != 0 || dip.gamType != 0)
1795 pT2nextQED(pT2begDip, pT2sel, dip, event);
1796 else if (dip.weakType != 0)
1797 pT2nextWeak(pT2begDip, pT2sel, dip, event);
1798 else if (dip.colvType != 0)
1799 pT2nextHV(pT2begDip, pT2sel, dip, event);
1802 if (dip.pT2 > pT2sel) {
1811 if (dipSel != 0) ++nProposed;
1814 return (dipSel == 0) ? 0. : sqrt(pT2sel);
1822 void TimeShower::pT2nextQCD(
double pT2begDip,
double pT2sel,
1823 TimeDipoleEnd& dip,
Event& event) {
1826 double pT2endDip = max( pT2sel, pT2colCut );
1827 if (pT2begDip < pT2endDip)
return;
1832 int colTypeAbs = abs(dip.colType);
1833 double wtPSglue = 2.;
1834 double colFac = (colTypeAbs == 1) ? 4./3. : 3./2.;
1835 if (dip.MEgluinoRec) colFac = 3.;
1836 if (dip.isOctetOnium) colFac *= 0.5 * octetOniumColFac;
1839 if (dip.isFlexible) colFac *= dip.flexFactor;
1840 double wtPSqqbar = (colTypeAbs == 2)
1841 ? 0.25 * nGluonToQuark * extraGluonToQuark : 0.;
1844 dip.pT2 = pT2begDip;
1846 double zMinAbs = 0.5;
1847 double pT2min = pT2endDip;
1849 double Lambda2 = Lambda3flav2;
1850 double emitCoefGlue = 0.;
1851 double emitCoefQqbar = 0.;
1852 double emitCoefTot = 0.;
1854 bool mustFindRange =
true;
1861 if (mustFindRange) {
1864 if (dip.pT2 > m2b) {
1866 pT2min = max( m2b, pT2endDip);
1868 Lambda2 = Lambda5flav2;
1869 }
else if (dip.pT2 > m2c) {
1871 pT2min = max( m2c, pT2endDip);
1873 Lambda2 = Lambda4flav2;
1878 Lambda2 = Lambda3flav2;
1881 Lambda2 /= renormMultFac;
1884 zMinAbs = 0.5 - sqrtpos( 0.25 - pT2min / dip.m2DipCorr );
1885 if (zMinAbs < SIMPLIFYROOT) zMinAbs = pT2min / dip.m2DipCorr;
1886 if (zMinAbs > 0.499) { dip.pT2 = 0.;
return; }
1889 emitCoefGlue = wtPSglue * colFac * log(1. / zMinAbs - 1.);
1890 emitCoefTot = emitCoefGlue;
1891 if (colTypeAbs == 2 && event[dip.iRadiator].id() == 21) {
1892 emitCoefQqbar = wtPSqqbar * (1. - 2. * zMinAbs);
1893 emitCoefTot += emitCoefQqbar;
1897 mustFindRange =
false;
1901 if (alphaSorder == 0) {
1902 dip.pT2 = dip.pT2 * pow( rndmPtr->flat(),
1903 1. / (alphaS2pi * emitCoefTot) );
1906 }
else if (alphaSorder == 1) {
1907 dip.pT2 = Lambda2 * pow( dip.pT2 / Lambda2,
1908 pow( rndmPtr->flat(), b0 / emitCoefTot) );
1912 do dip.pT2 = Lambda2 * pow( dip.pT2 / Lambda2,
1913 pow( rndmPtr->flat(), b0 / emitCoefTot) );
1914 while (alphaS.alphaS2OrdCorr(renormMultFac * dip.pT2) < rndmPtr->flat()
1915 && dip.pT2 > pT2min);
1920 if (nFlavour == 5 && dip.pT2 < m2b) {
1921 mustFindRange =
true;
1923 }
else if ( nFlavour == 4 && dip.pT2 < m2c) {
1924 mustFindRange =
true;
1929 if ( dip.pT2 < pT2endDip) { dip.pT2 = 0.;
return; }
1934 if (colTypeAbs == 2 && emitCoefQqbar > rndmPtr->flat()
1935 * emitCoefTot) dip.flavour = 0;
1938 if (dip.flavour == 21) {
1939 dip.z = 1. - zMinAbs * pow( 1. / zMinAbs - 1., rndmPtr->flat() );
1941 dip.z = zMinAbs + (1. - 2. * zMinAbs) * rndmPtr->flat();
1945 double zMin = 0.5 - sqrtpos( 0.25 - dip.pT2 / dip.m2DipCorr );
1946 if (zMin < SIMPLIFYROOT) zMin = dip.pT2 / dip.m2DipCorr;
1947 dip.m2 = dip.m2Rad + dip.pT2 / (dip.z * (1. - dip.z));
1948 if (dip.z > zMin && dip.z < 1. - zMin
1949 && dip.m2 * dip.m2Dip < dip.z * (1. - dip.z)
1950 * pow2(dip.m2Dip + dip.m2 - dip.m2Rec) ) {
1953 if (dip.flavour == 0) {
1954 dip.flavour = min(5, 1 +
int(nGluonToQuark * rndmPtr->flat()));
1955 dip.mFlavour = particleDataPtr->m0(dip.flavour);
1959 if (dip.MEtype > 0) {
1961 if (dip.flavour < 10 && dip.m2 < THRESHM2 * pow2(dip.mFlavour))
1965 }
else if (dip.flavour == 21
1966 && (colTypeAbs == 1 || colTypeAbs == 3) ) {
1967 wt = (1. + pow2(dip.z)) / wtPSglue;
1968 }
else if (dip.flavour == 21) {
1969 wt = (1. + pow3(dip.z)) / wtPSglue;
1973 double ratioQ = pow2(dip.mFlavour) / dip.m2;
1974 double betaQ = sqrtpos( 1. - 4. * ratioQ );
1975 if (weightGluonToQuark%4 == 1) {
1976 wt = betaQ * ( pow2(dip.z) + pow2(1. - dip.z) );
1977 }
else if (weightGluonToQuark%4 == 2) {
1978 wt = betaQ * ( pow2(dip.z) + pow2(1. - dip.z)
1979 + 8. * ratioQ * dip.z * (1. - dip.z) );
1981 double m2Rat = dip.m2 / dip.m2DipCorr;
1982 double zCosThe = ((1. + m2Rat) * dip.z - m2Rat) / (1. - m2Rat);
1983 wt = betaQ * ( pow2(zCosThe) + pow2(1. - zCosThe)
1984 + 8. * ratioQ * zCosThe * (1. - zCosThe) )
1985 * (1. + m2Rat) / ((1. - m2Rat) * extraGluonToQuark) ;
1986 if (weightGluonToQuark%4 == 0) wt *= pow3(1. - m2Rat);
1988 if (weightGluonToQuark > 4 && alphaSorder > 0)
1989 wt *= log(dip.pT2 / Lambda2)
1990 / log(scaleGluonToQuark * dip.m2 / Lambda2);
1994 if (dip.isrType != 0 && useLocalRecoilNow) {
1995 BeamParticle&
beam = (dip.isrType == 1) ? *beamAPtr : *beamBPtr;
1996 int iSysRec = dip.systemRec;
1997 double xOld = beam[iSysRec].x();
1998 double xNew = xOld * (1. + (dip.m2 - dip.m2Rad) /
1999 (dip.m2Dip - dip.m2Rad));
2000 double xMaxAbs = beam.xMax(iSysRec);
2002 infoPtr->errorMsg(
"Warning in TimeShower::pT2nextQCD: "
2003 "xMaxAbs negative");
2008 if (xNew > xMaxAbs) wt = 0.;
2010 int idRec =
event[dip.iRecoiler].id();
2011 pdfScale2 = (useFixedFacScale) ? fixedFacScale2
2012 : factorMultFac * dip.pT2;
2013 double pdfOld = max ( TINYPDF,
2014 beam.xfISR( iSysRec, idRec, xOld, pdfScale2) );
2016 beam.xfISR( iSysRec, idRec, xNew, pdfScale2);
2017 wt *= min( 1., pdfNew / pdfOld);
2021 if (dampenBeamRecoil) {
2022 double pTpT = sqrt(event[dip.iRadiator].pT2() * dip.pT2);
2023 wt *= pTpT / (pTpT + dip.m2);
2028 if (dopTdamp && dip.system == 0 && dip.MEtype == 0)
2029 wt *= pT2damp / (dip.pT2 + pT2damp);
2034 }
while (wt < rndmPtr->flat());
2042 void TimeShower::pT2nextQED(
double pT2begDip,
double pT2sel,
2043 TimeDipoleEnd& dip,
Event& event) {
2046 double pT2chgCut = (dip.chgType != 0 && abs(dip.chgType) != 3)
2047 ? pT2chgQCut : pT2chgLCut;
2048 double pT2endDip = max( pT2sel, pT2chgCut );
2049 if (pT2begDip < pT2endDip)
return;
2052 bool hasCharge = (dip.chgType != 0);
2055 double wtPSgam = 0.;
2056 double chg2Sum = 0.;
2057 double chg2SumL = 0.;
2058 double chg2SumQ = 0.;
2059 double zMinAbs = 0.;
2060 double emitCoefTot = 0.;
2063 double alphaEMmax = alphaEM.alphaEM(renormMultFac * dip.m2DipCorr);
2064 double alphaEM2pi = alphaEMmax / (2. * M_PI);
2069 double chg2 = pow2(dip.chgType / 3.);
2072 zMinAbs = 0.5 - sqrtpos( 0.25 - pT2endDip / dip.m2DipCorr );
2073 if (zMinAbs < SIMPLIFYROOT) zMinAbs = pT2endDip / dip.m2DipCorr;
2074 emitCoefTot = alphaEM2pi * chg2 * wtPSgam * log(1. / zMinAbs - 1.);
2078 chg2SumL = max(0, min(3, nGammaToLepton));
2079 if (nGammaToQuark > 4) chg2SumQ = 11. / 9.;
2080 else if (nGammaToQuark > 3) chg2SumQ = 10. / 9.;
2081 else if (nGammaToQuark > 2) chg2SumQ = 6. / 9.;
2082 else if (nGammaToQuark > 1) chg2SumQ = 5. / 9.;
2083 else if (nGammaToQuark > 0) chg2SumQ = 1. / 9.;
2086 chg2Sum = chg2SumL + 3. * chg2SumQ;
2087 emitCoefTot = alphaEM2pi * chg2Sum * extraGluonToQuark;
2091 dip.pT2 = pT2begDip;
2098 dip.pT2 = dip.pT2 * pow(rndmPtr->flat(), 1. / emitCoefTot);
2102 if ( dip.pT2 < pT2endDip) { dip.pT2 = 0.;
return; }
2105 if (hasCharge) dip.z = 1. - zMinAbs
2106 * pow( 1. / zMinAbs - 1., rndmPtr->flat() );
2107 else dip.z = rndmPtr->flat();
2110 double zMin = 0.5 - sqrtpos( 0.25 - dip.pT2 / dip.m2DipCorr );
2111 if (zMin < SIMPLIFYROOT) zMin = dip.pT2 / dip.m2DipCorr;
2112 if (dip.z <= zMin || dip.z >= 1. - zMin)
continue;
2113 dip.m2 = dip.m2Rad + dip.pT2 / (dip.z * (1. - dip.z));
2114 if (dip.m2 * dip.m2Dip < dip.z * (1. - dip.z)
2115 * pow2(dip.m2Dip + dip.m2 - dip.m2Rec)
2117 && (hasCharge || dip.m2 < m2MaxGamma) ) {
2126 if (rndmPtr->flat() * chg2Sum < chg2SumL)
2127 dip.flavour = 9 + 2 * min(3, 1 +
int(chg2SumL * rndmPtr->flat()));
2129 double rndmQ = 9. * chg2SumQ * rndmPtr->flat();
2130 if (rndmQ < 1.) dip.flavour = 1;
2131 else if (rndmQ < 5.) dip.flavour = 2;
2132 else if (rndmQ < 6.) dip.flavour = 3;
2133 else if (rndmQ < 10.) dip.flavour = 4;
2134 else dip.flavour = 5;
2136 dip.mFlavour = particleDataPtr->m0(dip.flavour);
2140 if (dip.MEtype > 0) {
2142 if (dip.flavour < 20 && dip.m2 < THRESHM2 * pow2(dip.mFlavour))
2146 }
else if (hasCharge) {
2147 wt = (1. + pow2(dip.z)) / wtPSgam;
2151 double ratioF = pow2(dip.mFlavour) / dip.m2;
2152 double betaF = sqrtpos( 1. - 4. * ratioF );
2153 if (weightGluonToQuark%4 == 1) {
2154 wt = betaF * ( pow2(dip.z) + pow2(1. - dip.z) );
2155 }
else if (weightGluonToQuark%4 == 2) {
2156 wt = betaF * ( pow2(dip.z) + pow2(1. - dip.z)
2157 + 8. * ratioF * dip.z * (1. - dip.z) );
2159 double m2Rat = dip.m2 / dip.m2DipCorr;
2160 double zCosThe = ((1. + m2Rat) * dip.z - m2Rat) / (1. - m2Rat);
2161 wt = betaF * ( pow2(zCosThe) + pow2(1. - zCosThe)
2162 + 8. * ratioF * zCosThe * (1. - zCosThe) )
2163 * (1. + m2Rat) / ((1. - m2Rat) * extraGluonToQuark) ;
2164 if (weightGluonToQuark%4 == 0) wt *= pow3(1. - m2Rat);
2169 double aEMscale = dip.pT2;
2170 if (dip.flavour < 20 && weightGluonToQuark > 4)
2171 aEMscale = scaleGluonToQuark * dip.m2;
2172 double alphaEMnow = alphaEM.alphaEM(renormMultFac * aEMscale);
2173 wt *= (alphaEMnow / alphaEMmax);
2176 if (dip.isrType != 0 && useLocalRecoilNow) {
2177 BeamParticle& beam = (dip.isrType == 1) ? *beamAPtr : *beamBPtr;
2178 int iSys = dip.system;
2179 double xOld = beam[iSys].x();
2180 double xNew = xOld * (1. + (dip.m2 - dip.m2Rad) /
2181 (dip.m2Dip - dip.m2Rad));
2182 double xMaxAbs = beam.xMax(iSys);
2184 infoPtr->errorMsg(
"Warning in TimeShower::pT2nextQED: "
2185 "xMaxAbs negative");
2190 if (xNew > xMaxAbs) wt = 0.;
2192 int idRec =
event[dip.iRecoiler].id();
2193 pdfScale2 = (useFixedFacScale) ? fixedFacScale2
2194 : factorMultFac * dip.pT2;
2195 double pdfOld = max ( TINYPDF,
2196 beam.xfISR( iSys, idRec, xOld, pdfScale2) );
2198 beam.xfISR( iSys, idRec, xNew, pdfScale2);
2199 wt *= min( 1., pdfNew / pdfOld);
2203 if (dampenBeamRecoil) {
2204 double pT24 = 4. *
event[dip.iRadiator].pT2();
2205 wt *= pT24 / (pT24 + dip.m2);
2210 if (dopTdamp && dip.system == 0 && dip.MEtype == 0)
2211 wt *= pT2damp / (dip.pT2 + pT2damp);
2215 }
while (wt < rndmPtr->flat());
2223 void TimeShower::pT2nextWeak(
double pT2begDip,
double pT2sel,
2224 TimeDipoleEnd& dip,
Event& event) {
2227 double pT2endDip = max( pT2sel, pT2weakCut );
2228 if (pT2begDip < pT2endDip)
return;
2231 double wtPSgam = 0.;
2232 double zMinAbs = 0.;
2233 double emitCoefTot = 0.;
2236 double alphaEMmax = alphaEM.alphaEM(renormMultFac * pT2begDip);
2237 double alphaEM2pi = alphaEMmax / (2. * M_PI);
2243 zMinAbs = 0.5 - sqrtpos( 0.25 - pT2endDip / dip.m2DipCorr );
2244 if (zMinAbs < SIMPLIFYROOT) zMinAbs = pT2endDip / dip.m2DipCorr;
2247 double weakCoupling = 0.;
2250 if (dip.weakType == 1)
2251 weakCoupling = 2. * alphaEM2pi / (4. * coupSMPtr->sin2thetaW());
2253 else if (dip.weakType == 2 && dip.weakPol == -1)
2254 weakCoupling = alphaEM2pi * thetaWRat
2255 * pow2(2. * coupSMPtr->lf( event[dip.iRadiator].idAbs() ));
2257 weakCoupling = alphaEM2pi * thetaWRat
2258 * pow2(2. * coupSMPtr->rf( event[dip.iRadiator].idAbs() ));
2261 emitCoefTot = weakEnhancement * weakCoupling
2262 * wtPSgam * log(1. / zMinAbs - 1.);
2264 if ( dip.MEtype == 201 || dip.MEtype == 202 || dip.MEtype == 203
2265 || dip.MEtype == 206 || dip.MEtype == 207 || dip.MEtype == 208 )
2266 emitCoefTot *= WEAKPSWEIGHT;
2267 dip.pT2 = pT2begDip;
2273 dip.pT2 = dip.pT2 * pow(rndmPtr->flat(), 1. / emitCoefTot);
2277 if ( dip.pT2 < pT2endDip) {dip.pT2 = 0.;
return; }
2280 dip.z = 1. - zMinAbs * pow( 1. / zMinAbs - 1., rndmPtr->flat() );
2283 double zMin = 0.5 - sqrtpos( 0.25 - dip.pT2 / dip.m2DipCorr );
2284 if (zMin < SIMPLIFYROOT) zMin = dip.pT2 / dip.m2DipCorr;
2285 dip.m2 = dip.m2Rad + dip.pT2 / (dip.z * (1. - dip.z));
2286 if (dip.z > zMin && dip.z < 1. - zMin
2287 && dip.m2 * dip.m2Dip < dip.z * (1. - dip.z)
2288 * pow2(dip.m2Dip + dip.m2 - dip.m2Rec) ) {
2291 if (dip.weakType == 1) {
2292 dip.flavour = (
event[dip.iRadiator].id() > 0) ? 24 : -24;
2293 if (event[dip.iRadiator].idAbs() % 2 == 1) dip.flavour = -dip.flavour;
2294 }
else if (dip.weakType == 2) dip.flavour = 23;
2297 dip.mFlavour = particleDataPtr->mSel( dip.flavour);
2301 if (dip.MEtype > 0) wt = 1.;
2304 double alphaEMnow = alphaEM.alphaEM(renormMultFac * dip.pT2);
2305 wt *= (alphaEMnow / alphaEMmax);
2308 if (dip.isrType != 0 && useLocalRecoilNow) {
2309 BeamParticle& beam = (dip.isrType == 1) ? *beamAPtr : *beamBPtr;
2310 int iSys = dip.system;
2311 double xOld = beam[iSys].x();
2312 double xNew = xOld * (1. + (dip.m2 - dip.m2Rad) /
2313 (dip.m2Dip - dip.m2Rad));
2314 double xMaxAbs = beam.xMax(iSys);
2316 infoPtr->errorMsg(
"Warning in TimeShower::pT2nextWeak: "
2317 "xMaxAbs negative");
2322 if (xNew > xMaxAbs) wt = 0.;
2324 int idRec =
event[dip.iRecoiler].id();
2325 pdfScale2 = (useFixedFacScale) ? fixedFacScale2
2326 : factorMultFac * dip.pT2;
2327 double pdfOld = max ( TINYPDF,
2328 beam.xfISR( iSys, idRec, xOld, pdfScale2) );
2330 beam.xfISR( iSys, idRec, xNew, pdfScale2);
2331 wt *= min( 1., pdfNew / pdfOld);
2334 if (dampenBeamRecoil) {
2335 double pT24 = 4. *
event[dip.iRadiator].pT2();
2336 wt *= pT24 / (pT24 + dip.m2);
2342 if (dopTdamp && dip.system == 0) wt *= pT2damp / (dip.pT2 + pT2damp);
2345 }
while (wt < rndmPtr->flat());
2353 void TimeShower::pT2nextHV(
double pT2begDip,
double pT2sel,
2354 TimeDipoleEnd& dip,
Event& ) {
2357 double pT2endDip = max( pT2sel, pT2hvCut );
2358 if (pT2begDip < pT2endDip)
return;
2361 int colvTypeAbs = abs(dip.colvType);
2362 double colvFac = (colvTypeAbs == 1) ? CFHV : 0.5 * nCHV;
2363 double alphaHV2pi = colvFac * (alphaHVfix / (2. * M_PI));
2366 double zMinAbs = 0.5 - sqrtpos( 0.25 - pT2endDip / dip.m2DipCorr );
2367 if (zMinAbs < SIMPLIFYROOT) zMinAbs = pT2endDip / dip.m2DipCorr;
2368 double emitCoefTot = alphaHV2pi * 2. * log(1. / zMinAbs - 1.);
2371 dip.pT2 = pT2begDip;
2378 dip.pT2 = dip.pT2 * pow(rndmPtr->flat(), 1. / emitCoefTot);
2382 if ( dip.pT2 < pT2endDip) { dip.pT2 = 0.;
return; }
2385 dip.z = 1. - zMinAbs * pow( 1. / zMinAbs - 1., rndmPtr->flat() );
2388 double zMin = 0.5 - sqrtpos( 0.25 - dip.pT2 / dip.m2DipCorr );
2389 if (zMin < SIMPLIFYROOT) zMin = dip.pT2 / dip.m2DipCorr;
2390 dip.m2 = dip.m2Rad + dip.pT2 / (dip.z * (1. - dip.z));
2391 if (dip.z > zMin && dip.z < 1. - zMin
2392 && dip.m2 * dip.m2Dip < dip.z * (1. - dip.z)
2393 * pow2(dip.m2Dip + dip.m2 - dip.m2Rec) ) {
2400 if (dip.MEtype > 0) wt = 1.;
2403 else if (colvTypeAbs == 1) wt = (1. + pow2(dip.z)) / 2.;
2404 else wt = (1. + pow3(dip.z)) / 2.;
2408 if (dopTdamp && dip.system == 0 && dip.MEtype == 0)
2409 wt *= pT2damp / (dip.pT2 + pT2damp);
2412 }
while (wt < rndmPtr->flat());
2423 bool TimeShower::branch(
Event& event,
bool isInterleaved) {
2426 useLocalRecoilNow = !(globalRecoil && dipSel->system == 0
2427 && partonSystemsPtr->sizeOut(0) <= nMaxGlobalRecoil);
2430 if (globalRecoilMode == 1) {
2431 if ( globalRecoil ) useLocalRecoilNow =
true;
2432 for (
int iHard = 0; iHard < int(hardPartons.size()); ++iHard)
2433 if ( event[dipSel->iRadiator].isAncestor(hardPartons[iHard]) )
2434 useLocalRecoilNow =
false;
2436 if ( !globalRecoil || nGlobal >= nMaxGlobalBranch )
2437 useLocalRecoilNow =
true;
2440 }
else if (globalRecoilMode == 2) {
2441 useLocalRecoilNow = !(globalRecoil && dipSel->system == 0
2442 && nGlobal <= nMaxGlobalBranch);
2444 for (
int i = 0; i < int(event.size()); ++i)
2445 if ( event[i].isFinal() &&
event[i].colType() != 0) nFinal++;
2446 bool isFirst = (nHard == nFinal);
2447 if ( globalRecoil && doInterleave && !isFirst )
2448 useLocalRecoilNow =
true;
2449 if ( globalRecoil && nProposed > 1 )
2450 useLocalRecoilNow =
true;
2452 if ( nFinalBorn > 0 && nHard > nFinalBorn )
2453 useLocalRecoilNow =
true;
2457 bool canMergeFirst = (mergingHooksPtr != 0)
2458 ? mergingHooksPtr->canVetoEmission() :
false;
2461 int iRadBef = dipSel->iRadiator;
2462 int iRecBef = dipSel->iRecoiler;
2463 Particle& radBef =
event[iRadBef];
2464 Particle& recBef =
event[iRecBef];
2467 Vec4 pRadBef =
event[iRadBef].p();
2469 vector<int> iGRecBef, iGRec;
2470 if (useLocalRecoilNow) pRecBef =
event[iRecBef].p();
2472 for (
int i = 0; i < partonSystemsPtr->sizeOut( dipSel->system); ++i) {
2473 int iG = partonSystemsPtr->getOut( dipSel->system, i);
2474 if (iG != dipSel->iRadiator) {
2475 iGRecBef.push_back(iG);
2476 pRecBef +=
event[iG].p();
2482 Vec4 p3weak =
event[3].p();
2483 Vec4 p4weak =
event[4].p();
2484 if ( dipSel->MEtype == 201 || dipSel->MEtype == 202
2485 || dipSel->MEtype == 203 || dipSel->MEtype == 206
2486 || dipSel->MEtype == 207 || dipSel->MEtype == 208) {
2489 int i2to2Mother = iRadBef;
2490 while (i2to2Mother != 5 && i2to2Mother != 6 && i2to2Mother != 0)
2491 i2to2Mother =
event[i2to2Mother].mother1();
2492 if (i2to2Mother == 0)
return false;
2495 if (event[3].
id() != event[4].
id()) {
2496 if (event[3].
id() == event[i2to2Mother].
id());
2497 else if (event[4].
id() == event[i2to2Mother].
id()) swap(p3weak, p4weak);
2499 else if (rndmPtr->flat() < 0.5) swap(p3weak, p4weak);
2502 else if (rndmPtr->flat() < 0.5) swap(p3weak, p4weak);
2506 int idRad = radBef.id();
2507 int idEmt = dipSel->flavour;
2508 int colRad = radBef.col();
2509 int acolRad = radBef.acol();
2512 iSysSel = dipSel->system;
2513 int iSysSelRec = dipSel->systemRec;
2516 if (dipSel->flavour == 22 || dipSel->flavour == idHV) {
2518 }
else if (dipSel->flavour == 21 && dipSel->colType > 0) {
2520 colRad =
event.nextColTag();
2522 }
else if (dipSel->flavour == 21) {
2524 acolRad =
event.nextColTag();
2527 }
else if (dipSel->colType > 0) {
2528 idEmt = dipSel->flavour ;
2532 }
else if (dipSel->colType < 0) {
2533 idEmt = -dipSel->flavour ;
2538 }
else if (dipSel->gamType == 1 && rndmPtr->flat() > 0.5) {
2539 idEmt = -dipSel->flavour ;
2541 if (idRad < 10) colRad =
event.nextColTag();
2543 }
else if (dipSel->gamType == 1) {
2544 idEmt = dipSel->flavour ;
2546 if (idEmt < 10) colEmt =
event.nextColTag();
2551 int idRadSv = idRad;
2552 if (abs(idEmt) == 24) {
2553 if (rndmPtr->flat() > coupSMPtr->V2CKMsum(idRad))
return false;
2554 idRad = coupSMPtr->V2CKMpick(idRad);
2559 double pTorig = sqrt( dipSel->pT2);
2560 double eRadPlusEmt = 0.5 * (dipSel->m2Dip + dipSel->m2 - dipSel->m2Rec)
2562 double e2RadPlusEmt = pow2(eRadPlusEmt);
2563 double pzRadPlusEmt = 0.5 * sqrtpos( pow2(dipSel->m2Dip - dipSel->m2
2564 - dipSel->m2Rec) - 4. * dipSel->m2 * dipSel->m2Rec ) / dipSel->mDip;
2565 double pT2corr = dipSel->m2 * (e2RadPlusEmt * dipSel->z * (1. - dipSel->z)
2566 - 0.25 * dipSel->m2) / pow2(pzRadPlusEmt);
2567 double pTcorr = sqrtpos( pT2corr );
2568 double pzRad = (e2RadPlusEmt * dipSel->z - 0.5 * dipSel->m2)
2570 double pzEmt = (e2RadPlusEmt * (1. - dipSel->z) - 0.5 * dipSel->m2)
2573 double mRad = (idRad == idRadSv) ? dipSel->mRad
2574 : particleDataPtr->m0(idRad);
2575 double m2Rad = pow2(mRad);
2580 if ( dipSel->weakType != 0
2581 || (abs(dipSel->colvType) == 1 && dipSel->mFlavour > 0.) ) {
2582 mEmt = dipSel->mFlavour;
2583 if (pow2(mRad + mEmt) > dipSel->m2)
return false;
2584 double m2Emt = pow2(mEmt);
2585 double lambda = sqrtpos( pow2(dipSel->m2 - m2Rad - m2Emt)
2586 - 4. * m2Rad * m2Emt );
2587 kRad = 0.5 * (dipSel->m2 - lambda + m2Emt - m2Rad)
2589 kEmt = 0.5 * (dipSel->m2 - lambda + m2Rad - m2Emt)
2591 pTorig *= 1. - kRad - kEmt;
2592 pTcorr *= 1. - kRad - kEmt;
2593 double pzMove = kRad * pzRad - kEmt * pzEmt;
2598 }
else if (abs(dipSel->colType) == 1 || dipSel->chgType != 0
2599 || abs(dipSel->colvType) == 1) {
2600 pTorig *= 1. - dipSel->m2Rad / dipSel->m2;
2601 pTcorr *= 1. - dipSel->m2Rad / dipSel->m2;
2602 pzRad += pzEmt * dipSel->m2Rad / dipSel->m2;
2603 pzEmt *= 1. - dipSel->m2Rad / dipSel->m2;
2606 }
else if (abs(dipSel->flavour) < 20) {
2607 mEmt = dipSel->mFlavour;
2609 double beta = sqrtpos( 1. - 4. * pow2(mEmt) / dipSel->m2 );
2612 pzRad = 0.5 * ( (1. + beta) * pzRad + (1. - beta) * pzEmt );
2613 pzEmt = pzRadPlusEmt - pzRad;
2617 if (idEmt == 21 && pTorig < pTcolCut)
return false;
2621 M.fromCMframe(pRadBef, pRecBef);
2624 findAsymPol( event, dipSel);
2627 Vec4 pRad, pEmt, pRec;
2630 double phi = 2. * M_PI * rndmPtr->flat();
2633 pRad = Vec4( pTcorr * cos(phi), pTcorr * sin(phi), pzRad,
2634 sqrt( pow2(pTcorr) + pow2(pzRad) + pow2(mRad) ) );
2635 pEmt = Vec4( -pRad.px(), -pRad.py(), pzEmt,
2636 sqrt( pow2(pTcorr) + pow2(pzEmt) + pow2(mEmt) ) );
2637 pRec = Vec4( 0., 0., -pzRadPlusEmt, sqrt( pow2(pzRadPlusEmt)
2638 + dipSel->m2Rec ) );
2646 if (dipSel->asymPol != 0.) {
2647 Vec4 pAunt =
event[dipSel->iAunt].p();
2648 double cosPhi = cosphi( pRad, pAunt, pRadBef );
2649 wtPhi = ( 1. + dipSel->asymPol * (2. * pow2(cosPhi) - 1.) )
2650 / ( 1. + abs(dipSel->asymPol) );
2652 }
while (wtPhi < rndmPtr->flat()) ;
2655 int isrTypeNow = dipSel->isrType;
2656 int isrTypeSave = isrTypeNow;
2657 if (!useLocalRecoilNow) isrTypeNow = 0;
2658 if (isrTypeNow != 0) pRec = 2. * recBef.p() - pRec;
2661 bool isFlexible = dipSel->isFlexible;
2664 double pTsel = sqrt(dipSel->pT2);
2665 Particle rad = Particle(idRad, 51, iRadBef, 0, 0, 0,
2666 colRad, acolRad, pRad, mRad, pTsel);
2667 Particle emt = Particle(idEmt, 51, iRadBef, 0, 0, 0,
2668 colEmt, acolEmt, pEmt, mEmt, pTsel);
2671 Particle rec = (isrTypeNow == 0)
2672 ? Particle(recBef.id(), 52, iRecBef, iRecBef, 0, 0,
2673 recBef.col(), recBef.acol(), pRec, dipSel->mRec, pTsel)
2674 : Particle(recBef.id(), -53, 0, 0, iRecBef, iRecBef,
2675 recBef.col(), recBef.acol(), pRec, 0., 0.);
2679 if (emt.idAbs() == 23 || emt.idAbs() == 24) {
2681 event[iRadBef].pol( dipSel->weakPol );
2682 rad.pol( dipSel->weakPol );
2686 if (dipSel->MEtype > 0) {
2687 Particle& partner = (dipSel->iMEpartner == iRecBef)
2688 ? rec : event[dipSel->iMEpartner];
2689 if ( findMEcorr( dipSel, rad, partner, emt) < rndmPtr->flat() )
2691 if (dipSel->MEtype >= 200 && dipSel->MEtype <= 210
2692 && findMEcorrWeak( dipSel, rad.p(), partner.p(), emt.p(), p3weak, p4weak,
2693 event[iRadBef].p(),
event[iRecBef].p()) < rndmPtr->flat() )
2700 if (allowRescatter && FIXRESCATTER && isInterleaved
2701 && iSysSel != iSysSelRec) {
2702 Vec4 pNew = rad.p() + emt.p();
2703 if (!rescatterPropagateRecoil(event, pNew))
return false;
2707 int eventSizeOld =
event.size();
2708 int iRadStatusV =
event[iRadBef].status();
2709 int iRadDau1V =
event[iRadBef].daughter1();
2710 int iRadDau2V =
event[iRadBef].daughter2();
2711 int iRecStatusV =
event[iRecBef].status();
2712 int iRecMot1V =
event[iRecBef].mother1();
2713 int iRecMot2V =
event[iRecBef].mother2();
2714 int iRecDau1V =
event[iRecBef].daughter1();
2715 int iRecDau2V =
event[iRecBef].daughter2();
2716 int beamOff1 = 1 + beamOffset;
2717 int beamOff2 = 2 + beamOffset;
2718 int ev1Dau1V =
event[beamOff1].daughter1();
2719 int ev2Dau1V =
event[beamOff2].daughter1();
2722 if (radBef.hasVertex()) {
2723 rad.vProd( radBef.vProd() );
2724 emt.vProd( radBef.vProd() );
2726 if (recBef.hasVertex()) rec.vProd( recBef.vProd() );
2730 int iRad =
event.append(rad);
2731 int iEmt =
event.append(emt);
2732 event[iRadBef].statusNeg();
2733 event[iRadBef].daughters( iRad, iEmt);
2735 if (useLocalRecoilNow) {
2736 iRec =
event.append(rec);
2737 if (isrTypeNow == 0) {
2738 event[iRecBef].statusNeg();
2739 event[iRecBef].daughters( iRec, iRec);
2741 event[iRecBef].mothers( iRec, iRec);
2742 event[iRec].mothers( iRecMot1V, iRecMot2V);
2743 if (iRecMot1V == beamOff1)
event[beamOff1].daughter1( iRec);
2744 if (iRecMot1V == beamOff2)
event[beamOff2].daughter1( iRec);
2750 RotBstMatrix MG = M;
2752 double pzRecBef = -0.5 * sqrtpos( pow2(dipSel->m2Dip - dipSel->m2Rad
2753 - dipSel->m2Rec) - 4. * dipSel->m2Rad * dipSel->m2Rec ) / dipSel->mDip;
2754 double eRecBef = sqrt( pow2(pzRecBef) + dipSel->m2Rec);
2755 double pzRecAft = -pzRadPlusEmt;
2756 double eRecAft = sqrt( pow2(pzRecAft) + dipSel->m2Rec);
2757 MG.bst( Vec4(0., 0., pzRecBef, eRecBef), Vec4(0., 0., pzRecAft, eRecAft) );
2761 for (
int iG = 0; iG < int(iGRecBef.size()); ++iG) {
2762 iRec =
event.copy( iGRecBef[iG], 52);
2763 iGRec.push_back( iRec);
2764 Vec4 pGRec =
event[iRec].p();
2766 event[iRec].p( pGRec);
2771 bool inResonance = (partonSystemsPtr->getInA(iSysSel) == 0) ?
true :
false;
2772 if ( (canVetoEmission && userHooksPtr->doVetoFSREmission( eventSizeOld,
2773 event, iSysSel, inResonance))
2774 || (canMergeFirst && mergingHooksPtr->doVetoEmission( event )) ) {
2775 event.popBack( event.size() - eventSizeOld);
2776 event[iRadBef].status( iRadStatusV);
2777 event[iRadBef].daughters( iRadDau1V, iRadDau2V);
2778 if (useLocalRecoilNow && isrTypeNow == 0) {
2779 event[iRecBef].status( iRecStatusV);
2780 event[iRecBef].daughters( iRecDau1V, iRecDau2V);
2781 }
else if (useLocalRecoilNow) {
2782 event[iRecBef].mothers( iRecMot1V, iRecMot2V);
2783 if (iRecMot1V == beamOff1)
event[beamOff1].daughter1( ev1Dau1V);
2784 if (iRecMot1V == beamOff2)
event[beamOff2].daughter1( ev2Dau1V);
2786 for (
int iG = 0; iG < int(iGRecBef.size()); ++iG) {
2787 event[iGRecBef[iG]].statusPos();
2788 event[iGRecBef[iG]].daughters( 0, 0);
2795 if (!useLocalRecoilNow) {
2797 for (
int iG = 0; iG < int(iGRecBef.size()); ++iG)
2798 if (iGRecBef[iG] == iRecBef) iRec = iGRec[iG];
2802 if (isrTypeNow != 0) {
2803 BeamParticle& beamRec = (isrTypeNow == 1) ? *beamAPtr : *beamBPtr;
2804 double xOld = beamRec[iSysSelRec].x();
2805 double xRec = 2. * pRec.e() / (beamAPtr->e() + beamBPtr->e());
2806 beamRec[iSysSelRec].iPos( iRec);
2807 beamRec[iSysSelRec].x( xRec);
2808 partonSystemsPtr->setSHat( iSysSelRec,
2809 partonSystemsPtr->getSHat(iSysSelRec) * xRec / xOld);
2814 if ( !useLocalRecoilNow || nGlobal >= nMaxGlobalBranch) {
2816 while ( doRemove ) {
2817 bool hasRemoved =
false;
2818 for (
int iHard = 0; iHard < int(hardPartons.size()); ++iHard)
2819 if ( event[dipSel->iRadiator].isAncestor(hardPartons[iHard]) ) {
2820 hardPartons.erase( hardPartons.begin() + iHard );
2824 doRemove = hasRemoved;
2829 if ( !useLocalRecoilNow ) ++nGlobal;
2832 if (dipSel->flavour == 22) {
2833 dipSel->iRadiator = iRad;
2834 dipSel->iRecoiler = iRec;
2837 if (recoilToColoured && inResonance && event[iRec].chargeType() == 0)
2838 dipSel->iRecoiler = iEmt;
2839 dipSel->pTmax = pTsel;
2840 if (doQEDshowerByGamma) dipEnd.push_back( TimeDipoleEnd(iEmt, iRad,
2841 pTsel, 0, 0, 1, 0, 0, iSysSel, 0) );
2844 }
else if (dipSel->flavour == 21) {
2845 dipSel->iRadiator = iRad;
2846 dipSel->iRecoiler = iEmt;
2847 dipSel->systemRec = iSysSel;
2848 dipSel->isrType = 0;
2849 dipSel->pTmax = pTsel;
2851 if (!doMEafterFirst) dipSel->MEtype = 0;
2854 double flexFactor = (isFlexible) ? dipSel->flexFactor : 1.0;
2855 dipSel->isFlexible =
false;
2856 for (
int i = 0; i < int(dipEnd.size()); ++i) {
2857 if (dipEnd[i].iRadiator == iRecBef && dipEnd[i].iRecoiler == iRadBef
2858 && dipEnd[i].colType != 0) {
2859 dipEnd[i].iRadiator = iRec;
2860 dipEnd[i].iRecoiler = iEmt;
2862 if (!doMEafterFirst) dipEnd[i].MEtype = 0;
2864 if ( !isFlexible && dipEnd[i].colType * dipSel->colType > 0)
2865 dipEnd[i].iRecoiler = iRad;
2866 dipEnd[i].pTmax = pTsel;
2873 if (event[iRadBef].
id() == 21 && dipEnd[i].iRecoiler == iRadBef
2874 && dipEnd[i].weakType != 0) {
2875 double m1 = (
event[iRad].p()+
event[dipEnd[i].iRadiator].p()).m2Calc();
2876 double m2 = (
event[iEmt].p()+
event[dipEnd[i].iRadiator].p()).m2Calc();
2877 dipEnd[i].iRecoiler = (m1 > m2) ? iRad : iEmt;
2880 int colType = (dipSel->colType > 0) ? 2 : -2 ;
2884 if (recoilToColoured && inResonance && event[iRec].col() == 0
2885 &&
event[iRec].acol() == 0) iRecMod = iRad;
2886 dipEnd.push_back( TimeDipoleEnd(iEmt, iRecMod, pTsel,
2887 colType, 0, 0, 0, isrTypeSave, iSysSel, 0));
2888 dipEnd.back().systemRec = iSysSelRec;
2891 dipEnd.back().isFlexible =
true;
2892 dipEnd.back().flexFactor = flexFactor;
2894 dipEnd.push_back( TimeDipoleEnd(iEmt, iRad, pTsel,
2895 -colType, 0, 0, 0, 0, iSysSel, 0));
2898 }
else if (dipSel->colType != 0) {
2899 for (
int i = 0; i < int(dipEnd.size()); ++i) {
2901 if ( !isFlexible && dipEnd[i].iRecoiler == iRadBef
2902 && dipEnd[i].colType * dipSel->colType < 0 )
2903 dipEnd[i].iRecoiler = iEmt;
2904 if (dipEnd[i].iRadiator == iRadBef && abs(dipEnd[i].colType) == 2) {
2905 dipEnd[i].colType /= 2;
2906 if (dipEnd[i].system != dipEnd[i].systemRec)
continue;
2910 dipEnd[i].MEtype = 66;
2911 if (&dipEnd[i] == dipSel) dipEnd[i].iMEpartner = iRad;
2912 else dipEnd[i].iMEpartner = iEmt;
2915 if (event[iRadBef].
id() == 21 && dipEnd[i].iRecoiler == iRadBef
2916 && dipEnd[i].weakType != 0) {
2917 double m1 = (
event[iRad].p()+
event[dipEnd[i].iRadiator].p()).m2Calc();
2918 double m2 = (
event[iEmt].p()+
event[dipEnd[i].iRadiator].p()).m2Calc();
2919 dipEnd[i].iRecoiler = (m1 > m2) ? iRad : iEmt;
2922 dipSel->iRadiator = iEmt;
2923 dipSel->iRecoiler = iRec;
2924 dipSel->pTmax = pTsel;
2929 if (doQEDshowerByQ) {
2930 int chgType =
event[iRad].chargeType();
2931 dipEnd.push_back( TimeDipoleEnd(iRad, iEmt, pTsel,
2932 0, chgType, 0, 0, 0, iSysSel, 66, iEmt));
2933 dipEnd.push_back( TimeDipoleEnd(iEmt, iRad, pTsel,
2934 0, -chgType, 0, 0, 0, iSysSel, 66, iRad));
2939 if (doWeakShower && iSysSel == 0 &&
2940 !(hasWeaklyRadiated && singleWeakEmission)) {
2941 int weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
2942 event[iRad].pol(weakPol);
2943 event[iEmt].pol(weakPol);
2944 if ((weakMode == 0 || weakMode == 1) && weakPol == -1) {
2945 dipEnd.push_back( TimeDipoleEnd(iRad, iEmt, pTsel,
2946 0, 0, 0, 1, 0, iSysSel, 200, iEmt, weakPol) );
2947 dipEnd.push_back( TimeDipoleEnd(iEmt, iRad, pTsel,
2948 0, 0, 0, 1, 0, iSysSel, 200, iRad, weakPol) );
2950 if (weakMode == 0 || weakMode == 2) {
2951 dipEnd.push_back( TimeDipoleEnd(iRad, iEmt, pTsel,
2952 0, 0, 0, 2, 0, iSysSel, 205, iEmt, weakPol) );
2953 dipEnd.push_back( TimeDipoleEnd(iEmt, iRad, pTsel,
2954 0, 0, 0, 2, 0, iSysSel, 205, iRad, weakPol) );
2961 }
else if (dipSel->gamType != 0) {
2962 dipSel->gamType = 0;
2963 int chgType =
event[iRad].chargeType();
2964 int colType =
event[iRad].colType();
2966 if ( chgType != 0 && ( ( doQEDshowerByQ && colType != 0 )
2967 || ( doQEDshowerByL && colType == 0 ) ) ) {
2968 dipEnd.push_back( TimeDipoleEnd(iRad, iEmt, pTsel,
2969 0, chgType, 0, 0, 0, iSysSel, 102, iEmt) );
2970 dipEnd.push_back( TimeDipoleEnd(iEmt, iRad, pTsel,
2971 0, -chgType, 0, 0, 0, iSysSel, 102, iRad) );
2974 if (colType != 0 && doQCDshower) {
2975 dipEnd.push_back( TimeDipoleEnd(iRad, iEmt, pTsel,
2976 colType, 0, 0, 0, 0, iSysSel, 11, iEmt) );
2977 dipEnd.push_back( TimeDipoleEnd(iEmt, iRad, pTsel,
2978 -colType, 0, 0, 0, 0, iSysSel, 11, iRad) );
2982 }
else if (dipSel->flavour == 4900022) {
2983 dipSel->iRadiator = iRad;
2984 dipSel->iRecoiler = iRec;
2985 dipSel->pTmax = pTsel;
2988 }
else if (dipSel->flavour == 4900021) {
2989 dipSel->iRadiator = iRad;
2990 dipSel->iRecoiler = iEmt;
2991 dipSel->pTmax = pTsel;
2992 for (
int i = 0; i < int(dipEnd.size()); ++i)
2993 if (dipEnd[i].iRadiator == iRecBef && dipEnd[i].iRecoiler == iRadBef
2994 && dipEnd[i].isHiddenValley) {
2995 dipEnd[i].iRadiator = iRec;
2996 dipEnd[i].iRecoiler = iEmt;
2997 dipEnd[i].pTmax = pTsel;
2999 int colvType = (dipSel->colvType > 0) ? 2 : -2 ;
3000 dipEnd.push_back( TimeDipoleEnd(iEmt, iRec, pTsel,
3001 0, 0, 0, 0, isrTypeSave, iSysSel, 0, -1, 0,
false,
true, colvType) );
3002 dipEnd.back().systemRec = iSysSelRec;
3003 dipEnd.push_back( TimeDipoleEnd(iEmt, iRad, pTsel,
3004 0, 0, 0, 0, 0, iSysSel, 0, -1, 0,
false,
true, -colvType) );
3007 }
else if (dipSel->weakType != 0) {
3008 hasWeaklyRadiated =
true;
3009 if (singleWeakEmission)
3010 for (
int i = 0; i < int(dipEnd.size()); ++i) dipEnd[i].weakType = 0;
3014 if (event[iRad].
id() ==
event[iRadBef].id()) {
3015 event[iRad].tau( event[iRadBef].tau() );
3017 event[iRad].tau( event[iRad].tau0() * rndmPtr->exp() );
3018 event[iEmt].tau( event[iEmt].tau0() * rndmPtr->exp() );
3020 event[iRec].tau( event[iRecBef].tau() );
3023 for (
int i = 0; i < int(dipEnd.size()); ++i) {
3026 if (isFlexible && !dipSel->isFlexible && dipEnd[i].isFlexible) {
3027 if (dipEnd[i].iRecoiler == iRadBef) dipEnd[i].iRecoiler = iEmt;
3028 if (dipEnd[i].iRadiator == iRadBef) {
3029 dipEnd[i].iRadiator = iEmt;
3030 if (dipEnd[i].colType == 1 && dipSel->flavour == 21)
3031 dipEnd[i].colType = 2;
3032 if (dipEnd[i].colType ==-1 && dipSel->flavour == 21)
3033 dipEnd[i].colType =-2;
3036 if (dipEnd[i].iRadiator == iRadBef) dipEnd[i].iRadiator = iRad;
3037 if (dipEnd[i].iRecoiler == iRadBef) dipEnd[i].iRecoiler = iRad;
3038 if (dipEnd[i].iMEpartner == iRadBef) dipEnd[i].iMEpartner = iRad;
3039 if (useLocalRecoilNow) {
3040 if (dipEnd[i].iRadiator == iRecBef) dipEnd[i].iRadiator = iRec;
3041 if (dipEnd[i].iRecoiler == iRecBef) dipEnd[i].iRecoiler = iRec;
3042 if (dipEnd[i].iMEpartner == iRecBef) dipEnd[i].iMEpartner = iRec;
3044 for (
int iG = 0; iG < int(iGRecBef.size()); ++iG) {
3045 if (dipEnd[i].iRadiator == iGRecBef[iG])
3046 dipEnd[i].iRadiator = iGRec[iG];
3047 if (dipEnd[i].iRecoiler == iGRecBef[iG])
3048 dipEnd[i].iRecoiler = iGRec[iG];
3049 if (dipEnd[i].iMEpartner == iGRecBef[iG])
3050 dipEnd[i].iMEpartner = iGRec[iG];
3059 for (
int iJun = 0; iJun <
event.sizeJunction(); iJun++) {
3061 int nIncoming = (
event.kindJunction(iJun)-1)/2;
3065 colChk = (
event.kindJunction(iJun) % 2 == 0 )
3066 ? event[iRadBef].col() :
event[iRadBef].acol();
3068 for (
int iCol = 0; iCol < nIncoming; iCol++) {
3069 int colJun =
event.colJunction( iJun, iCol);
3071 if (colJun == colChk) {
3073 if ( event.kindJunction(iJun) % 2 == 0 ) colNew = colRad;
3074 else colNew = acolRad;
3075 event.colJunction( iJun, iCol, colNew );
3081 partonSystemsPtr->replace(iSysSel, iRadBef, iRad);
3082 partonSystemsPtr->addOut(iSysSel, iEmt);
3083 if (useLocalRecoilNow)
3084 partonSystemsPtr->replace(iSysSelRec, iRecBef, iRec);
3086 for (
int iG = 0; iG < int(iGRecBef.size()); ++iG)
3087 partonSystemsPtr->replace(iSysSel, iGRecBef[iG], iGRec[iG]);
3109 typedef pair < int, int > pairInt;
3110 typedef vector < pairInt > vectorPairInt;
3129 inline vectorPairInt findParentSystems(
const int sys,
3130 Event& event, PartonSystems* partonSystemsPtr,
bool forwards) {
3132 vectorPairInt parentSystems;
3133 parentSystems.reserve(10);
3138 int iInA = partonSystemsPtr->getInA(iSysCur);
3139 int iInB = partonSystemsPtr->getInB(iSysCur);
3143 if (event[iInA].isRescatteredIncoming()) iIn = iInA;
3144 if (event[iInB].isRescatteredIncoming()) iIn = -iInB;
3147 parentSystems.push_back( pairInt(-iSysCur, iIn) );
3148 if (iIn == 0)
break;
3150 int iInAbs = abs(iIn);
3151 int iMother =
event[iInAbs].mother1();
3152 iSysCur = partonSystemsPtr->getSystemOf(iMother);
3153 if (iSysCur == -1) {
3154 parentSystems.clear();
3162 vectorPairInt::reverse_iterator rit;
3163 for (rit = parentSystems.rbegin(); rit < (parentSystems.rend() - 1);
3165 pairInt &cur = *rit;
3166 pairInt &next = *(rit + 1);
3167 cur.first = -cur.first;
3168 cur.second = (next.second < 0) ? -event[abs(next.second)].mother1() :
3169 event[abs(next.second)].mother1();
3173 return parentSystems;
3184 bool TimeShower::rescatterPropagateRecoil(
Event& event, Vec4& pNew) {
3187 int iRadBef = dipSel->iRadiator;
3188 iSysSel = dipSel->system;
3189 int iSysSelRec = dipSel->systemRec;
3190 Vec4 pImbal = pNew -
event[iRadBef].p();
3194 vector < pair < int, Vec4 > > eventMod;
3195 eventMod.reserve(10);
3200 vectorPairInt systemMod;
3201 systemMod.reserve(10);
3204 vectorPairInt radParent = findParentSystems(iSysSel, event,
3205 partonSystemsPtr,
false);
3206 vectorPairInt recParent = findParentSystems(iSysSelRec, event,
3207 partonSystemsPtr,
true);
3208 if (radParent.size() == 0 || recParent.size() == 0) {
3210 infoPtr->errorMsg(
"Error in TimeShower::rescatterPropagateRecoil: "
3211 "couldn't find parent system; branching vetoed");
3215 bool foundPath =
false;
3216 unsigned int iRadP = 0;
3217 unsigned int iRecP = 0;
3218 for (iRadP = 0; iRadP < radParent.size(); iRadP++) {
3219 for (iRecP = 0; iRecP < recParent.size(); iRecP++)
3220 if (abs(radParent[iRadP].first) == abs(recParent[iRecP].first)) {
3224 if (foundPath)
break;
3229 infoPtr->errorMsg(
"Warning in TimeShower::rescatterPropagateRecoil: "
3230 "couldn't find recoil path; branching vetoed");
3237 if (radParent.size() > 1)
3238 path.assign(radParent.begin(), radParent.begin() + iRadP);
3239 if (recParent.size() > 1)
3240 path.insert(path.end(), recParent.rend() - iRecP - 1,
3241 recParent.rend() - 1);
3244 for (
unsigned int i = 0; i < path.size(); i++) {
3246 bool isIncoming = (path[i].first < 0) ?
true :
false;
3247 int iSysCur = abs(path[i].first);
3248 bool isIncomingA = (path[i].second > 0) ?
true :
false;
3249 int iLink = abs(path[i].second);
3252 if (isIncoming) iMemCur = (isIncomingA) ? -1 : -2;
3255 for (
int j = 0; j < partonSystemsPtr->sizeOut(iSysCur); j++)
3256 if (partonSystemsPtr->getOut(iSysCur, j) == iLink) {
3260 if (iMemCur == -1) {
3262 infoPtr->errorMsg(
"Error in TimeShower::rescatterPropagateRecoil: "
3263 "couldn't find parton system; branching vetoed");
3268 Vec4 pMod = (isIncoming) ? event[iLink].p() + pImbal :
3269 event[iLink].p() - pImbal;
3270 eventMod.push_back(pair <int, Vec4> (iLink, pMod));
3271 systemMod.push_back(pairInt(iSysCur, iMemCur));
3274 int iInCurA = partonSystemsPtr->getInA(iSysCur);
3275 int iInCurB = partonSystemsPtr->getInB(iSysCur);
3276 Vec4 pTotCur =
event[iInCurA].p() +
event[iInCurB].p();
3279 if (iMemCur < 0) pTotCur += (isIncoming) ? pImbal : -pImbal;
3280 double sHatCur = pTotCur.m2Calc();
3284 if (abs(pMod.m2Calc()) > MAXVIRTUALITYFRACTION * sHatCur) {
3285 infoPtr->errorMsg(
"Warning in TimeShower::rescatterPropagateRecoil: "
3286 "virtuality much larger than sHat; branching vetoed");
3292 if (!isIncoming && pMod * pTotCur < -MAXNEGENERGYFRACTION * sHatCur) {
3293 infoPtr->errorMsg(
"Warning in TimeShower::rescatterPropagateRecoil: "
3294 "rest frame energy too negative; branching vetoed");
3299 if (sHatCur < 0.0) {
3300 infoPtr->errorMsg(
"Warning in TimeShower::rescatterPropagateRecoil: "
3301 "sHat became negative; branching vetoed");
3306 iLink = (isIncoming) ? event[iLink].mother1() :
3307 event[iLink].daughter1();
3308 iSysCur = partonSystemsPtr->getSystemOf(iLink,
true);
3310 if (!isIncoming) iMemCur = (isIncomingA) ? -1 : -2;
3313 for (
int j = 0; j < partonSystemsPtr->sizeOut(iSysCur); j++)
3314 if (partonSystemsPtr->getOut(iSysCur, j) == iLink) {
3318 if (iMemCur == -1) {
3320 infoPtr->errorMsg(
"Error in TimeShower::rescatterPropagateRecoil: "
3321 "couldn't find parton system; branching vetoed");
3326 pMod = (isIncoming) ? event[iLink].p() + pImbal :
3327 event[iLink].p() - pImbal;
3328 eventMod.push_back(pair <int, Vec4> (iLink, pMod));
3329 systemMod.push_back(pairInt(iSysCur, iMemCur));
3332 iInCurA = partonSystemsPtr->getInA(iSysCur);
3333 iInCurB = partonSystemsPtr->getInB(iSysCur);
3334 pTotCur =
event[iInCurA].p() +
event[iInCurB].p();
3337 if (iMemCur < 0) pTotCur += (isIncoming) ? pImbal : -pImbal;
3338 sHatCur = pTotCur.m2Calc();
3342 if (abs(pMod.m2Calc()) > MAXVIRTUALITYFRACTION * sHatCur) {
3343 infoPtr->errorMsg(
"Warning in TimeShower::rescatterPropagateRecoil: "
3344 "virtuality much larger than sHat; branching vetoed");
3350 if (!isIncoming && pMod * pTotCur < -MAXNEGENERGYFRACTION * sHatCur) {
3351 infoPtr->errorMsg(
"Warning in TimeShower::rescatterPropagateRecoil: "
3352 "rest frame energy too negative; branching vetoed");
3357 if (sHatCur < 0.0) {
3358 infoPtr->errorMsg(
"Warning in TimeShower::rescatterPropagateRecoil: "
3359 "sHat became negative; branching vetoed");
3364 if (VETONEGENERGY && pMod.e() < 0.0) {
3365 infoPtr->errorMsg(
"Warning in TimeShower::rescatterPropagateRecoil: "
3366 "energy became negative; branching vetoed");
3375 for (
unsigned int i = 0; i < eventMod.size(); i++) {
3376 int idx = eventMod[i].first;
3377 Vec4 &pMod = eventMod[i].second;
3378 int iSys = systemMod[i].first;
3379 int iMem = systemMod[i].second;
3382 if (event[idx].isRescatteredIncoming()) {
3383 int mother1 =
event[idx].mother1();
3384 idx =
event.copy(idx, -54);
3385 event[mother1].daughters(idx, idx);
3388 double eCM = sqrt(m2( beamAPtr->p(), beamBPtr->p()));
3390 partonSystemsPtr->setInA(iSys, idx);
3391 (*beamAPtr)[iSys].x((pMod.e() + pMod.pz()) / eCM);
3392 (*beamAPtr)[iSys].m(pMod.mCalc());
3393 (*beamAPtr)[iSys].p(pMod);
3394 (*beamAPtr)[iSys].iPos(idx);
3395 }
else if (iMem == -2) {
3396 partonSystemsPtr->setInB(iSys, idx);
3397 (*beamBPtr)[iSys].x((pMod.e() - pMod.pz()) / eCM);
3398 (*beamBPtr)[iSys].m(pMod.mCalc());
3399 (*beamBPtr)[iSys].p(pMod);
3400 (*beamBPtr)[iSys].iPos(idx);
3403 infoPtr->errorMsg(
"Error in TimeShower::rescatterPropagateRecoil: "
3404 "internal bookeeping error");
3409 int daughter1 =
event[idx].daughter1();
3410 idx =
event.copy(idx, 55);
3411 event[idx].statusNeg();
3412 event[daughter1].mothers(idx, idx);
3414 partonSystemsPtr->setOut(iSys, iMem, idx);
3417 event[idx].p( eventMod[i].second );
3418 event[idx].m( event[idx].mCalc() );
3433 void TimeShower::findMEtype(
Event& event, TimeDipoleEnd& dip) {
3437 if (!doMEcorrections) setME =
false;
3438 int iMother =
event[dip.iRadiator].mother1();
3439 int iMother2 =
event[dip.iRadiator].mother2();
3442 if (dip.isHiddenValley && event[dip.iRecoiler].id()
3443 == -
event[dip.iRadiator].id());
3446 else if (dip.weakType != 0);
3450 if (iMother2 != iMother && iMother2 != 0) setME =
false;
3451 if (event[dip.iRecoiler].mother1() != iMother) setME =
false;
3452 if (event[dip.iRecoiler].mother2() != iMother2) setME =
false;
3456 if (event[dip.iRecoiler].status() < 0) setME =
false;
3459 if (dip.system != dip.systemRec) setME =
false;
3468 if (dip.iMEpartner < 0) dip.iMEpartner = dip.iRecoiler;
3471 if (dip.colType != 0 || dip.colvType != 0) {
3472 bool isHiddenColour = (dip.colvType != 0);
3475 int idDau1 =
event[dip.iRadiator].id();
3476 int idDau2 =
event[dip.iMEpartner].id();
3477 int dau1Type = findMEparticle(idDau1, isHiddenColour);
3478 int dau2Type = findMEparticle(idDau2, isHiddenColour);
3479 int minDauType = min(dau1Type, dau2Type);
3480 int maxDauType = max(dau1Type, dau2Type);
3483 dip.MEorder = (dau2Type >= dau1Type);
3484 dip.MEsplit = (maxDauType <= 6);
3485 dip.MEgluinoRec =
false;
3488 if (minDauType == 0 && dip.MEtype < 0) dip.MEtype = 0;
3489 if (dip.MEtype >= 0)
return;
3493 if (dau1Type == 4 && dau2Type == 4)
return;
3497 if ( event[dip.iRecoiler].mother1() == iMother && iMother >= 0)
3498 idMother = event[iMother].
id();
3499 int motherType = (idMother != 0)
3500 ? findMEparticle(idMother, isHiddenColour) : 0;
3503 if (motherType == 0) {
3504 int col1 =
event[dip.iRadiator].col();
3505 int acol1 =
event[dip.iRadiator].acol();
3506 int col2 =
event[dip.iMEpartner].col();
3507 int acol2 =
event[dip.iMEpartner].acol();
3509 int spinT = (
event[dip.iRadiator].spinType()
3510 +
event[dip.iMEpartner].spinType() )%2;
3512 if ( col1 == acol2 && acol1 == col2 )
3513 motherType = (spinT == 0) ? 7 : 9;
3515 else if ( (col1 == acol2 && acol1 != 0 && col2 != 0)
3516 || (acol1 == col2 && col1 != 0 && acol2 != 0) )
3517 motherType = (spinT == 0) ? 4 : 5;
3519 else if ( (col1 == acol2 && acol1 != col2)
3520 || (acol1 == col2 && col1 != acol2) )
3521 motherType = (spinT == 0) ? 2 : 1;
3533 if (isHiddenColour && brokenHVsym) {
3534 MEkind = (dau2Type == 0 || dau2Type > 6) ? 30 : 31;
3535 dip.MEtype = 5 * MEkind + 1;
3541 dip.MEgluinoRec = (dau1Type >= 1 && dau1Type <= 3 && dau2Type == 5);
3544 if (minDauType == 1 && maxDauType == 1 &&
3545 (motherType == 4 || motherType == 7) ) {
3547 if (idMother == 21 || idMother == 22) MEcombi = 1;
3548 else if (idMother == 23 || idDau1 + idDau2 == 0) {
3550 dip.MEmix = gammaZmix( event, iMother, dip.iRadiator, dip.iRecoiler );
3552 else if (idMother == 24) MEcombi = 4;
3555 else if (minDauType == 1 && maxDauType == 1 && motherType == 9)
3559 else if (minDauType == 1 && maxDauType == 7 && motherType == 1)
3561 if (idDau1 == 22 || idDau2 == 22) MEcombi = 1;
3564 else if (minDauType == 1 && maxDauType == 1 && motherType == 8) {
3566 if (idMother == 25 || idMother == 35 || idMother == 37) MEcombi = 1;
3567 else if (idMother == 36) MEcombi = 2;
3569 else if (minDauType == 1 && maxDauType == 8 && motherType == 1)
3573 else if (minDauType == 2 && maxDauType == 2 && (motherType == 4
3574 || motherType == 7) ) MEkind = 6;
3575 else if (minDauType == 2 && (maxDauType == 4 || maxDauType == 7)
3576 && motherType == 2) MEkind = 7;
3577 else if (minDauType == 2 && maxDauType == 2 && motherType == 8)
3579 else if (minDauType == 2 && maxDauType == 8 && motherType == 2)
3583 else if (minDauType == 1 && maxDauType == 2 && motherType == 9)
3585 else if (minDauType == 1 && maxDauType == 9 && motherType == 2)
3587 else if (minDauType == 2 && maxDauType == 9 && motherType == 1)
3591 else if (minDauType == 1 && maxDauType == 2 && motherType == 5)
3593 else if (minDauType == 1 && maxDauType == 5 && motherType == 2)
3595 else if (minDauType == 2 && maxDauType == 5 && motherType == 1)
3600 else if (minDauType == 1 && maxDauType == 9 && motherType == 3)
3603 else if (minDauType == 3 && maxDauType == 9 && motherType == 1)
3607 else if (minDauType == 5 && maxDauType == 5) MEkind = 16;
3610 dip.MEtype = 5 * MEkind + MEcombi;
3613 }
else if (dip.chgType != 0) {
3618 if (dip.MEtype >= 0)
return;
3621 int idDau1 =
event[dip.iRadiator].id();
3622 int idDau2 =
event[dip.iMEpartner].id();
3623 if (abs(idDau1) < 9 && abs(idDau2) < 9 && idDau1 * idDau2 < 0) ;
3624 else if (abs(idDau1) > 10 && abs(idDau1) < 19 && abs(idDau2) > 10
3625 && abs(idDau2) < 19 && idDau1 * idDau2 < 0) ;
3626 else { dip.MEtype = 0;
return; }
3630 if (idDau1 + idDau2 == 0) dip.MEtype = 102;
3635 else if (dip.weakType == 1) {
3636 if (event[dip.iRadiator].id() == -
event[dip.iRecoiler].id()
3637 ||
event[
event[dip.iRadiator].mother1()].idAbs() == 24
3638 || infoPtr->nFinal() != 2) dip.MEtype = 200;
3639 else if (event[dip.iRadiator].idAbs() == 21
3640 ||
event[dip.iRecoiler].idAbs() == 21) dip.MEtype = 201;
3641 else if (event[dip.iRadiator].id() ==
event[dip.iRecoiler].id())
3643 else dip.MEtype = 203;
3644 }
else if (dip.weakType == 2) {
3645 if (event[dip.iRadiator].id() == -
event[dip.iRecoiler].id()
3646 ||
event[
event[dip.iRadiator].mother1()].idAbs() == 24) dip.MEtype = 205;
3647 else if (event[dip.iRadiator].idAbs() == 21
3648 ||
event[dip.iRecoiler].idAbs() == 21) dip.MEtype = 206;
3649 else if (event[dip.iRadiator].id() ==
event[dip.iRecoiler].id())
3651 else dip.MEtype = 208;
3662 int TimeShower::findMEparticle(
int id,
bool isHiddenColour) {
3666 int colType = abs(particleDataPtr->colType(
id));
3667 int spinType = particleDataPtr->spinType(
id);
3671 if (isHiddenColour) {
3673 int idAbs = abs(
id);
3674 if ( (idAbs > 4900000 && idAbs < 4900007)
3675 || (idAbs > 4900010 && idAbs < 4900017)
3676 || idAbs == 4900101) colType = 1;
3680 if (colType == 1 && spinType == 2) type = 1;
3681 else if (colType == 1 && spinType == 1) type = 2;
3682 else if (colType == 1) type = 3;
3683 else if (colType == 2 && spinType == 3) type = 4;
3684 else if (colType == 2 && spinType == 2) type = 5;
3685 else if (colType == 2) type = 6;
3686 else if (colType == 0 && spinType == 3) type = 7;
3687 else if (colType == 0 && spinType == 1) type = 8;
3688 else if (colType == 0 && spinType == 2) type = 9;
3699 double TimeShower::gammaZmix(
Event& event,
int iRes,
int iDau1,
int iDau2) {
3704 int iIn1 = (iRes >= 0) ? event[iRes].mother1() : -1;
3705 int iIn2 = (iRes >= 0) ? event[iRes].mother2() : -1;
3706 if (iIn1 >=0) idIn1 =
event[iIn1].id();
3707 if (iIn2 >=0) idIn2 =
event[iIn1].id();
3710 if (idIn1 == 21 || idIn1 == 22) idIn1 = -idIn2;
3711 if (idIn2 == 21 || idIn2 == 22) idIn2 = -idIn1;
3714 if (idIn1 + idIn2 != 0 )
return 0.5;
3715 int idInAbs = abs(idIn1);
3716 if (idInAbs == 0 || idInAbs > 18 )
return 0.5;
3717 double ei = coupSMPtr->ef(idInAbs);
3718 double vi = coupSMPtr->vf(idInAbs);
3719 double ai = coupSMPtr->af(idInAbs);
3722 if (event[iDau1].
id() + event[iDau2].
id() != 0)
return 0.5;
3723 int idOutAbs = abs(event[iDau1].
id());
3724 if (idOutAbs == 0 || idOutAbs >18 )
return 0.5;
3725 double ef = coupSMPtr->ef(idOutAbs);
3726 double vf = coupSMPtr->vf(idOutAbs);
3727 double af = coupSMPtr->af(idOutAbs);
3730 Vec4 psum =
event[iDau1].p() +
event[iDau2].p();
3731 double sH = psum.m2Calc();
3732 double intNorm = 2. * thetaWRat * sH * (sH - mZ*mZ)
3733 / ( pow2(sH - mZ*mZ) + pow2(sH * gammaZ / mZ) );
3734 double resNorm = pow2(thetaWRat * sH)
3735 / ( pow2(sH - mZ*mZ) + pow2(sH * gammaZ / mZ) );
3738 double vect = ei*ei * ef*ef + ei*vi * intNorm * ef*vf
3739 + (vi*vi + ai*ai) * resNorm * vf*vf;
3740 double axiv = (vi*vi + ai*ai) * resNorm * af*af;
3741 return vect / (vect + axiv);
3749 double TimeShower::findMEcorr(TimeDipoleEnd* dip, Particle& rad,
3750 Particle& partner, Particle& emt,
bool cutEdge) {
3755 int MEkind = dip->MEtype / 5;
3756 int MEcombi = dip->MEtype % 5;
3759 Vec4 sum = rad.p() + partner.p() + emt.p();
3760 double eCMME = sum.mCalc();
3761 double x1 = 2. * (sum * rad.p()) / pow2(eCMME);
3762 double x2 = 2. * (sum * partner.p()) / pow2(eCMME);
3763 double r1 = rad.m() / eCMME;
3764 double r2 = partner.m() / eCMME;
3768 double gammavCorr = 1.;
3769 if (dip->colvType != 0 && brokenHVsym) {
3770 r3 = emt.m() / eCMME;
3771 double x3Tmp = 2. - x1 - x2;
3772 gammavCorr = x3Tmp / (x3Tmp - kRad * (x1 + x3Tmp));
3775 double m2Pair = (rad.p() + partner.p()).m2Calc();
3776 double m2Avg = 0.5 * (rad.m2() + partner.m2())
3777 - 0.25 * pow2(rad.m2() - partner.m2()) / m2Pair;
3778 r1 = sqrt(m2Avg) / eCMME;
3780 double xShift = 0.5 * (x1 + x2) * (partner.m2() - rad.m2()) / m2Pair;
3787 double x1minus, x2minus, x3;
3789 x1minus = max(XMARGIN, 1. + r1*r1 - r2*r2 - x1);
3790 x2minus = max(XMARGIN, 1. + r2*r2 - r1*r1 - x2) ;
3791 x3 = max(XMARGIN, 2. - x1 - x2);
3793 x1minus = max(XMARGIN*XMARGIN, 1. + r1*r1 - r2*r2 - x1);
3794 x2minus = max(XMARGIN*XMARGIN, 1. + r2*r2 - r1*r1 - x2) ;
3795 x3 = max(XMARGIN*XMARGIN, 2. - x1 - x2);
3799 if (dip->colType !=0 || dip->colvType != 0) {
3802 if (dip->MEorder) wtME = calcMEcorr(MEkind, MEcombi, dip->MEmix,
3803 x1, x2, r1, r2, r3, cutEdge);
3804 else wtME = calcMEcorr(MEkind, MEcombi, dip->MEmix,
3805 x2, x1, r2, r1, r3, cutEdge);
3808 if (dip->MEsplit) wtME = wtME * x1minus / x3;
3811 wtPS = 2. / ( x3 * x2minus );
3812 if (dip->MEgluinoRec) wtPS *= 9./4.;
3813 if (dip->colvType != 0 && brokenHVsym) wtPS *= gammavCorr;
3817 }
else if (dip->chgType !=0 && dip->MEtype == 101) {
3818 double chg1 = particleDataPtr->charge(rad.id());
3819 double chg2 = particleDataPtr->charge(partner.id());
3820 wtME = (x1*x1 + x2*x2) * pow2( chg1 * x1minus / x3
3821 - chg2 * x2minus / x3 );
3822 wtPS = 2. * ( chg1*chg1 * x1minus / x3 + chg2*chg2 * x2minus / x3 );
3825 }
else if (dip->chgType !=0 && dip->MEtype == 102) {
3826 wtME = calcMEcorr(2, 1, dip->MEmix, x1, x2, r1, r2, 0., cutEdge)
3828 wtPS = 2. / ( x3 * x2minus );
3833 else if (dip->MEtype == 200 || dip->MEtype == 205) {
3834 r3 = emt.m() / eCMME;
3835 wtME = calcMEcorr(32, 1, dip->MEmix, x1, x2, r1, r2, r3, cutEdge)
3837 wtPS = 8. / (x3 * x2minus);
3838 wtPS *= x3 / (x3 - kRad * (x1 + x3));
3841 else if (dip->MEtype == 201 || dip->MEtype == 202
3842 || dip->MEtype == 203 || dip->MEtype == 205
3843 || dip->MEtype == 206 || dip->MEtype == 207)
return 1.;
3846 if (wtME > wtPS) infoPtr->errorMsg(
"Warning in TimeShower::findMEcorr: "
3847 "ME weight above PS one");
3885 double TimeShower::calcMEcorr(
int kind,
int combiIn,
double mixIn,
3886 double x1,
double x2,
double r1,
double r2,
double r3,
bool cutEdge) {
3889 double x3 = 2. - x1 - x2;
3890 double x1s = x1 * x1;
3891 double x2s = x2 * x2;
3892 double x3s = x3 * x3;
3893 double x1c = x1 * x1s;
3894 double x2c = x2 * x2s;
3895 double x3c = x3 * x3s;
3896 double r1s = r1 * r1;
3897 double r2s = r2 * r2;
3898 double r1c = r1 * r1s;
3899 double r2c = r2 * r2s;
3900 double r1q = r1s * r1s;
3901 double r2q = r2s * r2s;
3902 double prop1 = 1. + r1s - r2s - x1;
3903 double prop2 = 1. + r2s - r1s - x2;
3904 double prop1s = prop1 * prop1;
3905 double prop2s = prop2 * prop2;
3906 double prop12 = prop1 * prop2;
3907 double prop13 = prop1 * x3;
3908 double prop23 = prop2 * x3;
3911 double r3s = r3 * r3;
3912 double prop3 = r3s - x3;
3913 double prop3s = prop3 * prop3;
3914 if (kind == 30) prop13 = prop1 * prop3;
3918 if (x1 - 2.*r1 < XMARGIN || prop1 < XMARGIN)
return 0.;
3919 if (x2 - 2.*r2 < XMARGIN || prop2 < XMARGIN)
return 0.;
3921 if (kind != 30 && kind != 31) {
3922 if (x1 + x2 - 1. - pow2(r1+r2) < XMARGIN)
return 0.;
3926 if ( (x1s - 4.*r1s) * (x2s - 4.*r2s)
3927 - pow2( 2. * (1. - x1 - x2 + r1s + r2s) + x1*x2 )
3928 < XMARGIN * (XMARGINCOMB + r1 + r2) )
return 0.;
3933 int combi = max(1, min(4, combiIn) );
3934 double mix = max(0., min(1., mixIn) );
3935 bool isSet1 =
false;
3936 bool isSet2 =
false;
3937 bool isSet4 =
false;
3938 double ps = sqrtpos( pow2(1. - r1*r1 - r2*r2) - pow2(2. * r1 * r2) );
3939 double rLO = 0., rFO = 0., rLO1 = 0., rFO1 = 0., rLO2 = 0.,
3940 rFO2 = 0., rLO4 = 0., rFO4 = 0.;
3950 if (combi == 1 || combi == 3) {
3951 rLO1 = ps*(2.-r1s-r1q+6.*r1*r2-r2s+2.*r1s*r2s-r2q)/2.;
3952 rFO1 = -(3.+6.*r1s+r1q-6.*r1*r2+6.*r1c*r2-2.*r2s-6.*r1s*r2s
3953 +6.*r1*r2c+r2q-3.*x1+6.*r1*r2*x1+2.*r2s*x1+x1s-2.*r1s*x1s
3954 +3.*r1s*x3+6.*r1*r2*x3-r2s*x3-2.*x1*x3-5.*r1s*x1*x3
3955 +r2s*x1*x3+x1s*x3-3.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-6.*r1s-2.*r1c+2.*r2s-2.*r1*r2s-x1+r1s*x1
4231 -r2s*x1-3.*x2+2.*r1*x2+3.*r1s*x2-r2s*x2+x1*x2+x2s)
4235 if (combi == 2 || combi == 3) {
4236 rLO2 = ps*(1.-2.*r1+r1s-r2s);
4237 rFO2 = (2.*r1-x1)*(1.+r1s+r2s-x1)
4239 +2.*(-1.-r1s+2.*r1c-r2s+2.*r1*r2s+3.*x1*0.5-r1*x1
4240 -r1s*x1*0.5-r2s*x1*0.5+x2-r1*x2+r1s*x2-x1*x2*0.5)
4242 +(2.+2.*r1-6.*r1s+2.*r1c+2.*r2s+2.*r1*r2s-x1+r1s*x1
4243 -r2s*x1-3.*x2-2.*r1*x2+3.*r1s*x2-r2s*x2+x1*x2+x2s)/
4248 rLO4 = ps*(1.+r1s-r2s);
4249 rFO4 = x1*(-1.-r1s-r2s+x1)
4251 +2.*(-1.-r1s-r2s+3.*x1*0.5-r1s*x1*0.5-r2s*x1*0.5
4252 +x2+r1s*x2-x1*x2*0.5)
4254 +(2.-6.*r1s+2.*r2s-x1+r1s*x1-r2s*x1-3.*x2+3.*r1s*x2
4263 if (combi == 1 || combi == 3) {
4264 rLO1 = ps*(1.-pow2(r1+r2));
4265 rFO1 = (1.+r1s+2.*r1*r2+r2s-x1-x2)*(x1+x2)
4267 -(-1.+r1q-2.*r1*r2-2.*r1c*r2-6.*r1s*r2s-2.*r1*r2c+r2q+x1
4268 -r1s*x1+r2s*x1+x2+3.*r1s*x2+2.*r1*r2*x2-r2s*x2-x1*x2)
4270 +(-1.-2.*r1s-r1q-2.*r1*r2-2.*r1c*r2+2.*r1*r2c+r2q+x1+r1s*x1
4271 -2.*r1*r2*x1-3.*r2s*x1+2.*r1s*x2-2.*r2s*x2+x1*x2+x2s)
4275 if (combi == 2 || combi == 3) {
4276 rLO2 = ps*(1.-pow2(r1-r2));
4277 rFO2 = (1.+r1s-2.*r1*r2+r2s-x1-x2)*(x1+x2)
4279 -(-1.+r1q+2.*r1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
4551 else if (combi == 3) offset = mix * x3s;
4552 else if (combi == 4) offset = 0.5 * x3s;
4553 rFO = ps * 4.5 * ( (x1+x2-1.+offset-r1s-r2s)/prop12
4554 - r1s/prop2s - r2s/prop1s );
4559 rLO = ps*(1.-r1s+r2s+2.*r2);
4560 rFO = ( 0.5*r3s + 2.*r1q + 0.5*r2s*r3s + r2*r3s - 2.*r1s
4561 - 0.5*r1s*r3s - 2.*r1s*r2s - 4.*r1s*r2 ) / prop2s
4562 + ( -2. + 2.*r2q + 2.*r1q + 2.*r2s*r3s - 4.*r2 + 2.*r2*r3s
4563 + 4.*r2*r2s - 4.*r1s*r2s - 4.*r1s*r2 ) /prop23
4564 + ( -2. - 0.5*r3s - 2.*r2s - 4.*r2 + 2.*r1s ) / prop2
4565 + ( -2. - r3s - 2.*r2s - r2s*r3s - 4.*r2 - 2.*r2*r3s
4566 + 2.*r1s + r1s*r3s ) / prop3s
4567 + ( -1. - r3s - r2s - 4.*r2 + r1s - x2 ) / prop3
4573 rLO = ps*(1.-4.*r1s);
4574 rFO = (r3s + 2.*r1s) * (-1. + 4.*r1s) * (1./prop1s + 1./prop2s)
4575 + (-1. + 8.*r1s - x2) / prop1
4576 + (-1. + 8.*r1s - x1) / prop2
4577 + 2. * (1. - 6.*r1s + 8.*r1q + 4.*r3s*r1s) / prop12
4584 rFO = (2. * r3s * r3s + 2. * r3s * (x1 + x2) + x1s + x2s) / prop12
4585 - r3s / prop1s - r3s / prop2s;
4591 rFO = (2. * r3s * r3s + 2. * r3s * (x1 + x2) + x1s + x2s) / prop12
4592 - r3s / prop1s - r3s / prop2s;
4598 if (combi == 2) offset = x3s;
4599 else if (combi == 3) offset = mix * x3s;
4600 else if (combi == 4) offset = 0.5 * x3s;
4601 rFO = ps * 2. * ( (x1+x2-1.+offset-r1s-r2s)/prop12
4602 - r1s/prop2s - r2s/prop1s );
4609 if (combi == 1 && isSet1) {
4612 else if (combi == 2 && isSet2) {
4615 else if (combi == 3 && isSet1 && isSet2) {
4616 rLO = mix * rLO1 + (1.-mix) * rLO2;
4617 rFO = mix * rFO1 + (1.-mix) * rFO2; }
4621 else if (combi == 4 && isSet1 && isSet2) {
4622 rLO = 0.5 * (rLO1 + rLO2);
4623 rFO = 0.5 * (rFO1 + rFO2); }
4636 double TimeShower::findMEcorrWeak(TimeDipoleEnd* dip,Vec4 rad,
4637 Vec4 rec, Vec4 emt,Vec4 p3,Vec4 p4,Vec4 radBef, Vec4 recBef) {
4640 if (dip->MEtype > 210 || dip->MEtype < 200)
return 1.;
4645 if (infoPtr->nISR() + infoPtr->nFSRinProc() == 0
4646 && infoPtr->code() > 110 && infoPtr->code() < 130
4648 double d = emt.pT2();
4649 if (rad.pT2() < d) {d = rad.pT2(); cut =
true;}
4650 if (rec.pT2() < d) {d = rec.pT2(); cut =
true;}
4653 double dij = min(rad.pT2(),emt.pT2())
4654 * pow2(RRapPhi(rad,emt)) / vetoWeakDeltaR2;
4662 if (dip->MEtype == 200 || dip->MEtype == 205 ||
4663 dip->MEtype == 201 || dip->MEtype == 206) {
4664 dij = min(rad.pT2(),rec.pT2()) * pow2(RRapPhi(rad,rec))
4672 if (dip->MEtype == 200 || dip->MEtype == 205 ||
4673 dip->MEtype == 202 || dip->MEtype == 207 ||
4674 dip->MEtype == 203 || dip->MEtype == 208) {
4675 dij = min(emt.pT2(),rec.pT2()) * pow2(RRapPhi(emt,rec))
4686 if ( dip->MEtype != 201 && dip->MEtype != 202 && dip->MEtype != 203
4687 && dip->MEtype != 206 && dip->MEtype != 207 && dip->MEtype != 208)
4691 double scaleFactor2 = (rad + rec + emt).m2Calc() / (p3 + p4).m2Calc();
4692 double scaleFactor = sqrt(scaleFactor2);
4697 RotBstMatrix rot2to2frame;
4698 rot2to2frame.bstback(p3 + p4);
4699 p3.rotbst(rot2to2frame);
4700 p4.rotbst(rot2to2frame);
4701 rad.rotbst(rot2to2frame);
4702 emt.rotbst(rot2to2frame);
4703 rec.rotbst(rot2to2frame);
4704 recBef.rotbst(rot2to2frame);
4705 radBef.rotbst(rot2to2frame);
4708 RotBstMatrix rot2to3frame;
4709 rot2to3frame.bstback(rad + emt + rec);
4710 rad.rotbst(rot2to3frame);
4711 emt.rotbst(rot2to3frame);
4712 rec.rotbst(rot2to3frame);
4713 recBef.rotbst(rot2to3frame);
4714 radBef.rotbst(rot2to3frame);
4717 double sHat = (p3 + p4).m2Calc();
4718 double tHat = (radBef - p3).m2Calc();
4719 double uHat = (recBef - p3).m2Calc();
4721 double pT2 = dip->pT2;
4722 double Q2 = pT2 / (z*(1.-z));
4725 double wt = 2. * pT2 / z * (Q2+sHat)/sHat * (1. - kRad - kEmt) / 4.;
4726 if (dip->MEtype == 201 || dip->MEtype == 206)
4727 wt *= weakShowerMEs.getTchanneluGuGZME( p3, p4, rec, emt, rad)
4728 / weakShowerMEs.getTchanneluGuGME( sHat, tHat, uHat);
4729 else if (dip->MEtype == 202 || dip->MEtype == 207)
4730 wt *= weakShowerMEs.getTchannelududZME( p3, p4, emt, rec, rad)
4731 / weakShowerMEs.getTchanneluuuuME( sHat, tHat, uHat);
4732 else if (dip->MEtype == 203 || dip->MEtype == 208)
4733 wt *= weakShowerMEs.getTchannelududZME( p3, p4, emt, rec, rad)
4734 / weakShowerMEs.getTchannelududME( sHat, tHat, uHat);
4737 wt *= abs((-emt + p3).m2Calc()) / ((emt + rad).m2Calc()
4738 + abs((-p3 + emt).m2Calc()));
4742 if (wt > 1.) infoPtr->errorMsg(
"Warning in TimeShower::findMEcorrWeak: "
4743 "weight is above unity");
4752 void TimeShower::findAsymPol(
Event& event, TimeDipoleEnd* dip) {
4757 int iRad = dip->iRadiator;
4758 if (!doPhiPolAsym || event[iRad].
id() != 21)
return;
4761 int iMother =
event.iTopCopy(iRad);
4762 int iGrandM =
event[iMother].mother1();
4766 int statusGrandM =
event[iGrandM].status();
4767 bool isHardProc = (statusGrandM == -21 || statusGrandM == -31);
4769 if (event[iGrandM + 1].status() != statusGrandM)
return;
4770 if (event[iGrandM].isGluon() &&
event[iGrandM + 1].isGluon());
4771 else if (event[iGrandM].isQuark() &&
event[iGrandM + 1].isQuark());
4776 if (isHardProc) dip->iAunt = dip->iRecoiler;
4777 else dip->iAunt = (
event[iGrandM].daughter1() == iMother)
4778 ? event[iGrandM].daughter2() :
event[iGrandM].daughter1();
4782 double zProd = (isHardProc) ? 0.5 : event[iRad].e()
4783 / (
event[iRad].e() +
event[dip->iAunt].e());
4784 if (event[iGrandM].isGluon()) dip->asymPol = pow2( (1. - zProd)
4785 / (1. - zProd * (1. - zProd) ) );
4786 else dip->asymPol = 2. * (1. - zProd) / (1. + pow2(1. - zProd) );
4789 if (dip->flavour == 21) dip->asymPol *= pow2( (1. - dip->z)
4790 / (1. - dip->z * (1. - dip->z) ) );
4791 else dip->asymPol *= -2. * dip->z *( 1. - dip->z )
4792 / (1. - 2. * dip->z * (1. - dip->z) );
4800 void TimeShower::list(ostream& os)
const {
4803 os <<
"\n -------- PYTHIA TimeShower Dipole Listing ----------------"
4804 <<
"------------------------------------------------------- \n \n "
4805 <<
" i rad rec pTmax col chg gam weak oni hv is"
4806 <<
"r sys sysR type MErec mix ord spl ~gR pol \n"
4807 << fixed << setprecision(3);
4810 for (
int i = 0; i < int(dipEnd.size()); ++i)
4811 os << setw(5) << i << setw(7) << dipEnd[i].iRadiator
4812 << setw(7) << dipEnd[i].iRecoiler << setw(12) << dipEnd[i].pTmax
4813 << setw(5) << dipEnd[i].colType << setw(5) << dipEnd[i].chgType
4814 << setw(5) << dipEnd[i].gamType << setw(5) << dipEnd[i].weakType
4815 << setw(5) << dipEnd[i].isOctetOnium
4816 << setw(5) << dipEnd[i].isHiddenValley << setw(5) << dipEnd[i].isrType
4817 << setw(5) << dipEnd[i].system << setw(5) << dipEnd[i].systemRec
4818 << setw(5) << dipEnd[i].MEtype << setw(7) << dipEnd[i].iMEpartner
4819 << setw(8) << dipEnd[i].MEmix << setw(5) << dipEnd[i].MEorder
4820 << setw(5) << dipEnd[i].MEsplit << setw(5) << dipEnd[i].MEgluinoRec
4821 << setw(5) << dipEnd[i].weakPol <<
"\n";
4824 os <<
"\n -------- End PYTHIA TimeShower Dipole Listing ------------"
4825 <<
"-------------------------------------------------------" << endl;