9 #include "Pythia8/SimpleSpaceShower.h"
24 const int SimpleSpaceShower::MAXLOOPTINYPDF = 10;
27 const double SimpleSpaceShower::MCMIN = 1.2;
28 const double SimpleSpaceShower::MBMIN = 4.0;
32 const double SimpleSpaceShower::CTHRESHOLD = 2.0;
33 const double SimpleSpaceShower::BTHRESHOLD = 2.0;
37 const double SimpleSpaceShower::EVALPDFSTEP = 0.1;
40 const double SimpleSpaceShower::TINYPDF = 1e-10;
43 const double SimpleSpaceShower::TINYKERNELPDF = 1e-6;
46 const double SimpleSpaceShower::TINYPT2 = 0.25e-6;
50 const double SimpleSpaceShower::HEAVYPT2EVOL = 1.1;
55 const double SimpleSpaceShower::HEAVYXEVOL = 0.9;
60 const double SimpleSpaceShower::EXTRASPACEQ = 2.0;
63 const double SimpleSpaceShower::LAMBDA3MARGIN = 1.1;
66 const double SimpleSpaceShower::PT2MINWARN = 1.;
70 const double SimpleSpaceShower::LEPTONXMIN = 1e-10;
71 const double SimpleSpaceShower::LEPTONXMAX = 1. - 1e-10;
74 const double SimpleSpaceShower::LEPTONPT2MIN = 1.2;
77 const double SimpleSpaceShower::LEPTONFUDGE = 10.;
80 const double SimpleSpaceShower::WEAKPSWEIGHT = 5.;
83 const double SimpleSpaceShower::HEADROOMQ2G = 1.35;
84 const double SimpleSpaceShower::HEADROOMQ2Q = 1.15;
85 const double SimpleSpaceShower::HEADROOMG2Q = 1.35;
86 const double SimpleSpaceShower::HEADROOMG2G = 1.35;
87 const double SimpleSpaceShower::HEADROOMHQG = 1.35;
90 const double SimpleSpaceShower::REJECTFACTOR = 0.1;
93 const double SimpleSpaceShower::PROBLIMIT = 0.99;
99 void SimpleSpaceShower::init( BeamParticle* beamAPtrIn,
100 BeamParticle* beamBPtrIn) {
103 beamAPtr = beamAPtrIn;
104 beamBPtr = beamBPtrIn;
107 doQCDshower = flag(
"SpaceShower:QCDshower");
108 doQEDshowerByQ = flag(
"SpaceShower:QEDshowerByQ");
109 doQEDshowerByL = flag(
"SpaceShower:QEDshowerByL");
110 doWeakShower = flag(
"SpaceShower:WeakShower");
113 pTmaxMatch = mode(
"SpaceShower:pTmaxMatch");
114 pTdampMatch = mode(
"SpaceShower:pTdampMatch");
115 pTmaxFudge = parm(
"SpaceShower:pTmaxFudge");
116 pTmaxFudgeMPI = parm(
"SpaceShower:pTmaxFudgeMPI");
117 pTdampFudge = parm(
"SpaceShower:pTdampFudge");
120 doRapidityOrder = flag(
"SpaceShower:rapidityOrder");
121 doRapidityOrderMPI = flag(
"SpaceShower:rapidityOrderMPI");
124 mc = max( MCMIN, particleDataPtr->m0(4));
125 mb = max( MBMIN, particleDataPtr->m0(5));
130 renormMultFac = parm(
"SpaceShower:renormMultFac");
131 factorMultFac = parm(
"SpaceShower:factorMultFac");
132 useFixedFacScale = flag(
"SpaceShower:useFixedFacScale");
133 fixedFacScale2 = pow2(parm(
"SpaceShower:fixedFacScale"));
136 alphaSvalue = parm(
"SpaceShower:alphaSvalue");
137 alphaSorder = mode(
"SpaceShower:alphaSorder");
138 alphaSnfmax = mode(
"StandardModel:alphaSnfmax");
139 alphaSuseCMW = 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 = flag(
"SpaceShower:samePTasMPI");
156 if (useSamePTasMPI) {
159 if (beamAPtr->isGamma() && beamBPtr->isGamma()) {
160 pT0paramMode = mode(
"PhotonPhoton:pT0parametrization");
161 pT0Ref = parm(
"PhotonPhoton:pT0Ref");
162 ecmRef = parm(
"PhotonPhoton:ecmRef");
163 ecmPow = parm(
"PhotonPhoton:ecmPow");
164 pTmin = parm(
"PhotonPhoton:pTmin");
167 = mode(
"MultipartonInteractions:pT0parametrization");
168 pT0Ref = parm(
"MultipartonInteractions:pT0Ref");
169 ecmRef = parm(
"MultipartonInteractions:ecmRef");
170 ecmPow = parm(
"MultipartonInteractions:ecmPow");
171 pTmin = parm(
"MultipartonInteractions:pTmin");
175 pT0paramMode = mode(
"SpaceShower:pT0parametrization");
176 pT0Ref = parm(
"SpaceShower:pT0Ref");
177 ecmRef = parm(
"SpaceShower:ecmRef");
178 ecmPow = parm(
"SpaceShower:ecmPow");
179 pTmin = 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 = mode(
"SpaceShower:alphaEMorder");
206 alphaEM.init( alphaEMorder, settingsPtr);
209 pTminChgQ = parm(
"SpaceShower:pTminchgQ");
210 pTminChgL = parm(
"SpaceShower:pTminchgL");
214 pT2min = pow2(pTmin);
215 pT2minChgQ = pow2(pTminChgQ);
216 pT2minChgL = pow2(pTminChgL);
219 weakMode = mode(
"SpaceShower:weakShowerMode");
220 pTweakCut = parm(
"SpaceShower:pTminWeak");
221 pT2weakCut = pow2(pTweakCut);
222 weakEnhancement = parm(
"WeakShower:enhancement");
223 singleWeakEmission = flag(
"WeakShower:singleEmission");
224 vetoWeakJets = flag(
"WeakShower:vetoWeakJets");
225 vetoWeakDeltaR2 = pow2(parm(
"weakShower:vetoWeakDeltaR"));
226 weakExternal = flag(
"WeakShower:externalSetup");
229 doMEcorrections = flag(
"SpaceShower:MEcorrections");
230 doMEafterFirst = flag(
"SpaceShower:MEafterFirst");
231 doPhiPolAsym = flag(
"SpaceShower:phiPolAsym");
232 doPhiPolAsymHard = flag(
"SpaceShower:phiPolAsymHard");
233 doPhiIntAsym = flag(
"SpaceShower:phiIntAsym");
234 strengthIntAsym = parm(
"SpaceShower:strengthIntAsym");
235 nQuarkIn = mode(
"SpaceShower:nQuarkIn");
238 doDipoleRecoil = 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 = flag(
"SecondHard:generate");
251 twoHard = doSecondHard;
254 doMPI = flag(
"PartonLevel:MPI");
259 = mode(
"MultipartonInteractions:enhanceScreening");
260 if (!useSamePTasMPI) enhanceScreening = 0;
263 hasUserHooks = (userHooksPtr != 0);
264 canVetoEmission = hasUserHooks && userHooksPtr->canVetoISREmission();
267 hasWeaklyRadiated =
false;
271 canEnhanceEmission = hasUserHooks && userHooksPtr->canEnhanceEmission();
272 canEnhanceTrial = hasUserHooks && userHooksPtr->canEnhanceTrial();
273 if (canEnhanceEmission && canEnhanceTrial) {
274 infoPtr->errorMsg(
"Error in SimpleSpaceShower::init: Enhance for both "
275 "actual and trial emissions not possible. Both switched off.");
276 canEnhanceEmission =
false;
277 canEnhanceTrial =
false;
281 splittingNameSel =
"";
282 splittingNameNow =
"";
283 enhanceFactors.clear();
287 doUncertainties = flag(
"UncertaintyBands:doVariations")
288 && initUncertainties();
289 doUncertaintiesNow = doUncertainties;
290 uVarNflavQ = mode(
"UncertaintyBands:nFlavQ");
291 uVarMPIshowers = flag(
"UncertaintyBands:MPIshowers");
292 cNSpTmin = parm(
"UncertaintyBands:cNSpTmin");
293 uVarpTmin2 = pow2(pT0Ref);
294 uVarpTmin2 *= parm(
"UncertaintyBands:ISRpTmin2Fac");
295 overFactor = parm(
"UncertaintyBands:overSampleISR");
298 doPartonVertex = flag(
"PartonVertex:setVertex")
299 && (partonVertexPtr != 0);
308 bool SimpleSpaceShower::limitPTmax(
Event& event,
double Q2Fac,
double Q2Ren) {
311 twoHard = doSecondHard;
312 bool dopTlimit =
false;
313 dopTlimit1 = dopTlimit2 =
false;
315 if (pTmaxMatch == 1) dopTlimit = dopTlimit1 = dopTlimit2 =
true;
316 else if (pTmaxMatch == 2) dopTlimit = dopTlimit1 = dopTlimit2 =
false;
319 else if (infoPtr->isNonDiffractive() || infoPtr->isDiffractiveA()
320 || infoPtr->isDiffractiveB() || infoPtr->isDiffractiveC() )
321 dopTlimit = dopTlimit1 = dopTlimit2 =
true;
327 int iBegin = 5 + beamOffset;
328 for (
int i = iBegin; i <
event.size(); ++i) {
329 if (event[i].status() == -21) ++n21;
331 int idAbs =
event[i].idAbs();
332 if (idAbs <= 5 || idAbs == 21 || idAbs == 22) dopTlimit1 =
true;
333 if ( (event[i].col() != 0 || event[i].acol() != 0)
334 && idAbs > 5 && idAbs != 21 ) ++nHeavyCol;
335 }
else if (n21 == 2) {
336 int idAbs =
event[i].idAbs();
337 if (idAbs <= 5 || idAbs == 21 || idAbs == 22) dopTlimit2 =
true;
340 twoHard = (n21 == 2);
341 dopTlimit = (twoHard) ? (dopTlimit1 && dopTlimit2) : dopTlimit1;
347 if (!dopTlimit1 && (pTdampMatch == 1 || pTdampMatch == 2)) {
349 pT2damp = pow2(pTdampFudge) * ((pTdampMatch == 1) ? Q2Fac : Q2Ren);
351 if (!dopTlimit1 && nHeavyCol > 1 && (pTdampMatch == 3 || pTdampMatch == 4)) {
353 pT2damp = pow2(pTdampFudge) * ((pTdampMatch == 3) ? Q2Fac : Q2Ren);
366 void SimpleSpaceShower::prepare(
int iSys,
Event& event,
bool limitPTmaxIn) {
372 hasWeaklyRadiated =
false;
376 int in1 = partonSystemsPtr->getInA(iSys);
377 int in2 = partonSystemsPtr->getInB(iSys);
380 bool canRadiate1 = !(
event[in1].isRescatteredIncoming());
381 bool canRadiate2 = !(
event[in2].isRescatteredIncoming());
384 if (iSys == 0) {dipEnd.resize(0); idResFirst = 0;}
385 if (iSys == 1) idResSecond = 0;
388 int MEtype = findMEtype( iSys, event,
false);
391 if (twoHard && iSys == 0) limitPTmaxIn = dopTlimit1;
392 if (twoHard && iSys == 1) limitPTmaxIn = dopTlimit2;
395 double pTmax1 = (limitPTmaxIn) ? event[in1].scale() : eCM;
396 double pTmax2 = (limitPTmaxIn) ? event[in2].scale() : eCM;
397 if ( limitPTmaxIn && (iSys == 0 || (iSys == 1 && twoHard)) ) {
398 pTmax1 *= pTmaxFudge;
399 pTmax2 *= pTmaxFudge;
400 }
else if (limitPTmaxIn && iSys > 0) {
401 pTmax1 *= pTmaxFudgeMPI;
402 pTmax2 *= pTmaxFudgeMPI;
408 int colType1 =
event[in1].colType();
411 int iColPartner = (doDipoleRecoil)
412 ? findColPartner(event, in1, in2, iSys) : 0;
413 int idColPartner = (iColPartner != 0) ? event[iColPartner].
id() : 0;
414 dipEnd.push_back( SpaceDipoleEnd( iSys, 1, in1, in2, pTmax1,
415 colType1, 0, 0, MEtype, canRadiate2, 0, iColPartner, idColPartner) );
417 int colType2 =
event[in2].colType();
420 int iColPartner = (doDipoleRecoil)
421 ? findColPartner(event, in2, in1, iSys) : 0;
422 int idColPartner = (iColPartner != 0) ? event[iColPartner].
id() : 0;
423 dipEnd.push_back( SpaceDipoleEnd( iSys, 2, in2, in1, pTmax2,
424 colType2, 0, 0, MEtype, canRadiate1, 0, iColPartner, idColPartner) );
430 if (doQEDshowerByQ || doQEDshowerByL) {
431 int chgType1 = ( (
event[in1].isQuark() && doQEDshowerByQ)
432 || (event[in1].isLepton() && doQEDshowerByL) )
433 ?
event[in1].chargeType() : 0;
435 if (event[in1].
id() == 22 && doQEDshowerByQ) chgType1 = 22 ;
436 if (canRadiate1) dipEnd.push_back( SpaceDipoleEnd( iSys, -1,
437 in1, in2, pTmax1, 0, chgType1, 0, MEtype, canRadiate2) );
438 int chgType2 = ( (
event[in2].isQuark() && doQEDshowerByQ)
439 || (event[in2].isLepton() && doQEDshowerByL) )
440 ?
event[in2].chargeType() : 0;
442 if (event[in2].
id() == 22 && doQEDshowerByQ) chgType2 = 22 ;
443 if (canRadiate2) dipEnd.push_back( SpaceDipoleEnd( iSys, -2,
444 in2, in1, pTmax2, 0, chgType2, 0, MEtype, canRadiate1) );
450 if (doWeakShower && iSys == 0) {
454 int MEtypeWeak = findMEtype( iSys, event,
true);
455 if (MEtypeWeak == 201 || MEtypeWeak == 202 || MEtypeWeak == 203 ||
456 MEtypeWeak == 206 || MEtypeWeak == 207 || MEtypeWeak == 208) {
459 if (event[in1].
id() != event[in2].
id()) {
460 if (event[in1].
id() == event[in1 + 2].
id()) tChannel =
true;
461 else if (event[in2].
id() == event[in1 + 2].
id()) tChannel =
false;
463 else tChannel = (rndmPtr->flat() < 0.5);
465 }
else tChannel = (rndmPtr->flat() < 0.5);
469 int weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
470 if (event[in1].idAbs() < 20) event[in1].pol(weakPol);
472 if ( (weakMode == 0 || weakMode == 1) && weakPol == -1
473 &&
event[in1].isQuark() )
474 dipEnd.push_back( SpaceDipoleEnd( iSys, 1, in1, in2, pTmax1,
475 0, 0, 1, MEtypeWeak, canRadiate2, weakPol) );
476 if ( (weakMode == 0 || weakMode == 2)
477 && (event[in1].isQuark() || event[in1].isLepton()) )
478 dipEnd.push_back( SpaceDipoleEnd( iSys, 1, in1, in2, pTmax1,
479 0, 0, 2, MEtypeWeak + 5, canRadiate2, weakPol) );
483 if (event[in1].
id() != - event[in2].
id())
484 weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
485 if (event[in2].idAbs() < 20) event[in2].pol(weakPol);
487 if ( (weakMode == 0 || weakMode == 1) && weakPol == -1
488 &&
event[in2].isQuark())
489 dipEnd.push_back( SpaceDipoleEnd( iSys, 2, in2, in1, pTmax2,
490 0, 0, 1, MEtypeWeak, canRadiate1, weakPol) );
491 if ( (weakMode == 0 || weakMode == 2) &&
492 (event[in2].isQuark() || event[in2].isLepton()) )
493 dipEnd.push_back( SpaceDipoleEnd( iSys, 2, in2, in1, pTmax2,
494 0, 0, 2, MEtypeWeak + 5, canRadiate1, weakPol) );
499 vector<pair<int,int> > weakDipoles = infoPtr->getWeakDipoles();
500 vector<int> weakModes = infoPtr->getWeakModes();
501 weakMomenta = infoPtr->getWeakMomenta();
504 for (
int i = 0; i < int(weakDipoles.size()); ++i) {
507 if (event[weakDipoles[i].first].status() < 0) {
509 int iRadLocal = weakDipoles[i].first;
510 int iRecLocal = weakDipoles[i].second;
511 int side = (iRadLocal == 3) ? 1 : 2;
512 double pTmax = (side == 1) ? pTmax1 : pTmax2;
516 if (weakModes[weakDipoles[i].first] == 1) MEtypeWeak = 200;
517 else if (weakModes[weakDipoles[i].first] == 2) MEtypeWeak = 201;
518 else if (weakModes[weakDipoles[i].first] == 3) MEtypeWeak = 202;
519 else MEtypeWeak = 203;
523 int weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
524 if (event[weakDipoles[i].first].intPol() != 9)
525 weakPol = event[weakDipoles[i].first].intPol();
526 event[weakDipoles[i].first].pol(weakPol);
529 if ( (weakMode == 0 || weakMode == 1) && weakPol == -1)
530 dipEnd.push_back( SpaceDipoleEnd( iSys, side, iRadLocal, iRecLocal,
531 pTmax, 0, 0, 1, MEtypeWeak,
true, weakPol) );
532 if (weakMode == 0 || weakMode == 2)
533 dipEnd.push_back( SpaceDipoleEnd( iSys, side, iRadLocal, iRecLocal,
534 pTmax, 0, 0, 2, MEtypeWeak + 5,
true, weakPol) );
542 if (iSys == 0 && infoPtr->hasHistory()) {
543 double zNow = infoPtr->zNowISR();
544 double pT2Now = infoPtr->pT2NowISR();
545 for (
int iDipEnd = 0; iDipEnd < int(dipEnd.size()); ++iDipEnd) {
546 dipEnd[iDipEnd].zOld = zNow;
547 dipEnd[iDipEnd].pT2Old = pT2Now;
548 ++dipEnd[iDipEnd].nBranch;
558 double SimpleSpaceShower::pTnext(
Event& event,
double pTbegAll,
559 double pTendAll,
int nRadIn,
bool doTrialIn) {
562 sCM = m2( beamAPtr->p(), beamBPtr->p());
568 double pT2sel = pow2(pTendAll);
574 doTrialNow = doTrialIn;
575 canEnhanceET = (!doTrialNow && canEnhanceEmission)
576 || ( doTrialNow && canEnhanceTrial);
579 splittingNameSel =
"";
580 splittingNameNow =
"";
581 enhanceFactors.clear();
582 if (hasUserHooks) userHooksPtr->setEnhancedTrial(0., 1.);
585 for (
int iDipEnd = 0; iDipEnd < int(dipEnd.size()); ++iDipEnd) {
587 dipEndNow = &dipEnd[iDipEnd];
588 iSysNow = dipEndNow->system;
590 dipEndNow->pAccept = 1.0;
591 double pTbegDip = min( pTbegAll, dipEndNow->pTmax );
594 double pT2begDip = pow2(pTbegDip);
595 if (pT2begDip > pT2sel && ( dipEndNow->colType != 0
596 || dipEndNow->chgType != 0 || dipEndNow->weakType != 0) ) {
597 double pT2endDip = 0.;
600 if (dipEndNow->colType != 0)
601 pT2endDip = max( pT2sel, pT2min );
602 else if (abs(dipEndNow->weakType) != 0)
603 pT2endDip = max( pT2sel, pT2weakCut);
604 else if (abs(dipEndNow->chgType) != 3 && dipEndNow->chgType != 0)
605 pT2endDip = max( pT2sel, pT2minChgQ );
607 pT2endDip = max( pT2sel, pT2minChgL );
610 sideA = ( abs(dipEndNow->side) == 1 );
611 BeamParticle& beamNow = (sideA) ? *beamAPtr : *beamBPtr;
612 BeamParticle& beamRec = (sideA) ? *beamBPtr : *beamAPtr;
613 iNow = beamNow[iSysNow].iPos();
614 iRec = beamRec[iSysNow].iPos();
615 idDaughter = beamNow[iSysNow].id();
616 xDaughter = beamNow[iSysNow].x();
617 x1Now = (sideA) ? xDaughter : beamRec[iSysNow].x();
618 x2Now = (sideA) ? beamRec[iSysNow].x() : xDaughter;
621 if ( beamNow.isGamma() && !(beamNow.resolvedGamma()) )
continue;
624 m2Rec = (dipEndNow->normalRecoil) ? 0. : event[iRec].m2();
625 m2Dip = x1Now * x2Now * sCM + m2Rec;
628 m2ColPair = (dipEndNow->iColPartner == 0) ? 0.
629 : m2( event[iNow].p(),
event[dipEndNow->iColPartner].p() );
630 mColPartner = (dipEndNow->iColPartner == 0) ? 0.
631 : event[dipEndNow->iColPartner].m();
632 m2ColPartner = pow2(mColPartner);
635 if (m2ColPair < 0.)
return 0.;
638 if (pT2begDip > pT2endDip) {
639 if (dipEndNow->colType != 0) pT2nextQCD( pT2begDip, pT2endDip);
640 else if (dipEndNow->chgType != 0 || idDaughter == 22)
641 pT2nextQED( pT2begDip, pT2endDip);
642 else if (dipEndNow->weakType != 0) pT2nextWeak( pT2begDip, pT2endDip);
645 if (dipEndNow->pT2 > pT2sel) {
646 pT2sel = dipEndNow->pT2;
649 dipEndSel = dipEndNow;
650 splittingNameSel = splittingNameNow;
658 return (dipEndSel == 0) ? 0. : sqrt(pT2sel);
665 void SimpleSpaceShower::pT2nextQCD(
double pT2begDip,
double pT2endDip) {
668 BeamParticle&
beam = (sideA) ? *beamAPtr : *beamBPtr;
669 bool isGluon = (idDaughter == 21);
670 bool isValence = beam[iSysNow].isValence();
671 int MEtype = dipEndNow->MEtype;
672 int iColPartner = dipEndNow->iColPartner;
673 int idColPartner = dipEndNow->idColPartner;
674 double pT2 = pT2begDip;
675 double xMaxAbs = beam.xMax(iSysNow);
676 double zMinAbs = xDaughter / xMaxAbs;
678 infoPtr->errorMsg(
"Warning in SimpleSpaceShower::pT2nextQCD: "
684 double idMassive = 0;
685 if ( abs(idDaughter) == 4 ) idMassive = 4;
686 if ( abs(idDaughter) == 5 ) idMassive = 5;
687 bool isMassive = (idMassive > 0);
688 double m2Massive = 0.;
690 double zMaxMassive = 1.;
691 double m2Threshold = pT2;
695 m2Massive = (idMassive == 4) ? m2c : m2b;
696 if (pT2 < HEAVYPT2EVOL * m2Massive)
return;
697 if (iColPartner == 0) {
698 mRatio = sqrt( m2Massive / m2Dip );
699 zMaxMassive = (1. - mRatio) / ( 1. + mRatio * (1. - mRatio) );
701 double m2Red = m2ColPair - m2ColPartner;
702 zMaxMassive = m2Red / (m2Red + m2Massive);
704 if (xDaughter > HEAVYXEVOL * zMaxMassive * xMaxAbs)
return;
707 m2Threshold = (idMassive == 4) ? min( pT2, CTHRESHOLD * m2c)
708 : min( pT2, BTHRESHOLD * m2b);
714 double Lambda2 = Lambda3flav2;
715 double pT2minNow = pT2endDip;
720 double zRootMax = 0.;
721 double zRootMin = 0.;
726 double g2Qenhance = 0.;
727 double xPDFdaughter = 0.;
728 double xPDFmother[21] = {0.};
729 double xPDFgMother = 0.;
730 double xPDFmotherSum = 0.;
731 double kernelPDF = 0.;
736 double m2Sister = 0.;
739 bool needNewPDF =
true;
743 doUncertaintiesNow = doUncertainties;
744 if (!uVarMPIshowers && iSysNow != 0) doUncertaintiesNow =
false;
745 double overFac = doUncertaintiesNow ? overFactor : 1.0;
748 double coefColRec = (iColPartner != 0 && idColPartner == 21) ? 9./8. : 1.;
751 bool isEnhancedQ2QG, isEnhancedG2QQ, isEnhancedQ2GQ, isEnhancedG2GG;
752 isEnhancedQ2QG = isEnhancedG2QQ = isEnhancedQ2GQ = isEnhancedG2GG =
false;
753 double enhanceNow = 1.;
757 int loopTinyPDFdau = 0;
758 bool hasTinyPDFdau =
false;
763 isEnhancedQ2QG = isEnhancedG2QQ = isEnhancedQ2GQ = isEnhancedG2GG =
false;
769 if (hasTinyPDFdau) ++loopTinyPDFdau;
770 if (loopTinyPDFdau > MAXLOOPTINYPDF) {
771 infoPtr->errorMsg(
"Warning in SimpleSpaceShower::pT2nextQCD: "
772 "small daughter PDF");
779 if (needNewPDF || pT2 < EVALPDFSTEP * pT2PDF) {
781 hasTinyPDFdau =
false;
786 pT2minNow = max( m2b, pT2endDip);
788 Lambda2 = Lambda5flav2;
789 }
else if (pT2 > m2c) {
791 pT2minNow = max( m2c, pT2endDip);
793 Lambda2 = Lambda4flav2;
796 pT2minNow = pT2endDip;
798 Lambda2 = Lambda3flav2;
802 Lambda2 /= renormMultFac;
805 if (iColPartner == 0) zMaxAbs = 1. - 0.5 * (pT2minNow / m2Dip)
806 * ( sqrt( 1. + 4. * m2Dip / pT2minNow ) - 1. );
808 double m2Red = m2ColPair - m2ColPartner;
809 double pT2Ext = sqrt(pT2minNow * (pT2minNow + 4. * m2ColPartner));
810 zMaxAbs = (m2Red + 0.5 * (pT2minNow - pT2Ext))
811 / (m2Red + pT2minNow * (1. - m2ColPartner / m2Red));
813 if (isMassive) zMaxAbs = min( zMaxAbs, zMaxMassive);
816 if (zMinAbs > zMaxAbs) {
817 if (nFlavour == 3 || (idMassive == 4 && nFlavour == 4)
818 || idMassive == 5)
return;
819 pT2 = (nFlavour == 4) ? m2c : m2b;
824 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
825 xfModPrepData xfData = beam.xfModPrep(iSysNow, pdfScale2);
826 xPDFdaughter = beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2,
828 if (xPDFdaughter < TINYPDF) {
829 xPDFdaughter = TINYPDF;
830 hasTinyPDFdau =
true;
835 g2gInt = overFac * HEADROOMG2G * 6.
836 * log(zMaxAbs * (1.-zMinAbs) / (zMinAbs * (1.-zMaxAbs)));
837 if (doMEcorrections) g2gInt *= calcMEmax(MEtype, 21, 21);
839 if (canEnhanceET) g2gInt *= userHooksPtr->enhanceFactor(
"isr:G2GG");
840 q2gInt = overFac * HEADROOMQ2G * (16./3.)
841 * (1./sqrt(zMinAbs) - 1./sqrt(zMaxAbs));
842 if (doMEcorrections) q2gInt *= calcMEmax(MEtype, 1, 21);
844 if (canEnhanceET) q2gInt *= userHooksPtr->enhanceFactor(
"isr:Q2GQ");
849 for (
int i = -nQuarkIn; i <= nQuarkIn; ++i) {
850 if (i == 0)
continue;
851 xPDFmother[i+10] = beam.xfISR(iSysNow, i, xDaughter, pdfScale2,
853 xPDFmotherSum += xPDFmother[i+10];
857 kernelPDF = g2gInt + q2gInt * xPDFmotherSum / xPDFdaughter;
861 }
else if (isValence) {
862 zRootMin = (1. + sqrt(zMinAbs)) / (1. - sqrt(zMinAbs));
863 zRootMax = (1. + sqrt(zMaxAbs)) / (1. - sqrt(zMaxAbs));
864 q2qInt = coefColRec * overFac * (8./3.) * log( zRootMax / zRootMin );
865 if (doMEcorrections) q2qInt *= calcMEmax(MEtype, 1, 1);
867 if (canEnhanceET) q2qInt *= userHooksPtr->enhanceFactor(
"isr:Q2QG");
872 q2qInt = coefColRec * overFac * HEADROOMQ2Q * (8./3.)
873 * log( (1. - zMinAbs) / (1. - zMaxAbs) );
874 if (doMEcorrections) q2qInt *= calcMEmax(MEtype, 1, 1);
876 if (canEnhanceET) q2qInt *= userHooksPtr->enhanceFactor(
"isr:Q2QG");
877 g2qInt = overFac * HEADROOMG2Q * 0.5 * (zMaxAbs - zMinAbs);
878 if (doMEcorrections) g2qInt *= calcMEmax(MEtype, 21, 1);
880 if (canEnhanceET) g2qInt *= userHooksPtr->enhanceFactor(
"isr:G2QQ");
884 if (beam.isGamma() && isMassive) q2qInt *= HEADROOMHQG;
888 if (alphaSorder == 0) g2Qenhance = log(pT2/m2Massive)
889 / log(m2Threshold/m2Massive);
891 double m2log = log( m2Massive / Lambda2);
892 g2Qenhance = log( log(pT2/Lambda2) / m2log )
893 / log( log(m2Threshold/Lambda2) / m2log );
895 g2qInt *= g2Qenhance;
899 xPDFgMother = beam.xfISR(iSysNow, 21, xDaughter, pdfScale2, xfData);
902 kernelPDF = q2qInt + g2qInt * xPDFgMother / xPDFdaughter;
908 if (kernelPDF < TINYKERNELPDF)
return;
915 if (alphaSorder == 0) {
916 pT2 = (pT2 + pT20) * pow( rndmPtr->flat(),
917 1. / (alphaS2pi * kernelPDF)) - pT20;
920 }
else if (alphaSorder == 1) {
921 pT2 = Lambda2 * pow( (pT2 + pT20) / Lambda2,
922 pow(rndmPtr->flat(), b0 / kernelPDF) ) - pT20;
927 pT2 = Lambda2 * pow( (pT2 + pT20) / Lambda2,
928 pow(rndmPtr->flat(), b0 / kernelPDF) ) - pT20;
929 Q2alphaS = renormMultFac * max( pT2 + pT20,
930 pow2(LAMBDA3MARGIN) * Lambda3flav2);
931 }
while (alphaS.alphaS2OrdCorr(Q2alphaS) < rndmPtr->flat()
938 if (idMassive == 5 && pT2 < m2Threshold) {
939 pT2nearThreshold( beam, m2Massive, m2Threshold, xMaxAbs,
940 zMinAbs, zMaxMassive, iColPartner );
944 }
else if (nFlavour == 5 && pT2 < m2b) {
950 }
else if (idMassive == 4 && pT2 < m2Threshold) {
951 pT2nearThreshold( beam, m2Massive, m2Threshold, xMaxAbs,
952 zMinAbs, zMaxMassive, iColPartner );
956 }
else if (nFlavour == 4 && pT2 < m2c) {
962 }
else if (pT2 < pT2endDip)
return;
968 if (rndmPtr->flat() * kernelPDF < g2gInt) {
971 z = 1. / ( 1. + ((1. - zMinAbs) / zMinAbs) * pow( (zMinAbs *
972 (1. - zMaxAbs)) / (zMaxAbs * (1. - zMinAbs)), rndmPtr->flat() ) );
973 wt = pow2( 1. - z * (1. - z));
975 if (iColPartner != 0 && idColPartner != 21)
976 wt *= (m2ColPair * pow2(1. - z) + z * pT2 * 8./9.)
977 / (m2ColPair * pow2(1. - z) + z * pT2);
981 nameNow =
"isr:G2GG";
983 double enhance = userHooksPtr->enhanceFactor(nameNow);
985 enhanceNow = enhance;
986 isEnhancedG2GG =
true;
992 double temp = xPDFmotherSum * rndmPtr->flat();
993 idMother = -nQuarkIn - 1;
994 do { temp -= xPDFmother[(++idMother) + 10]; }
995 while (temp > 0. && idMother < nQuarkIn);
997 z = (zMinAbs * zMaxAbs) / pow2( sqrt(zMinAbs) + rndmPtr->flat()
998 * ( sqrt(zMaxAbs)- sqrt(zMinAbs) ));
999 wt = 0.5 * (1. + pow2(1. - z)) * sqrt(z)
1000 * xPDFdaughter / xPDFmother[idMother + 10];
1004 nameNow =
"isr:Q2GQ";
1006 double enhance = userHooksPtr->enhanceFactor(nameNow);
1007 if (enhance != 1.) {
1008 enhanceNow = enhance;
1009 isEnhancedQ2GQ =
true;
1019 if (isValence || rndmPtr->flat() * kernelPDF < q2qInt) {
1020 idMother = idDaughter;
1024 double zTmp = zRootMin * pow(zRootMax / zRootMin, rndmPtr->flat() );
1025 z = pow2( (1. - zTmp) / (1. + zTmp) );
1027 z = 1. - (1. - zMinAbs) * pow( (1. - zMaxAbs) / (1. - zMinAbs),
1031 wt = 0.5 * (1. + pow2(z));
1033 wt = 0.5 * (1. + pow2(z)) - z * pow2(1.-z) * m2Massive / pT2;
1035 if (isValence) wt *= sqrt(z);
1037 else wt /= HEADROOMQ2Q;
1039 if (beam.isGamma() && isMassive) wt /= HEADROOMHQG;
1041 if (iColPartner != 0 && idColPartner == 21)
1042 wt *= (m2ColPair * pow2(1. - z) + z * pT2 * 9./8.)
1043 / ((m2ColPair * pow2(1. - z) + z * pT2) * coefColRec);
1045 nameNow =
"isr:Q2QG";
1047 double enhance = userHooksPtr->enhanceFactor(nameNow);
1048 if (enhance != 1.) {
1049 enhanceNow = enhance;
1050 isEnhancedQ2QG =
true;
1057 idSister = - idDaughter;
1058 z = zMinAbs + rndmPtr->flat() * (zMaxAbs - zMinAbs);
1060 wt = (pow2(z) + pow2(1.-z)) * xPDFdaughter / xPDFgMother;
1062 wt = (pow2(z) + pow2(1.-z) + 2. * z * (1.-z) * m2Massive / pT2)
1063 * xPDFdaughter / (xPDFgMother * g2Qenhance) ;
1068 if (abs(idSister) < 4) nameNow =
"isr:G2QQ";
1069 else if (abs(idSister) == 4) nameNow =
"isr:G2QQ:cc";
1070 else nameNow =
"isr:G2QQ:bb";
1072 double enhance = userHooksPtr->enhanceFactor(nameNow);
1073 if (enhance != 1.) {
1074 enhanceNow = enhance;
1075 isEnhancedG2QQ =
true;
1085 Q2 = pT2 / (1. - z);
1086 xMother = xDaughter / z;
1089 if (!dipEndNow->normalRecoil) {
1090 if (sideA) xMother += (m2Rec / (x2Now * sCM)) * (1. / z - 1.);
1091 else xMother += (m2Rec / (x1Now * sCM)) * (1. / z - 1.);
1093 if (xMother > xMaxAbs) { wt = 0.;
continue; }
1096 mSister = particleDataPtr->m0(idSister);
1097 m2Sister = pow2(mSister);
1098 if (iColPartner == 0) {
1099 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Sister) / m2Dip;
1101 double tmpRat = z * (Q2 + m2Sister) / (m2ColPair - m2ColPartner);
1102 pT2corr = ((1. - z) * Q2 - z * m2Sister) * (1. - tmpRat)
1103 - m2ColPartner * pow2(tmpRat);
1105 if (pT2corr < TINYPT2) { wt = 0.;
continue; }
1109 if ( iSysNow == 0 && doRapidityOrder && dipEndNow->nBranch > 0
1110 && pT2 > pow2( (1. - z) / (z * (1. - dipEndNow->zOld)) )
1111 * dipEndNow->pT2Old ) { wt = 0.;
continue; }
1115 if ( iSysNow != 0 && doRapidityOrderMPI && dipEndNow->nBranch > 0
1116 && pT2 > pow2( (1. - z) / (z * (1. - dipEndNow->zOld)) )
1117 * dipEndNow->pT2Old ) { wt = 0.;
continue; }
1121 if ( isGluon && ( abs(idMother) == 4 || abs(idMother) == 5 )) {
1122 double m2QQsister = EXTRASPACEQ * 4. * m2Sister;
1123 double pT2QQcorr = 0.;
1124 if (iColPartner == 0) {
1125 pT2QQcorr = Q2 - z * (m2Dip + Q2) * (Q2 + m2QQsister) / m2Dip;
1127 double tmpRat = z * (Q2 + m2QQsister) / (m2ColPair - m2ColPartner);
1128 pT2QQcorr = ((1. - z) * Q2 - z * m2QQsister) * (1. - tmpRat)
1129 - m2ColPartner * pow2(tmpRat);
1131 if (pT2QQcorr < TINYPT2) { wt = 0.;
continue; }
1135 if ( beam.isGamma() ) {
1136 BeamParticle& beamOther = (sideA) ? *beamBPtr : *beamAPtr;
1137 if ( !beamOther.resolvedGamma() ) {
1139 if ( !beam.roomFor1Remnant( idMother, xMother, eCM) ) {
1145 if ( !beamOther.roomFor2Remnants( idMother, xMother, eCM ) ) {
1153 if (doMEcorrections) wt *= calcMEcorr(MEtype, idMother, idDaughter,
1154 m2Dip, z, Q2, m2Sister) / calcMEmax(MEtype, idMother, idDaughter);
1157 if (dopTdamp && iSysNow == 0 && MEtype == 0 && nRad == 0)
1158 wt *= pT2damp / (pT2 + pT2damp);
1162 if (enhanceScreening == 2) {
1163 int nSysNow = infoPtr->nMPI() + infoPtr->nISR() + 1;
1164 double WTscreen = pow2( (pT2 + pT20) / (pT2 + nSysNow * pT20) );
1169 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1170 xfModPrepData xfData2 = beam.xfModPrep(iSysNow, pdfScale2);
1171 double xPDFdaughterNew = max ( TINYPDF,
1172 beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2, xfData2) );
1173 double xPDFmotherNew =
1174 beam.xfISR(iSysNow, idMother, xMother, pdfScale2, xfData2);
1175 wt *= xPDFmotherNew / xPDFdaughterNew;
1178 if (wt > 0. && pT2 > pT2min && doUncertaintiesNow ) {
1179 dipEndNow->pAccept = wt;
1184 if (wt > 1. && pT2 > PT2MINWARN) infoPtr->errorMsg(
"Warning in "
1185 "SimpleSpaceShower::pT2nextQCD: weight above unity");
1188 }
while (wt < rndmPtr->flat()) ;
1191 splittingNameNow = nameNow;
1193 if (isEnhancedQ2QG) storeEnhanceFactor(pT2,
"isr:Q2QG", enhanceNow);
1194 if (isEnhancedG2QQ) storeEnhanceFactor(pT2,
"isr:G2QQ", enhanceNow);
1195 if (isEnhancedQ2GQ) storeEnhanceFactor(pT2,
"isr:Q2GQ", enhanceNow);
1196 if (isEnhancedG2GG) storeEnhanceFactor(pT2,
"isr:G2GG", enhanceNow);
1200 dipEndNow->store( idDaughter,idMother, idSister, x1Now, x2Now, m2Dip,
1201 pT2, z, xMother, Q2, mSister, m2Sister, pT2corr, iColPartner, m2ColPair,
1214 void SimpleSpaceShower::pT2nearThreshold( BeamParticle& beam,
1215 double m2Massive,
double m2Threshold,
double xMaxAbs,
1216 double zMinAbs,
double zMaxMassive,
int iColPartner) {
1219 double Lambda2 = (abs(idDaughter) == 4) ? Lambda4flav2 : Lambda5flav2;
1220 Lambda2 /= renormMultFac;
1221 double logM2Lambda2 = (alphaSorder > 0) ? log( m2Massive / Lambda2 ) : 1.;
1222 pdfScale2 = (useFixedFacScale) ? fixedFacScale2
1223 : factorMultFac * m2Threshold;
1224 double xPDFmotherOld = beam.xfISR(iSysNow, 21, xDaughter, pdfScale2);
1226 if ( xPDFmotherOld < TINYPDF ) {
1227 infoPtr->errorMsg(
"Error in SimpleSpaceShower::pT2nearThreshold: "
1238 double pT2corr = 0.;
1239 double xMother = 0.;
1242 bool isGammaBeam = beam.isGamma();
1244 BeamParticle& beamOther = (sideA) ? *beamBPtr : *beamAPtr;
1246 if ( !beamOther.roomFor1Remnant(eCM) )
return;
1255 infoPtr->errorMsg(
"Error in SimpleSpaceShower::pT2nearThreshold: "
1261 pT2 = m2Massive * pow( m2Threshold / m2Massive, rndmPtr->flat() );
1266 z = xDaughter/xMother;
1269 z = zMinAbs + rndmPtr->flat() * (zMaxMassive - zMinAbs);
1273 Q2 = pT2 / (1.-z) - m2Massive;
1274 if (iColPartner == 0) {
1275 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Massive) / m2Dip;
1277 double tmpRat = z * (Q2 + m2Massive) / (m2ColPair - m2ColPartner);
1278 pT2corr = ((1. - z) * Q2 - z * m2Massive) * (1. - tmpRat)
1279 - m2ColPartner * pow2(tmpRat);
1281 if (pT2corr < TINYPT2)
continue;
1284 wt = pow2(z) + pow2(1.-z) + 2. * z * (1.-z) * m2Massive / pT2;
1290 wt *= (alphaSorder > 0) ? logM2Lambda2 / log( pT2 / Lambda2 ) : 1.;
1293 xMother = xDaughter / z;
1294 if (!dipEndNow->normalRecoil) {
1295 if (sideA) xMother += (m2Rec / (x2Now * sCM)) * (1. / z - 1.);
1296 else xMother += (m2Rec / (x1Now * sCM)) * (1. / z - 1.);
1298 if (xMother > xMaxAbs) { wt = 0.;
continue; }
1301 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1302 double xPDFmotherNew = beam.xfISR(iSysNow, 21, xMother, pdfScale2);
1303 wt *= xPDFmotherNew / xPDFmotherOld;
1308 if (wt > 0. && pT2 > pT2min && doUncertaintiesNow ) {
1309 dipEndNow->pAccept = wt;
1314 }
while (wt < rndmPtr->flat()) ;
1317 int idMother = isGammaBeam ? 22 : 21;
1320 double mSister = (abs(idDaughter) == 4) ? mc : mb;
1322 if ( isGammaBeam ) splittingNameNow =
"isr:A2QQ";
1323 else splittingNameNow =
"isr:G2QQ";
1324 dipEndNow->store( idDaughter, idMother, -idDaughter, x1Now, x2Now, m2Dip,
1325 pT2, z, xMother, Q2, mSister, pow2(mSister), pT2corr, iColPartner,
1326 m2ColPair, mColPartner);
1334 void SimpleSpaceShower::pT2nextQED(
double pT2begDip,
double pT2endDip) {
1337 BeamParticle& beam = (sideA) ? *beamAPtr : *beamBPtr;
1338 bool isLeptonBeam = beam.isLepton();
1339 bool isGammaBeam = beam.isGamma();
1340 int MEtype = dipEndNow->MEtype;
1341 bool isPhoton = (idDaughter == 22);
1342 double pT2 = pT2begDip;
1343 double m2Lepton = (isLeptonBeam) ? pow2(beam.m()) : 0.;
1344 if (isLeptonBeam && pT2begDip < m2Lepton)
return;
1347 if (isPhoton && (isLeptonBeam || isGammaBeam) )
return;
1350 double alphaEMmax = alphaEM.alphaEM(renormMultFac * pT2begDip);
1351 double alphaEM2pi = alphaEMmax / (2. * M_PI);
1354 double xMaxAbs = (isLeptonBeam) ? LEPTONXMAX : beam.xMax(iSysNow);
1355 double zMinAbs = xDaughter / xMaxAbs;
1357 infoPtr->errorMsg(
"Warning in SimpleSpaceShower::pT2nextQED: "
1358 "xMaxAbs negative");
1363 double zMaxAbs = 1. - 0.5 * (pT2endDip / m2Dip) *
1364 ( sqrt( 1. + 4. * m2Dip / pT2endDip ) - 1. );
1366 double zMaxLepton = xDaughter / (xDaughter + LEPTONXMIN);
1367 if (zMaxLepton < zMaxAbs) zMaxAbs = zMaxLepton;
1369 if (zMaxAbs < zMinAbs)
return;
1372 double idMassive = 0;
1373 if ( isGammaBeam && abs(idDaughter) == 4 ) idMassive = 4;
1374 if ( isGammaBeam && abs(idDaughter) == 5 ) idMassive = 5;
1375 bool isMassive = (idMassive > 0);
1376 double m2Massive = 0.;
1378 double zMaxMassive = 1.;
1379 double m2Threshold = pT2;
1383 m2Massive = (idMassive == 4) ? m2c : m2b;
1384 if (pT2 < HEAVYPT2EVOL * m2Massive)
return;
1385 mRatio = sqrt( m2Massive / m2Dip );
1386 zMaxMassive = (1. - mRatio) / ( 1. + mRatio * (1. - mRatio) );
1387 if (xDaughter > HEAVYXEVOL * zMaxMassive * xMaxAbs)
return;
1390 m2Threshold = (idMassive == 4) ? min( pT2, CTHRESHOLD * m2c)
1391 : min( pT2, BTHRESHOLD * m2b);
1398 double xMother = 0.;
1401 double mSister = 0.;
1402 double m2Sister = 0.;
1403 double pT2corr = 0.;
1406 bool isEnhancedQ2QA, isEnhancedQ2AQ, isEnhancedA2QQ;
1407 isEnhancedQ2QA = isEnhancedQ2AQ = isEnhancedA2QQ =
false;
1408 double enhanceNow = 1.;
1409 string nameNow =
"";
1417 double f2fIntA = 2. * log( (1. - zMinAbs) / (1. - zMaxAbs) );
1418 double f2fIntB = 0.;
1420 f2fIntB = 2. * log( (zMaxAbs - xDaughter) / (zMinAbs - xDaughter) );
1421 f2fInt = f2fIntA + f2fIntB;
1422 }
else f2fInt = pow2(dipEndNow->chgType / 3.) * f2fIntA;
1429 double xfApprox = 0;
1434 pT2ref = beam.gammaPDFRefScale(idDaughter);
1435 xfApprox = beam.gammaPDFxDependence(idDaughter, xDaughter);
1438 BeamParticle& beamOther = (sideA) ? *beamBPtr : *beamAPtr;
1439 if ( beamOther.roomFor1Remnant(eCM) ) {
1440 gamma2f = alphaEM2pi * pow2(
double(dipEndNow->chgType) / 3.)* 3.
1441 * (pow2(xDaughter) + pow2(1. - xDaughter))/xfApprox;
1446 if (doMEcorrections) f2fInt *= calcMEmax(MEtype, 1, 1);
1447 double kernelPDF = alphaEM2pi * f2fInt;
1448 double fudge = (isLeptonBeam) ? LEPTONFUDGE * log(m2Dip/m2Lepton) : 1.;
1452 if ( (kernelPDF + gamma2f) < TINYKERNELPDF )
return;
1455 if (canEnhanceET) kernelPDF *= userHooksPtr->enhanceFactor(
"isr:Q2QA");
1458 if (canEnhanceET) gamma2f *= userHooksPtr->enhanceFactor(
"isr:A2QQ");
1461 kernelPDF += gamma2f;
1467 isEnhancedQ2QA = isEnhancedA2QQ =
false;
1472 if( (rndmPtr->flat() * kernelPDF) < gamma2f ){
1475 pT2 = pT2ref*pow(pT2/pT2ref, pow(rndmPtr->flat(), 1. / kernelPDF));
1478 if ( isMassive && (pT2 < m2Threshold ) ) {
1479 pT2nearThreshold( beam, m2Massive, m2Threshold, xMaxAbs,
1480 zMinAbs, zMaxMassive, 0 );
1482 }
else if (pT2 < pT2endDip)
return;
1487 z = xDaughter/xMother;
1488 idSister = -idDaughter;
1489 mSister = particleDataPtr->m0(idSister);
1490 m2Sister = pow2(mSister);
1493 Q2 = pT2 / (1. - z);
1496 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Sister) / m2Dip;
1497 if (pT2corr < TINYPT2) { wt = 0.;
continue; }
1500 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1501 double daughterPDF = max ( TINYPDF,
1502 beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2) );
1503 wt = xDaughter*log(pT2/pT2ref)/daughterPDF;
1510 double alphaEMnow = alphaEM.alphaEM(renormMultFac * pT2);
1511 wt *= (alphaEMnow / alphaEMmax);
1514 nameNow =
"isr:A2QQ";
1516 double enhance = userHooksPtr->enhanceFactor(nameNow);
1517 if (enhance != 1.) {
1518 enhanceNow = enhance;
1519 isEnhancedA2QQ =
true;
1524 if (wt > 1. && pT2 > PT2MINWARN){
1525 infoPtr->errorMsg(
"Warning in SimpleSpaceShower::pT2nextQED: "
1526 "weight above unity");
1534 double shift = pow(rndmPtr->flat(), 1. / kernelPDF);
1535 if (isLeptonBeam) pT2 = m2Lepton * pow( pT2 / m2Lepton, shift);
1536 else pT2 = pT2 * shift;
1539 if ( isGammaBeam && isMassive && (pT2 < m2Threshold ) ) {
1540 pT2nearThreshold( beam, m2Massive, m2Threshold, xMaxAbs,
1541 zMinAbs, zMaxMassive, 0 );
1546 if (pT2 < pT2endDip)
return;
1547 if (isLeptonBeam && pT2 < LEPTONPT2MIN * m2Lepton)
return;
1551 idMother = idDaughter;
1556 if (f2fIntA > rndmPtr->flat() * (f2fIntA + f2fIntB)) {
1557 z = 1. - (1. - zMinAbs)
1558 * pow( (1. - zMaxAbs) / (1. - zMinAbs), rndmPtr->flat() );
1560 z = xDaughter + (zMinAbs - xDaughter)
1561 * pow( (zMaxAbs - xDaughter) / (zMinAbs - xDaughter),
1564 wt *= (z - xDaughter) / (1. - xDaughter);
1566 z = 1. - (1. - zMinAbs)
1567 * pow( (1. - zMaxAbs) / (1. - zMinAbs), rndmPtr->flat() );
1572 wt *= 0.5 * (1. + pow2(z));
1574 wt *= 0.5 * (1. + pow2(z)) - z * pow2(1.-z) * m2Massive / pT2;
1578 nameNow =
"isr:Q2QA";
1580 double enhance = userHooksPtr->enhanceFactor(nameNow);
1581 if (enhance != 1.) {
1582 enhanceNow = enhance;
1583 isEnhancedQ2QA =
true;
1588 Q2 = pT2 / (1. - z);
1589 xMother = xDaughter / z;
1591 if (!dipEndNow->normalRecoil) {
1592 if (sideA) xMother += (m2Rec / (x2Now * sCM)) * (1. / z - 1.);
1593 else xMother += (m2Rec / (x1Now * sCM)) * (1. / z - 1.);
1595 if (xMother > xMaxAbs) { wt = 0.;
continue; }
1600 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Sister) / m2Dip;
1601 if (pT2corr < TINYPT2) { wt = 0.;
continue; }
1604 if ( beam.isGamma() ) {
1605 BeamParticle& beamOther = (sideA) ? *beamBPtr : *beamAPtr;
1607 if( !beamOther.resolvedGamma() ){
1608 if ( !beam.roomFor1Remnant( idMother, xMother, eCM) ) {
1614 if( !beamOther.roomFor2Remnants( idMother, xMother, eCM ) ) {
1622 if (isLeptonBeam) wt *= log(pT2 / m2Lepton) / fudge;
1625 if (doMEcorrections) wt *= calcMEcorr(MEtype, idMother, idDaughter,
1626 m2Dip, z, Q2, m2Sister) / calcMEmax(MEtype, idMother, idDaughter);
1629 if (doMEcorrections && MEtype == 1 && idDaughter == idMother
1630 && ( (iSysNow == 0 && idResFirst == 24)
1631 || (iSysNow == 1 && idResSecond == 24) ) ) {
1633 double uHe = Q2 - m2Dip * (1. - z) / z;
1634 double chg1 = abs(dipEndNow->chgType / 3.);
1635 double chg2 = 1. - chg1;
1636 wt *= pow2(chg1 * uHe - chg2 * tHe)
1637 / ( (tHe + uHe) * (pow2(chg1) * uHe + pow2(chg2) * tHe) );
1641 if (dopTdamp && iSysNow == 0 && MEtype == 0 && nRad == 0)
1642 wt *= pT2damp / (pT2 + pT2damp);
1645 double alphaEMnow = alphaEM.alphaEM(renormMultFac * pT2);
1646 wt *= (alphaEMnow / alphaEMmax);
1649 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1650 xfModPrepData xfData = beam.xfModPrep(iSysNow, pdfScale2);
1651 double xPDFdaughterNew = max ( TINYPDF,
1652 beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2, xfData) );
1653 double xPDFmotherNew =
1654 beam.xfISR(iSysNow, idMother, xMother, pdfScale2, xfData);
1655 wt *= xPDFmotherNew / xPDFdaughterNew;
1659 }
while (wt < rndmPtr->flat()) ;
1668 double kernelPDF = 0.0;
1669 double xPDFdaughter = 0.;
1670 double xPDFmother[21] = {0.};
1671 double xPDFmotherSum = 0.0;
1672 double pT2PDF = pT2;
1673 double pT2minNow = pT2endDip;
1674 bool needNewPDF =
true;
1677 int loopTinyPDFdau = 0;
1678 bool hasTinyPDFdau =
false;
1683 isEnhancedQ2AQ =
false;
1688 if (hasTinyPDFdau) ++loopTinyPDFdau;
1689 if (loopTinyPDFdau > MAXLOOPTINYPDF) {
1690 infoPtr->errorMsg(
"Warning in SimpleSpaceShower::pT2nextQED: "
1691 "small daughter PDF");
1698 if (needNewPDF || pT2 < EVALPDFSTEP * pT2PDF) {
1701 hasTinyPDFdau =
false;
1704 if (pT2 > m2b && nQuarkIn >= 5) {
1706 pT2minNow = max( m2b, pT2endDip);
1707 }
else if (pT2 > m2c && nQuarkIn >= 4) {
1709 pT2minNow = max( m2c, pT2endDip);
1712 pT2minNow = pT2endDip;
1716 zMaxAbs = 1. - 0.5 * (pT2minNow / m2Dip) *
1717 ( sqrt( 1. + 4. * m2Dip / pT2minNow ) - 1. );
1720 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1721 xPDFdaughter = beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2);
1722 if (xPDFdaughter < TINYPDF) {
1723 xPDFdaughter = TINYPDF;
1724 hasTinyPDFdau =
true;
1730 double q2gInt = 4. * (1./sqrt(zMinAbs) - 1./sqrt(zMaxAbs));
1732 if (canEnhanceET) q2gInt *= userHooksPtr->enhanceFactor(
"isr:Q2QA");
1736 xPDFmother[10] = 0.;
1737 xfModPrepData xfData2 = beam.xfModPrep(iSysNow, pdfScale2);
1738 for (
int i = -nFlavour; i <= nFlavour; ++i) {
1739 if (i == 0)
continue;
1740 xPDFmother[i+10] = pow2((abs(i+1) % 2 + 1)/3.0)
1741 * beam.xfISR(iSysNow, i, xDaughter, pdfScale2, xfData2);
1742 xPDFmotherSum += xPDFmother[i+10];
1746 kernelPDF = q2gInt * xPDFmotherSum / xPDFdaughter;
1751 if (kernelPDF < TINYKERNELPDF)
return;
1754 pT2 *= pow( rndmPtr->flat(), 1. / (alphaEM2pi * kernelPDF));
1757 if (nFlavour == 5 && pT2 < m2b) {
1764 else if (nFlavour == 4 && pT2 < m2c) {
1771 else if (pT2 < pT2endDip)
return;
1774 double temp = xPDFmotherSum * rndmPtr->flat();
1775 idMother = -nQuarkIn - 1;
1777 temp -= xPDFmother[(++idMother) + 10];
1778 }
while (temp > 0. && idMother < nQuarkIn);
1781 idSister = idMother;
1782 mSister = particleDataPtr->m0(idSister);
1783 m2Sister = pow2(mSister);
1786 z = (zMinAbs * zMaxAbs) / pow2( sqrt(zMinAbs) + rndmPtr->flat()
1787 * ( sqrt(zMaxAbs)- sqrt(zMinAbs) ));
1790 wt = 0.5 * (1. + pow2(1. - z)) * sqrt(z);
1793 double alphaEMnow = alphaEM.alphaEM(renormMultFac * pT2);
1794 wt *= (alphaEMnow / alphaEMmax);
1797 nameNow =
"isr:Q2AQ";
1799 double enhance = userHooksPtr->enhanceFactor(nameNow);
1800 if (enhance != 1.) {
1801 enhanceNow = enhance;
1802 isEnhancedQ2AQ =
true;
1807 Q2 = pT2 / (1. - z);
1808 xMother = xDaughter / z;
1810 if (!dipEndNow->normalRecoil) {
1811 if (sideA) xMother += (m2Rec / (x2Now * sCM)) * (1. / z - 1.);
1812 else xMother += (m2Rec / (x1Now * sCM)) * (1. / z - 1.);
1816 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Sister) / m2Dip;
1817 if (pT2corr < TINYPT2) { wt = 0.;
continue; }
1821 if ( abs(idMother) == 4 || abs(idMother) == 5 ) {
1822 double m2QQsister = EXTRASPACEQ * 4. * m2Sister;
1823 double pT2QQcorr = Q2 - z * (m2Dip + Q2) * (Q2 + m2QQsister) / m2Dip;
1824 if (pT2QQcorr < TINYPT2) { wt = 0.;
continue; }
1828 if (dopTdamp && iSysNow == 0 && MEtype == 0 && nRad == 0)
1829 wt *= pT2damp / (pT2 + pT2damp);
1832 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
1833 double xPDFdaughterNew = beam.xfISR(iSysNow, idDaughter, xDaughter,
1835 if (xPDFdaughterNew < TINYPDF) {
1836 xPDFdaughterNew = TINYPDF;
1840 double xPDFmotherNew = pow2( (abs(idMother+1) % 2 + 1)/3.0 )
1841 * beam.xfISR(iSysNow, idMother, xMother, pdfScale2);
1844 wt *= xPDFdaughter / xPDFmother[idMother + 10];
1847 wt *= xPDFmotherNew / xPDFdaughterNew;
1850 }
while (wt < rndmPtr->flat()) ;
1854 splittingNameNow = nameNow;
1856 if (isEnhancedQ2QA) storeEnhanceFactor(pT2,
"isr:Q2QA", enhanceNow);
1857 if (isEnhancedQ2AQ) storeEnhanceFactor(pT2,
"isr:Q2AQ", enhanceNow);
1858 if (isEnhancedA2QQ) storeEnhanceFactor(pT2,
"isr:A2QQ", enhanceNow);
1862 dipEndNow->store( idDaughter, idMother, idSister, x1Now, x2Now, m2Dip,
1863 pT2, z, xMother, Q2, mSister, m2Sister, pT2corr, 0, m2ColPair,
1870 void SimpleSpaceShower::pT2nextWeak(
double pT2begDip,
double pT2endDip) {
1873 BeamParticle& beam = (sideA) ? *beamAPtr : *beamBPtr;
1874 bool isLeptonBeam = beam.isLepton();
1875 bool isValence = beam[iSysNow].isValence();
1876 int MEtype = dipEndNow->MEtype;
1877 double pT2 = pT2begDip;
1878 double m2Lepton = (isLeptonBeam) ? pow2(beam.m()) : 0.;
1879 if (isLeptonBeam && pT2begDip < m2Lepton)
return;
1882 double alphaEMmax = alphaEM.alphaEM(pT2begDip);
1883 double alphaEM2pi = alphaEMmax / (2. * M_PI);
1886 double xMaxAbs = (isLeptonBeam) ? LEPTONXMAX : beam.xMax(iSysNow);
1887 double zMinAbs = xDaughter / xMaxAbs;
1889 infoPtr->errorMsg(
"Warning in SimpleSpaceShower::pT2nextWeak: "
1890 "xMaxAbs negative");
1895 double zMaxAbs = 1. - 0.5 * (pT2endDip / m2Dip) *
1896 ( sqrt( 1. + 4. * m2Dip / pT2endDip ) - 1. );
1898 double zMaxLepton = xDaughter / (xDaughter + LEPTONXMIN);
1899 if (zMaxLepton < zMaxAbs) zMaxAbs = zMaxLepton;
1901 if (zMaxAbs < zMinAbs)
return;
1907 if (dipEndNow->weakType == 1) {
1908 idSister = (idDaughter > 0) ? -24 : 24;
1909 if (abs(idDaughter) % 2 == 1) idSister = -idSister;
1910 }
else if (dipEndNow->weakType == 2) idSister = 23;
1912 double xMother = 0.;
1915 double mSister = particleDataPtr->mSel(idSister);
1916 double m2Sister = pow2(mSister);
1917 double pT2corr = 0.;
1921 double mRatio = mSister/ sqrt(m2Dip);
1922 double m2R1 = 1. + pow2(mRatio);
1923 double zMaxMassive = 1. / (m2R1 + pT2endDip/m2Dip);
1924 if (zMaxMassive < zMaxAbs) zMaxAbs = zMaxMassive;
1925 if (zMaxAbs < zMinAbs)
return;
1928 bool isEnhancedQ2QW;
1929 isEnhancedQ2QW =
false;
1930 double enhanceNow = 1.;
1931 string nameNow =
"";
1940 double f2fIntA = (1. + pow2(zMaxAbs * m2R1)) / m2R1
1941 * log( (1. - m2R1 * zMinAbs) / (1. - m2R1 * zMaxAbs) );
1942 double f2fIntB = 0.;
1943 double zRootMin = (1. + sqrt(m2R1 * zMinAbs)) / (1. - sqrt(m2R1 * zMinAbs));
1944 double zRootMax = (1. + sqrt(m2R1 * zMaxAbs)) / (1. - sqrt(m2R1 * zMaxAbs));
1946 f2fIntB = 2. * log( (zMaxAbs - xDaughter) / (zMinAbs - xDaughter) );
1947 f2fInt = f2fIntA + f2fIntB;
1948 }
else if (isValence)
1949 f2fInt = (1. + pow2(zMaxAbs) * pow2(m2R1))/ sqrt(m2R1)
1950 * log( zRootMax / zRootMin );
1955 double weakCoupling = 0;
1956 if (dipEndNow->weakType == 1)
1957 weakCoupling = 2. * alphaEM2pi / (4. * coupSMPtr->sin2thetaW());
1958 else if (dipEndNow->weakType == 2 && dipEndNow->weakPol == -1)
1959 weakCoupling = alphaEM2pi * thetaWRat
1960 * pow2(2. * coupSMPtr->lf( abs(idDaughter) ));
1962 weakCoupling = alphaEM2pi * thetaWRat
1963 * pow2(2. * coupSMPtr->rf(abs(idDaughter) ));
1966 vector<int> possibleMothers;
1967 if (abs(idDaughter) % 2 == 0) {
1968 possibleMothers.push_back(1);
1969 possibleMothers.push_back(3);
1970 possibleMothers.push_back(5);
1972 possibleMothers.push_back(2);
1973 possibleMothers.push_back(4);
1976 for (
unsigned int i = 0;i < possibleMothers.size();i++)
1977 possibleMothers[i] = - possibleMothers[i];
1981 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2begDip;
1982 double xPDFdaughter = beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2);
1983 if (xPDFdaughter < TINYPDF) {
1984 if (abs(idDaughter) == 1 || abs(idDaughter) == 2 || abs(idDaughter) == 21)
1985 infoPtr->errorMsg(
"Warning in SimpleSpaceShower::pT2nextWeak: "
1991 double overEstimatePDFCKM = 0.;
1992 if (dipEndNow->weakType == 1) {
1993 xfModPrepData xfData = beam.xfModPrep(iSysNow, pdfScale2);
1994 for (
unsigned int i = 0; i < possibleMothers.size(); i++)
1995 overEstimatePDFCKM += coupSMPtr->V2CKMid(idDaughter, possibleMothers[i])
1996 * beam.xfISR(iSysNow, possibleMothers[i], xDaughter, pdfScale2, xfData)
1999 if (dipEndNow->weakType == 2) overEstimatePDFCKM = 1.;
2002 if (doMEcorrections) f2fInt *= calcMEmax(MEtype, 1, 1);
2003 double kernelPDF = weakCoupling * f2fInt * weakEnhancement;
2006 kernelPDF *= overEstimatePDFCKM;
2007 double fudge = (isLeptonBeam) ? LEPTONFUDGE * log(m2Dip/m2Lepton) : 1.;
2009 if (kernelPDF < TINYKERNELPDF)
return;
2011 if (canEnhanceET) kernelPDF *= userHooksPtr->enhanceFactor(
"isr:Q2QW");
2017 isEnhancedQ2QW =
false;
2023 double shift = pow(rndmPtr->flat(), 1. / kernelPDF);
2024 if (isLeptonBeam) pT2 = m2Lepton * pow( pT2 / m2Lepton, shift);
2025 else pT2 = pT2 * shift;
2028 if (pT2 < pT2endDip)
return;
2029 if (isLeptonBeam && pT2 < LEPTONPT2MIN * m2Lepton)
return;
2032 if (pT2 < HEAVYPT2EVOL * pow2(particleDataPtr->m0(idDaughter)))
return;
2036 idMother = idDaughter;
2041 if (f2fIntA > rndmPtr->flat() * (f2fIntA + f2fIntB)) {
2042 z = 1. - (1. - zMinAbs)
2043 * pow( (1. - zMaxAbs) / (1. - zMinAbs), rndmPtr->flat() );
2045 z = xDaughter + (zMinAbs - xDaughter)
2046 * pow( (zMaxAbs - xDaughter) / (zMinAbs - xDaughter),
2049 wt *= (z - xDaughter) / (1. - xDaughter);
2050 }
else if (isValence) {
2052 double zTmp = zRootMin * pow(zRootMax / zRootMin, rndmPtr->flat() );
2053 z = pow2( (1. - zTmp) / (1. + zTmp) ) / m2R1;
2056 z = (1. - (1. - zMinAbs * m2R1) * pow( (1. - zMaxAbs * m2R1)
2057 / (1. - zMinAbs * m2R1), rndmPtr->flat() ) ) / m2R1;
2059 wt *= (1. + pow2(z * m2R1)) / (1. + pow2(zMaxAbs * m2R1));
2062 nameNow =
"isr:Q2QW";
2064 double enhance = userHooksPtr->enhanceFactor(nameNow);
2065 if (enhance != 1.) {
2066 enhanceNow = enhance;
2067 isEnhancedQ2QW =
true;
2072 Q2 = pT2 / (1. - z);
2073 xMother = xDaughter / z;
2076 if (!dipEndNow->normalRecoil) {
2077 if (sideA) xMother += (m2Rec / (x2Now * sCM)) * (1. / z - 1.);
2078 else xMother += (m2Rec / (x1Now * sCM)) * (1. / z - 1.);
2080 if (xMother > xMaxAbs) { wt = 0.;
continue; }
2083 pT2corr = Q2 - z * (m2Dip + Q2) * (Q2 + m2Sister) / m2Dip;
2084 if (pT2corr < TINYPT2) { wt = 0.;
continue; }
2087 if (isLeptonBeam) wt *= log(pT2 / m2Lepton) / fudge;
2090 if (doMEcorrections) wt *= calcMEcorr(MEtype, idMother, idDaughter,
2091 m2Dip, z, Q2, m2Sister) / calcMEmax(MEtype, idMother, idDaughter);
2095 if (dopTdamp && iSysNow == 0 && nRad == 0)
2096 wt *= pT2damp / (pT2 + pT2damp);
2099 double alphaEMnow = alphaEM.alphaEM(pT2);
2100 wt *= (alphaEMnow / alphaEMmax);
2103 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
2104 xfModPrepData xfData2 = beam.xfModPrep(iSysNow, pdfScale2);
2105 double xPDFdaughterNew = max ( TINYPDF,
2106 beam.xfISR(iSysNow, idDaughter, xDaughter, pdfScale2, xfData2) );
2107 if (dipEndNow->weakType == 2) {
2108 double xPDFmotherNew
2109 = beam.xfISR(iSysNow, idMother, xMother, pdfScale2, xfData2);
2110 wt *= xPDFmotherNew / xPDFdaughterNew;
2114 if (dipEndNow->weakType == 1) {
2115 double valPDFCKM[3] = {0.};
2116 double sumPDFCKM = 0.;
2117 for (
unsigned int i = 0; i < possibleMothers.size(); i++) {
2118 valPDFCKM[i] = coupSMPtr->V2CKMid(idDaughter,possibleMothers[i])
2119 * beam.xfISR(iSysNow, possibleMothers[i], xMother, pdfScale2,
2120 xfData2) / xPDFdaughterNew;
2121 sumPDFCKM += valPDFCKM[i];
2123 wt *= sumPDFCKM / overEstimatePDFCKM;
2126 double pickId = sumPDFCKM * rndmPtr->flat();
2128 int pmSize = possibleMothers.size();
2129 do pickId -= valPDFCKM[++iId];
2130 while (pickId > 0. && iId < pmSize);
2131 idMother = possibleMothers[iId];
2135 if (wt > 1.) infoPtr->errorMsg(
"Warning in SimpleSpaceShower::pT2next"
2136 "Weak: weight is above unity.");
2139 }
while (wt < rndmPtr->flat()) ;
2142 splittingNameNow = nameNow;
2143 if (canEnhanceET && isEnhancedQ2QW)
2144 storeEnhanceFactor(pT2,
"isr:Q2QW", enhanceNow);
2147 dipEndNow->store( idDaughter, idMother, idSister, x1Now, x2Now, m2Dip,
2148 pT2, z, xMother, Q2, mSister, m2Sister, pT2corr, 0, m2ColPair,
2158 bool SimpleSpaceShower::branch(
Event& event) {
2161 int side = abs(dipEndSel->side);
2162 double sideSign = (side == 1) ? 1. : -1.;
2165 int iDaughter = partonSystemsPtr->getInA(iSysSel);
2166 int iRecoiler = partonSystemsPtr->getInB(iSysSel);
2167 if (side == 2) swap(iDaughter, iRecoiler);
2168 int idDaughterNow = dipEndSel->idDaughter;
2169 int idMother = dipEndSel->idMother;
2170 int idSister = dipEndSel->idSister;
2171 int idRecoiler =
event[iRecoiler].id();
2172 int colDaughter =
event[iDaughter].col();
2173 int acolDaughter =
event[iDaughter].acol();
2174 int iColPartner = dipEndSel->iColPartner;
2177 bool normalRecoil = dipEndSel->normalRecoil;
2178 int iRecoilMother =
event[iRecoiler].mother1();
2181 double x1 = dipEndSel->x1;
2182 double x2 = dipEndSel->x2;
2183 double xMo = dipEndSel->xMo;
2184 double m2II = dipEndSel->m2Dip;
2185 double mII = sqrt(m2II);
2186 double pT2 = dipEndSel->pT2;
2187 double z = dipEndSel->z;
2188 double Q2 = dipEndSel->Q2;
2189 double mSister = dipEndSel->mSister;
2190 double m2Sister = dipEndSel->m2Sister;
2191 double pT2corr = dipEndSel->pT2corr;
2192 double x1New = (side == 1) ? xMo : x1;
2193 double x2New = (side == 2) ? xMo : x2;
2196 gamma2qqbar =
false;
2199 BeamParticle& beamNow = (side == 1) ? *beamAPtr : *beamBPtr;
2203 if ( beamNow.isGamma() && idMother == 22 && infoPtr->nMPI() > 1 ) {
2205 beamNow.resolvedGamma(
false);
2206 beamNow.pT2gamma2qqbar(pT2corr);
2207 beamNow.gamVal(iSysSel);
2212 int MEtype = dipEndSel->MEtype;
2213 Vec4 pMother, pSister, pNewRec, pNewColPartner;
2217 rescatterFail =
false;
2222 if (iColPartner == 0) {
2223 double eNewRec, pzNewRec, pTbranch, pzMother;
2225 eNewRec = 0.5 * (m2II + Q2) / mII;
2226 pzNewRec = -sideSign * eNewRec;
2227 pTbranch = sqrt(pT2corr) * m2II / ( z * (m2II + Q2) );
2228 pzMother = sideSign * 0.5 * mII * ( (m2II - Q2)
2229 / ( z * (m2II + Q2) ) + (Q2 + m2Sister) / m2II );
2232 m2Rec =
event[iRecoiler].m2();
2233 double s1Tmp = m2II + Q2 - m2Rec;
2234 double s3Tmp = m2II / z - m2Rec;
2235 double r1Tmp = sqrt(s1Tmp * s1Tmp + 4. * Q2 * m2Rec);
2236 eNewRec = 0.5 * (m2II + m2Rec + Q2) / mII;
2237 pzNewRec = -sideSign * 0.5 * r1Tmp / mII;
2238 double pT2br = Q2 * s3Tmp * (m2II / z - m2II - Q2)
2239 - m2Sister * s1Tmp * s3Tmp - m2Rec * pow2(Q2 + m2Sister);
2240 if (pT2br <= 0.)
return false;
2241 pTbranch = sqrt(pT2br) / r1Tmp;
2242 pzMother = sideSign * (mII * s3Tmp
2243 - eNewRec * (m2II / z - Q2 - m2Rec - m2Sister)) / r1Tmp;
2246 double eMother = sqrt( pow2(pTbranch) + pow2(pzMother) );
2247 double pzSister = pzMother + pzNewRec;
2248 double eSister = sqrt( pow2(pTbranch) + pow2(pzSister) + m2Sister );
2249 pMother.p( pTbranch, 0., pzMother, eMother );
2250 pSister.p( pTbranch, 0., pzSister, eSister );
2251 pNewRec.p( 0., 0., pzNewRec, eNewRec );
2257 double m2IF = dipEndSel->m2IF;
2258 double mIF = sqrt(m2IF);
2259 m2ColPartner = pow2( dipEndSel->mColPartner );
2262 double m2IFred = m2IF - m2ColPartner;
2263 pMother.p( 0., 0., 0.5 * m2IFred / (z * mIF), 0.5 * m2IFred / (z * mIF) );
2264 Vec4 pShift( 0., 0.,
2265 -0.5 * Q2 / mIF - z * (Q2 + m2Sister) * m2ColPartner / (mIF * m2IFred),
2266 -0.5 * Q2 / mIF + z * (Q2 + m2Sister) / mIF );
2267 pSister = (1. - z) * pMother + pShift;
2268 pNewColPartner = Vec4( 0., 0., -0.5 * m2IFred /mIF,
2269 0.5 * (m2IF + m2ColPartner) / mIF ) - pShift;
2271 pNewRec.p( event[iRecoiler].p() );
2274 double phi = 2. * M_PI * rndmPtr->flat();
2277 findAsymPol( event, dipEndSel);
2278 int iFinPol = dipEndSel->iFinPol;
2279 double cPol = dipEndSel->asymPol;
2280 double phiPol = (iFinPol == 0) ? 0. : event[iFinPol].phi();
2284 double cPhiPol, weight;
2287 M.fromCMframe( event[iDaughter].p(), event[iColPartner].p() );
2288 double pTcorr = sqrt(pT2corr);
2290 phi = 2. * M_PI * rndmPtr->flat();
2292 Vec4 pSisTmp = pSister + pTcorr * Vec4( cos(phi), sin(phi), 0., 0.);
2294 cPhiPol = cos(pSisTmp.phi() - phiPol);
2295 weight *= ( 1. + cPol * (2. * pow2(cPhiPol) - 1.) )
2296 / ( 1. + abs(cPol) );
2297 }
while (weight < rndmPtr->flat());
2301 pSister.px( sqrt(pT2corr) * cos(phi) );
2302 pSister.py( sqrt(pT2corr) * sin(phi) );
2303 pNewColPartner.px( - pSister.px() );
2304 pNewColPartner.py( - pSister.py() );
2308 int eventSizeOld =
event.size();
2309 int systemSizeOld = partonSystemsPtr->sizeAll(iSysSel);
2312 int beamOff1 = 1 + beamOffset;
2313 int beamOff2 = 2 + beamOffset;
2314 int ev1Dau1V =
event[beamOff1].daughter1();
2315 int ev2Dau1V =
event[beamOff2].daughter1();
2316 vector<int> statusV, mother1V, mother2V, daughter1V, daughter2V;
2319 bool canMergeFirst = (mergingHooksPtr != 0)
2320 ? mergingHooksPtr->canVetoEmission() :
false;
2323 doUncertaintiesNow = doUncertainties;
2324 if (!uVarMPIshowers && iSysSel != 0) doUncertaintiesNow =
false;
2325 if (pT2 < uVarpTmin2) doUncertaintiesNow =
false;
2328 if (canVetoEmission || canMergeFirst || canEnhanceET || doWeakShower
2329 || doUncertainties) {
2330 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2331 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2332 statusV.push_back( event[iOldCopy].status());
2333 mother1V.push_back( event[iOldCopy].mother1());
2334 mother2V.push_back( event[iOldCopy].mother2());
2335 daughter1V.push_back( event[iOldCopy].daughter1());
2336 daughter2V.push_back( event[iOldCopy].daughter2());
2342 int iNewColPartner = 0;
2343 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2344 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2345 int statusOld =
event[iOldCopy].status();
2346 int statusNew = (iOldCopy == iDaughter
2347 || iOldCopy == iRecoiler) ? statusOld : 44;
2348 int iNewCopy =
event.copy(iOldCopy, statusNew);
2349 if (statusOld < 0)
event[iNewCopy].statusNeg();
2350 if (iOldCopy == iColPartner) iNewColPartner = iNewCopy;
2355 int colMother = colDaughter;
2356 int acolMother = acolDaughter;
2359 if (idSister == 22 || idSister == 23 || abs(idSister) == 24) ;
2361 else if (idSister == 21 && ( (idMother > 0 && idMother < 9)
2362 || (idMother == 21 && rndmPtr->flat() < 0.5) ) ) {
2363 colMother =
event.nextColTag();
2364 colSister = colMother;
2365 acolSister = colDaughter;
2367 }
else if (idSister == 21) {
2368 acolMother =
event.nextColTag();
2369 acolSister = acolMother;
2370 colSister = acolDaughter;
2372 }
else if (idDaughterNow == 21 && idMother > 0) {
2373 colMother = colDaughter;
2375 colSister = acolDaughter;
2377 }
else if (idDaughterNow == 21) {
2378 acolMother = acolDaughter;
2380 acolSister = colDaughter;
2382 }
else if ( (idDaughterNow > 0 && idDaughterNow < 9) && idMother != 22) {
2383 acolMother =
event.nextColTag();
2384 acolSister = acolMother;
2386 }
else if ( (idDaughterNow < 0 && idDaughterNow > -9) && idMother != 22) {
2387 colMother =
event.nextColTag();
2388 colSister = colMother;
2390 }
else if (idDaughterNow == 22 && idMother > 0) {
2391 colMother =
event.nextColTag();
2392 colSister = colMother;
2394 }
else if (idDaughterNow == 22) {
2395 acolMother =
event.nextColTag();
2396 acolSister = acolMother;
2398 }
else if ( (idDaughterNow > 0 && idDaughterNow < 9) && idMother == 22) {
2401 acolSister = colDaughter;
2404 }
else if ( (idDaughterNow < 0 && idDaughterNow > -9) && idMother == 22) {
2407 colSister = acolDaughter;
2412 int iMother = eventSizeOld + side - 1;
2413 int iNewRec = eventSizeOld + 2 - side;
2414 int iSister =
event.append( idSister, 43, iMother, 0, 0, 0,
2415 colSister, acolSister, pSister, mSister, sqrt(pT2) );
2418 Particle& daughter =
event[iDaughter];
2419 Particle& mother =
event[iMother];
2420 Particle& newRecoiler =
event[iNewRec];
2421 Particle& sister =
event.back();
2424 if (doPartonVertex) {
2425 if (!daughter.hasVertex()) partonVertexPtr->vertexISR( iDaughter, event);
2426 if (!newRecoiler.hasVertex()) partonVertexPtr->vertexISR( iNewRec, event);
2427 if (!sister.hasVertex()) partonVertexPtr->vertexISR( iSister, event);
2431 mother.id( idMother );
2432 mother.status( -41);
2433 mother.cols( colMother, acolMother);
2435 if (mother.idAbs() == 21 || mother.idAbs() == 22) mother.pol(9);
2436 newRecoiler.status( (normalRecoil) ? -42 : -46 );
2437 newRecoiler.p( pNewRec);
2438 if (!normalRecoil) newRecoiler.m( event[iRecoiler].m() );
2440 if (iNewColPartner != 0)
event[iNewColPartner].p( pNewColPartner );
2443 daughter.mothers( iMother, 0);
2444 mother.daughters( iSister, iDaughter);
2446 event[beamOff1].daughter1( (side == 1) ? iMother : iNewRec );
2447 event[beamOff2].daughter1( (side == 2) ? iMother : iNewRec );
2451 if (sister.idAbs() == 23 || sister.idAbs() == 24) sister.status(47);
2454 if (iNewColPartner == 0) {
2458 if (normalRecoil) Mtot.bst(0., 0., (x2 - x1) / (x1 + x2) );
2460 Mtot.toCMframe( event[iDaughter].p(), event[iRecoiler].p() );
2461 else Mtot.toCMframe( event[iRecoiler].p(), event[iDaughter].p() );
2464 double phi = 2. * M_PI * rndmPtr->flat();
2467 findAsymPol( event, dipEndSel);
2468 int iFinPol = dipEndSel->iFinPol;
2469 double cPol = dipEndSel->asymPol;
2470 double phiPol = (iFinPol == 0) ? 0. : event[iFinPol].phi();
2477 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSysSel); ++ i) {
2478 int iOut = partonSystemsPtr->getOut(iSysSel, i);
2479 if ( (acolSister != 0 && event[iOut].col() == acolSister)
2480 || (colSister != 0 && event[iOut].acol() == colSister) )
2485 Vec4 pFinTmp =
event[iFinInt].p();
2486 pFinTmp.rotbst(Mtot);
2487 double theFin = pFinTmp.theta();
2488 if (side == 2) theFin = M_PI - theFin;
2489 double theSis = pSister.theta();
2490 if (side == 2) theSis = M_PI - theSis;
2491 cInt = strengthIntAsym * 2. * theSis * theFin
2492 / (pow2(theSis) + pow2(theFin));
2493 phiInt =
event[iFinInt].phi();
2498 if (iFinPol != 0 || iFinInt != 0) {
2499 double cPhiPol, cPhiInt, weight;
2501 phi = 2. * M_PI * rndmPtr->flat();
2504 cPhiPol = cos(phi - phiPol);
2505 weight *= ( 1. + cPol * (2. * pow2(cPhiPol) - 1.) )
2506 / ( 1. + abs(cPol) );
2509 cPhiInt = cos(phi - phiInt);
2510 weight *= (1. - cInt) * (1. - cInt * cPhiInt)
2511 / (1. + pow2(cInt) - 2. * cInt * cPhiInt);
2513 }
while (weight < rndmPtr->flat());
2520 RotBstMatrix MfromRest;
2522 Vec4 sumNew = pMother + pNewRec;
2523 double betaX = sumNew.px() / sumNew.e();
2524 double betaZ = sumNew.pz() / sumNew.e();
2525 MfromRest.bst( -betaX, 0., -betaZ);
2528 pMother.rotbst(MfromRest);
2529 double theta = pMother.theta();
2530 if (pMother.px() < 0.) theta = -theta;
2531 if (side == 2) theta += M_PI;
2532 MfromRest.rot(-theta, phi);
2535 MfromRest.bst( 0., 0., (x1New - x2New) / (x1New + x2New) );
2536 }
else if (side == 1) {
2537 Vec4 pMotherWanted( 0., 0., 0.5 * eCM * x1New, 0.5 * eCM * x1New);
2538 MfromRest.fromCMframe( pMotherWanted, event[iRecoiler].p() );
2540 Vec4 pMotherWanted( 0., 0., -0.5 * eCM * x2New, 0.5 * eCM * x2New);
2541 MfromRest.fromCMframe( event[iRecoiler].p(), pMotherWanted );
2543 Mtot.rotbst(MfromRest);
2547 if (MEtype == 201 || MEtype == 202 || MEtype == 203 ||
2548 MEtype == 206 || MEtype == 207 || MEtype == 208) {
2551 Vec4 pA0 = mother.p();
2552 Vec4 pB = newRecoiler.p();
2553 bool sideRad = (abs(side) == 1);
2556 p1 = weakMomenta[2];
2557 p2 = weakMomenta[3];
2562 if (!tChannel) swap(p1,p2);
2563 if (!sideRad) swap(p1,p2);
2570 wt = calcMEcorrWeak(MEtype, m2II, z, pT2, pA0, pB,
2571 event[iDaughter].p(), event[iRecoiler].p(), p1, p2, sister.p());
2572 if (wt > weakMaxWt) {
2574 infoPtr->errorMsg(
"Warning in SimpleSpaceShower::Branch: "
2575 "weight is above unity for weak emission.");
2579 if (wt < rndmPtr->flat()) {
2580 event.popBack( event.size() - eventSizeOld);
2581 event[beamOff1].daughter1( ev1Dau1V);
2582 event[beamOff2].daughter1( ev2Dau1V);
2583 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2584 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2585 event[iOldCopy].status( statusV[iCopy]);
2586 event[iOldCopy].mothers( mother1V[iCopy], mother2V[iCopy]);
2587 event[iOldCopy].daughters( daughter1V[iCopy], daughter2V[iCopy]);
2595 mother.rotbst(MfromRest,
false);
2596 newRecoiler.rotbst(MfromRest,
false);
2597 sister.rotbst(MfromRest,
false);
2599 for (
int i = eventSizeOld + 2; i < eventSizeOld + systemSizeOld; ++i)
2600 event[i].rotbst(Mtot,
false);
2606 RotBstMatrix MfromRest;
2607 MfromRest.fromCMframe( event[iDaughter].p(), event[iColPartner].p() );
2609 mother.rotbst(MfromRest,
false);
2610 sister.rotbst(MfromRest,
false);
2611 event[iNewColPartner].rotbst(MfromRest,
false);
2616 if (infoPtr->nISR() + infoPtr->nFSRinProc() == 0
2617 && infoPtr->code() > 110 && infoPtr->code() < 130
2618 && MEtype >= 200 && MEtype < 210 && vetoWeakJets) {
2621 int iP1 =
event[5].daughter1();
2622 int iP2 =
event[6].daughter1();
2623 Vec4 pP1 =
event[iP1].p();
2624 Vec4 pP2 =
event[iP2].p();
2627 double d = sister.pT2();
2630 if (pP1.pT2() < d) {d = pP1.pT2(); cut =
true;}
2631 if (pP2.pT2() < d) {d = pP2.pT2(); cut =
true;}
2635 if (event[iP1].idAbs() < 20) {
2636 double dij = min(pP1.pT2(),sister.pT2())
2637 * pow2(RRapPhi(pP1,sister.p()))/vetoWeakDeltaR2;
2644 if (event[iP2].idAbs() < 20) {
2645 double dij = min(pP2.pT2(),sister.pT2())
2646 * pow2(RRapPhi(pP2,sister.p()))/vetoWeakDeltaR2;
2655 if (event[iP1].idAbs() == 21 ||
event[iP2].idAbs() == 21 ||
2656 event[iP1].id() == -
event[iP2].id()) {
2657 double dij = min(pP1.pT2(),pP2.pT2())
2658 * pow2(RRapPhi(pP1,pP2))/vetoWeakDeltaR2;
2667 event.popBack( event.size() - eventSizeOld);
2668 event[beamOff1].daughter1( ev1Dau1V);
2669 event[beamOff2].daughter1( ev2Dau1V);
2670 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2671 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2672 event[iOldCopy].status( statusV[iCopy]);
2673 event[iOldCopy].mothers( mother1V[iCopy], mother2V[iCopy]);
2674 event[iOldCopy].daughters( daughter1V[iCopy], daughter2V[iCopy]);
2681 if ( (canVetoEmission
2682 && userHooksPtr->doVetoISREmission(eventSizeOld, event, iSysSel))
2684 && mergingHooksPtr->doVetoEmission( event )) ) {
2685 event.popBack( event.size() - eventSizeOld);
2686 event[beamOff1].daughter1( ev1Dau1V);
2687 event[beamOff2].daughter1( ev2Dau1V);
2688 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2689 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2690 event[iOldCopy].status( statusV[iCopy]);
2691 event[iOldCopy].mothers( mother1V[iCopy], mother2V[iCopy]);
2692 event[iOldCopy].daughters( daughter1V[iCopy], daughter2V[iCopy]);
2700 double pAccept = dipEndSel->pAccept;
2704 bool acceptEvent =
true;
2705 if (pAccept < 1.0) acceptEvent = (rndmPtr->flat() < pAccept);
2710 bool vetoedEnhancedEmission =
false;
2715 bool foundEnhance =
false;
2718 for ( map<
double,pair<string,double> >::reverse_iterator
2719 it = enhanceFactors.rbegin();
2720 it != enhanceFactors.rend(); ++it ){
2721 if (splittingNameSel.find(it->second.first) != string::npos
2722 && abs(it->second.second-1.0) > 1e-9) {
2723 foundEnhance =
true;
2724 weight = it->second.second;
2725 vp = userHooksPtr->vetoProbability(splittingNameSel);
2731 if (foundEnhance && rndmPtr->flat() < vp ) vetoedEnhancedEmission =
true;
2734 if (foundEnhance && vetoedEnhancedEmission) rwgt *= (1.-1./weight)/vp;
2735 else if (foundEnhance) rwgt *= 1./((1.-vp)*weight);
2738 enhanceFactors.clear();
2741 double wtOld = userHooksPtr->getEnhancedEventWeight();
2742 if (!doTrialNow && canEnhanceEmission && !doUncertaintiesNow)
2743 userHooksPtr->setEnhancedEventWeight(wtOld*rwgt);
2744 if ( doTrialNow && canEnhanceTrial)
2745 userHooksPtr->setEnhancedTrial(sqrt(pT2), weight);
2747 if (vetoedEnhancedEmission && canEnhanceEmission)
2748 infoPtr->addCounter(40);
2751 if (vetoedEnhancedEmission) acceptEvent =
false;
2754 if (doUncertaintiesNow) calcUncertainties( acceptEvent, pAccept, pT20,
2755 weight, vp, dipEndSel, &mother, &sister);
2759 if ( (doUncertainties && !acceptEvent)
2760 || (vetoedEnhancedEmission && canEnhanceEmission) ) {
2762 event.popBack( event.size() - eventSizeOld);
2763 event[beamOff1].daughter1( ev1Dau1V);
2764 event[beamOff2].daughter1( ev2Dau1V);
2765 for (
int iCopy = 0; iCopy < systemSizeOld; ++iCopy) {
2766 int iOldCopy = partonSystemsPtr->getAll(iSysSel, iCopy);
2767 event[iOldCopy].status( statusV[iCopy]);
2768 event[iOldCopy].mothers( mother1V[iCopy], mother2V[iCopy]);
2769 event[iOldCopy].daughters( daughter1V[iCopy], daughter2V[iCopy]);
2775 partonSystemsPtr->setInA(iSysSel, eventSizeOld);
2776 partonSystemsPtr->setInB(iSysSel, eventSizeOld + 1);
2777 for (
int iCopy = 2; iCopy < systemSizeOld; ++iCopy)
2778 partonSystemsPtr->setOut(iSysSel, iCopy - 2, eventSizeOld + iCopy);
2779 partonSystemsPtr->addOut(iSysSel, eventSizeOld + systemSizeOld);
2780 partonSystemsPtr->setSHat(iSysSel, m2II / z);
2783 if (idDaughter == 21 && idMother != 21) {
2784 if (doQEDshowerByQ) {
2785 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2786 iNewRec, pT2, 0, mother.chargeType(), 0, 0, normalRecoil) );
2788 if (doWeakShower && iSysSel == 0) {
2789 int MEtypeNew = 203;
2790 if (idRecoiler == 21) MEtypeNew = 201;
2791 if (idRecoiler == idMother) MEtypeNew = 202;
2793 if( event[3].
id() == -
event[4].id()) MEtypeNew = 200;
2794 int weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
2795 event[iMother].pol(weakPol);
2796 if ((weakMode == 0 || weakMode == 1) && weakPol == -1)
2797 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2798 iNewRec, pT2, 0, 0, 1, MEtypeNew, normalRecoil, weakPol) );
2799 if (weakMode == 0 || weakMode == 2)
2800 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2801 iNewRec, pT2, 0, 0, 2, MEtypeNew + 5, normalRecoil, weakPol) );
2806 if (idDaughter == 22 && idMother != 22) {
2807 if (doQCDshower && mother.colType() != 0) {
2808 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2809 iNewRec, pT2, mother.colType(), 0, 0, 0, normalRecoil) );
2811 if (doQEDshowerByQ && mother.chargeType() != 3) {
2812 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2813 iNewRec, pT2, 0, mother.chargeType(), 0, 0, normalRecoil) );
2815 if (doQEDshowerByL && mother.chargeType() == 3) {
2816 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2817 iNewRec, pT2, 0, mother.chargeType(), 0, 0, normalRecoil) );
2819 if (doWeakShower && iSysSel == 0) {
2820 int MEtypeNew = 203;
2821 if (idRecoiler == 21) MEtypeNew = 201;
2822 if (idRecoiler == idMother) MEtypeNew = 202;
2824 if( event[3].
id() == -
event[4].id()) MEtypeNew = 200;
2825 int weakPol = (rndmPtr->flat() > 0.5) ? -1 : 1;
2826 event[iMother].pol(weakPol);
2827 if ((weakMode == 0 || weakMode == 1) && weakPol == -1)
2828 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2829 iNewRec, pT2, 0, 0, 1, MEtypeNew, normalRecoil, weakPol) );
2830 if (weakMode == 0 || weakMode == 2)
2831 dipEnd.push_back( SpaceDipoleEnd( iSysSel, side, iMother,
2832 iNewRec, pT2, 0, 0, 2, MEtypeNew + 5, normalRecoil, weakPol) );
2837 dipEndSel = &dipEnd[iDipSel];
2840 if (dipEndSel->weakType != 0) hasWeaklyRadiated =
true;
2844 while (iSysSel >=
int(nRadA.size()) || iSysSel >=
int(nRadB.size())) {
2848 if (dipEndSel->colType != 0 && side == 1) ++nRadA[iSysSel];
2849 else if (dipEndSel->colType != 0) ++nRadB[iSysSel];
2852 for (
int iDip = 0; iDip < int(dipEnd.size()); ++iDip)
2853 if ( dipEnd[iDip].system == iSysSel) {
2854 if (abs(dipEnd[iDip].side) == side) {
2855 dipEnd[iDip].iRadiator = iMother;
2856 dipEnd[iDip].iRecoiler = iNewRec;
2858 dipEnd[iDip].iColPartner = (doDipoleRecoil) ? findColPartner( event,
2859 dipEnd[iDip].iRadiator, dipEnd[iDip].iRecoiler, iSysSel) : 0;
2860 dipEnd[iDip].idColPartner = (dipEnd[iDip].iColPartner != 0)
2861 ? event[dipEnd[iDip].iColPartner].
id() : 0;
2862 if (dipEnd[iDip].colType != 0)
2863 dipEnd[iDip].colType = mother.colType();
2864 else if (dipEnd[iDip].chgType != 0) {
2865 dipEnd[iDip].chgType = 0;
2866 if ( (mother.isQuark() && doQEDshowerByQ)
2867 || (mother.isLepton() && doQEDshowerByL) )
2868 dipEnd[iDip].chgType = mother.chargeType();
2870 else if (dipEnd[iDip].weakType != 0) {
2872 if (!(mother.isLepton() || mother.isQuark()))
2873 dipEnd[iDip].weakType = 0;
2874 if (singleWeakEmission && hasWeaklyRadiated)
2875 dipEnd[iDip].weakType = 0;
2880 if (dipEnd[iDip].weakType == 0) dipEnd[iDip].MEtype = 0;
2884 dipEnd[iDip].iRadiator = iNewRec;
2885 dipEnd[iDip].iRecoiler = iMother;
2887 dipEnd[iDip].iColPartner = (doDipoleRecoil) ? findColPartner( event,
2888 dipEnd[iDip].iRadiator, dipEnd[iDip].iRecoiler, iSysSel) : 0;
2889 dipEnd[iDip].idColPartner = (dipEnd[iDip].iColPartner != 0)
2890 ? event[dipEnd[iDip].iColPartner].
id() : 0;
2892 if (!doMEafterFirst && dipEnd[iDip].weakType == 0)
2893 dipEnd[iDip].MEtype = 0;
2895 if (dipEnd[iDip].weakType != 0 && singleWeakEmission
2896 && hasWeaklyRadiated) dipEnd[iDip].weakType = 0;
2901 if (dipEndSel->weakType != 0) mother.pol(dipEndSel->weakPol);
2904 double xNew = (side == 1) ? x1New : x2New;
2905 beamNow[iSysSel].update( iMother, idMother, xNew);
2907 if (idMother != idDaughterNow) {
2908 pdfScale2 = (useFixedFacScale) ? fixedFacScale2 : factorMultFac * pT2;
2909 beamNow.xfISR( iSysSel, idMother, xNew, pdfScale2);
2910 beamNow.pickValSeaComp();
2912 BeamParticle& beamRec = (side == 1) ? *beamBPtr : *beamAPtr;
2913 beamRec[iSysSel].iPos( iNewRec);
2916 ++dipEndSel->nBranch;
2917 dipEndSel->pT2Old = pT2;
2918 dipEndSel->zOld = z;
2922 event[iRecoilMother].daughters( iNewRec, iNewRec);
2925 vector<int> iRescatterer;
2926 for (
int i = 0; i < systemSizeOld - 2; ++i) {
2927 int iOutNew = partonSystemsPtr->getOut( iSysSel, i);
2928 if (!event[iOutNew].isFinal()) iRescatterer.push_back(iOutNew);
2933 while (++iRescNow <
int(iRescatterer.size())) {
2939 int iOutNew = iRescatterer[iRescNow];
2940 int iInOld =
event[iOutNew].daughter1();
2941 int iSysResc = partonSystemsPtr->getSystemOf(iInOld,
true);
2944 int iOldA = partonSystemsPtr->getInA(iSysResc);
2945 int iOldB = partonSystemsPtr->getInB(iSysResc);
2946 bool rescSideA =
event[iOldA].isRescatteredIncoming();
2947 int statusNewA = (rescSideA) ? -45 : -42;
2948 int statusNewB = (rescSideA) ? -42 : -45;
2949 int iNewA =
event.copy(iOldA, statusNewA);
2950 int iNewB =
event.copy(iOldB, statusNewB);
2953 int eventSize =
event.size();
2954 int sizeOutAB = partonSystemsPtr->sizeOut(iSysResc);
2955 int iOldAB, statusOldAB, iNewAB;
2956 for (
int iOutAB = 0; iOutAB < sizeOutAB; ++iOutAB) {
2957 iOldAB = partonSystemsPtr->getOut(iSysResc, iOutAB);
2958 statusOldAB =
event[iOldAB].status();
2959 iNewAB =
event.copy(iOldAB, 44);
2961 if (statusOldAB < 0) {
2962 event[iNewAB].statusNeg();
2963 iRescatterer.push_back(iNewAB);
2968 int iInNew = (rescSideA) ? iNewA : iNewB;
2969 event[iOutNew].daughters( iInNew, iInNew);
2970 event[iInNew].mothers( iOutNew, iOutNew);
2973 event[iInNew].p( event[iOutNew].p() );
2974 double momFac = (rescSideA)
2975 ? event[iInOld].pPos() /
event[iInNew].pPos()
2976 :
event[iInOld].pNeg() /
event[iInNew].pNeg();
2977 int iInRec = (rescSideA) ? iNewB : iNewA;
2983 infoPtr->errorMsg(
"Warning in SimpleSpaceShower::branch: "
2984 "change in lightcone momentum sign; retrying parton level");
2985 rescatterFail =
true;
2988 event[iInRec].rescale4( momFac);
2991 RotBstMatrix MmodResc;
2992 MmodResc.toCMframe( event[iOldA].p(), event[iOldB].p());
2993 MmodResc.fromCMframe(event[iNewA].p(), event[iNewB].p());
2994 for (
int iOutAB = 0; iOutAB < sizeOutAB; ++iOutAB)
2995 event[eventSize + iOutAB].rotbst(MmodResc,
false);
2998 partonSystemsPtr->setInA(iSysResc, iNewA);
2999 partonSystemsPtr->setInB(iSysResc, iNewB);
3000 for (
int iCopy = 0; iCopy < sizeOutAB; ++iCopy)
3001 partonSystemsPtr->setOut(iSysResc, iCopy, eventSize + iCopy);
3004 for (
int iDip = 0; iDip < int(dipEnd.size()); ++iDip)
3005 if ( dipEnd[iDip].system == iSysResc) {
3006 bool sideAnow = (abs(dipEnd[iDip].side) == 1);
3007 dipEnd[iDip].iRadiator = (sideAnow) ? iNewA : iNewB;
3008 dipEnd[iDip].iRecoiler = (sideAnow) ? iNewB : iNewA;
3012 BeamParticle& beamResc = (rescSideA) ? *beamAPtr : *beamBPtr;
3013 beamResc[iSysResc].iPos( iInNew);
3014 beamResc[iSysResc].p( event[iInNew].p() );
3015 beamResc[iSysResc].scaleX( 1. / momFac );
3016 BeamParticle& beamReco = (rescSideA) ? *beamBPtr : *beamAPtr;
3017 beamReco[iSysResc].iPos( iInRec);
3018 beamReco[iSysResc].scaleX( momFac);
3024 if ( ( beamAPtr->xMax(-1) < 0.0 && !(beamAPtr->isUnresolved()) )
3025 || ( beamBPtr->xMax(-1) < 0.0 && !(beamBPtr->isUnresolved()) ) ) {
3026 infoPtr->errorMsg(
"Warning in SimpleSpaceShower::branch: "
3027 "used up beam momentum; retrying parton level");
3028 rescatterFail =
true;
3033 if ( beamNow.isGamma() && beamNow.resolvedGamma() && gamma2qqbar)
3034 beamNow.resolvedGamma(
false);
3045 bool SimpleSpaceShower::initUncertainties() {
3048 if( nUncertaintyVariations )
return(nUncertaintyVariations);
3052 uVarMuSoftCorr = flag(
"UncertaintyBands:muSoftCorr");
3053 dASmax = parm(
"UncertaintyBands:deltaAlphaSmax");
3056 varG2GGmuRfac.clear(); varG2GGcNS.clear();
3057 varQ2QGmuRfac.clear(); varQ2QGcNS.clear();
3058 varQ2GQmuRfac.clear(); varQ2GQcNS.clear();
3059 varX2XGmuRfac.clear(); varX2XGcNS.clear();
3060 varG2QQmuRfac.clear(); varG2QQcNS.clear();
3062 varPDFplus = &weightContainerPtr->weightsPS.varPDFplus;
3063 varPDFminus = &weightContainerPtr->weightsPS.varPDFminus;
3064 varPDFmember = &weightContainerPtr->weightsPS.varPDFmember;
3065 varPDFplus->clear();
3066 varPDFminus->clear();
3067 varPDFmember->clear();
3069 vector<string> keys;
3071 keys.push_back(
"isr:murfac");
3072 keys.push_back(
"isr:g2gg:murfac");
3073 keys.push_back(
"isr:q2qg:murfac");
3074 keys.push_back(
"isr:q2gq:murfac");
3075 keys.push_back(
"isr:x2xg:murfac");
3076 keys.push_back(
"isr:g2qq:murfac");
3077 keys.push_back(
"isr:cns");
3078 keys.push_back(
"isr:g2gg:cns");
3079 keys.push_back(
"isr:q2qg:cns");
3080 keys.push_back(
"isr:q2gq:cns");
3081 keys.push_back(
"isr:x2xg:cns");
3082 keys.push_back(
"isr:g2qq:cns");
3083 keys.push_back(
"isr:pdf:plus");
3084 keys.push_back(
"isr:pdf:minus");
3085 keys.push_back(
"isr:pdf:member");
3088 int nKeysQCD=keys.size();
3091 vector<string> uniqueVarsIn = weightContainerPtr->weightsPS.
3092 getUniqueShowerVars();
3093 size_t varSize = uniqueVarsIn.size();
3095 nUncertaintyVariations = varSize;
3098 vector<string> uniqueVars;
3101 string tmpKey(
"isr:pdf:family");
3103 for (
string uVarString: uniqueVarsIn) {
3104 int firstEqual = uVarString.find_first_of(
"=");
3105 string testString = uVarString.substr(0, firstEqual);
3107 if( find(keys.begin(), keys.end(), testString) != keys.end() ) {
3108 if( uniqueVars.size() == 0 ) {
3109 uniqueVars.push_back(uVarString);
3110 }
else if ( find(uniqueVars.begin(), uniqueVars.end(), uVarString)
3111 == uniqueVars.end() ) {
3112 uniqueVars.push_back(uVarString);
3114 }
else if ( testString == tmpKey ) {
3116 BeamParticle& beam = *beamAPtr;
3117 nMembers = beam.nMembers();
3118 for(
int iMem=1; iMem<nMembers; ++iMem) {
3121 string tmpString(
"isr:pdf:member="+iss.str());
3122 if (find(uniqueVars.begin(), uniqueVars.end(), tmpString)
3123 == uniqueVars.end() ) {
3124 uniqueVars.push_back(tmpString);
3130 nUncertaintyVariations = int(uniqueVars.size());
3132 if ( nUncertaintyVariations > 0 ) {
3133 int nWeights = weightContainerPtr->weightsPS.getWeightsSize();
3134 int newSize = nWeights + nUncertaintyVariations;
3135 for(
int iWeight = nWeights; iWeight < newSize; ++iWeight) {
3136 string uVarString = uniqueVars[iWeight - nWeights];
3137 weightContainerPtr->weightsPS.bookWeight(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;
3201 return (nVarQCD > 0);
3208 void SimpleSpaceShower::calcUncertainties(
bool accept,
double pAccept,
3209 double pT20in,
double enhance,
double vp, SpaceDipoleEnd* dip,
3210 Particle* motPtr, Particle* sisPtr) {
3213 if (!doUncertainties || !doUncertaintiesNow || nUncertaintyVariations <= 0)
3218 map<int,double>* varPtr=0;
3219 map<int,double>::iterator itVar;
3221 map<int,double> dummy; dummy.clear();
3223 int numWeights = weightContainerPtr->weightsPS.getWeightsSize();
3226 vector<double> uVarFac(numWeights, 1.0);
3227 vector<bool> doVar(numWeights,
false);
3233 int idSis = sisPtr->id();
3234 int idMot = motPtr->id();
3237 if ( !varPDFplus->empty() || !varPDFminus->empty() || !varPDFmember->empty()
3240 double scale2 = (useFixedFacScale) ? fixedFacScale2
3241 : factorMultFac * dip->pT2;
3242 double xMother = dip->xMo;
3243 double xDau = dip->z * xMother;
3244 BeamParticle& beam = (abs(dip->side) == 1) ? *beamAPtr : *beamBPtr;
3245 int valSea = (beam[iSysSel].isValence()) ? 1 : 0;
3246 if( beam[iSysSel].isUnmatched() ) valSea = 2;
3247 beam.calcPDFEnvelope( make_pair(dip->idMother,dip->idDaughter),
3248 make_pair(xMother,xDau), scale2, valSea);
3249 PDF::PDFEnvelope ratioPDFEnv = beam.getPDFEnvelope( );
3251 varPtr = varPDFplus;
3252 for (itVar = varPtr->begin(); itVar != varPtr->end(); ++itVar) {
3253 int iWeight = itVar->first;
3254 uVarFac[iWeight] *= 1.0 + min(ratioPDFEnv.errplusPDF
3255 / ratioPDFEnv.centralPDF, 0.5);
3256 doVar[iWeight] =
true;
3259 varPtr = varPDFminus;
3260 for (itVar = varPtr->begin(); itVar != varPtr->end(); ++itVar) {
3261 int iWeight = itVar->first;
3262 uVarFac[iWeight] *= max(.01,1.0 - min(ratioPDFEnv.errminusPDF
3263 / ratioPDFEnv.centralPDF, 0.5));
3264 doVar[iWeight] =
true;
3266 varPtr = varPDFmember;
3267 for (itVar = varPtr->begin(); itVar != varPtr->end(); ++itVar) {
3268 int iWeight = itVar->first;
3269 int member = int( itVar->second );
3270 uVarFac[iWeight] *= max(.01,ratioPDFEnv.pdfMemberVars[member]
3271 / ratioPDFEnv.centralPDF);
3272 doVar[iWeight] =
true;
3277 if (dip->colType != 0) {
3280 if (alphaSorder == 0) varPtr = &dummy;
3281 else if (idMot == 21 && idSis == 21) varPtr = &varG2GGmuRfac;
3282 else if (idMot == 21 && abs(idSis) <= nQuarkIn) varPtr = &varG2QQmuRfac;
3283 else if (abs(idMot) <= nQuarkIn) {
3284 if (abs(idMot) <= uVarNflavQ) varPtr = &varQ2QGmuRfac;
3285 else varPtr = &varX2XGmuRfac;
3287 else varPtr = &dummy;
3288 double Q2 = dip->pT2;
3289 double muR2 = renormMultFac * (Q2 + pT20in);
3290 double alphaSbaseline = alphaS.alphaS(muR2);
3291 for (itVar = varPtr->begin(); itVar != varPtr->end(); ++itVar) {
3292 int iWeight = itVar->first;
3293 double valFac = itVar->second;
3295 double muR2var = max(1.1 * Lambda3flav2, pow2(valFac) * muR2);
3296 double alphaSratio = alphaS.alphaS(muR2var) / alphaSbaseline;
3298 double facCorr = 1.;
3299 if (idSis == 21 && uVarMuSoftCorr) {
3302 if (dip->pT2 < pow2(mc)) nf = 3;
3303 else if (dip->pT2 < pow2(mb)) nf = 4;
3304 double alphaScorr = alphaS.alphaS(dip->m2Dip);
3305 double facSoft = alphaScorr * (33. - 2. * nf) / (6. * M_PI);
3307 double zeta = 1. - dip->z;
3308 facCorr = 1. + (1. - zeta) * facSoft * log(valFac);
3311 double alphaSfac = alphaSratio * facCorr;
3314 alphaSfac = min(alphaSfac, (alphaSbaseline + dASmax) / alphaSbaseline);
3315 else if (alphaSbaseline > dASmax)
3316 alphaSfac = max(alphaSfac, (alphaSbaseline - dASmax) / alphaSbaseline);
3317 uVarFac[iWeight] *= alphaSfac;
3318 doVar[iWeight] =
true;
3322 if (dip->MEtype != 0 || dip->pT2 < pow2(cNSpTmin) ) varPtr = &dummy;
3323 else if (idMot == 21 && idSis == 21) varPtr = &varG2GGcNS;
3324 else if (idMot == 21 && abs(idSis) <= nQuarkIn) varPtr = &varG2QQcNS;
3325 else if (abs(idMot) <= nQuarkIn) {
3326 if (abs(idMot) <= uVarNflavQ) varPtr = &varQ2QGcNS;
3327 else varPtr = &varX2XGcNS;
3329 else varPtr = &dummy;
3331 for (itVar = varPtr->begin(); itVar != varPtr->end(); ++itVar) {
3332 int iWeight = itVar->first;
3333 double valFac = itVar->second;
3336 if (idMot == 21 && abs(idSis) >= 4 && idSis != 21)
3337 Q2 = max(1., Q2+pow2(sisPtr->m0()));
3338 else if (idSis == 21 && abs(idMot) >= 4 && idMot != 21)
3339 Q2 = max(1., Q2+pow2(motPtr->m0()));
3340 double yQ = Q2 / dip->m2Dip;
3341 double num = yQ * valFac;
3344 if (idSis == 21 && idMot == 21)
3345 denom = pow2(1. - z * (1.-z)) / (z*(1.-z));
3347 else if (idSis == 21)
3348 denom = (1. + pow2(z)) / (1. - z);
3350 else if (idMot == idSis)
3351 denom = (1. + pow2(1. - z)) / z;
3354 denom = pow2(z) + pow2(1. - z);
3356 double minReWeight = max( 1. + num / denom, REJECTFACTOR );
3357 uVarFac[iWeight] *= minReWeight;
3358 doVar[iWeight] =
true;
3364 for (
int iWeight = 1; iWeight<numWeights; ++iWeight) {
3365 if (!doVar[iWeight])
continue;
3366 double pAcceptPrime = pAccept * uVarFac[iWeight];
3367 if (pAcceptPrime > PROBLIMIT && dip->colType != 0) {
3368 uVarFac[iWeight] *= PROBLIMIT / pAcceptPrime;
3373 for (
int iWeight = 0; iWeight < numWeights; ++iWeight) {
3374 if (!doVar[iWeight])
continue;
3378 weightContainerPtr->weightsPS.reweightValueByIndex(iWeight,
3379 uVarFac[iWeight] / ((1.0 - vp) * enhance) );
3385 double denom = 1. - pAccept * (1.0 - vp);
3386 if (denom < REJECTFACTOR) {
3387 stringstream message;
3389 infoPtr->errorMsg(
"Warning in SimpleSpaceShower: reject denom for"
3390 " iWeight = ", message.str());
3393 double reWtFail = max(0.01, (1. - uVarFac[iWeight] * pAccept / enhance )
3395 weightContainerPtr->weightsPS.reweightValueByIndex(iWeight,
3405 int SimpleSpaceShower::findMEtype(
int iSys,
Event& event,
3406 bool weakRadiation) {
3410 if (!doMEcorrections)
return MEtype;
3413 if (partonSystemsPtr->sizeOut( iSys) == 1 && !weakRadiation) {
3414 int idIn1 =
event[partonSystemsPtr->getInA(iSys)].id();
3415 int idIn2 =
event[partonSystemsPtr->getInA(iSys)].id();
3416 int idRes =
event[partonSystemsPtr->getOut(iSys, 0)].id();
3417 if (iSys == 0) idResFirst = abs(idRes);
3418 if (iSys == 1) idResSecond = abs(idRes);
3421 if ( (idRes == 23 || abs(idRes) == 24 || idRes == 32
3422 || idRes == 33 || abs(idRes) == 34 || abs(idRes) == 41)
3423 && abs(idIn1) < 20 && abs(idIn2) < 20 ) MEtype = 1;
3426 if ( (idRes == 25 || idRes == 35 || idRes == 36)
3427 && ( ( idIn1 == 21 && idIn2 == 21 )
3428 || ( idIn1 == 22 && idIn2 == 22 ) ) ) MEtype = 2;
3431 if ( (idRes == 25 || idRes == 35 || idRes == 36)
3432 && abs(idIn1) < 20 && abs(idIn2) < 20 ) MEtype = 3;
3436 if (weakRadiation) {
3437 if (event[3].
id() == -event[4].
id()
3438 || event[event[3].daughter1()].idAbs() == 24 || infoPtr->nFinal() != 2)
3440 else if (event[3].idAbs() == 21 ||
event[4].idAbs() == 21) MEtype = 201;
3441 else if (event[3].
id() ==
event[4].id()) MEtype = 202;
3454 double SimpleSpaceShower::calcMEmax(
int MEtype,
int idMother,
3458 if (MEtype == 1 && idMother > 20 && idDaughterIn < 20)
return 3.;
3463 if ( MEtype == 201 || MEtype == 202 || MEtype == 203
3464 || MEtype == 206 || MEtype == 207 || MEtype == 208)
return WEAKPSWEIGHT;
3477 double SimpleSpaceShower::calcMEcorr(
int MEtype,
int idMother,
3478 int idDaughterIn,
double M2,
double z,
double Q2,
double m2Sister) {
3483 double uH = Q2 - M2 * (1. - z) / z;
3484 int idMabs = abs(idMother);
3485 int idDabs = abs(idDaughterIn);
3489 if (idMabs < 20 && idDabs < 20) {
3490 return (tH*tH + uH*uH + 2. * M2 * sH) / (sH*sH + M2*M2);
3491 }
else if (idDabs < 20) {
3495 return (sH*sH + uH*uH + 2. * M2 * tH) / (pow2(sH - M2) + M2*M2);
3499 }
else if (MEtype == 2) {
3500 if (idMabs < 20 && idDabs > 20) {
3501 return (sH*sH + uH*uH) / (sH*sH + pow2(sH - M2));
3502 }
else if (idDabs > 20) {
3503 return 0.5 * (pow4(sH) + pow4(tH) + pow4(uH) + pow4(M2))
3504 / pow2(sH*sH - M2 * (sH - M2));
3508 }
else if (MEtype == 3) {
3509 if (idMabs < 20 && idDabs < 20) {
3512 }
else if (idDabs < 20) {
3515 return (sH*sH + uH*uH + 2. * (M2 - uH) * (M2 - sH))
3516 / (pow2(sH - M2) + M2*M2);
3520 }
else if (MEtype == 200 || MEtype == 205) {
3523 double wtME = (uH*uH + tH*tH + 2 * sH * (m2Sister + M2)) / (uH*tH)
3524 - M2 * m2Sister * (1/(tH*tH) + 1/(uH*uH));
3525 double wtPS = (sH*sH + pow2(M2 + m2Sister)) / (tH*uH);
3527 }
else if (MEtype == 201 || MEtype == 202 || MEtype == 203 ||
3528 MEtype == 206 || MEtype == 207 || MEtype == 208)
3529 return calcMEmax(MEtype, 0, 0);
3540 double SimpleSpaceShower::calcMEcorrWeak(
int MEtype,
double m2,
double z,
3541 double pT2, Vec4 pMother, Vec4 pB, Vec4 pDaughter,
3542 Vec4 pB0, Vec4 p1, Vec4 p2, Vec4 pSister) {
3545 Vec4 pA = pMother - pSister;
3548 double scaleFactor2 = (pA + pB).m2Calc() / (p1 + p2).m2Calc();
3549 double scaleFactor = sqrt(scaleFactor2);
3550 RotBstMatrix rot2to2frame;
3551 rot2to2frame.bstback(p1 + p2);
3552 p1.rotbst(rot2to2frame);
3553 p2.rotbst(rot2to2frame);
3559 RotBstMatrix rot2to2frameInc;
3560 rot2to2frameInc.bstback(pDaughter + pB0);
3561 pDaughter.rotbst(rot2to2frameInc);
3562 pB0.rotbst(rot2to2frameInc);
3563 double sHat = (p1 + p2).m2Calc();
3564 double tHat = (p1 - pDaughter).m2Calc();
3565 double uHat = (p1 - pB0).m2Calc();
3568 double m2R1 = 1. + pSister.m2Calc() / m2;
3569 double wt = 4. * sHat / (pMother + pB).m2Calc() * pT2 * ( 1. - z * m2R1)
3570 / (1. + pow2(z * m2R1)) / (1.-z);
3571 if (MEtype == 201 || MEtype == 206)
3572 wt *= simpleWeakShowerMEs.getMEqg2qgZ(pMother, pB, p2, pSister, p1)
3573 / simpleWeakShowerMEs.getMEqg2qg(sHat, tHat, uHat);
3574 else if (MEtype == 202 || MEtype == 207)
3575 wt *= simpleWeakShowerMEs.getMEqq2qqZ(pMother, pB, pSister, p2, p1)
3576 / simpleWeakShowerMEs.getMEqq2qq(sHat, tHat, uHat,
true);
3577 else if (MEtype == 203 || MEtype == 208)
3578 wt *= simpleWeakShowerMEs.getMEqq2qqZ(pMother, pB, pSister, p2, p1)
3579 / simpleWeakShowerMEs.getMEqq2qq(sHat, tHat, uHat,
false);
3582 wt *= (pSister + p1).m2Calc() / ( (pSister + p1).m2Calc()
3583 + abs((-pMother + pSister).m2Calc()) );
3586 wt /= calcMEmax(MEtype, 0, 0);
3595 void SimpleSpaceShower::findAsymPol(
Event& event, SpaceDipoleEnd* dip) {
3600 int iRad = dip->iRadiator;
3601 if (!doPhiPolAsym || dip->idDaughter != 21)
return;
3604 int systemSizeOut = partonSystemsPtr->sizeOut( iSysSel);
3605 if (systemSizeOut < 2)
return;
3606 bool foundColOut =
false;
3607 for (
int ii = 0; ii < systemSizeOut; ++ii) {
3608 int i = partonSystemsPtr->getOut( iSysSel, ii);
3609 if (event[i].col() != 0 || event[i].acol() != 0) foundColOut =
true;
3611 if (!foundColOut)
return;
3616 int iGrandD1 =
event[iRad].daughter1();
3617 int iGrandD2 =
event[iRad].daughter2();
3618 bool traceCopy =
false;
3621 if (iGrandD1 > 0 && iGrandD2 == iGrandD1) {
3622 iGrandD1 =
event[iGrandD2].daughter1();
3623 iGrandD2 =
event[iGrandD2].daughter2();
3626 }
while (traceCopy);
3627 int statusGrandD1 =
event[ iGrandD1 ].statusAbs();
3628 bool isHardProc = (statusGrandD1 == 23 || statusGrandD1 == 33);
3630 if (!doPhiPolAsymHard)
return;
3631 if (iGrandD2 != iGrandD1 + 1)
return;
3632 if (event[iGrandD1].isGluon() &&
event[iGrandD2].isGluon());
3633 else if (event[iGrandD1].isQuark() &&
event[iGrandD2].isQuark());
3636 dip->iFinPol = iGrandD1;
3639 if (dip->idMother == 21) dip->asymPol = pow2( (1. - dip->z)
3640 / (1. - dip->z * (1. - dip->z) ) );
3641 else dip->asymPol = 2. * (1. - dip->z) / (1. + pow2(1. - dip->z) );
3644 double zDau = (isHardProc) ? 0.5 : dip->zOld;
3645 if (event[iGrandD1].isGluon()) dip->asymPol *= pow2( zDau * (1. - zDau)
3646 / (1. - zDau * (1. - zDau) ) );
3647 else dip->asymPol *= -2. * zDau *( 1. - zDau )
3648 / (1. - 2. * zDau * (1. - zDau) );
3656 int SimpleSpaceShower::findColPartner(
Event& event,
int iSideA,
int iSideB,
3659 int iColPartner = 0;
3660 int colSideA =
event[iSideA].col();
3661 int acolSideA =
event[iSideA].acol();
3664 if ( (colSideA != 0 && event[iSideB].acol() == colSideA)
3665 || (acolSideA != 0 && event[iSideB].col() == acolSideA) ) {
3669 if (event[iSideA].
id() == 21)
3670 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSystem); ++i) {
3671 int iOut = partonSystemsPtr->getOut(iSystem, i);
3672 if ( event[iOut].col() == colSideA
3673 || event[iOut].acol() == acolSideA )
3675 if (rndmPtr->flat() < 0.5) iColPartner = iOut;
3679 }
else if (colSideA != 0 || acolSideA != 0) {
3680 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSystem); ++ i) {
3681 int iOut = partonSystemsPtr->getOut(iSystem, i);
3682 if ( (colSideA != 0 && event[iOut].col() == colSideA)
3683 || (acolSideA != 0 && event[iOut].acol() == acolSideA) ) {
3684 if (iColPartner == 0) iColPartner = iOut;
3686 else if (rndmPtr->flat() < 0.5) iColPartner = iOut;
3700 void SimpleSpaceShower::update(
int iSys,
Event& event,
bool hasWeakRad) {
3702 if (hasWeakRad && singleWeakEmission)
3703 for (
int i = 0; i < int(dipEnd.size()); i++)
3704 if (dipEnd[i].weakType != 0) dipEnd[i].weakType = 0;
3705 if (hasWeakRad) hasWeaklyRadiated =
true;
3709 for (
int i = 0; i < int(dipEnd.size()); i++)
3710 if (dipEnd[i].system == iSys) {
3711 dipEnd[i].iColPartner = findColPartner(event, dipEnd[i].iRadiator,
3712 dipEnd[i].iRecoiler, iSys);
3713 dipEnd[i].idColPartner = (dipEnd[i].iColPartner != 0)
3714 ? event[dipEnd[i].iColPartner].
id() : 0;
3723 void SimpleSpaceShower::list()
const {
3726 cout <<
"\n -------- PYTHIA SimpleSpaceShower Dipole Listing --------- \n"
3727 <<
"\n i syst side rad rec pTmax col chg ME rec \n"
3728 << fixed << setprecision(3);
3731 for (
int i = 0; i < int(dipEnd.size()); ++i)
3732 cout << setw(5) << i << setw(6) << dipEnd[i].system
3733 << setw(6) << dipEnd[i].side << setw(6) << dipEnd[i].iRadiator
3734 << setw(6) << dipEnd[i].iRecoiler << setw(12) << dipEnd[i].pTmax
3735 << setw(5) << dipEnd[i].colType << setw(5) << dipEnd[i].chgType
3736 << setw(5) << dipEnd[i].MEtype << setw(4)
3737 << dipEnd[i].normalRecoil <<
"\n";
3740 cout <<
"\n -------- End PYTHIA SimpleSpaceShower Dipole Listing -----"