9 #include "Pythia8/SpaceShower.h"
24 const int SpaceShower::MAXLOOPTINYPDF = 10;
27 const double SpaceShower::MCMIN = 1.2;
28 const double SpaceShower::MBMIN = 4.0;
32 const double SpaceShower::CTHRESHOLD = 2.0;
33 const double SpaceShower::BTHRESHOLD = 2.0;
37 const double SpaceShower::EVALPDFSTEP = 0.1;
40 const double SpaceShower::TINYPDF = 1e-10;
43 const double SpaceShower::TINYKERNELPDF = 1e-6;
46 const double SpaceShower::TINYPT2 = 0.25e-6;
50 const double SpaceShower::HEAVYPT2EVOL = 1.1;
55 const double SpaceShower::HEAVYXEVOL = 0.9;
60 const double SpaceShower::EXTRASPACEQ = 2.0;
63 const double SpaceShower::LAMBDA3MARGIN = 1.1;
66 const double SpaceShower::PT2MINWARN = 1.;
70 const double SpaceShower::LEPTONXMIN = 1e-10;
71 const double SpaceShower::LEPTONXMAX = 1. - 1e-10;
74 const double SpaceShower::LEPTONPT2MIN = 1.2;
77 const double SpaceShower::LEPTONFUDGE = 10.;
80 const double SpaceShower::WEAKPSWEIGHT = 5.;
83 const double SpaceShower::HEADROOMQ2G = 1.35;
84 const double SpaceShower::HEADROOMQ2Q = 1.15;
85 const double SpaceShower::HEADROOMG2Q = 1.35;
86 const double SpaceShower::HEADROOMG2G = 1.35;
87 const double SpaceShower::HEADROOMHQG = 1.35;
90 const double SpaceShower::REJECTFACTOR = 0.1;
93 const double SpaceShower::PROBLIMIT = 0.99;
99 void SpaceShower::init( BeamParticle* beamAPtrIn,
100 BeamParticle* beamBPtrIn) {
103 beamAPtr = beamAPtrIn;
104 beamBPtr = beamBPtrIn;
107 doQCDshower = settingsPtr->flag(
"SpaceShower:QCDshower");
108 doQEDshowerByQ = settingsPtr->flag(
"SpaceShower:QEDshowerByQ");
109 doQEDshowerByL = settingsPtr->flag(
"SpaceShower:QEDshowerByL");
110 doWeakShower = settingsPtr->flag(
"SpaceShower:WeakShower");
113 pTmaxMatch = settingsPtr->mode(
"SpaceShower:pTmaxMatch");
114 pTdampMatch = settingsPtr->mode(
"SpaceShower:pTdampMatch");
115 pTmaxFudge = settingsPtr->parm(
"SpaceShower:pTmaxFudge");
116 pTmaxFudgeMPI = settingsPtr->parm(
"SpaceShower:pTmaxFudgeMPI");
117 pTdampFudge = settingsPtr->parm(
"SpaceShower:pTdampFudge");
120 doRapidityOrder = settingsPtr->flag(
"SpaceShower:rapidityOrder");
121 doRapidityOrderMPI = settingsPtr->flag(
"SpaceShower:rapidityOrderMPI");
124 mc = max( MCMIN, particleDataPtr->m0(4));
125 mb = max( MBMIN, particleDataPtr->m0(5));
130 renormMultFac = settingsPtr->parm(
"SpaceShower:renormMultFac");
131 factorMultFac = settingsPtr->parm(
"SpaceShower:factorMultFac");
132 useFixedFacScale = settingsPtr->flag(
"SpaceShower:useFixedFacScale");
133 fixedFacScale2 = pow2(settingsPtr->parm(
"SpaceShower:fixedFacScale"));
136 alphaSvalue = settingsPtr->parm(
"SpaceShower:alphaSvalue");
137 alphaSorder = settingsPtr->mode(
"SpaceShower:alphaSorder");
138 alphaSnfmax = settingsPtr->mode(
"StandardModel:alphaSnfmax");
139 alphaSuseCMW = settingsPtr->flag(
"SpaceShower:alphaSuseCMW");
140 alphaS2pi = 0.5 * alphaSvalue / M_PI;
143 alphaS.init( alphaSvalue, alphaSorder, alphaSnfmax, alphaSuseCMW);
146 Lambda5flav = alphaS.Lambda5();
147 Lambda4flav = alphaS.Lambda4();
148 Lambda3flav = alphaS.Lambda3();
149 Lambda5flav2 = pow2(Lambda5flav);
150 Lambda4flav2 = pow2(Lambda4flav);
151 Lambda3flav2 = pow2(Lambda3flav);
155 useSamePTasMPI = settingsPtr->flag(
"SpaceShower:samePTasMPI");
156 if (useSamePTasMPI) {
159 if (beamAPtr->isGamma() && beamBPtr->isGamma()) {
160 pT0paramMode = settingsPtr->mode(
"PhotonPhoton:pT0parametrization");
161 pT0Ref = settingsPtr->parm(
"PhotonPhoton:pT0Ref");
162 ecmRef = settingsPtr->parm(
"PhotonPhoton:ecmRef");
163 ecmPow = settingsPtr->parm(
"PhotonPhoton:ecmPow");
164 pTmin = settingsPtr->parm(
"PhotonPhoton:pTmin");
167 = settingsPtr->mode(
"MultipartonInteractions:pT0parametrization");
168 pT0Ref = settingsPtr->parm(
"MultipartonInteractions:pT0Ref");
169 ecmRef = settingsPtr->parm(
"MultipartonInteractions:ecmRef");
170 ecmPow = settingsPtr->parm(
"MultipartonInteractions:ecmPow");
171 pTmin = settingsPtr->parm(
"MultipartonInteractions:pTmin");
175 pT0paramMode = settingsPtr->mode(
"SpaceShower:pT0parametrization");
176 pT0Ref = settingsPtr->parm(
"SpaceShower:pT0Ref");
177 ecmRef = settingsPtr->parm(
"SpaceShower:ecmRef");
178 ecmPow = settingsPtr->parm(
"SpaceShower:ecmPow");
179 pTmin = settingsPtr->parm(
"SpaceShower:pTmin");
183 sCM = m2( beamAPtr->p(), beamBPtr->p());
187 if (pT0paramMode == 0) pT0 = pT0Ref * pow(eCM / ecmRef, ecmPow);
188 else pT0 = pT0Ref + ecmPow * log (eCM / ecmRef);
191 double pTminAbs = sqrtpos(pow2(LAMBDA3MARGIN) * Lambda3flav2 / renormMultFac
193 if (pTmin < pTminAbs) {
195 ostringstream newPTmin;
196 newPTmin << fixed << setprecision(3) << pTmin;
197 infoPtr->errorMsg(
"Warning in SpaceShower::init: pTmin too low",
198 ", raised to " + newPTmin.str() );
199 infoPtr->setTooLowPTmin(
true);
203 alphaEMorder = settingsPtr->mode(
"SpaceShower:alphaEMorder");
206 alphaEM.init( alphaEMorder, settingsPtr);
209 pTminChgQ = settingsPtr->parm(
"SpaceShower:pTminchgQ");
210 pTminChgL = settingsPtr->parm(
"SpaceShower:pTminchgL");
214 pT2min = pow2(pTmin);
215 pT2minChgQ = pow2(pTminChgQ);
216 pT2minChgL = pow2(pTminChgL);
219 weakMode = settingsPtr->mode(
"SpaceShower:weakShowerMode");
220 pTweakCut = settingsPtr->parm(
"SpaceShower:pTminWeak");
221 pT2weakCut = pow2(pTweakCut);
222 weakEnhancement = settingsPtr->parm(
"WeakShower:enhancement");
223 singleWeakEmission = settingsPtr->flag(
"WeakShower:singleEmission");
224 vetoWeakJets = settingsPtr->flag(
"WeakShower:vetoWeakJets");
225 vetoWeakDeltaR2 = pow2(settingsPtr->parm(
"weakShower:vetoWeakDeltaR"));
226 weakExternal = settingsPtr->flag(
"WeakShower:externalSetup");
229 doMEcorrections = settingsPtr->flag(
"SpaceShower:MEcorrections");
230 doMEafterFirst = settingsPtr->flag(
"SpaceShower:MEafterFirst");
231 doPhiPolAsym = settingsPtr->flag(
"SpaceShower:phiPolAsym");
232 doPhiPolAsymHard = settingsPtr->flag(
"SpaceShower:phiPolAsymHard");
233 doPhiIntAsym = settingsPtr->flag(
"SpaceShower:phiIntAsym");
234 strengthIntAsym = settingsPtr->parm(
"SpaceShower:strengthIntAsym");
235 nQuarkIn = settingsPtr->mode(
"SpaceShower:nQuarkIn");
238 doDipoleRecoil = settingsPtr->flag(
"SpaceShower:dipoleRecoil");
239 if (doDipoleRecoil) doPhiIntAsym =
false;
242 mZ = particleDataPtr->m0(23);
243 gammaZ = particleDataPtr->mWidth(23);
244 thetaWRat = 1. / (16. * coupSMPtr->sin2thetaW()
245 * coupSMPtr->cos2thetaW());
246 mW = particleDataPtr->m0(24);
247 gammaW = particleDataPtr->mWidth(24);
250 doSecondHard = settingsPtr->flag(
"SecondHard:generate");
253 doMPI = settingsPtr->flag(
"PartonLevel:MPI");
258 = settingsPtr->mode(
"MultipartonInteractions:enhanceScreening");
259 if (!useSamePTasMPI) enhanceScreening = 0;
262 hasUserHooks = (userHooksPtr != 0);
263 canVetoEmission = hasUserHooks && userHooksPtr->canVetoISREmission();
266 hasWeaklyRadiated =
false;
270 canEnhanceEmission = hasUserHooks && userHooksPtr->canEnhanceEmission();
271 canEnhanceTrial = hasUserHooks && userHooksPtr->canEnhanceTrial();
272 if (canEnhanceEmission && canEnhanceTrial) {
273 infoPtr->errorMsg(
"Error in SpaceShower::init: Enhance for both actual "
274 "and trial emissions not possible. Both switched off.");
275 canEnhanceEmission =
false;
276 canEnhanceTrial =
false;
280 splittingNameSel =
"";
281 splittingNameNow =
"";
282 enhanceFactors.clear();
286 doUncertainties = settingsPtr->flag(
"UncertaintyBands:doVariations")
287 && initUncertainties();
288 doUncertaintiesNow = doUncertainties;
289 uVarNflavQ = settingsPtr->mode(
"UncertaintyBands:nFlavQ");
290 uVarMPIshowers = settingsPtr->flag(
"UncertaintyBands:MPIshowers");
291 cNSpTmin = settingsPtr->parm(
"UncertaintyBands:cNSpTmin");
292 uVarpTmin2 = pow2(pT0Ref);
293 uVarpTmin2 *= settingsPtr->parm(
"UncertaintyBands:FSRpTmin2Fac");
294 overFactor = settingsPtr->parm(
"UncertaintyBands:overSampleISR");
297 doPartonVertex = settingsPtr->flag(
"PartonVertex:setVertex")
298 && (partonVertexPtr != 0);
307 bool SpaceShower::limitPTmax(
Event& event,
double Q2Fac,
double Q2Ren) {
310 bool dopTlimit =
false;
311 dopTlimit1 = dopTlimit2 =
false;
313 if (pTmaxMatch == 1) dopTlimit = dopTlimit1 = dopTlimit2 =
true;
314 else if (pTmaxMatch == 2) dopTlimit = dopTlimit1 = dopTlimit2 =
false;
317 else if (infoPtr->isNonDiffractive() || infoPtr->isDiffractiveA()
318 || infoPtr->isDiffractiveB() || infoPtr->isDiffractiveC() )
319 dopTlimit = dopTlimit1 = dopTlimit2 =
true;
325 int iBegin = 5 + beamOffset;
326 for (
int i = iBegin; i <
event.size(); ++i) {
327 if (event[i].status() == -21) ++n21;
329 int idAbs =
event[i].idAbs();
330 if (idAbs <= 5 || idAbs == 21 || idAbs == 22) dopTlimit1 =
true;
331 if ( (event[i].col() != 0 || event[i].acol() != 0)
332 && idAbs > 5 && idAbs != 21 ) ++nHeavyCol;
333 }
else if (n21 == 2) {
334 int idAbs =
event[i].idAbs();
335 if (idAbs <= 5 || idAbs == 21 || idAbs == 22) dopTlimit2 =
true;
338 dopTlimit = (doSecondHard) ? (dopTlimit1 && dopTlimit2) : dopTlimit1;
344 if (!dopTlimit1 && (pTdampMatch == 1 || pTdampMatch == 2)) {
346 pT2damp = pow2(pTdampFudge) * ((pTdampMatch == 1) ? Q2Fac : Q2Ren);
348 if (!dopTlimit1 && nHeavyCol > 1 && (pTdampMatch == 3 || pTdampMatch == 4)) {
350 pT2damp = pow2(pTdampFudge) * ((pTdampMatch == 3) ? Q2Fac : Q2Ren);
363 void SpaceShower::prepare(
int iSys,
Event& event,
bool limitPTmaxIn) {
369 hasWeaklyRadiated =
false;
373 int in1 = partonSystemsPtr->getInA(iSys);
374 int in2 = partonSystemsPtr->getInB(iSys);
377 bool canRadiate1 = !(
event[in1].isRescatteredIncoming());
378 bool canRadiate2 = !(
event[in2].isRescatteredIncoming());
381 if (iSys == 0) dipEnd.resize(0);
382 if (iSys == 0) idResFirst = 0;
383 if (iSys == 1) idResSecond = 0;
386 int MEtype = findMEtype( iSys, event,
false);
389 if (doSecondHard && iSys == 0) limitPTmaxIn = dopTlimit1;
390 if (doSecondHard && iSys == 1) limitPTmaxIn = dopTlimit2;
393 double pTmax1 = (limitPTmaxIn) ? event[in1].scale() : eCM;
394 double pTmax2 = (limitPTmaxIn) ? event[in2].scale() : eCM;
395 if ( limitPTmaxIn && (iSys == 0 || (iSys == 1 && doSecondHard)) ) {
396 pTmax1 *= pTmaxFudge;
397 pTmax2 *= pTmaxFudge;
398 }
else if (limitPTmaxIn && iSys > 0) {
399 pTmax1 *= pTmaxFudgeMPI;
400 pTmax2 *= pTmaxFudgeMPI;
406 int colType1 =
event[in1].colType();
409 int iColPartner = (doDipoleRecoil)
410 ? findColPartner(event, in1, in2, iSys) : 0;
411 int idColPartner = (iColPartner != 0) ? event[iColPartner].
id() : 0;
412 dipEnd.push_back( SpaceDipoleEnd( iSys, 1, in1, in2, pTmax1,
413 colType1, 0, 0, MEtype, canRadiate2, 0, iColPartner, idColPartner) );
415 int colType2 =
event[in2].colType();
418 int iColPartner = (doDipoleRecoil)
419 ? findColPartner(event, in2, in1, iSys) : 0;
420 int idColPartner = (iColPartner != 0) ? event[iColPartner].
id() : 0;
421 dipEnd.push_back( SpaceDipoleEnd( iSys, 2, in2, in1, pTmax2,
422 colType2, 0, 0, MEtype, canRadiate1, 0, iColPartner, idColPartner) );
428 if (doQEDshowerByQ || doQEDshowerByL) {
429 int chgType1 = ( (
event[in1].isQuark() && doQEDshowerByQ)
430 || (event[in1].isLepton() && doQEDshowerByL) )
431 ?
event[in1].chargeType() : 0;
433 if (event[in1].
id() == 22 && doQEDshowerByQ) chgType1 = 22 ;
434 if (canRadiate1) dipEnd.push_back( SpaceDipoleEnd( iSys, -1,
435 in1, in2, pTmax1, 0, chgType1, 0, MEtype, canRadiate2) );
436 int chgType2 = ( (
event[in2].isQuark() && doQEDshowerByQ)
437 || (event[in2].isLepton() && doQEDshowerByL) )
438 ?
event[in2].chargeType() : 0;
440 if (event[in2].
id() == 22 && doQEDshowerByQ) chgType2 = 22 ;
441 if (canRadiate2) dipEnd.push_back( SpaceDipoleEnd( iSys, -2,
442 in2, in1, pTmax2, 0, chgType2, 0, MEtype, canRadiate1) );
448 if (doWeakShower && iSys == 0) {
452 int MEtypeWeak = findMEtype( iSys, event,
true);
453 if (MEtypeWeak == 201 || MEtypeWeak == 202 || MEtypeWeak == 203 ||
454 MEtypeWeak == 206 || MEtypeWeak == 207 || MEtypeWeak == 208) {
457 if (event[in1].
id() != event[in2].
id()) {
458 if (event[in1].
id() == event[in1 + 2].
id()) tChannel =
true;
459 else if (event[in2].
id() == event[in1 + 2].
id()) tChannel =
false;
461 else tChannel = (rndmPtr->flat() < 0.5);
463 }
else tChannel = (rndmPtr->flat() < 0.5);
467 int weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
468 if (event[in1].idAbs() < 20) event[in1].pol(weakPol);
470 if ( (weakMode == 0 || weakMode == 1) && weakPol == -1
471 &&
event[in1].isQuark() )
472 dipEnd.push_back( SpaceDipoleEnd( iSys, 1, in1, in2, pTmax1,
473 0, 0, 1, MEtypeWeak, canRadiate2, weakPol) );
474 if ( (weakMode == 0 || weakMode == 2)
475 && (event[in1].isQuark() || event[in1].isLepton()) )
476 dipEnd.push_back( SpaceDipoleEnd( iSys, 1, in1, in2, pTmax1,
477 0, 0, 2, MEtypeWeak + 5, canRadiate2, weakPol) );
481 if (event[in1].
id() != - event[in2].
id())
482 weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
483 if (event[in2].idAbs() < 20) event[in2].pol(weakPol);
485 if ( (weakMode == 0 || weakMode == 1) && weakPol == -1
486 &&
event[in2].isQuark())
487 dipEnd.push_back( SpaceDipoleEnd( iSys, 2, in2, in1, pTmax2,
488 0, 0, 1, MEtypeWeak, canRadiate1, weakPol) );
489 if ( (weakMode == 0 || weakMode == 2) &&
490 (event[in2].isQuark() || event[in2].isLepton()) )
491 dipEnd.push_back( SpaceDipoleEnd( iSys, 2, in2, in1, pTmax2,
492 0, 0, 2, MEtypeWeak + 5, canRadiate1, weakPol) );
497 vector<pair<int,int> > weakDipoles = infoPtr->getWeakDipoles();
498 vector<int> weakModes = infoPtr->getWeakModes();
499 weakMomenta = infoPtr->getWeakMomenta();
502 for (
int i = 0; i < int(weakDipoles.size()); ++i) {
505 if (event[weakDipoles[i].first].status() < 0) {
507 int iRadLocal = weakDipoles[i].first;
508 int iRecLocal = weakDipoles[i].second;
509 int side = (iRadLocal == 3) ? 1 : 2;
510 double pTmax = (side == 1) ? pTmax1 : pTmax2;
514 if (weakModes[weakDipoles[i].first] == 1) MEtypeWeak = 200;
515 else if (weakModes[weakDipoles[i].first] == 2) MEtypeWeak = 201;
516 else if (weakModes[weakDipoles[i].first] == 3) MEtypeWeak = 202;
517 else MEtypeWeak = 203;
521 int weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
522 if (event[weakDipoles[i].first].intPol() != 9)
523 weakPol = event[weakDipoles[i].first].intPol();
524 event[weakDipoles[i].first].pol(weakPol);
527 if ( (weakMode == 0 || weakMode == 1) && weakPol == -1)
528 dipEnd.push_back( SpaceDipoleEnd( iSys, side, iRadLocal, iRecLocal,
529 pTmax, 0, 0, 1, MEtypeWeak,
true, weakPol) );
530 if (weakMode == 0 || weakMode == 2)
531 dipEnd.push_back( SpaceDipoleEnd( iSys, side, iRadLocal, iRecLocal,
532 pTmax, 0, 0, 2, MEtypeWeak + 5,
true, weakPol) );
540 if (iSys == 0 && infoPtr->hasHistory()) {
541 double zNow = infoPtr->zNowISR();
542 double pT2Now = infoPtr->pT2NowISR();
543 for (
int iDipEnd = 0; iDipEnd < int(dipEnd.size()); ++iDipEnd) {
544 dipEnd[iDipEnd].zOld = zNow;
545 dipEnd[iDipEnd].pT2Old = pT2Now;
546 ++dipEnd[iDipEnd].nBranch;
556 double SpaceShower::pTnext(
Event& event,
double pTbegAll,
double pTendAll,
557 int nRadIn,
bool doTrialIn) {
560 sCM = m2( beamAPtr->p(), beamBPtr->p());
566 double pT2sel = pow2(pTendAll);
572 doTrialNow = doTrialIn;
573 canEnhanceET = (!doTrialNow && canEnhanceEmission)
574 || ( doTrialNow && canEnhanceTrial);
577 splittingNameSel =
"";
578 splittingNameNow =
"";
579 enhanceFactors.clear();
580 if (hasUserHooks) userHooksPtr->setEnhancedTrial(0., 1.);
583 for (
int iDipEnd = 0; iDipEnd < int(dipEnd.size()); ++iDipEnd) {
585 dipEndNow = &dipEnd[iDipEnd];
586 iSysNow = dipEndNow->system;
588 dipEndNow->pAccept = 1.0;
589 double pTbegDip = min( pTbegAll, dipEndNow->pTmax );
592 double pT2begDip = pow2(pTbegDip);
593 if (pT2begDip > pT2sel && ( dipEndNow->colType != 0
594 || dipEndNow->chgType != 0 || dipEndNow->weakType != 0) ) {
595 double pT2endDip = 0.;
598 if (dipEndNow->colType != 0)
599 pT2endDip = max( pT2sel, pT2min );
600 else if (abs(dipEndNow->weakType) != 0)
601 pT2endDip = max( pT2sel, pT2weakCut);
602 else if (abs(dipEndNow->chgType) != 3 && dipEndNow->chgType != 0)
603 pT2endDip = max( pT2sel, pT2minChgQ );
605 pT2endDip = max( pT2sel, pT2minChgL );
608 sideA = ( abs(dipEndNow->side) == 1 );
609 BeamParticle& beamNow = (sideA) ? *beamAPtr : *beamBPtr;
610 BeamParticle& beamRec = (sideA) ? *beamBPtr : *beamAPtr;
611 iNow = beamNow[iSysNow].iPos();
612 iRec = beamRec[iSysNow].iPos();
613 idDaughter = beamNow[iSysNow].id();
614 xDaughter = beamNow[iSysNow].x();
615 x1Now = (sideA) ? xDaughter : beamRec[iSysNow].x();
616 x2Now = (sideA) ? beamRec[iSysNow].x() : xDaughter;
619 if ( beamNow.isGamma() && !(beamNow.resolvedGamma()) )
continue;
622 m2Rec = (dipEndNow->normalRecoil) ? 0. : event[iRec].m2();
623 m2Dip = x1Now * x2Now * sCM + m2Rec;
626 m2ColPair = (dipEndNow->iColPartner == 0) ? 0.
627 : m2( event[iNow].p(),
event[dipEndNow->iColPartner].p() );
628 mColPartner = (dipEndNow->iColPartner == 0) ? 0.
629 : event[dipEndNow->iColPartner].m();
630 m2ColPartner = pow2(mColPartner);
633 if (m2ColPair < 0.)
return 0.;
636 if (pT2begDip > pT2endDip) {
637 if (dipEndNow->colType != 0) pT2nextQCD( pT2begDip, pT2endDip);
638 else if (dipEndNow->chgType != 0 || idDaughter == 22)
639 pT2nextQED( pT2begDip, pT2endDip);
640 else if (dipEndNow->weakType != 0) pT2nextWeak( pT2begDip, pT2endDip);
643 if (dipEndNow->pT2 > pT2sel) {
644 pT2sel = dipEndNow->pT2;
647 dipEndSel = dipEndNow;
648 splittingNameSel = splittingNameNow;
656 return (dipEndSel == 0) ? 0. : sqrt(pT2sel);
663 void SpaceShower::pT2nextQCD(
double pT2begDip,
double pT2endDip) {
666 BeamParticle&
beam = (sideA) ? *beamAPtr : *beamBPtr;
667 bool isGluon = (idDaughter == 21);
668 bool isValence = beam[iSysNow].isValence();
669 int MEtype = dipEndNow->MEtype;
670 int iColPartner = dipEndNow->iColPartner;
671 int idColPartner = dipEndNow->idColPartner;
672 double pT2 = pT2begDip;
673 double xMaxAbs = beam.xMax(iSysNow);
674 double zMinAbs = xDaughter / xMaxAbs;
676 infoPtr->errorMsg(
"Warning in SpaceShower::pT2nextQCD: "
682 double idMassive = 0;
683 if ( abs(idDaughter) == 4 ) idMassive = 4;
684 if ( abs(idDaughter) == 5 ) idMassive = 5;
685 bool isMassive = (idMassive > 0);
686 double m2Massive = 0.;
688 double zMaxMassive = 1.;
689 double m2Threshold = pT2;
693 m2Massive = (idMassive == 4) ? m2c : m2b;
694 if (pT2 < HEAVYPT2EVOL * m2Massive)
return;
695 if (iColPartner == 0) {
696 mRatio = sqrt( m2Massive / m2Dip );
697 zMaxMassive = (1. - mRatio) / ( 1. + mRatio * (1. - mRatio) );
699 double m2Red = m2ColPair - m2ColPartner;
700 zMaxMassive = m2Red / (m2Red + m2Massive);
702 if (xDaughter > HEAVYXEVOL * zMaxMassive * xMaxAbs)
return;
705 m2Threshold = (idMassive == 4) ? min( pT2, CTHRESHOLD * m2c)
706 : min( pT2, BTHRESHOLD * m2b);
712 double Lambda2 = Lambda3flav2;
713 double pT2minNow = pT2endDip;
718 double zRootMax = 0.;
719 double zRootMin = 0.;
724 double g2Qenhance = 0.;
725 double xPDFdaughter = 0.;
726 double xPDFmother[21] = {0.};
727 double xPDFgMother = 0.;
728 double xPDFmotherSum = 0.;
729 double kernelPDF = 0.;
734 double m2Sister = 0.;
737 bool needNewPDF =
true;
741 doUncertaintiesNow = doUncertainties;
742 if (!uVarMPIshowers && iSysNow != 0) doUncertaintiesNow =
false;
743 double overFac = doUncertaintiesNow ? overFactor : 1.0;
746 double coefColRec = (iColPartner != 0 && idColPartner == 21) ? 9./8. : 1.;
749 bool isEnhancedQ2QG, isEnhancedG2QQ, isEnhancedQ2GQ, isEnhancedG2GG;
750 isEnhancedQ2QG = isEnhancedG2QQ = isEnhancedQ2GQ = isEnhancedG2GG =
false;
751 double enhanceNow = 1.;
755 int loopTinyPDFdau = 0;
756 bool hasTinyPDFdau =
false;
761 isEnhancedQ2QG = isEnhancedG2QQ = isEnhancedQ2GQ = isEnhancedG2GG =
false;
767 if (hasTinyPDFdau) ++loopTinyPDFdau;
768 if (loopTinyPDFdau > MAXLOOPTINYPDF) {
769 infoPtr->errorMsg(
"Warning in SpaceShower::pT2nextQCD: "
770 "small daughter PDF");
777 if (needNewPDF || pT2 < EVALPDFSTEP * pT2PDF) {
779 hasTinyPDFdau =
false;
784 pT2minNow = max( m2b, pT2endDip);
786 Lambda2 = Lambda5flav2;
787 }
else if (pT2 > m2c) {
789 pT2minNow = max( m2c, pT2endDip);
791 Lambda2 = Lambda4flav2;
794 pT2minNow = pT2endDip;
796 Lambda2 = Lambda3flav2;
800 Lambda2 /= renormMultFac;
803 if (iColPartner == 0) zMaxAbs = 1. - 0.5 * (pT2minNow / m2Dip)
804 * ( sqrt( 1. + 4. * m2Dip / pT2minNow ) - 1. );
806 double m2Red = m2ColPair - m2ColPartner;
807 double pT2Ext = sqrt(pT2minNow * (pT2minNow + 4. * m2ColPartner));
808 zMaxAbs = (m2Red + 0.5 * (pT2minNow - pT2Ext))
809 / (m2Red + pT2minNow * (1. - m2ColPartner / m2Red));
811 if (isMassive) zMaxAbs = min( zMaxAbs, zMaxMassive);
814 if (zMinAbs > zMaxAbs) {
815 if (nFlavour == 3 || (idMassive == 4 && nFlavour == 4)
816 || idMassive == 5)
return;
817 pT2 = (nFlavour == 4) ? m2c : m2b;
822 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
823 xPDFdaughter = beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2);
824 if (xPDFdaughter < TINYPDF) {
825 xPDFdaughter = TINYPDF;
826 hasTinyPDFdau =
true;
831 g2gInt = overFac * HEADROOMG2G * 6.
832 * log(zMaxAbs * (1.-zMinAbs) / (zMinAbs * (1.-zMaxAbs)));
833 if (doMEcorrections) g2gInt *= calcMEmax(MEtype, 21, 21);
835 if (canEnhanceET) g2gInt *= userHooksPtr->enhanceFactor(
"isr:G2GG");
836 q2gInt = overFac * HEADROOMQ2G * (16./3.)
837 * (1./sqrt(zMinAbs) - 1./sqrt(zMaxAbs));
838 if (doMEcorrections) q2gInt *= calcMEmax(MEtype, 1, 21);
840 if (canEnhanceET) q2gInt *= userHooksPtr->enhanceFactor(
"isr:Q2GQ");
844 for (
int i = -nQuarkIn; i <= nQuarkIn; ++i) {
848 xPDFmother[i+10] = beam.xfISR(iSysNow, i, xDaughter, pdfScale2);
849 xPDFmotherSum += xPDFmother[i+10];
854 kernelPDF = g2gInt + q2gInt * xPDFmotherSum / xPDFdaughter;
858 }
else if (isValence) {
859 zRootMin = (1. + sqrt(zMinAbs)) / (1. - sqrt(zMinAbs));
860 zRootMax = (1. + sqrt(zMaxAbs)) / (1. - sqrt(zMaxAbs));
861 q2qInt = coefColRec * overFac * (8./3.) * log( zRootMax / zRootMin );
862 if (doMEcorrections) q2qInt *= calcMEmax(MEtype, 1, 1);
864 if (canEnhanceET) q2qInt *= userHooksPtr->enhanceFactor(
"isr:Q2QG");
869 q2qInt = coefColRec * overFac * HEADROOMQ2Q * (8./3.)
870 * log( (1. - zMinAbs) / (1. - zMaxAbs) );
871 if (doMEcorrections) q2qInt *= calcMEmax(MEtype, 1, 1);
873 if (canEnhanceET) q2qInt *= userHooksPtr->enhanceFactor(
"isr:Q2QG");
874 g2qInt = overFac * HEADROOMG2Q * 0.5 * (zMaxAbs - zMinAbs);
875 if (doMEcorrections) g2qInt *= calcMEmax(MEtype, 21, 1);
877 if (canEnhanceET) g2qInt *= userHooksPtr->enhanceFactor(
"isr:G2QQ");
881 if (beam.isGamma() && isMassive) q2qInt *= HEADROOMHQG;
885 if (alphaSorder == 0) g2Qenhance = log(pT2/m2Massive)
886 / log(m2Threshold/m2Massive);
888 double m2log = log( m2Massive / Lambda2);
889 g2Qenhance = log( log(pT2/Lambda2) / m2log )
890 / log( log(m2Threshold/Lambda2) / m2log );
892 g2qInt *= g2Qenhance;
896 xPDFgMother = beam.xfISR(iSysNow, 21, xDaughter, pdfScale2);
899 kernelPDF = q2qInt + g2qInt * xPDFgMother / xPDFdaughter;
905 if (kernelPDF < TINYKERNELPDF)
return;
912 if (alphaSorder == 0) {
913 pT2 = (pT2 + pT20) * pow( rndmPtr->flat(),
914 1. / (alphaS2pi * kernelPDF)) - pT20;
917 }
else if (alphaSorder == 1) {
918 pT2 = Lambda2 * pow( (pT2 + pT20) / Lambda2,
919 pow(rndmPtr->flat(), b0 / kernelPDF) ) - pT20;
924 pT2 = Lambda2 * pow( (pT2 + pT20) / Lambda2,
925 pow(rndmPtr->flat(), b0 / kernelPDF) ) - pT20;
926 Q2alphaS = renormMultFac * max( pT2 + pT20,
927 pow2(LAMBDA3MARGIN) * Lambda3flav2);
928 }
while (alphaS.alphaS2OrdCorr(Q2alphaS) < rndmPtr->flat()
935 if (idMassive == 5 && pT2 < m2Threshold) {
936 pT2nearThreshold( beam, m2Massive, m2Threshold, xMaxAbs,
937 zMinAbs, zMaxMassive, iColPartner );
941 }
else if (nFlavour == 5 && pT2 < m2b) {
947 }
else if (idMassive == 4 && pT2 < m2Threshold) {
948 pT2nearThreshold( beam, m2Massive, m2Threshold, xMaxAbs,
949 zMinAbs, zMaxMassive, iColPartner );
953 }
else if (nFlavour == 4 && pT2 < m2c) {
959 }
else if (pT2 < pT2endDip)
return;
965 if (rndmPtr->flat() * kernelPDF < g2gInt) {
968 z = 1. / ( 1. + ((1. - zMinAbs) / zMinAbs) * pow( (zMinAbs *
969 (1. - zMaxAbs)) / (zMaxAbs * (1. - zMinAbs)), rndmPtr->flat() ) );
970 wt = pow2( 1. - z * (1. - z));
972 if (iColPartner != 0 && idColPartner != 21)
973 wt *= (m2ColPair * pow2(1. - z) + z * pT2 * 8./9.)
974 / (m2ColPair * pow2(1. - z) + z * pT2);
978 nameNow =
"isr:G2GG";
980 double enhance = userHooksPtr->enhanceFactor(nameNow);
982 enhanceNow = enhance;
983 isEnhancedG2GG =
true;
989 double temp = xPDFmotherSum * rndmPtr->flat();
990 idMother = -nQuarkIn - 1;
991 do { temp -= xPDFmother[(++idMother) + 10]; }
992 while (temp > 0. && idMother < nQuarkIn);
994 z = (zMinAbs * zMaxAbs) / pow2( sqrt(zMinAbs) + rndmPtr->flat()
995 * ( sqrt(zMaxAbs)- sqrt(zMinAbs) ));
996 wt = 0.5 * (1. + pow2(1. - z)) * sqrt(z)
997 * xPDFdaughter / xPDFmother[idMother + 10];
1001 nameNow =
"isr:Q2GQ";
1003 double enhance = userHooksPtr->enhanceFactor(nameNow);
1004 if (enhance != 1.) {
1005 enhanceNow = enhance;
1006 isEnhancedQ2GQ =
true;
1016 if (isValence || rndmPtr->flat() * kernelPDF < q2qInt) {
1017 idMother = idDaughter;
1021 double zTmp = zRootMin * pow(zRootMax / zRootMin, rndmPtr->flat() );
1022 z = pow2( (1. - zTmp) / (1. + zTmp) );
1024 z = 1. - (1. - zMinAbs) * pow( (1. - zMaxAbs) / (1. - zMinAbs),
1028 wt = 0.5 * (1. + pow2(z));
1030 wt = 0.5 * (1. + pow2(z)) - z * pow2(1.-z) * m2Massive / pT2;
1032 if (isValence) wt *= sqrt(z);
1034 else wt /= HEADROOMQ2Q;
1036 if (beam.isGamma() && isMassive) wt /= HEADROOMHQG;
1038 if (iColPartner != 0 && idColPartner == 21)
1039 wt *= (m2ColPair * pow2(1. - z) + z * pT2 * 9./8.)
1040 / ((m2ColPair * pow2(1. - z) + z * pT2) * coefColRec);
1042 nameNow =
"isr:Q2QG";
1044 double enhance = userHooksPtr->enhanceFactor(nameNow);
1045 if (enhance != 1.) {
1046 enhanceNow = enhance;
1047 isEnhancedQ2QG =
true;
1054 idSister = - idDaughter;
1055 z = zMinAbs + rndmPtr->flat() * (zMaxAbs - zMinAbs);
1057 wt = (pow2(z) + pow2(1.-z)) * xPDFdaughter / xPDFgMother;
1059 wt = (pow2(z) + pow2(1.-z) + 2. * z * (1.-z) * m2Massive / pT2)
1060 * xPDFdaughter / (xPDFgMother * g2Qenhance) ;
1065 if (abs(idSister) < 4) nameNow =
"isr:G2QQ";
1066 else if (abs(idSister) == 4) nameNow =
"isr:G2QQ:cc";
1067 else nameNow =
"isr:G2QQ:bb";
1069 double enhance = userHooksPtr->enhanceFactor(nameNow);
1070 if (enhance != 1.) {
1071 enhanceNow = enhance;
1072 isEnhancedG2QQ =
true;
1082 Q2 = pT2 / (1. - z);
1083 xMother = xDaughter / z;
1086 if (!dipEndNow->normalRecoil) {
1087 if (sideA) xMother += (m2Rec / (x2Now * sCM)) * (1. / z - 1.);
1088 else xMother += (m2Rec / (x1Now * sCM)) * (1. / z - 1.);
1090 if (xMother > xMaxAbs) { wt = 0.;
continue; }
1093 mSister = particleDataPtr->m0(idSister);
1094 m2Sister = pow2(mSister);
1095 if (iColPartner == 0) {
1096 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Sister) / m2Dip;
1098 double tmpRat = z * (Q2 + m2Sister) / (m2ColPair - m2ColPartner);
1099 pT2corr = ((1. - z) * Q2 - z * m2Sister) * (1. - tmpRat)
1100 - m2ColPartner * pow2(tmpRat);
1102 if (pT2corr < TINYPT2) { wt = 0.;
continue; }
1106 if ( iSysNow == 0 && doRapidityOrder && dipEndNow->nBranch > 0
1107 && pT2 > pow2( (1. - z) / (z * (1. - dipEndNow->zOld)) )
1108 * dipEndNow->pT2Old ) { wt = 0.;
continue; }
1112 if ( iSysNow != 0 && doRapidityOrderMPI && dipEndNow->nBranch > 0
1113 && pT2 > pow2( (1. - z) / (z * (1. - dipEndNow->zOld)) )
1114 * dipEndNow->pT2Old ) { wt = 0.;
continue; }
1118 if ( isGluon && ( abs(idMother) == 4 || abs(idMother) == 5 )) {
1119 double m2QQsister = EXTRASPACEQ * 4. * m2Sister;
1120 double pT2QQcorr = 0.;
1121 if (iColPartner == 0) {
1122 pT2QQcorr = Q2 - z * (m2Dip + Q2) * (Q2 + m2QQsister) / m2Dip;
1124 double tmpRat = z * (Q2 + m2QQsister) / (m2ColPair - m2ColPartner);
1125 pT2QQcorr = ((1. - z) * Q2 - z * m2QQsister) * (1. - tmpRat)
1126 - m2ColPartner * pow2(tmpRat);
1128 if (pT2QQcorr < TINYPT2) { wt = 0.;
continue; }
1132 if ( beam.isGamma() ) {
1133 BeamParticle& beamOther = (sideA) ? *beamBPtr : *beamAPtr;
1134 if ( !beamOther.resolvedGamma() ) {
1136 if ( !beam.roomFor1Remnant( idMother, xMother, eCM) ) {
1142 if ( !beamOther.roomFor2Remnants( idMother, xMother, eCM ) ) {
1150 if (doMEcorrections) wt *= calcMEcorr(MEtype, idMother, idDaughter,
1151 m2Dip, z, Q2, m2Sister) / calcMEmax(MEtype, idMother, idDaughter);
1154 if (dopTdamp && iSysNow == 0 && MEtype == 0 && nRad == 0)
1155 wt *= pT2damp / (pT2 + pT2damp);
1159 if (enhanceScreening == 2) {
1160 int nSysNow = infoPtr->nMPI() + infoPtr->nISR() + 1;
1161 double WTscreen = pow2( (pT2 + pT20) / (pT2 + nSysNow * pT20) );
1166 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1167 double xPDFdaughterNew = max ( TINYPDF,
1168 beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2) );
1169 double xPDFmotherNew =
1170 beam.xfISR(iSysNow, idMother, xMother, pdfScale2);
1171 wt *= xPDFmotherNew / xPDFdaughterNew;
1174 if (wt > 0. && pT2 > pT2min && doUncertaintiesNow ) {
1175 dipEndNow->pAccept = wt;
1180 if (wt > 1. && pT2 > PT2MINWARN) infoPtr->errorMsg(
"Warning in "
1181 "SpaceShower::pT2nextQCD: weight above unity");
1184 }
while (wt < rndmPtr->flat()) ;
1187 splittingNameNow = nameNow;
1189 if (isEnhancedQ2QG) storeEnhanceFactor(pT2,
"isr:Q2QG", enhanceNow);
1190 if (isEnhancedG2QQ) storeEnhanceFactor(pT2,
"isr:G2QQ", enhanceNow);
1191 if (isEnhancedQ2GQ) storeEnhanceFactor(pT2,
"isr:Q2GQ", enhanceNow);
1192 if (isEnhancedG2GG) storeEnhanceFactor(pT2,
"isr:G2GG", enhanceNow);
1196 dipEndNow->store( idDaughter,idMother, idSister, x1Now, x2Now, m2Dip,
1197 pT2, z, xMother, Q2, mSister, m2Sister, pT2corr, iColPartner, m2ColPair,
1210 void SpaceShower::pT2nearThreshold( BeamParticle& beam,
1211 double m2Massive,
double m2Threshold,
double xMaxAbs,
1212 double zMinAbs,
double zMaxMassive,
int iColPartner) {
1215 double Lambda2 = (abs(idDaughter) == 4) ? Lambda4flav2 : Lambda5flav2;
1216 Lambda2 /= renormMultFac;
1217 double logM2Lambda2 = (alphaSorder > 0) ? log( m2Massive / Lambda2 ) : 1.;
1218 pdfScale2 = (useFixedFacScale) ? fixedFacScale2
1219 : factorMultFac * m2Threshold;
1220 double xPDFmotherOld = beam.xfISR(iSysNow, 21, xDaughter, pdfScale2);
1222 if ( xPDFmotherOld < TINYPDF ) {
1223 infoPtr->errorMsg(
"Error in SpaceShower::pT2nearThreshold: xPDF = 0");
1233 double pT2corr = 0.;
1234 double xMother = 0.;
1237 bool isGammaBeam = beam.isGamma();
1239 BeamParticle& beamOther = (sideA) ? *beamBPtr : *beamAPtr;
1241 if ( !beamOther.roomFor1Remnant(eCM) )
return;
1250 infoPtr->errorMsg(
"Error in SpaceShower::pT2nearThreshold: "
1256 pT2 = m2Massive * pow( m2Threshold / m2Massive, rndmPtr->flat() );
1261 z = xDaughter/xMother;
1264 z = zMinAbs + rndmPtr->flat() * (zMaxMassive - zMinAbs);
1268 Q2 = pT2 / (1.-z) - m2Massive;
1269 if (iColPartner == 0) {
1270 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Massive) / m2Dip;
1272 double tmpRat = z * (Q2 + m2Massive) / (m2ColPair - m2ColPartner);
1273 pT2corr = ((1. - z) * Q2 - z * m2Massive) * (1. - tmpRat)
1274 - m2ColPartner * pow2(tmpRat);
1276 if (pT2corr < TINYPT2)
continue;
1279 wt = pow2(z) + pow2(1.-z) + 2. * z * (1.-z) * m2Massive / pT2;
1285 wt *= (alphaSorder > 0) ? logM2Lambda2 / log( pT2 / Lambda2 ) : 1.;
1288 xMother = xDaughter / z;
1289 if (!dipEndNow->normalRecoil) {
1290 if (sideA) xMother += (m2Rec / (x2Now * sCM)) * (1. / z - 1.);
1291 else xMother += (m2Rec / (x1Now * sCM)) * (1. / z - 1.);
1293 if (xMother > xMaxAbs) { wt = 0.;
continue; }
1296 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1297 double xPDFmotherNew = beam.xfISR(iSysNow, 21, xMother, pdfScale2);
1298 wt *= xPDFmotherNew / xPDFmotherOld;
1303 if (wt > 0. && pT2 > pT2min && doUncertaintiesNow ) {
1304 dipEndNow->pAccept = wt;
1309 }
while (wt < rndmPtr->flat()) ;
1312 int idMother = isGammaBeam ? 22 : 21;
1315 double mSister = (abs(idDaughter) == 4) ? mc : mb;
1317 if ( isGammaBeam ) splittingNameNow =
"isr:A2QQ";
1318 else splittingNameNow =
"isr:G2QQ";
1319 dipEndNow->store( idDaughter, idMother, -idDaughter, x1Now, x2Now, m2Dip,
1320 pT2, z, xMother, Q2, mSister, pow2(mSister), pT2corr, iColPartner,
1321 m2ColPair, mColPartner);
1329 void SpaceShower::pT2nextQED(
double pT2begDip,
double pT2endDip) {
1332 BeamParticle& beam = (sideA) ? *beamAPtr : *beamBPtr;
1333 bool isLeptonBeam = beam.isLepton();
1334 bool isGammaBeam = beam.isGamma();
1335 int MEtype = dipEndNow->MEtype;
1336 bool isPhoton = (idDaughter == 22);
1337 double pT2 = pT2begDip;
1338 double m2Lepton = (isLeptonBeam) ? pow2(beam.m()) : 0.;
1339 if (isLeptonBeam && pT2begDip < m2Lepton)
return;
1342 if (isPhoton && (isLeptonBeam || isGammaBeam) )
return;
1345 double alphaEMmax = alphaEM.alphaEM(renormMultFac * pT2begDip);
1346 double alphaEM2pi = alphaEMmax / (2. * M_PI);
1349 double xMaxAbs = (isLeptonBeam) ? LEPTONXMAX : beam.xMax(iSysNow);
1350 double zMinAbs = xDaughter / xMaxAbs;
1352 infoPtr->errorMsg(
"Warning in SpaceShower::pT2nextQED: "
1353 "xMaxAbs negative");
1358 double zMaxAbs = 1. - 0.5 * (pT2endDip / m2Dip) *
1359 ( sqrt( 1. + 4. * m2Dip / pT2endDip ) - 1. );
1361 double zMaxLepton = xDaughter / (xDaughter + LEPTONXMIN);
1362 if (zMaxLepton < zMaxAbs) zMaxAbs = zMaxLepton;
1364 if (zMaxAbs < zMinAbs)
return;
1367 double idMassive = 0;
1368 if ( isGammaBeam && abs(idDaughter) == 4 ) idMassive = 4;
1369 if ( isGammaBeam && abs(idDaughter) == 5 ) idMassive = 5;
1370 bool isMassive = (idMassive > 0);
1371 double m2Massive = 0.;
1373 double zMaxMassive = 1.;
1374 double m2Threshold = pT2;
1378 m2Massive = (idMassive == 4) ? m2c : m2b;
1379 if (pT2 < HEAVYPT2EVOL * m2Massive)
return;
1380 mRatio = sqrt( m2Massive / m2Dip );
1381 zMaxMassive = (1. - mRatio) / ( 1. + mRatio * (1. - mRatio) );
1382 if (xDaughter > HEAVYXEVOL * zMaxMassive * xMaxAbs)
return;
1385 m2Threshold = (idMassive == 4) ? min( pT2, CTHRESHOLD * m2c)
1386 : min( pT2, BTHRESHOLD * m2b);
1393 double xMother = 0.;
1396 double mSister = 0.;
1397 double m2Sister = 0.;
1398 double pT2corr = 0.;
1401 bool isEnhancedQ2QA, isEnhancedQ2AQ, isEnhancedA2QQ;
1402 isEnhancedQ2QA = isEnhancedQ2AQ = isEnhancedA2QQ =
false;
1403 double enhanceNow = 1.;
1404 string nameNow =
"";
1412 double f2fIntA = 2. * log( (1. - zMinAbs) / (1. - zMaxAbs) );
1413 double f2fIntB = 0.;
1415 f2fIntB = 2. * log( (zMaxAbs - xDaughter) / (zMinAbs - xDaughter) );
1416 f2fInt = f2fIntA + f2fIntB;
1417 }
else f2fInt = pow2(dipEndNow->chgType / 3.) * f2fIntA;
1424 double xfApprox = 0;
1429 pT2ref = beam.gammaPDFRefScale(idDaughter);
1430 xfApprox = beam.gammaPDFxDependence(idDaughter, xDaughter);
1433 BeamParticle& beamOther = (sideA) ? *beamBPtr : *beamAPtr;
1434 if ( beamOther.roomFor1Remnant(eCM) ) {
1435 gamma2f = alphaEM2pi * pow2(
double(dipEndNow->chgType) / 3.)* 3.
1436 * (pow2(xDaughter) + pow2(1. - xDaughter))/xfApprox;
1441 if (doMEcorrections) f2fInt *= calcMEmax(MEtype, 1, 1);
1442 double kernelPDF = alphaEM2pi * f2fInt;
1443 double fudge = (isLeptonBeam) ? LEPTONFUDGE * log(m2Dip/m2Lepton) : 1.;
1447 if ( (kernelPDF + gamma2f) < TINYKERNELPDF )
return;
1450 if (canEnhanceET) kernelPDF *= userHooksPtr->enhanceFactor(
"isr:Q2QA");
1453 if (canEnhanceET) gamma2f *= userHooksPtr->enhanceFactor(
"isr:A2QQ");
1456 kernelPDF += gamma2f;
1462 isEnhancedQ2QA = isEnhancedA2QQ =
false;
1467 if( (rndmPtr->flat() * kernelPDF) < gamma2f ){
1470 pT2 = pT2ref*pow(pT2/pT2ref, pow(rndmPtr->flat(), 1. / kernelPDF));
1473 if ( isMassive && (pT2 < m2Threshold ) ) {
1474 pT2nearThreshold( beam, m2Massive, m2Threshold, xMaxAbs,
1475 zMinAbs, zMaxMassive, 0 );
1477 }
else if (pT2 < pT2endDip)
return;
1482 z = xDaughter/xMother;
1483 idSister = -idDaughter;
1484 mSister = particleDataPtr->m0(idSister);
1485 m2Sister = pow2(mSister);
1488 Q2 = pT2 / (1. - z);
1491 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Sister) / m2Dip;
1492 if (pT2corr < TINYPT2) { wt = 0.;
continue; }
1495 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1496 double daughterPDF = max ( TINYPDF,
1497 beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2) );
1498 wt = xDaughter*log(pT2/pT2ref)/daughterPDF;
1505 double alphaEMnow = alphaEM.alphaEM(renormMultFac * pT2);
1506 wt *= (alphaEMnow / alphaEMmax);
1509 nameNow =
"isr:A2QQ";
1511 double enhance = userHooksPtr->enhanceFactor(nameNow);
1512 if (enhance != 1.) {
1513 enhanceNow = enhance;
1514 isEnhancedA2QQ =
true;
1519 if (wt > 1. && pT2 > PT2MINWARN){
1520 infoPtr->errorMsg(
"Warning in "
1521 "SpaceShower::pT2nextQED: weight above unity");
1529 double shift = pow(rndmPtr->flat(), 1. / kernelPDF);
1530 if (isLeptonBeam) pT2 = m2Lepton * pow( pT2 / m2Lepton, shift);
1531 else pT2 = pT2 * shift;
1534 if ( isGammaBeam && isMassive && (pT2 < m2Threshold ) ) {
1535 pT2nearThreshold( beam, m2Massive, m2Threshold, xMaxAbs,
1536 zMinAbs, zMaxMassive, 0 );
1541 if (pT2 < pT2endDip)
return;
1542 if (isLeptonBeam && pT2 < LEPTONPT2MIN * m2Lepton)
return;
1546 idMother = idDaughter;
1551 if (f2fIntA > rndmPtr->flat() * (f2fIntA + f2fIntB)) {
1552 z = 1. - (1. - zMinAbs)
1553 * pow( (1. - zMaxAbs) / (1. - zMinAbs), rndmPtr->flat() );
1555 z = xDaughter + (zMinAbs - xDaughter)
1556 * pow( (zMaxAbs - xDaughter) / (zMinAbs - xDaughter),
1559 wt *= (z - xDaughter) / (1. - xDaughter);
1561 z = 1. - (1. - zMinAbs)
1562 * pow( (1. - zMaxAbs) / (1. - zMinAbs), rndmPtr->flat() );
1567 wt *= 0.5 * (1. + pow2(z));
1569 wt *= 0.5 * (1. + pow2(z)) - z * pow2(1.-z) * m2Massive / pT2;
1573 nameNow =
"isr:Q2QA";
1575 double enhance = userHooksPtr->enhanceFactor(nameNow);
1576 if (enhance != 1.) {
1577 enhanceNow = enhance;
1578 isEnhancedQ2QA =
true;
1583 Q2 = pT2 / (1. - z);
1584 xMother = xDaughter / z;
1586 if (!dipEndNow->normalRecoil) {
1587 if (sideA) xMother += (m2Rec / (x2Now * sCM)) * (1. / z - 1.);
1588 else xMother += (m2Rec / (x1Now * sCM)) * (1. / z - 1.);
1590 if (xMother > xMaxAbs) { wt = 0.;
continue; }
1595 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Sister) / m2Dip;
1596 if (pT2corr < TINYPT2) { wt = 0.;
continue; }
1599 if ( beam.isGamma() ) {
1600 BeamParticle& beamOther = (sideA) ? *beamBPtr : *beamAPtr;
1602 if( !beamOther.resolvedGamma() ){
1603 if ( !beam.roomFor1Remnant( idMother, xMother, eCM) ) {
1609 if( !beamOther.roomFor2Remnants( idMother, xMother, eCM ) ) {
1617 if (isLeptonBeam) wt *= log(pT2 / m2Lepton) / fudge;
1620 if (doMEcorrections) wt *= calcMEcorr(MEtype, idMother, idDaughter,
1621 m2Dip, z, Q2, m2Sister) / calcMEmax(MEtype, idMother, idDaughter);
1624 if (doMEcorrections && MEtype == 1 && idDaughter == idMother
1625 && ( (iSysNow == 0 && idResFirst == 24)
1626 || (iSysNow == 1 && idResSecond == 24) ) ) {
1628 double uHe = Q2 - m2Dip * (1. - z) / z;
1629 double chg1 = abs(dipEndNow->chgType / 3.);
1630 double chg2 = 1. - chg1;
1631 wt *= pow2(chg1 * uHe - chg2 * tHe)
1632 / ( (tHe + uHe) * (pow2(chg1) * uHe + pow2(chg2) * tHe) );
1636 if (dopTdamp && iSysNow == 0 && MEtype == 0 && nRad == 0)
1637 wt *= pT2damp / (pT2 + pT2damp);
1640 double alphaEMnow = alphaEM.alphaEM(renormMultFac * pT2);
1641 wt *= (alphaEMnow / alphaEMmax);
1644 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1645 double xPDFdaughterNew = max ( TINYPDF,
1646 beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2) );
1647 double xPDFmotherNew =
1648 beam.xfISR(iSysNow, idMother, xMother, pdfScale2);
1649 wt *= xPDFmotherNew / xPDFdaughterNew;
1653 }
while (wt < rndmPtr->flat()) ;
1662 double kernelPDF = 0.0;
1663 double xPDFdaughter = 0.;
1664 double xPDFmother[21] = {0.};
1665 double xPDFmotherSum = 0.0;
1666 double pT2PDF = pT2;
1667 double pT2minNow = pT2endDip;
1668 bool needNewPDF =
true;
1671 int loopTinyPDFdau = 0;
1672 bool hasTinyPDFdau =
false;
1677 isEnhancedQ2AQ =
false;
1682 if (hasTinyPDFdau) ++loopTinyPDFdau;
1683 if (loopTinyPDFdau > MAXLOOPTINYPDF) {
1684 infoPtr->errorMsg(
"Warning in SpaceShower::pT2nextQED: "
1685 "small daughter PDF");
1692 if (needNewPDF || pT2 < EVALPDFSTEP * pT2PDF) {
1695 hasTinyPDFdau =
false;
1698 if (pT2 > m2b && nQuarkIn >= 5) {
1700 pT2minNow = max( m2b, pT2endDip);
1701 }
else if (pT2 > m2c && nQuarkIn >= 4) {
1703 pT2minNow = max( m2c, pT2endDip);
1706 pT2minNow = pT2endDip;
1710 zMaxAbs = 1. - 0.5 * (pT2minNow / m2Dip) *
1711 ( sqrt( 1. + 4. * m2Dip / pT2minNow ) - 1. );
1714 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1715 xPDFdaughter = beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2);
1716 if (xPDFdaughter < TINYPDF) {
1717 xPDFdaughter = TINYPDF;
1718 hasTinyPDFdau =
true;
1724 double q2gInt = 4. * (1./sqrt(zMinAbs) - 1./sqrt(zMaxAbs));
1726 if (canEnhanceET) q2gInt *= userHooksPtr->enhanceFactor(
"isr:Q2QA");
1731 for (
int i = -nFlavour; i <= nFlavour; ++i) {
1733 xPDFmother[10] = 0.;
1735 xPDFmother[i+10] = pow2((abs(i+1) % 2 + 1)/3.0)
1736 * beam.xfISR(iSysNow, i, xDaughter, pdfScale2);
1737 xPDFmotherSum += xPDFmother[i+10];
1742 kernelPDF = q2gInt * xPDFmotherSum / xPDFdaughter;
1747 if (kernelPDF < TINYKERNELPDF)
return;
1750 pT2 *= pow( rndmPtr->flat(), 1. / (alphaEM2pi * kernelPDF));
1753 if (nFlavour == 5 && pT2 < m2b) {
1760 else if (nFlavour == 4 && pT2 < m2c) {
1767 else if (pT2 < pT2endDip)
return;
1770 double temp = xPDFmotherSum * rndmPtr->flat();
1771 idMother = -nQuarkIn - 1;
1773 temp -= xPDFmother[(++idMother) + 10];
1774 }
while (temp > 0. && idMother < nQuarkIn);
1777 idSister = idMother;
1778 mSister = particleDataPtr->m0(idSister);
1779 m2Sister = pow2(mSister);
1782 z = (zMinAbs * zMaxAbs) / pow2( sqrt(zMinAbs) + rndmPtr->flat()
1783 * ( sqrt(zMaxAbs)- sqrt(zMinAbs) ));
1786 wt = 0.5 * (1. + pow2(1. - z)) * sqrt(z);
1789 double alphaEMnow = alphaEM.alphaEM(renormMultFac * pT2);
1790 wt *= (alphaEMnow / alphaEMmax);
1793 nameNow =
"isr:Q2AQ";
1795 double enhance = userHooksPtr->enhanceFactor(nameNow);
1796 if (enhance != 1.) {
1797 enhanceNow = enhance;
1798 isEnhancedQ2AQ =
true;
1803 Q2 = pT2 / (1. - z);
1804 xMother = xDaughter / z;
1806 if (!dipEndNow->normalRecoil) {
1807 if (sideA) xMother += (m2Rec / (x2Now * sCM)) * (1. / z - 1.);
1808 else xMother += (m2Rec / (x1Now * sCM)) * (1. / z - 1.);
1812 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Sister) / m2Dip;
1813 if (pT2corr < TINYPT2) { wt = 0.;
continue; }
1817 if ( abs(idMother) == 4 || abs(idMother) == 5 ) {
1818 double m2QQsister = EXTRASPACEQ * 4. * m2Sister;
1819 double pT2QQcorr = Q2 - z * (m2Dip + Q2) * (Q2 + m2QQsister) / m2Dip;
1820 if (pT2QQcorr < TINYPT2) { wt = 0.;
continue; }
1824 if (dopTdamp && iSysNow == 0 && MEtype == 0 && nRad == 0)
1825 wt *= pT2damp / (pT2 + pT2damp);
1828 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1829 double xPDFdaughterNew = beam.xfISR(iSysNow, idDaughter, xDaughter,
1831 if (xPDFdaughterNew < TINYPDF) {
1832 xPDFdaughterNew = TINYPDF;
1836 double xPDFmotherNew = pow2( (abs(idMother+1) % 2 + 1)/3.0 )
1837 * beam.xfISR(iSysNow, idMother, xMother, pdfScale2);
1840 wt *= xPDFdaughter / xPDFmother[idMother + 10];
1843 wt *= xPDFmotherNew / xPDFdaughterNew;
1846 }
while (wt < rndmPtr->flat()) ;
1850 splittingNameNow = nameNow;
1852 if (isEnhancedQ2QA) storeEnhanceFactor(pT2,
"isr:Q2QA", enhanceNow);
1853 if (isEnhancedQ2AQ) storeEnhanceFactor(pT2,
"isr:Q2AQ", enhanceNow);
1854 if (isEnhancedA2QQ) storeEnhanceFactor(pT2,
"isr:A2QQ", enhanceNow);
1858 dipEndNow->store( idDaughter, idMother, idSister, x1Now, x2Now, m2Dip,
1859 pT2, z, xMother, Q2, mSister, m2Sister, pT2corr, 0, m2ColPair,
1866 void SpaceShower::pT2nextWeak(
double pT2begDip,
double pT2endDip) {
1869 BeamParticle& beam = (sideA) ? *beamAPtr : *beamBPtr;
1870 bool isLeptonBeam = beam.isLepton();
1871 bool isValence = beam[iSysNow].isValence();
1872 int MEtype = dipEndNow->MEtype;
1873 double pT2 = pT2begDip;
1874 double m2Lepton = (isLeptonBeam) ? pow2(beam.m()) : 0.;
1875 if (isLeptonBeam && pT2begDip < m2Lepton)
return;
1878 double alphaEMmax = alphaEM.alphaEM(pT2begDip);
1879 double alphaEM2pi = alphaEMmax / (2. * M_PI);
1882 double xMaxAbs = (isLeptonBeam) ? LEPTONXMAX : beam.xMax(iSysNow);
1883 double zMinAbs = xDaughter / xMaxAbs;
1885 infoPtr->errorMsg(
"Warning in SpaceShower::pT2nextWeak: "
1886 "xMaxAbs negative");
1891 double zMaxAbs = 1. - 0.5 * (pT2endDip / m2Dip) *
1892 ( sqrt( 1. + 4. * m2Dip / pT2endDip ) - 1. );
1894 double zMaxLepton = xDaughter / (xDaughter + LEPTONXMIN);
1895 if (zMaxLepton < zMaxAbs) zMaxAbs = zMaxLepton;
1897 if (zMaxAbs < zMinAbs)
return;
1903 if (dipEndNow->weakType == 1) {
1904 idSister = (idDaughter > 0) ? -24 : 24;
1905 if (abs(idDaughter) % 2 == 1) idSister = -idSister;
1906 }
else if (dipEndNow->weakType == 2) idSister = 23;
1908 double xMother = 0.;
1911 double mSister = particleDataPtr->mSel(idSister);
1912 double m2Sister = pow2(mSister);
1913 double pT2corr = 0.;
1917 double mRatio = mSister/ sqrt(m2Dip);
1918 double m2R1 = 1. + pow2(mRatio);
1919 double zMaxMassive = 1. / (m2R1 + pT2endDip/m2Dip);
1920 if (zMaxMassive < zMaxAbs) zMaxAbs = zMaxMassive;
1921 if (zMaxAbs < zMinAbs)
return;
1924 bool isEnhancedQ2QW;
1925 isEnhancedQ2QW =
false;
1926 double enhanceNow = 1.;
1927 string nameNow =
"";
1936 double f2fIntA = (1. + pow2(zMaxAbs * m2R1)) / m2R1
1937 * log( (1. - m2R1 * zMinAbs) / (1. - m2R1 * zMaxAbs) );
1938 double f2fIntB = 0.;
1939 double zRootMin = (1. + sqrt(m2R1 * zMinAbs)) / (1. - sqrt(m2R1 * zMinAbs));
1940 double zRootMax = (1. + sqrt(m2R1 * zMaxAbs)) / (1. - sqrt(m2R1 * zMaxAbs));
1942 f2fIntB = 2. * log( (zMaxAbs - xDaughter) / (zMinAbs - xDaughter) );
1943 f2fInt = f2fIntA + f2fIntB;
1944 }
else if (isValence)
1945 f2fInt = (1. + pow2(zMaxAbs) * pow2(m2R1))/ sqrt(m2R1)
1946 * log( zRootMax / zRootMin );
1951 double weakCoupling = 0;
1952 if (dipEndNow->weakType == 1)
1953 weakCoupling = 2. * alphaEM2pi / (4. * coupSMPtr->sin2thetaW());
1954 else if (dipEndNow->weakType == 2 && dipEndNow->weakPol == -1)
1955 weakCoupling = alphaEM2pi * thetaWRat
1956 * pow2(2. * coupSMPtr->lf( abs(idDaughter) ));
1958 weakCoupling = alphaEM2pi * thetaWRat
1959 * pow2(2. * coupSMPtr->rf(abs(idDaughter) ));
1962 vector<int> possibleMothers;
1963 if (abs(idDaughter) % 2 == 0) {
1964 possibleMothers.push_back(1);
1965 possibleMothers.push_back(3);
1966 possibleMothers.push_back(5);
1968 possibleMothers.push_back(2);
1969 possibleMothers.push_back(4);
1972 for (
unsigned int i = 0;i < possibleMothers.size();i++)
1973 possibleMothers[i] = - possibleMothers[i];
1977 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2begDip;
1978 double xPDFdaughter = beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2);
1979 if (xPDFdaughter < TINYPDF) {
1980 if (abs(idDaughter) == 1 || abs(idDaughter) == 2 || abs(idDaughter) == 21)
1981 infoPtr->errorMsg(
"Warning in SpaceShower::pT2nextWeak: "
1987 double overEstimatePDFCKM = 0.;
1988 if (dipEndNow->weakType == 1) {
1989 for (
unsigned int i = 0; i < possibleMothers.size(); i++)
1990 overEstimatePDFCKM += coupSMPtr->V2CKMid(idDaughter, possibleMothers[i])
1991 * beam.xfISR(iSysNow, possibleMothers[i], xDaughter, pdfScale2)
1994 if (dipEndNow->weakType == 2) overEstimatePDFCKM = 1.;
1997 if (doMEcorrections) f2fInt *= calcMEmax(MEtype, 1, 1);
1998 double kernelPDF = weakCoupling * f2fInt * weakEnhancement;
2001 kernelPDF *= overEstimatePDFCKM;
2002 double fudge = (isLeptonBeam) ? LEPTONFUDGE * log(m2Dip/m2Lepton) : 1.;
2004 if (kernelPDF < TINYKERNELPDF)
return;
2006 if (canEnhanceET) kernelPDF *= userHooksPtr->enhanceFactor(
"isr:Q2QW");
2012 isEnhancedQ2QW =
false;
2018 double shift = pow(rndmPtr->flat(), 1. / kernelPDF);
2019 if (isLeptonBeam) pT2 = m2Lepton * pow( pT2 / m2Lepton, shift);
2020 else pT2 = pT2 * shift;
2023 if (pT2 < pT2endDip)
return;
2024 if (isLeptonBeam && pT2 < LEPTONPT2MIN * m2Lepton)
return;
2027 if (pT2 < HEAVYPT2EVOL * pow2(particleDataPtr->m0(idDaughter)))
return;
2031 idMother = idDaughter;
2036 if (f2fIntA > rndmPtr->flat() * (f2fIntA + f2fIntB)) {
2037 z = 1. - (1. - zMinAbs)
2038 * pow( (1. - zMaxAbs) / (1. - zMinAbs), rndmPtr->flat() );
2040 z = xDaughter + (zMinAbs - xDaughter)
2041 * pow( (zMaxAbs - xDaughter) / (zMinAbs - xDaughter),
2044 wt *= (z - xDaughter) / (1. - xDaughter);
2045 }
else if (isValence) {
2047 double zTmp = zRootMin * pow(zRootMax / zRootMin, rndmPtr->flat() );
2048 z = pow2( (1. - zTmp) / (1. + zTmp) ) / m2R1;
2051 z = (1. - (1. - zMinAbs * m2R1) * pow( (1. - zMaxAbs * m2R1)
2052 / (1. - zMinAbs * m2R1), rndmPtr->flat() ) ) / m2R1;
2054 wt *= (1. + pow2(z * m2R1)) / (1. + pow2(zMaxAbs * m2R1));
2057 nameNow =
"isr:Q2QW";
2059 double enhance = userHooksPtr->enhanceFactor(nameNow);
2060 if (enhance != 1.) {
2061 enhanceNow = enhance;
2062 isEnhancedQ2QW =
true;
2067 Q2 = pT2 / (1. - z);
2068 xMother = xDaughter / z;
2071 if (!dipEndNow->normalRecoil) {
2072 if (sideA) xMother += (m2Rec / (x2Now * sCM)) * (1. / z - 1.);
2073 else xMother += (m2Rec / (x1Now * sCM)) * (1. / z - 1.);
2075 if (xMother > xMaxAbs) { wt = 0.;
continue; }
2078 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Sister) / m2Dip;
2079 if (pT2corr < TINYPT2) { wt = 0.;
continue; }
2082 if (isLeptonBeam) wt *= log(pT2 / m2Lepton) / fudge;
2085 if (doMEcorrections) wt *= calcMEcorr(MEtype, idMother, idDaughter,
2086 m2Dip, z, Q2, m2Sister) / calcMEmax(MEtype, idMother, idDaughter);
2090 if (dopTdamp && iSysNow == 0 && nRad == 0)
2091 wt *= pT2damp / (pT2 + pT2damp);
2094 double alphaEMnow = alphaEM.alphaEM(pT2);
2095 wt *= (alphaEMnow / alphaEMmax);
2098 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
2099 double xPDFdaughterNew = max ( TINYPDF,
2100 beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2) );
2101 if (dipEndNow->weakType == 2) {
2102 double xPDFmotherNew
2103 = beam.xfISR(iSysNow, idMother, xMother, pdfScale2);
2104 wt *= xPDFmotherNew / xPDFdaughterNew;
2108 if (dipEndNow->weakType == 1) {
2109 double valPDFCKM[3] = {0.};
2110 double sumPDFCKM = 0.;
2111 for (
unsigned int i = 0; i < possibleMothers.size(); i++) {
2112 valPDFCKM[i] = coupSMPtr->V2CKMid(idDaughter,possibleMothers[i])
2113 * beam.xfISR(iSysNow, possibleMothers[i], xMother, pdfScale2)
2115 sumPDFCKM += valPDFCKM[i];
2117 wt *= sumPDFCKM / overEstimatePDFCKM;
2120 double pickId = sumPDFCKM * rndmPtr->flat();
2122 int pmSize = possibleMothers.size();
2123 do pickId -= valPDFCKM[++iId];
2124 while (pickId > 0. && iId < pmSize);
2125 idMother = possibleMothers[iId];
2129 if (wt > 1.) infoPtr->errorMsg(
"Warning in SpaceShower::pT2nextWeak: "
2130 "weight is above unity.");
2133 }
while (wt < rndmPtr->flat()) ;
2136 splittingNameNow = nameNow;
2137 if (canEnhanceET && isEnhancedQ2QW)
2138 storeEnhanceFactor(pT2,
"isr:Q2QW", enhanceNow);
2141 dipEndNow->store( idDaughter, idMother, idSister, x1Now, x2Now, m2Dip,
2142 pT2, z, xMother, Q2, mSister, m2Sister, pT2corr, 0, m2ColPair,
2152 bool SpaceShower::branch(
Event& event) {
2155 int side = abs(dipEndSel->side);
2156 double sideSign = (side == 1) ? 1. : -1.;
2159 int iDaughter = partonSystemsPtr->getInA(iSysSel);
2160 int iRecoiler = partonSystemsPtr->getInB(iSysSel);
2161 if (side == 2) swap(iDaughter, iRecoiler);
2162 int idDaughterNow = dipEndSel->idDaughter;
2163 int idMother = dipEndSel->idMother;
2164 int idSister = dipEndSel->idSister;
2165 int idRecoiler =
event[iRecoiler].id();
2166 int colDaughter =
event[iDaughter].col();
2167 int acolDaughter =
event[iDaughter].acol();
2168 int iColPartner = dipEndSel->iColPartner;
2171 bool normalRecoil = dipEndSel->normalRecoil;
2172 int iRecoilMother =
event[iRecoiler].mother1();
2175 double x1 = dipEndSel->x1;
2176 double x2 = dipEndSel->x2;
2177 double xMo = dipEndSel->xMo;
2178 double m2II = dipEndSel->m2Dip;
2179 double mII = sqrt(m2II);
2180 double pT2 = dipEndSel->pT2;
2181 double z = dipEndSel->z;
2182 double Q2 = dipEndSel->Q2;
2183 double mSister = dipEndSel->mSister;
2184 double m2Sister = dipEndSel->m2Sister;
2185 double pT2corr = dipEndSel->pT2corr;
2186 double x1New = (side == 1) ? xMo : x1;
2187 double x2New = (side == 2) ? xMo : x2;
2190 gamma2qqbar =
false;
2193 BeamParticle& beamNow = (side == 1) ? *beamAPtr : *beamBPtr;
2197 if ( beamNow.isGamma() && idMother == 22 && infoPtr->nMPI() > 1 ) {
2199 beamNow.resolvedGamma(
false);
2200 beamNow.pT2gamma2qqbar(pT2corr);
2201 beamNow.gamVal(iSysSel);
2206 int MEtype = dipEndSel->MEtype;
2207 Vec4 pMother, pSister, pNewRec, pNewColPartner;
2211 rescatterFail =
false;
2216 if (iColPartner == 0) {
2217 double eNewRec, pzNewRec, pTbranch, pzMother;
2219 eNewRec = 0.5 * (m2II + Q2) / mII;
2220 pzNewRec = -sideSign * eNewRec;
2221 pTbranch = sqrt(pT2corr) * m2II / ( z * (m2II + Q2) );
2222 pzMother = sideSign * 0.5 * mII * ( (m2II - Q2)
2223 / ( z * (m2II + Q2) ) + (Q2 + m2Sister) / m2II );
2226 m2Rec =
event[iRecoiler].m2();
2227 double s1Tmp = m2II + Q2 - m2Rec;
2228 double s3Tmp = m2II / z - m2Rec;
2229 double r1Tmp = sqrt(s1Tmp * s1Tmp + 4. * Q2 * m2Rec);
2230 eNewRec = 0.5 * (m2II + m2Rec + Q2) / mII;
2231 pzNewRec = -sideSign * 0.5 * r1Tmp / mII;
2232 double pT2br = Q2 * s3Tmp * (m2II / z - m2II - Q2)
2233 - m2Sister * s1Tmp * s3Tmp - m2Rec * pow2(Q2 + m2Sister);
2234 if (pT2br <= 0.)
return false;
2235 pTbranch = sqrt(pT2br) / r1Tmp;
2236 pzMother = sideSign * (mII * s3Tmp
2237 - eNewRec * (m2II / z - Q2 - m2Rec - m2Sister)) / r1Tmp;
2240 double eMother = sqrt( pow2(pTbranch) + pow2(pzMother) );
2241 double pzSister = pzMother + pzNewRec;
2242 double eSister = sqrt( pow2(pTbranch) + pow2(pzSister) + m2Sister );
2243 pMother.p( pTbranch, 0., pzMother, eMother );
2244 pSister.p( pTbranch, 0., pzSister, eSister );
2245 pNewRec.p( 0., 0., pzNewRec, eNewRec );
2251 double m2IF = dipEndSel->m2IF;
2252 double mIF = sqrt(m2IF);
2253 m2ColPartner = pow2( dipEndSel->mColPartner );
2256 double m2IFred = m2IF - m2ColPartner;
2257 pMother.p( 0., 0., 0.5 * m2IFred / (z * mIF), 0.5 * m2IFred / (z * mIF) );
2258 Vec4 pShift( 0., 0.,
2259 -0.5 * Q2 / mIF - z * (Q2 + m2Sister) * m2ColPartner / (mIF * m2IFred),
2260 -0.5 * Q2 / mIF + z * (Q2 + m2Sister) / mIF );
2261 pSister = (1. - z) * pMother + pShift;
2262 pNewColPartner = Vec4( 0., 0., -0.5 * m2IFred /mIF,
2263 0.5 * (m2IF + m2ColPartner) / mIF ) - pShift;
2265 pNewRec.p( event[iRecoiler].p() );
2268 double phi = 2. * M_PI * rndmPtr->flat();
2271 findAsymPol( event, dipEndSel);
2272 int iFinPol = dipEndSel->iFinPol;
2273 double cPol = dipEndSel->asymPol;
2274 double phiPol = (iFinPol == 0) ? 0. : event[iFinPol].phi();
2278 double cPhiPol, weight;
2281 M.fromCMframe( event[iDaughter].p(), event[iColPartner].p() );
2282 double pTcorr = sqrt(pT2corr);
2284 phi = 2. * M_PI * rndmPtr->flat();
2286 Vec4 pSisTmp = pSister + pTcorr * Vec4( cos(phi), sin(phi), 0., 0.);
2288 cPhiPol = cos(pSisTmp.phi() - phiPol);
2289 weight *= ( 1. + cPol * (2. * pow2(cPhiPol) - 1.) )
2290 / ( 1. + abs(cPol) );
2291 }
while (weight < rndmPtr->flat());
2295 pSister.px( sqrt(pT2corr) * cos(phi) );
2296 pSister.py( sqrt(pT2corr) * sin(phi) );
2297 pNewColPartner.px( - pSister.px() );
2298 pNewColPartner.py( - pSister.py() );
2302 int eventSizeOld =
event.size();
2303 int systemSizeOld = partonSystemsPtr->sizeAll(iSysSel);
2306 int beamOff1 = 1 + beamOffset;
2307 int beamOff2 = 2 + beamOffset;
2308 int ev1Dau1V =
event[beamOff1].daughter1();
2309 int ev2Dau1V =
event[beamOff2].daughter1();
2310 vector<int> statusV, mother1V, mother2V, daughter1V, daughter2V;
2313 bool canMergeFirst = (mergingHooksPtr != 0)
2314 ? mergingHooksPtr->canVetoEmission() :
false;
2317 doUncertaintiesNow = doUncertainties;
2318 if (!uVarMPIshowers && iSysSel != 0) doUncertaintiesNow =
false;
2319 if (pT2 < uVarpTmin2) doUncertaintiesNow =
false;
2322 if (canVetoEmission || canMergeFirst || canEnhanceET || doWeakShower
2323 || doUncertainties) {
2324 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2325 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2326 statusV.push_back( event[iOldCopy].status());
2327 mother1V.push_back( event[iOldCopy].mother1());
2328 mother2V.push_back( event[iOldCopy].mother2());
2329 daughter1V.push_back( event[iOldCopy].daughter1());
2330 daughter2V.push_back( event[iOldCopy].daughter2());
2336 int iNewColPartner = 0;
2337 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2338 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2339 int statusOld =
event[iOldCopy].status();
2340 int statusNew = (iOldCopy == iDaughter
2341 || iOldCopy == iRecoiler) ? statusOld : 44;
2342 int iNewCopy =
event.copy(iOldCopy, statusNew);
2343 if (statusOld < 0)
event[iNewCopy].statusNeg();
2344 if (iOldCopy == iColPartner) iNewColPartner = iNewCopy;
2349 int colMother = colDaughter;
2350 int acolMother = acolDaughter;
2353 if (idSister == 22 || idSister == 23 || abs(idSister) == 24) ;
2355 else if (idSister == 21 && ( (idMother > 0 && idMother < 9)
2356 || (idMother == 21 && rndmPtr->flat() < 0.5) ) ) {
2357 colMother =
event.nextColTag();
2358 colSister = colMother;
2359 acolSister = colDaughter;
2361 }
else if (idSister == 21) {
2362 acolMother =
event.nextColTag();
2363 acolSister = acolMother;
2364 colSister = acolDaughter;
2366 }
else if (idDaughterNow == 21 && idMother > 0) {
2367 colMother = colDaughter;
2369 colSister = acolDaughter;
2371 }
else if (idDaughterNow == 21) {
2372 acolMother = acolDaughter;
2374 acolSister = colDaughter;
2376 }
else if ( (idDaughterNow > 0 && idDaughterNow < 9) && idMother != 22) {
2377 acolMother =
event.nextColTag();
2378 acolSister = acolMother;
2380 }
else if ( (idDaughterNow < 0 && idDaughterNow > -9) && idMother != 22) {
2381 colMother =
event.nextColTag();
2382 colSister = colMother;
2384 }
else if (idDaughterNow == 22 && idMother > 0) {
2385 colMother =
event.nextColTag();
2386 colSister = colMother;
2388 }
else if (idDaughterNow == 22) {
2389 acolMother =
event.nextColTag();
2390 acolSister = acolMother;
2392 }
else if ( (idDaughterNow > 0 && idDaughterNow < 9) && idMother == 22) {
2395 acolSister = colDaughter;
2398 }
else if ( (idDaughterNow < 0 && idDaughterNow > -9) && idMother == 22) {
2401 colSister = acolDaughter;
2406 int iMother = eventSizeOld + side - 1;
2407 int iNewRec = eventSizeOld + 2 - side;
2408 int iSister =
event.append( idSister, 43, iMother, 0, 0, 0,
2409 colSister, acolSister, pSister, mSister, sqrt(pT2) );
2412 Particle& daughter =
event[iDaughter];
2413 Particle& mother =
event[iMother];
2414 Particle& newRecoiler =
event[iNewRec];
2415 Particle& sister =
event.back();
2418 if (doPartonVertex) {
2419 if (!daughter.hasVertex()) partonVertexPtr->vertexISR( iDaughter, event);
2420 if (!newRecoiler.hasVertex()) partonVertexPtr->vertexISR( iNewRec, event);
2421 if (!sister.hasVertex()) partonVertexPtr->vertexISR( iSister, event);
2425 mother.id( idMother );
2426 mother.status( -41);
2427 mother.cols( colMother, acolMother);
2429 if (mother.idAbs() == 21 || mother.idAbs() == 22) mother.pol(9);
2430 newRecoiler.status( (normalRecoil) ? -42 : -46 );
2431 newRecoiler.p( pNewRec);
2432 if (!normalRecoil) newRecoiler.m( event[iRecoiler].m() );
2434 if (iNewColPartner != 0)
event[iNewColPartner].p( pNewColPartner );
2437 daughter.mothers( iMother, 0);
2438 mother.daughters( iSister, iDaughter);
2440 event[beamOff1].daughter1( (side == 1) ? iMother : iNewRec );
2441 event[beamOff2].daughter1( (side == 2) ? iMother : iNewRec );
2445 if (sister.idAbs() == 23 || sister.idAbs() == 24) sister.status(47);
2448 if (iNewColPartner == 0) {
2452 if (normalRecoil) Mtot.bst(0., 0., (x2 - x1) / (x1 + x2) );
2454 Mtot.toCMframe( event[iDaughter].p(), event[iRecoiler].p() );
2455 else Mtot.toCMframe( event[iRecoiler].p(), event[iDaughter].p() );
2458 double phi = 2. * M_PI * rndmPtr->flat();
2461 findAsymPol( event, dipEndSel);
2462 int iFinPol = dipEndSel->iFinPol;
2463 double cPol = dipEndSel->asymPol;
2464 double phiPol = (iFinPol == 0) ? 0. : event[iFinPol].phi();
2471 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSysSel); ++ i) {
2472 int iOut = partonSystemsPtr->getOut(iSysSel, i);
2473 if ( (acolSister != 0 && event[iOut].col() == acolSister)
2474 || (colSister != 0 && event[iOut].acol() == colSister) )
2479 Vec4 pFinTmp =
event[iFinInt].p();
2480 pFinTmp.rotbst(Mtot);
2481 double theFin = pFinTmp.theta();
2482 if (side == 2) theFin = M_PI - theFin;
2483 double theSis = pSister.theta();
2484 if (side == 2) theSis = M_PI - theSis;
2485 cInt = strengthIntAsym * 2. * theSis * theFin
2486 / (pow2(theSis) + pow2(theFin));
2487 phiInt =
event[iFinInt].phi();
2492 if (iFinPol != 0 || iFinInt != 0) {
2493 double cPhiPol, cPhiInt, weight;
2495 phi = 2. * M_PI * rndmPtr->flat();
2498 cPhiPol = cos(phi - phiPol);
2499 weight *= ( 1. + cPol * (2. * pow2(cPhiPol) - 1.) )
2500 / ( 1. + abs(cPol) );
2503 cPhiInt = cos(phi - phiInt);
2504 weight *= (1. - cInt) * (1. - cInt * cPhiInt)
2505 / (1. + pow2(cInt) - 2. * cInt * cPhiInt);
2507 }
while (weight < rndmPtr->flat());
2514 RotBstMatrix MfromRest;
2516 Vec4 sumNew = pMother + pNewRec;
2517 double betaX = sumNew.px() / sumNew.e();
2518 double betaZ = sumNew.pz() / sumNew.e();
2519 MfromRest.bst( -betaX, 0., -betaZ);
2522 pMother.rotbst(MfromRest);
2523 double theta = pMother.theta();
2524 if (pMother.px() < 0.) theta = -theta;
2525 if (side == 2) theta += M_PI;
2526 MfromRest.rot(-theta, phi);
2529 MfromRest.bst( 0., 0., (x1New - x2New) / (x1New + x2New) );
2530 }
else if (side == 1) {
2531 Vec4 pMotherWanted( 0., 0., 0.5 * eCM * x1New, 0.5 * eCM * x1New);
2532 MfromRest.fromCMframe( pMotherWanted, event[iRecoiler].p() );
2534 Vec4 pMotherWanted( 0., 0., -0.5 * eCM * x2New, 0.5 * eCM * x2New);
2535 MfromRest.fromCMframe( event[iRecoiler].p(), pMotherWanted );
2537 Mtot.rotbst(MfromRest);
2541 if (MEtype == 201 || MEtype == 202 || MEtype == 203 ||
2542 MEtype == 206 || MEtype == 207 || MEtype == 208) {
2545 Vec4 pA0 = mother.p();
2546 Vec4 pB = newRecoiler.p();
2547 bool sideRad = (abs(side) == 1);
2550 p1 = weakMomenta[2];
2551 p2 = weakMomenta[3];
2556 if (!tChannel) swap(p1,p2);
2557 if (!sideRad) swap(p1,p2);
2564 wt = calcMEcorrWeak(MEtype, m2II, z, pT2, pA0, pB,
2565 event[iDaughter].p(), event[iRecoiler].p(), p1, p2, sister.p());
2566 if (wt > weakMaxWt) {
2568 infoPtr->errorMsg(
"Warning in SpaceShower::Branch: "
2569 "weight is above unity for weak emission.");
2573 if (wt < rndmPtr->flat()) {
2574 event.popBack( event.size() - eventSizeOld);
2575 event[beamOff1].daughter1( ev1Dau1V);
2576 event[beamOff2].daughter1( ev2Dau1V);
2577 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2578 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2579 event[iOldCopy].status( statusV[iCopy]);
2580 event[iOldCopy].mothers( mother1V[iCopy], mother2V[iCopy]);
2581 event[iOldCopy].daughters( daughter1V[iCopy], daughter2V[iCopy]);
2589 mother.rotbst(MfromRest);
2590 newRecoiler.rotbst(MfromRest);
2591 sister.rotbst(MfromRest);
2593 for (
int i = eventSizeOld + 2; i < eventSizeOld + systemSizeOld; ++i)
2594 event[i].rotbst(Mtot);
2600 RotBstMatrix MfromRest;
2601 MfromRest.fromCMframe( event[iDaughter].p(), event[iColPartner].p() );
2603 mother.rotbst(MfromRest);
2604 sister.rotbst(MfromRest);
2605 event[iNewColPartner].rotbst(MfromRest);
2610 if (infoPtr->nISR() + infoPtr->nFSRinProc() == 0
2611 && infoPtr->code() > 110 && infoPtr->code() < 130
2612 && MEtype >= 200 && MEtype < 210 && vetoWeakJets) {
2615 int iP1 =
event[5].daughter1();
2616 int iP2 =
event[6].daughter1();
2617 Vec4 pP1 =
event[iP1].p();
2618 Vec4 pP2 =
event[iP2].p();
2621 double d = sister.pT2();
2624 if (pP1.pT2() < d) {d = pP1.pT2(); cut =
true;}
2625 if (pP2.pT2() < d) {d = pP2.pT2(); cut =
true;}
2629 if (event[iP1].idAbs() < 20) {
2630 double dij = min(pP1.pT2(),sister.pT2())
2631 * pow2(RRapPhi(pP1,sister.p()))/vetoWeakDeltaR2;
2638 if (event[iP2].idAbs() < 20) {
2639 double dij = min(pP2.pT2(),sister.pT2())
2640 * pow2(RRapPhi(pP2,sister.p()))/vetoWeakDeltaR2;
2649 if (event[iP1].idAbs() == 21 ||
event[iP2].idAbs() == 21 ||
2650 event[iP1].id() == -
event[iP2].id()) {
2651 double dij = min(pP1.pT2(),pP2.pT2())
2652 * pow2(RRapPhi(pP1,pP2))/vetoWeakDeltaR2;
2661 event.popBack( event.size() - eventSizeOld);
2662 event[beamOff1].daughter1( ev1Dau1V);
2663 event[beamOff2].daughter1( ev2Dau1V);
2664 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2665 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2666 event[iOldCopy].status( statusV[iCopy]);
2667 event[iOldCopy].mothers( mother1V[iCopy], mother2V[iCopy]);
2668 event[iOldCopy].daughters( daughter1V[iCopy], daughter2V[iCopy]);
2675 if ( (canVetoEmission
2676 && userHooksPtr->doVetoISREmission(eventSizeOld, event, iSysSel))
2678 && mergingHooksPtr->doVetoEmission( event )) ) {
2679 event.popBack( event.size() - eventSizeOld);
2680 event[beamOff1].daughter1( ev1Dau1V);
2681 event[beamOff2].daughter1( ev2Dau1V);
2682 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2683 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2684 event[iOldCopy].status( statusV[iCopy]);
2685 event[iOldCopy].mothers( mother1V[iCopy], mother2V[iCopy]);
2686 event[iOldCopy].daughters( daughter1V[iCopy], daughter2V[iCopy]);
2694 double pAccept = dipEndSel->pAccept;
2698 bool acceptEvent =
true;
2699 if (pAccept < 1.0) acceptEvent = (rndmPtr->flat() < pAccept);
2704 bool vetoedEnhancedEmission =
false;
2709 bool foundEnhance =
false;
2712 for ( map<
double,pair<string,double> >::reverse_iterator
2713 it = enhanceFactors.rbegin();
2714 it != enhanceFactors.rend(); ++it ){
2715 if (splittingNameSel.find(it->second.first) != string::npos
2716 && abs(it->second.second-1.0) > 1e-9) {
2717 foundEnhance =
true;
2718 weight = it->second.second;
2719 vp = userHooksPtr->vetoProbability(splittingNameSel);
2725 if (foundEnhance && rndmPtr->flat() < vp ) vetoedEnhancedEmission =
true;
2728 if (foundEnhance && vetoedEnhancedEmission) rwgt *= (1.-1./weight)/vp;
2729 else if (foundEnhance) rwgt *= 1./((1.-vp)*weight);
2732 enhanceFactors.clear();
2735 double wtOld = userHooksPtr->getEnhancedEventWeight();
2736 if (!doTrialNow && canEnhanceEmission && !doUncertaintiesNow)
2737 userHooksPtr->setEnhancedEventWeight(wtOld*rwgt);
2738 if ( doTrialNow && canEnhanceTrial)
2739 userHooksPtr->setEnhancedTrial(sqrt(pT2), weight);
2741 if (vetoedEnhancedEmission && canEnhanceEmission) infoPtr->addCounter(40);
2744 if (vetoedEnhancedEmission) acceptEvent =
false;
2747 if (doUncertaintiesNow) calcUncertainties( acceptEvent, pAccept, pT20,
2748 weight, vp, dipEndSel, &mother, &sister);
2752 if ( (doUncertainties && !acceptEvent)
2753 || (vetoedEnhancedEmission && canEnhanceEmission) ) {
2755 event.popBack( event.size() - eventSizeOld);
2756 event[beamOff1].daughter1( ev1Dau1V);
2757 event[beamOff2].daughter1( ev2Dau1V);
2758 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2759 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2760 event[iOldCopy].status( statusV[iCopy]);
2761 event[iOldCopy].mothers( mother1V[iCopy], mother2V[iCopy]);
2762 event[iOldCopy].daughters( daughter1V[iCopy], daughter2V[iCopy]);
2770 partonSystemsPtr->setInA(iSysSel, eventSizeOld);
2771 partonSystemsPtr->setInB(iSysSel, eventSizeOld + 1);
2772 for (
int iCopy = 2; iCopy < systemSizeOld; ++iCopy)
2773 partonSystemsPtr->setOut(iSysSel, iCopy - 2, eventSizeOld + iCopy);
2774 partonSystemsPtr->addOut(iSysSel, eventSizeOld + systemSizeOld);
2775 partonSystemsPtr->setSHat(iSysSel, m2II / z);
2778 if (idDaughter == 21 && idMother != 21) {
2779 if (doQEDshowerByQ) {
2780 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2781 iNewRec, pT2, 0, mother.chargeType(), 0, 0, normalRecoil) );
2783 if (doWeakShower && iSysSel == 0) {
2784 int MEtypeNew = 203;
2785 if (idRecoiler == 21) MEtypeNew = 201;
2786 if (idRecoiler == idMother) MEtypeNew = 202;
2788 if( event[3].
id() == -
event[4].id()) MEtypeNew = 200;
2789 int weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
2790 event[iMother].pol(weakPol);
2791 if ((weakMode == 0 || weakMode == 1) && weakPol == -1)
2792 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2793 iNewRec, pT2, 0, 0, 1, MEtypeNew, normalRecoil, weakPol) );
2794 if (weakMode == 0 || weakMode == 2)
2795 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2796 iNewRec, pT2, 0, 0, 2, MEtypeNew + 5, normalRecoil, weakPol) );
2801 if (idDaughter == 22 && idMother != 22) {
2802 if (doQCDshower && mother.colType() != 0) {
2803 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2804 iNewRec, pT2, mother.colType(), 0, 0, 0, normalRecoil) );
2806 if (doQEDshowerByQ && mother.chargeType() != 3) {
2807 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2808 iNewRec, pT2, 0, mother.chargeType(), 0, 0, normalRecoil) );
2810 if (doQEDshowerByL && mother.chargeType() == 3) {
2811 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2812 iNewRec, pT2, 0, mother.chargeType(), 0, 0, normalRecoil) );
2814 if (doWeakShower && iSysSel == 0) {
2815 int MEtypeNew = 203;
2816 if (idRecoiler == 21) MEtypeNew = 201;
2817 if (idRecoiler == idMother) MEtypeNew = 202;
2819 if( event[3].
id() == -
event[4].id()) MEtypeNew = 200;
2820 int weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
2821 event[iMother].pol(weakPol);
2822 if ((weakMode == 0 || weakMode == 1) && weakPol == -1)
2823 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2824 iNewRec, pT2, 0, 0, 1, MEtypeNew, normalRecoil, weakPol) );
2825 if (weakMode == 0 || weakMode == 2)
2826 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2827 iNewRec, pT2, 0, 0, 2, MEtypeNew + 5, normalRecoil, weakPol) );
2832 dipEndSel = &dipEnd[iDipSel];
2835 if (dipEndSel->weakType != 0) hasWeaklyRadiated =
true;
2839 while (iSysSel >=
int(nRadA.size()) || iSysSel >=
int(nRadB.size())) {
2843 if (dipEndSel->colType != 0 && side == 1) ++nRadA[iSysSel];
2844 else if (dipEndSel->colType != 0) ++nRadB[iSysSel];
2847 for (
int iDip = 0; iDip < int(dipEnd.size()); ++iDip)
2848 if ( dipEnd[iDip].system == iSysSel) {
2849 if (abs(dipEnd[iDip].side) == side) {
2850 dipEnd[iDip].iRadiator = iMother;
2851 dipEnd[iDip].iRecoiler = iNewRec;
2853 dipEnd[iDip].iColPartner = (doDipoleRecoil) ? findColPartner( event,
2854 dipEnd[iDip].iRadiator, dipEnd[iDip].iRecoiler, iSysSel) : 0;
2855 dipEnd[iDip].idColPartner = (dipEnd[iDip].iColPartner != 0)
2856 ? event[dipEnd[iDip].iColPartner].
id() : 0;
2857 if (dipEnd[iDip].colType != 0)
2858 dipEnd[iDip].colType = mother.colType();
2859 else if (dipEnd[iDip].chgType != 0) {
2860 dipEnd[iDip].chgType = 0;
2861 if ( (mother.isQuark() && doQEDshowerByQ)
2862 || (mother.isLepton() && doQEDshowerByL) )
2863 dipEnd[iDip].chgType = mother.chargeType();
2865 else if (dipEnd[iDip].weakType != 0) {
2867 if (!(mother.isLepton() || mother.isQuark()))
2868 dipEnd[iDip].weakType = 0;
2869 if (singleWeakEmission && hasWeaklyRadiated)
2870 dipEnd[iDip].weakType = 0;
2875 if (dipEnd[iDip].weakType == 0) dipEnd[iDip].MEtype = 0;
2879 dipEnd[iDip].iRadiator = iNewRec;
2880 dipEnd[iDip].iRecoiler = iMother;
2882 dipEnd[iDip].iColPartner = (doDipoleRecoil) ? findColPartner( event,
2883 dipEnd[iDip].iRadiator, dipEnd[iDip].iRecoiler, iSysSel) : 0;
2884 dipEnd[iDip].idColPartner = (dipEnd[iDip].iColPartner != 0)
2885 ? event[dipEnd[iDip].iColPartner].
id() : 0;
2887 if (!doMEafterFirst && dipEnd[iDip].weakType == 0)
2888 dipEnd[iDip].MEtype = 0;
2890 if (dipEnd[iDip].weakType != 0 && singleWeakEmission
2891 && hasWeaklyRadiated) dipEnd[iDip].weakType = 0;
2896 if (dipEndSel->weakType != 0) mother.pol(dipEndSel->weakPol);
2899 double xNew = (side == 1) ? x1New : x2New;
2900 beamNow[iSysSel].update( iMother, idMother, xNew);
2902 if (idMother != idDaughterNow) {
2903 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
2904 beamNow.xfISR( iSysSel, idMother, xNew, pdfScale2);
2905 beamNow.pickValSeaComp();
2907 BeamParticle& beamRec = (side == 1) ? *beamBPtr : *beamAPtr;
2908 beamRec[iSysSel].iPos( iNewRec);
2911 ++dipEndSel->nBranch;
2912 dipEndSel->pT2Old = pT2;
2913 dipEndSel->zOld = z;
2917 event[iRecoilMother].daughters( iNewRec, iNewRec);
2920 vector<int> iRescatterer;
2921 for (
int i = 0; i < systemSizeOld - 2; ++i) {
2922 int iOutNew = partonSystemsPtr->getOut( iSysSel, i);
2923 if (!event[iOutNew].isFinal()) iRescatterer.push_back(iOutNew);
2928 while (++iRescNow <
int(iRescatterer.size())) {
2934 int iOutNew = iRescatterer[iRescNow];
2935 int iInOld =
event[iOutNew].daughter1();
2936 int iSysResc = partonSystemsPtr->getSystemOf(iInOld,
true);
2939 int iOldA = partonSystemsPtr->getInA(iSysResc);
2940 int iOldB = partonSystemsPtr->getInB(iSysResc);
2941 bool rescSideA =
event[iOldA].isRescatteredIncoming();
2942 int statusNewA = (rescSideA) ? -45 : -42;
2943 int statusNewB = (rescSideA) ? -42 : -45;
2944 int iNewA =
event.copy(iOldA, statusNewA);
2945 int iNewB =
event.copy(iOldB, statusNewB);
2948 int eventSize =
event.size();
2949 int sizeOutAB = partonSystemsPtr->sizeOut(iSysResc);
2950 int iOldAB, statusOldAB, iNewAB;
2951 for (
int iOutAB = 0; iOutAB < sizeOutAB; ++iOutAB) {
2952 iOldAB = partonSystemsPtr->getOut(iSysResc, iOutAB);
2953 statusOldAB =
event[iOldAB].status();
2954 iNewAB =
event.copy(iOldAB, 44);
2956 if (statusOldAB < 0) {
2957 event[iNewAB].statusNeg();
2958 iRescatterer.push_back(iNewAB);
2963 int iInNew = (rescSideA) ? iNewA : iNewB;
2964 event[iOutNew].daughters( iInNew, iInNew);
2965 event[iInNew].mothers( iOutNew, iOutNew);
2968 event[iInNew].p( event[iOutNew].p() );
2969 double momFac = (rescSideA)
2970 ? event[iInOld].pPos() /
event[iInNew].pPos()
2971 :
event[iInOld].pNeg() /
event[iInNew].pNeg();
2972 int iInRec = (rescSideA) ? iNewB : iNewA;
2978 infoPtr->errorMsg(
"Warning in SpaceShower::branch: "
2979 "change in lightcone momentum sign; retrying parton level");
2980 rescatterFail =
true;
2983 event[iInRec].rescale4( momFac);
2986 RotBstMatrix MmodResc;
2987 MmodResc.toCMframe( event[iOldA].p(), event[iOldB].p());
2988 MmodResc.fromCMframe(event[iNewA].p(), event[iNewB].p());
2989 for (
int iOutAB = 0; iOutAB < sizeOutAB; ++iOutAB)
2990 event[eventSize + iOutAB].rotbst(MmodResc);
2993 partonSystemsPtr->setInA(iSysResc, iNewA);
2994 partonSystemsPtr->setInB(iSysResc, iNewB);
2995 for (
int iCopy = 0; iCopy < sizeOutAB; ++iCopy)
2996 partonSystemsPtr->setOut(iSysResc, iCopy, eventSize + iCopy);
2999 for (
int iDip = 0; iDip < int(dipEnd.size()); ++iDip)
3000 if ( dipEnd[iDip].system == iSysResc) {
3001 bool sideAnow = (abs(dipEnd[iDip].side) == 1);
3002 dipEnd[iDip].iRadiator = (sideAnow) ? iNewA : iNewB;
3003 dipEnd[iDip].iRecoiler = (sideAnow) ? iNewB : iNewA;
3007 BeamParticle& beamResc = (rescSideA) ? *beamAPtr : *beamBPtr;
3008 beamResc[iSysResc].iPos( iInNew);
3009 beamResc[iSysResc].p( event[iInNew].p() );
3010 beamResc[iSysResc].scaleX( 1. / momFac );
3011 BeamParticle& beamReco = (rescSideA) ? *beamBPtr : *beamAPtr;
3012 beamReco[iSysResc].iPos( iInRec);
3013 beamReco[iSysResc].scaleX( momFac);
3019 if ( ( beamAPtr->xMax(-1) < 0.0 && !(beamAPtr->isUnresolved()) )
3020 || (beamBPtr->xMax(-1) < 0.0 && !(beamBPtr->isUnresolved()) ) ) {
3021 infoPtr->errorMsg(
"Warning in SpaceShower::branch: "
3022 "used up beam momentum; retrying parton level");
3023 rescatterFail =
true;
3028 if ( beamNow.isGamma() && beamNow.resolvedGamma() && gamma2qqbar)
3029 beamNow.resolvedGamma(
false);
3040 bool SpaceShower::initUncertainties() {
3043 uVarMuSoftCorr = settingsPtr->flag(
"UncertaintyBands:muSoftCorr");
3044 dASmax = settingsPtr->parm(
"UncertaintyBands:deltaAlphaSmax");
3047 varG2GGmuRfac.clear(); varG2GGcNS.clear();
3048 varQ2QGmuRfac.clear(); varQ2QGcNS.clear();
3049 varQ2GQmuRfac.clear(); varQ2GQcNS.clear();
3050 varX2XGmuRfac.clear(); varX2XGcNS.clear();
3051 varG2QQmuRfac.clear(); varG2QQcNS.clear();
3053 varPDFplus = &infoPtr->varPDFplus;
3054 varPDFminus = &infoPtr->varPDFminus;
3055 varPDFmember = &infoPtr->varPDFmember;
3056 varPDFplus->clear(); varPDFminus->clear();
3057 varPDFmember->clear();
3059 vector<string> keys;
3061 keys.push_back(
"isr:murfac");
3062 keys.push_back(
"isr:g2gg:murfac");
3063 keys.push_back(
"isr:q2qg:murfac");
3064 keys.push_back(
"isr:q2gq:murfac");
3065 keys.push_back(
"isr:x2xg:murfac");
3066 keys.push_back(
"isr:g2qq:murfac");
3067 keys.push_back(
"isr:cns");
3068 keys.push_back(
"isr:g2gg:cns");
3069 keys.push_back(
"isr:q2qg:cns");
3070 keys.push_back(
"isr:q2gq:cns");
3071 keys.push_back(
"isr:x2xg:cns");
3072 keys.push_back(
"isr:g2qq:cns");
3073 keys.push_back(
"isr:pdf:plus");
3074 keys.push_back(
"isr:pdf:minus");
3075 keys.push_back(
"isr:pdf:member");
3078 int nKeysQCD=keys.size();
3081 vector<string> uVars = settingsPtr->wvec(
"UncertaintyBands:List");
3082 size_t varSize = uVars.size();
3083 nUncertaintyVariations = int(uVars.size());
3084 if (nUncertaintyVariations == 0)
return false;
3085 vector<string> uniqueVars;
3088 string tmpKey(
"isr:pdf:family");
3090 for (
size_t iWeight = 0; iWeight < varSize; ++iWeight) {
3093 string uVarString = toLower(uVars[iWeight]);
3094 while (uVarString.find(
" ") == 0) uVarString.erase( 0, 1);
3095 int iEnd = uVarString.find(
" ", 0);
3096 uVarString.erase(0,iEnd+1);
3097 while (uVarString.find(
"=") != string::npos) {
3098 int firstEqual = uVarString.find_first_of(
"=");
3099 string testString = uVarString.substr(0, firstEqual);
3100 iEnd = uVarString.find_first_of(
" ", 0);
3101 if( iEnd<0 ) iEnd = uVarString.length();
3102 string insertString = uVarString.substr(0,iEnd);
3104 if( find(keys.begin(), keys.end(), testString) != keys.end() ) {
3105 if( uniqueVars.size() == 0 ) {
3106 uniqueVars.push_back(insertString);
3107 }
else if ( find(uniqueVars.begin(), uniqueVars.end(), insertString)
3108 == uniqueVars.end() ) {
3109 uniqueVars.push_back(insertString);
3111 }
else if ( testString == tmpKey ) {
3113 BeamParticle& beam = *beamAPtr;
3114 nMembers = beam.nMembers();
3115 for(
int iMem=1; iMem<nMembers; ++iMem) {
3118 string tmpString(
"isr:pdf:member="+iss.str());
3119 if (find(uniqueVars.begin(), uniqueVars.end(), tmpString)
3120 == uniqueVars.end() ) {
3121 uniqueVars.push_back(tmpString);
3125 uVarString.erase(0,iEnd+1);
3129 nUncertaintyVariations = int(uniqueVars.size());
3131 if ( nUncertaintyVariations > 0 ) {
3132 int nWeights = infoPtr->nWeights();
3133 infoPtr->setNWeights( nWeights + nUncertaintyVariations );
3134 int newSize = infoPtr->nWeights();
3135 for(
int iWeight = nWeights; iWeight < newSize; ++iWeight) {
3136 string uVarString = uniqueVars[iWeight - nWeights];
3137 infoPtr->setWeightLabel(iWeight, uVarString);
3142 while (uVarString.find(
"=") != string::npos) {
3143 int firstEqual = uVarString.find_first_of(
"=");
3144 uVarString.replace(firstEqual, 1,
" ");
3146 while (uVarString.find(
" ") != string::npos)
3147 uVarString.erase( uVarString.find(
" "), 1);
3148 if (uVarString ==
"" || uVarString ==
" ")
continue;
3151 int nRecognizedQCD = 0;
3152 for (
int iWord = 0; iWord < int(keys.size()); ++iWord) {
3154 string key = toLower(keys[iWord]);
3156 int iKey = uVarString.find(key);
3157 int iBeg = uVarString.find(
" ", iKey) + 1;
3158 int iEnd = uVarString.find(
" ", iBeg);
3159 string valueString = uVarString.substr(iBeg, iEnd - iBeg);
3160 stringstream ss(valueString);
3167 if (key ==
"isr:murfac" || key ==
"isr:g2gg:murfac")
3168 varG2GGmuRfac[iWeight] = value;
3169 if (key ==
"isr:murfac" || key ==
"isr:q2qg:murfac")
3170 varQ2QGmuRfac[iWeight] = value;
3171 if (key ==
"isr:murfac" || key ==
"isr:q2gq:murfac")
3172 varQ2GQmuRfac[iWeight] = value;
3173 if (key ==
"isr:murfac" || key ==
"isr:x2xg:murfac")
3174 varX2XGmuRfac[iWeight] = value;
3175 if (key ==
"isr:murfac" || key ==
"isr:g2qq:murfac")
3176 varG2QQmuRfac[iWeight] = value;
3177 if (key ==
"isr:cns" || key ==
"isr:g2gg:cns")
3178 varG2GGcNS[iWeight] = value;
3179 if (key ==
"isr:cns" || key ==
"isr:q2qg:cns")
3180 varQ2QGcNS[iWeight] = value;
3181 if (key ==
"isr:cns" || key ==
"isr:q2gq:cns")
3182 varQ2GQcNS[iWeight] = value;
3183 if (key ==
"isr:cns" || key ==
"isr:x2xg:cns")
3184 varX2XGcNS[iWeight] = value;
3185 if (key ==
"isr:cns" || key ==
"isr:g2qq:cns")
3186 varG2QQcNS[iWeight] = value;
3187 if (key ==
"isr:pdf:plus") varPDFplus->operator[](iWeight) = 1;
3188 if (key ==
"isr:pdf:minus") varPDFminus->operator[](iWeight) = 1;
3189 if (key ==
"isr:pdf:member")
3190 varPDFmember->operator[](iWeight) =
int(value);
3192 if (iWord < nKeysQCD) nRecognizedQCD++;
3196 if (nRecognizedQCD > 0) ++nVarQCD;
3200 infoPtr->initUncertainties(&uVars,
true);
3202 return (nVarQCD > 0);
3209 void SpaceShower::calcUncertainties(
bool accept,
double pAccept,
double pT20in,
3210 double enhance,
double vp, SpaceDipoleEnd* dip, Particle* motPtr,
3214 if (!doUncertainties || !doUncertaintiesNow || nUncertaintyVariations <= 0)
3219 map<int,double>* varPtr=0;
3220 map<int,double>::iterator itVar;
3222 map<int,double> dummy; dummy.clear();
3224 int numWeights = infoPtr->nWeights();
3227 vector<double> uVarFac(numWeights, 1.0);
3228 vector<bool> doVar(numWeights,
false);
3234 int idSis = sisPtr->id();
3235 int idMot = motPtr->id();
3238 if ( !varPDFplus->empty() || !varPDFminus->empty() || !varPDFmember->empty()
3241 double scale2 = (useFixedFacScale) ? fixedFacScale2
3242 : factorMultFac * dip->pT2;
3243 double xMother = dip->xMo;
3244 double xDau = dip->z * xMother;
3245 BeamParticle& beam = (abs(dip->side) == 1) ? *beamAPtr : *beamBPtr;
3246 int valSea = (beam[iSysSel].isValence()) ? 1 : 0;
3247 if( beam[iSysSel].isUnmatched() ) valSea = 2;
3248 beam.calcPDFEnvelope( make_pair(dip->idMother,dip->idDaughter),
3249 make_pair(xMother,xDau), scale2, valSea);
3250 PDF::PDFEnvelope ratioPDFEnv = beam.getPDFEnvelope( );
3252 varPtr = varPDFplus;
3253 for (itVar = varPtr->begin(); itVar != varPtr->end(); ++itVar) {
3254 int iWeight = itVar->first;
3255 uVarFac[iWeight] *= 1.0 + min(ratioPDFEnv.errplusPDF
3256 / ratioPDFEnv.centralPDF, 0.5);
3257 doVar[iWeight] =
true;
3260 varPtr = varPDFminus;
3261 for (itVar = varPtr->begin(); itVar != varPtr->end(); ++itVar) {
3262 int iWeight = itVar->first;
3263 uVarFac[iWeight] *= max(.01,1.0 - min(ratioPDFEnv.errminusPDF
3264 / ratioPDFEnv.centralPDF, 0.5));
3265 doVar[iWeight] =
true;
3267 varPtr = varPDFmember;
3268 for (itVar = varPtr->begin(); itVar != varPtr->end(); ++itVar) {
3269 int iWeight = itVar->first;
3270 int member = int( itVar->second );
3271 uVarFac[iWeight] *= max(.01,ratioPDFEnv.pdfMemberVars[member]
3272 / ratioPDFEnv.centralPDF);
3273 doVar[iWeight] =
true;
3278 if (dip->colType != 0) {
3281 if (alphaSorder == 0) varPtr = &dummy;
3282 else if (idMot == 21 && idSis == 21) varPtr = &varG2GGmuRfac;
3283 else if (idMot == 21 && abs(idSis) <= nQuarkIn) varPtr = &varG2QQmuRfac;
3284 else if (abs(idMot) <= nQuarkIn) {
3285 if (abs(idMot) <= uVarNflavQ) varPtr = &varQ2QGmuRfac;
3286 else varPtr = &varX2XGmuRfac;
3288 else varPtr = &dummy;
3289 double Q2 = dip->pT2;
3290 double muR2 = renormMultFac * (Q2 + pT20in);
3291 double alphaSbaseline = alphaS.alphaS(muR2);
3292 for (itVar = varPtr->begin(); itVar != varPtr->end(); ++itVar) {
3293 int iWeight = itVar->first;
3294 double valFac = itVar->second;
3296 double muR2var = max(1.1 * Lambda3flav2, pow2(valFac) * muR2);
3297 double alphaSratio = alphaS.alphaS(muR2var) / alphaSbaseline;
3299 double facCorr = 1.;
3300 if (idSis == 21 && uVarMuSoftCorr) {
3303 if (dip->pT2 < pow2(mc)) nf = 3;
3304 else if (dip->pT2 < pow2(mb)) nf = 4;
3305 double alphaScorr = alphaS.alphaS(dip->m2Dip);
3306 double facSoft = alphaScorr * (33. - 2. * nf) / (6. * M_PI);
3308 double zeta = 1. - dip->z;
3309 facCorr = 1. + (1. - zeta) * facSoft * log(valFac);
3312 double alphaSfac = alphaSratio * facCorr;
3315 alphaSfac = min(alphaSfac, (alphaSbaseline + dASmax) / alphaSbaseline);
3316 else if (alphaSbaseline > dASmax)
3317 alphaSfac = max(alphaSfac, (alphaSbaseline - dASmax) / alphaSbaseline);
3318 uVarFac[iWeight] *= alphaSfac;
3319 doVar[iWeight] =
true;
3323 if (dip->MEtype != 0 || dip->pT2 < pow2(cNSpTmin) ) varPtr = &dummy;
3324 else if (idMot == 21 && idSis == 21) varPtr = &varG2GGcNS;
3325 else if (idMot == 21 && abs(idSis) <= nQuarkIn) varPtr = &varG2QQcNS;
3326 else if (abs(idMot) <= nQuarkIn) {
3327 if (abs(idMot) <= uVarNflavQ) varPtr = &varQ2QGcNS;
3328 else varPtr = &varX2XGcNS;
3330 else varPtr = &dummy;
3332 for (itVar = varPtr->begin(); itVar != varPtr->end(); ++itVar) {
3333 int iWeight = itVar->first;
3334 double valFac = itVar->second;
3337 if (idMot == 21 && abs(idSis) >= 4 && idSis != 21)
3338 Q2 = max(1., Q2+pow2(sisPtr->m0()));
3339 else if (idSis == 21 && abs(idMot) >= 4 && idMot != 21)
3340 Q2 = max(1., Q2+pow2(motPtr->m0()));
3341 double yQ = Q2 / dip->m2Dip;
3342 double num = yQ * valFac;
3345 if (idSis == 21 && idMot == 21)
3346 denom = pow2(1. - z * (1.-z)) / (z*(1.-z));
3348 else if (idSis == 21)
3349 denom = (1. + pow2(z)) / (1. - z);
3351 else if (idMot == idSis)
3352 denom = (1. + pow2(1. - z)) / z;
3355 denom = pow2(z) + pow2(1. - z);
3357 double minReWeight = max( 1. + num / denom, REJECTFACTOR );
3358 uVarFac[iWeight] *= minReWeight;
3359 doVar[iWeight] =
true;
3365 for (
int iWeight = 1; iWeight<numWeights; ++iWeight) {
3366 if (!doVar[iWeight])
continue;
3367 double pAcceptPrime = pAccept * uVarFac[iWeight];
3368 if (pAcceptPrime > PROBLIMIT && dip->colType != 0) {
3369 uVarFac[iWeight] *= PROBLIMIT / pAcceptPrime;
3374 for (
int iWeight = 0; iWeight < numWeights; ++iWeight) {
3375 if (!doVar[iWeight])
continue;
3377 if (accept) infoPtr->reWeight( iWeight,
3378 uVarFac[iWeight] / ((1.0 - vp) * enhance) );
3383 double denom = 1. - pAccept * (1.0 - vp);
3384 if (denom < REJECTFACTOR) {
3385 stringstream message;
3387 infoPtr->errorMsg(
"Warning in SpaceShower: reject denom for"
3388 " iWeight = ", message.str());
3391 double reWtFail = max(0.01, (1. - uVarFac[iWeight] * pAccept / enhance )
3393 infoPtr->reWeight(iWeight, reWtFail);
3402 int SpaceShower::findMEtype(
int iSys,
Event& event,
bool weakRadiation) {
3406 if (!doMEcorrections)
return MEtype;
3409 if (partonSystemsPtr->sizeOut( iSys) == 1 && !weakRadiation) {
3410 int idIn1 =
event[partonSystemsPtr->getInA(iSys)].id();
3411 int idIn2 =
event[partonSystemsPtr->getInA(iSys)].id();
3412 int idRes =
event[partonSystemsPtr->getOut(iSys, 0)].id();
3413 if (iSys == 0) idResFirst = abs(idRes);
3414 if (iSys == 1) idResSecond = abs(idRes);
3417 if ( (idRes == 23 || abs(idRes) == 24 || idRes == 32
3418 || idRes == 33 || abs(idRes) == 34 || abs(idRes) == 41)
3419 && abs(idIn1) < 20 && abs(idIn2) < 20 ) MEtype = 1;
3422 if ( (idRes == 25 || idRes == 35 || idRes == 36)
3423 && ( ( idIn1 == 21 && idIn2 == 21 )
3424 || ( idIn1 == 22 && idIn2 == 22 ) ) ) MEtype = 2;
3427 if ( (idRes == 25 || idRes == 35 || idRes == 36)
3428 && abs(idIn1) < 20 && abs(idIn2) < 20 ) MEtype = 3;
3432 if (weakRadiation) {
3433 if (event[3].
id() == -event[4].
id()
3434 || event[event[3].daughter1()].idAbs() == 24 || infoPtr->nFinal() != 2)
3436 else if (event[3].idAbs() == 21 ||
event[4].idAbs() == 21) MEtype = 201;
3437 else if (event[3].
id() ==
event[4].id()) MEtype = 202;
3450 double SpaceShower::calcMEmax(
int MEtype,
int idMother,
int idDaughterIn) {
3453 if (MEtype == 1 && idMother > 20 && idDaughterIn < 20)
return 3.;
3458 if ( MEtype == 201 || MEtype == 202 || MEtype == 203
3459 || MEtype == 206 || MEtype == 207 || MEtype == 208)
return WEAKPSWEIGHT;
3472 double SpaceShower::calcMEcorr(
int MEtype,
int idMother,
int idDaughterIn,
3473 double M2,
double z,
double Q2,
double m2Sister) {
3478 double uH = Q2 - M2 * (1. - z) / z;
3479 int idMabs = abs(idMother);
3480 int idDabs = abs(idDaughterIn);
3484 if (idMabs < 20 && idDabs < 20) {
3485 return (tH*tH + uH*uH + 2. * M2 * sH) / (sH*sH + M2*M2);
3486 }
else if (idDabs < 20) {
3490 return (sH*sH + uH*uH + 2. * M2 * tH) / (pow2(sH - M2) + M2*M2);
3494 }
else if (MEtype == 2) {
3495 if (idMabs < 20 && idDabs > 20) {
3496 return (sH*sH + uH*uH) / (sH*sH + pow2(sH - M2));
3497 }
else if (idDabs > 20) {
3498 return 0.5 * (pow4(sH) + pow4(tH) + pow4(uH) + pow4(M2))
3499 / pow2(sH*sH - M2 * (sH - M2));
3503 }
else if (MEtype == 3) {
3504 if (idMabs < 20 && idDabs < 20) {
3507 }
else if (idDabs < 20) {
3510 return (sH*sH + uH*uH + 2. * (M2 - uH) * (M2 - sH))
3511 / (pow2(sH - M2) + M2*M2);
3515 }
else if (MEtype == 200 || MEtype == 205) {
3518 double wtME = (uH*uH + tH*tH + 2 * sH * (m2Sister + M2)) / (uH*tH)
3519 - M2 * m2Sister * (1/(tH*tH) + 1/(uH*uH));
3520 double wtPS = (sH*sH + pow2(M2 + m2Sister)) / (tH*uH);
3522 }
else if (MEtype == 201 || MEtype == 202 || MEtype == 203 ||
3523 MEtype == 206 || MEtype == 207 || MEtype == 208)
3524 return calcMEmax(MEtype, 0, 0);
3535 double SpaceShower::calcMEcorrWeak(
int MEtype,
double m2,
double z,
3536 double pT2, Vec4 pMother, Vec4 pB, Vec4 pDaughter,
3537 Vec4 pB0, Vec4 p1, Vec4 p2, Vec4 pSister) {
3540 Vec4 pA = pMother - pSister;
3543 double scaleFactor2 = (pA + pB).m2Calc() / (p1 + p2).m2Calc();
3544 double scaleFactor = sqrt(scaleFactor2);
3545 RotBstMatrix rot2to2frame;
3546 rot2to2frame.bstback(p1 + p2);
3547 p1.rotbst(rot2to2frame);
3548 p2.rotbst(rot2to2frame);
3554 RotBstMatrix rot2to2frameInc;
3555 rot2to2frameInc.bstback(pDaughter + pB0);
3556 pDaughter.rotbst(rot2to2frameInc);
3557 pB0.rotbst(rot2to2frameInc);
3558 double sHat = (p1 + p2).m2Calc();
3559 double tHat = (p1 - pDaughter).m2Calc();
3560 double uHat = (p1 - pB0).m2Calc();
3563 double m2R1 = 1. + pSister.m2Calc() / m2;
3564 double wt = 4. * sHat / (pMother + pB).m2Calc() * pT2 * ( 1. - z * m2R1)
3565 / (1. + pow2(z * m2R1)) / (1.-z);
3566 if (MEtype == 201 || MEtype == 206)
3567 wt *= weakShowerMEs.getMEqg2qgZ(pMother, pB, p2, pSister, p1)
3568 / weakShowerMEs.getMEqg2qg(sHat, tHat, uHat);
3569 else if (MEtype == 202 || MEtype == 207)
3570 wt *= weakShowerMEs.getMEqq2qqZ(pMother, pB, pSister, p2, p1)
3571 / weakShowerMEs.getMEqq2qq(sHat, tHat, uHat,
true);
3572 else if (MEtype == 203 || MEtype == 208)
3573 wt *= weakShowerMEs.getMEqq2qqZ(pMother, pB, pSister, p2, p1)
3574 / weakShowerMEs.getMEqq2qq(sHat, tHat, uHat,
false);
3577 wt *= (pSister + p1).m2Calc() / ( (pSister + p1).m2Calc()
3578 + abs((-pMother + pSister).m2Calc()) );
3581 wt /= calcMEmax(MEtype, 0, 0);
3590 void SpaceShower::findAsymPol(
Event& event, SpaceDipoleEnd* dip) {
3595 int iRad = dip->iRadiator;
3596 if (!doPhiPolAsym || dip->idDaughter != 21)
return;
3599 int systemSizeOut = partonSystemsPtr->sizeOut( iSysSel);
3600 if (systemSizeOut < 2)
return;
3601 bool foundColOut =
false;
3602 for (
int ii = 0; ii < systemSizeOut; ++ii) {
3603 int i = partonSystemsPtr->getOut( iSysSel, ii);
3604 if (event[i].col() != 0 || event[i].acol() != 0) foundColOut =
true;
3606 if (!foundColOut)
return;
3611 int iGrandD1 =
event[iRad].daughter1();
3612 int iGrandD2 =
event[iRad].daughter2();
3613 bool traceCopy =
false;
3616 if (iGrandD1 > 0 && iGrandD2 == iGrandD1) {
3617 iGrandD1 =
event[iGrandD2].daughter1();
3618 iGrandD2 =
event[iGrandD2].daughter2();
3621 }
while (traceCopy);
3622 int statusGrandD1 =
event[ iGrandD1 ].statusAbs();
3623 bool isHardProc = (statusGrandD1 == 23 || statusGrandD1 == 33);
3625 if (!doPhiPolAsymHard)
return;
3626 if (iGrandD2 != iGrandD1 + 1)
return;
3627 if (event[iGrandD1].isGluon() &&
event[iGrandD2].isGluon());
3628 else if (event[iGrandD1].isQuark() &&
event[iGrandD2].isQuark());
3631 dip->iFinPol = iGrandD1;
3634 if (dip->idMother == 21) dip->asymPol = pow2( (1. - dip->z)
3635 / (1. - dip->z * (1. - dip->z) ) );
3636 else dip->asymPol = 2. * (1. - dip->z) / (1. + pow2(1. - dip->z) );
3639 double zDau = (isHardProc) ? 0.5 : dip->zOld;
3640 if (event[iGrandD1].isGluon()) dip->asymPol *= pow2( zDau * (1. - zDau)
3641 / (1. - zDau * (1. - zDau) ) );
3642 else dip->asymPol *= -2. * zDau *( 1. - zDau )
3643 / (1. - 2. * zDau * (1. - zDau) );
3651 int SpaceShower::findColPartner(
Event& event,
int iSideA,
int iSideB,
3654 int iColPartner = 0;
3655 int colSideA =
event[iSideA].col();
3656 int acolSideA =
event[iSideA].acol();
3659 if ( (colSideA != 0 && event[iSideB].acol() == colSideA)
3660 || (acolSideA != 0 && event[iSideB].col() == acolSideA) ) {
3664 if (event[iSideA].
id() == 21)
3665 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSystem); ++i) {
3666 int iOut = partonSystemsPtr->getOut(iSystem, i);
3667 if ( event[iOut].col() == colSideA
3668 || event[iOut].acol() == acolSideA )
3670 if (rndmPtr->flat() < 0.5) iColPartner = iOut;
3674 }
else if (colSideA != 0 || acolSideA != 0) {
3675 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSystem); ++ i) {
3676 int iOut = partonSystemsPtr->getOut(iSystem, i);
3677 if ( (colSideA != 0 && event[iOut].col() == colSideA)
3678 || (acolSideA != 0 && event[iOut].acol() == acolSideA) ) {
3679 if (iColPartner == 0) iColPartner = iOut;
3681 else if (rndmPtr->flat() < 0.5) iColPartner = iOut;
3695 void SpaceShower::update(
int iSys,
Event& event,
bool hasWeakRad) {
3697 if (hasWeakRad && singleWeakEmission)
3698 for (
int i = 0; i < int(dipEnd.size()); i++)
3699 if (dipEnd[i].weakType != 0) dipEnd[i].weakType = 0;
3700 if (hasWeakRad) hasWeaklyRadiated =
true;
3704 for (
int i = 0; i < int(dipEnd.size()); i++)
3705 if (dipEnd[i].system == iSys) {
3706 dipEnd[i].iColPartner = findColPartner(event, dipEnd[i].iRadiator,
3707 dipEnd[i].iRecoiler, iSys);
3708 dipEnd[i].idColPartner = (dipEnd[i].iColPartner != 0)
3709 ? event[dipEnd[i].iColPartner].
id() : 0;
3718 void SpaceShower::list()
const {
3721 cout <<
"\n -------- PYTHIA SpaceShower Dipole Listing -------------- \n"
3722 <<
"\n i syst side rad rec pTmax col chg ME rec \n"
3723 << fixed << setprecision(3);
3726 for (
int i = 0; i < int(dipEnd.size()); ++i)
3727 cout << setw(5) << i << setw(6) << dipEnd[i].system
3728 << setw(6) << dipEnd[i].side << setw(6) << dipEnd[i].iRadiator
3729 << setw(6) << dipEnd[i].iRecoiler << setw(12) << dipEnd[i].pTmax
3730 << setw(5) << dipEnd[i].colType << setw(5) << dipEnd[i].chgType
3731 << setw(5) << dipEnd[i].MEtype << setw(4)
3732 << dipEnd[i].normalRecoil <<
"\n";
3735 cout <<
"\n -------- End PYTHIA SpaceShower Dipole Listing ----------"