9 #include "Pythia8/PartonLevel.h"
10 #include "Pythia8/ColourReconnection.h"
24 const int PartonLevel::NTRY = 10;
30 bool PartonLevel::init( TimeShowerPtr timesDecPtrIn,
31 TimeShowerPtr timesPtrIn, SpaceShowerPtr spacePtrIn, RHadrons* rHadronsPtrIn,
32 MergingHooksPtr mergingHooksPtrIn, PartonVertexPtr partonVertexPtrIn,
33 StringIntPtr stringInteractionsPtrIn,
bool useAsTrial ) {
36 beamHadAPtr = beamAPtr;
37 beamHadBPtr = beamBPtr;
38 timesDecPtr = timesDecPtrIn;
39 timesPtr = timesPtrIn;
40 spacePtr = spacePtrIn;
41 rHadronsPtr = rHadronsPtrIn;
42 mergingHooksPtr = mergingHooksPtrIn;
43 partonVertexPtr = partonVertexPtrIn;
44 colourReconnectionPtr = stringInteractionsPtrIn->getColourReconnections();
47 Settings& settings = *settingsPtr;
50 bool doSQ = settings.flag(
"SoftQCD:all")
51 || settings.flag(
"SoftQCD:inelastic");
52 bool doND = settings.flag(
"SoftQCD:nonDiffractive");
53 bool doSD = settings.flag(
"SoftQCD:singleDiffractive");
54 bool doDD = settings.flag(
"SoftQCD:doubleDiffractive");
55 bool doCD = settings.flag(
"SoftQCD:centralDiffractive");
56 doNonDiff = doSQ || doND;
57 doDiffraction = doSQ || doSD || doDD || doCD;
58 doHardDiff = settings.flag(
"Diffraction:doHard");
59 hardDiffSide = (doHardDiff) ? settings.mode(
"Diffraction:hardDiffSide")
61 sampleTypeDiff = (doHardDiff) ? settings.mode(
"Diffraction:sampleType")
65 mMinDiff = settings.parm(
"Diffraction:mMinPert");
66 mWidthDiff = settings.parm(
"Diffraction:mWidthPert");
67 pMaxDiff = settings.parm(
"Diffraction:probMaxPert");
68 if (mMinDiff > infoPtr->eCM()) doDiffraction =
false;
71 gammaMode = settings.mode(
"Photon:ProcessType");
73 beamAhasGamma = settings.flag(
"PDF:beamA2gamma");
74 beamBhasGamma = settings.flag(
"PDF:beamB2gamma");
75 sampleQ2gamma = settings.flag(
"Photon:sampleQ2");
76 beamHasGamma = (beamAhasGamma || beamBhasGamma)
77 && (beamAPtr != 0) && (beamBPtr != 0);
80 beamAisGamma = (beamAPtr != 0) ? beamAPtr->isGamma() :
false;
81 beamBisGamma = (beamBPtr != 0) ? beamBPtr->isGamma() :
false;
82 beamAhasResGamma = (beamAPtr != 0) ? beamAPtr->hasResGamma() :
false;
83 beamBhasResGamma = (beamBPtr != 0) ? beamBPtr->hasResGamma() :
false;
84 beamHasResGamma = (gammaMode < 4) && beamHasGamma;
85 isGammaHadronDir =
false;
88 bool isAgamBhad = (beamAisGamma || beamAhasGamma) && beamBPtr->isHadron();
89 bool isBgamAhad = (beamBisGamma || beamBhasGamma) && beamAPtr->isHadron();
90 bool isAgamBgam = (beamAisGamma || beamAhasGamma)
91 && (beamBisGamma || beamBhasGamma);
92 bool onlyDirGamma = ( gammaMode == 4 || ( gammaMode == 3 && isAgamBhad )
93 || ( gammaMode == 2 && isBgamAhad ) || ( gammaMode > 1 && isAgamBgam) );
96 showUnresGamma = settings.flag(
"Photon:showUnres");
100 doMPI = settings.flag(
"PartonLevel:MPI");
107 if (doNonDiff || doDiffraction) doMPIinit =
true;
108 if (!settings.flag(
"PartonLevel:all")) doMPIinit =
false;
111 pTmaxMatchMPI = settings.mode(
"MultipartonInteractions:pTmaxMatch");
114 doTrial = useAsTrial;
116 bool hasMergingHooks = (mergingHooksPtr != 0);
117 canRemoveEvent = !doTrial && hasMergingHooks
118 && ( mergingHooksPtr->doCKKWLMerging() || mergingHooksPtr->doNL3Merging());
119 canRemoveEmission = !doTrial && hasMergingHooks
120 && ( mergingHooksPtr->doUMEPSMerging() || mergingHooksPtr->doNL3Merging()
121 || mergingHooksPtr->doUNLOPSMerging() );
127 doISR = settings.flag(
"PartonLevel:ISR");
128 bool FSR = settings.flag(
"PartonLevel:FSR");
129 bool FSRinProcess = settings.flag(
"PartonLevel:FSRinProcess");
130 bool interleaveFSR = settings.flag(
"TimeShower:interleave");
131 doFSRduringProcess = FSR && FSRinProcess && interleaveFSR;
132 doFSRafterProcess = FSR && FSRinProcess && !interleaveFSR;
133 doFSRinResonances = FSR && settings.flag(
"PartonLevel:FSRinResonances");
136 doReconnect = settings.flag(
"ColourReconnection:reconnect");
137 reconnectMode = settings.mode(
"ColourReconnection:mode");
138 forceResonanceCR = settings.flag(
"ColourReconnection:forceResonance");
141 doRemnants = settings.flag(
"PartonLevel:Remnants");
142 doSecondHard = settings.flag(
"SecondHard:generate");
143 twoHard = doSecondHard;
144 earlyResDec = settings.flag(
"PartonLevel:earlyResDec");
147 allowRH = settings.flag(
"RHadrons:allow");
150 canVetoPT = (userHooksPtr != 0)
151 ? userHooksPtr->canVetoPT() :
false;
152 pTvetoPT = (canVetoPT)
153 ? userHooksPtr->scaleVetoPT() : -1.;
154 canVetoStep = (userHooksPtr != 0)
155 ? userHooksPtr->canVetoStep() :
false;
156 nVetoStep = (canVetoStep)
157 ? userHooksPtr->numberVetoStep() : -1;
158 canVetoMPIStep = (userHooksPtr != 0)
159 ? userHooksPtr->canVetoMPIStep() :
false;
160 nVetoMPIStep = (canVetoMPIStep)
161 ? userHooksPtr->numberVetoMPIStep() : -1;
162 canVetoEarly = (userHooksPtr != 0)
163 ? userHooksPtr->canVetoPartonLevelEarly() :
false;
166 vetoWeakJets = settings.flag(
"WeakShower:vetoQCDjets");
167 vetoWeakDeltaR2 = pow2(settings.parm(
"WeakShower:vetoWeakDeltaR"));
170 canSetScale = (userHooksPtr != 0)
171 ? userHooksPtr->canSetResonanceScale() :
false;
174 canReconResSys = (userHooksPtr != 0)
175 ? userHooksPtr->canReconnectResonanceSystems() :
false;
178 if (beamAPtr == 0 || beamBPtr == 0)
return true;
182 if ( (beamAisGamma || beamAhasGamma) && gammaMode == 0) {
183 beamAPtr->setGammaMode(1);
184 if (beamAhasGamma) beamGamAPtr->setGammaMode(1);
186 if ( (beamBisGamma || beamBhasGamma) && gammaMode == 0) {
187 beamBPtr->setGammaMode(1);
188 if (beamBhasGamma) beamGamBPtr->setGammaMode(1);
192 hasTwoLeptonBeams = beamAPtr->isLepton() && beamBPtr->isLepton();
193 hasOneLeptonBeam = (beamAPtr->isLepton() || beamBPtr->isLepton())
194 && !hasTwoLeptonBeams;
195 hasPointLeptons = (hasOneLeptonBeam || hasTwoLeptonBeams)
196 && (beamAPtr->isUnresolved() || beamBPtr->isUnresolved());
197 if ( (hasOneLeptonBeam || hasTwoLeptonBeams) && !beamHasResGamma ) {
205 if (hasTwoLeptonBeams && hasPointLeptons) {
212 if (beamHasResGamma) doMPIinit =
false;
213 if (beamHasResGamma && doND) doNDgamma =
true;
216 if (timesPtr) timesPtr->init( beamAPtr, beamBPtr);
217 if (doISR && spacePtr) spacePtr->init( beamAPtr, beamBPtr);
219 doMPIMB = multiMB.init( doMPIinit, 0, beamAPtr, beamBPtr, partonVertexPtr);
223 if (doSD || doDD || doSQ || ( doHardDiff && (hardDiffSide == 0
224 || hardDiffSide == 1) && beamBPtr->getGammaMode() < 2 ) ) {
225 BeamParticle* tmpBeamA = (beamAhasGamma) ? beamGamAPtr : beamAPtr;
226 if (infoPtr->isVMDstateA()) tmpBeamA = beamVMDAPtr;
227 doMPISDA = multiSDA.init( !onlyDirGamma, 1, tmpBeamA, beamPomBPtr,
228 partonVertexPtr, (beamAisGamma || beamAhasGamma) );
230 if (doSD || doDD || doSQ || ( doHardDiff && (hardDiffSide == 0
231 || hardDiffSide == 2) && beamAPtr->getGammaMode() < 2 ) ) {
232 BeamParticle* tmpBeamB = (beamBhasGamma) ? beamGamBPtr : beamBPtr;
233 if (infoPtr->isVMDstateB()) tmpBeamB = beamVMDBPtr;
234 doMPISDB = multiSDB.init( !onlyDirGamma, 2, beamPomAPtr, tmpBeamB,
235 partonVertexPtr, (beamBisGamma || beamBhasGamma) );
237 if (doCD || doSQ) doMPICD = multiCD.init( doMPIinit, 3, beamPomAPtr,
238 beamPomBPtr, partonVertexPtr);
239 if (!remnants.init( partonVertexPtr, colourReconnectionPtr))
return false;
240 resonanceDecays.init();
241 if (colourReconnectionPtr) colourReconnectionPtr->init();
242 junctionSplitting.init();
245 if (doHardDiff && (gammaMode !=4) ) {
246 hardDiffraction.init(beamAhasGamma ? beamGamAPtr : beamAPtr,
247 beamBhasGamma ? beamGamBPtr : beamBPtr);
251 if ( beamHasResGamma && (doMPI || doNDgamma) ) {
254 if (beamAhasGamma && !beamBhasGamma ) {
255 doMPIgmgm = multiGmGm.init( doMPIinit, 0, beamGamAPtr, beamBPtr,
256 partonVertexPtr,
true);
258 }
else if (beamBhasGamma && !beamAhasGamma ) {
259 doMPIgmgm = multiGmGm.init( doMPIinit, 0, beamAPtr, beamGamBPtr,
260 partonVertexPtr,
true);
263 doMPIgmgm = multiGmGm.init( doMPIinit, 0, beamGamAPtr, beamGamBPtr,
264 partonVertexPtr,
true);
271 if (doMPIinit && !doMPIMB)
return false;
272 if (doMPIinit && (doSD || doDD || doSQ) && (!doMPISDA || !doMPISDB))
274 if (doMPIinit && (doCD || doSQ) && !doMPICD)
return false;
275 if (!doMPIMB || !doMPISDA || !doMPISDB || !doMPICD) doMPI =
false;
284 void PartonLevel::resetTrial() {
287 partonSystemsPtr->clear();
290 beamHadAPtr->clear();
291 beamHadBPtr->clear();
292 beamPomAPtr->clear();
293 beamPomBPtr->clear();
294 beamGamAPtr->clear();
295 beamGamBPtr->clear();
296 beamVMDAPtr->clear();
297 beamVMDBPtr->clear();
309 bool PartonLevel::next(
Event& process,
Event& event) {
312 isResolved = infoPtr->isResolved();
313 isResolvedA = isResolved;
314 isResolvedB = isResolved;
315 isResolvedC = isResolved;
316 isDiffA = infoPtr->isDiffractiveA();
317 isDiffB = infoPtr->isDiffractiveB();
318 isDiffC = infoPtr->isDiffractiveC();
319 isDiff = isDiffA || isDiffB || isDiffC;
320 isCentralDiff = isDiffC;
321 isDoubleDiff = isDiffA && isDiffB;
322 isSingleDiff = isDiff && !isDoubleDiff && !isCentralDiff;
323 isNonDiff = infoPtr->isNonDiffractive();
324 isElastic = infoPtr->isElastic();
332 bool doDiffCR =
false;
334 int nHardDiffLoop = 1;
342 infoPtr->setAbortPartonLevel(
false);
345 beamAhasResGamma = beamAPtr ==
nullptr ?
false : beamAPtr->hasResGamma();
346 beamBhasResGamma = beamBPtr ==
nullptr ?
false : beamBPtr->hasResGamma();
347 beamHasResGamma = beamAhasResGamma || beamBhasResGamma;
350 hasGammaA = (beamAPtr != 0) ? beamAPtr->getGammaMode() > 0 :
false;
351 hasGammaB = (beamBPtr != 0) ? beamBPtr->getGammaMode() > 0 :
false;
354 gammaModeEvent = gammaMode;
355 if ( hasGammaA || hasGammaB ) {
356 if (beamAPtr->getGammaMode() < 2 && beamBPtr->getGammaMode() < 2)
358 if (beamAPtr->getGammaMode() < 2 && beamBPtr->getGammaMode() == 2)
360 if (beamAPtr->getGammaMode() == 2 && beamBPtr->getGammaMode() < 2)
362 if (beamAPtr->getGammaMode() == 2 && beamBPtr->getGammaMode() == 2)
367 isGammaHadronDir = !(hasGammaA || hasGammaB) ?
false :
368 ( (beamAPtr->getGammaMode() == 2) && (beamBPtr->getGammaMode() == 0) )
369 || ( (beamAPtr->getGammaMode() == 0) && (beamBPtr->getGammaMode() == 2) );
373 if ( !setupResolvedLeptonGamma( process) )
return false;
380 bool checkSideA = (hardDiffSide < 2) && (beamBPtr->isHadron() ||
381 ((beamBisGamma || beamBhasGamma) && beamBPtr->getGammaMode() == 1));
382 bool checkSideB = (hardDiffSide%2 == 0) && (beamAPtr->isHadron() ||
383 ((beamAisGamma || beamAhasGamma) && beamAPtr->getGammaMode() == 1));
392 double xGammaB = beamBhasGamma ? beamHadBPtr->xGamma() : 1.;
393 double xBrescaled = infoPtr->x2pdf() / xGammaB;
394 double pdfB = beamBhasGamma ? beamGamBPtr->xf(infoPtr->id2pdf(),
395 xBrescaled, infoPtr->Q2Fac()) : infoPtr->pdf2();
396 isHardDiffA = hardDiffraction.isDiffractive(2, infoPtr->id2pdf(),
397 xBrescaled, infoPtr->Q2Fac(), pdfB);
400 double xGammaA = beamAhasGamma ? beamHadAPtr->xGamma() : 1.;
401 double xArescaled = infoPtr->x1pdf() / xGammaA;
402 double pdfA = beamAhasGamma ? beamGamAPtr->xf(infoPtr->id1pdf(),
403 xArescaled, infoPtr->Q2Fac()) : infoPtr->pdf1();
404 isHardDiffB = hardDiffraction.isDiffractive(1, infoPtr->id1pdf(),
405 xArescaled, infoPtr->Q2Fac(), pdfA);
409 if (isHardDiffA && isHardDiffB) {
410 if (rndmPtr->flat() < 0.5) isHardDiffA =
false;
411 else isHardDiffB =
false;
413 isHardDiff = isHardDiffA || isHardDiffB;
416 double xPomA = (isHardDiffB) ? hardDiffraction.getXPomeronA() : 0.;
417 double xPomB = (isHardDiffA) ? hardDiffraction.getXPomeronB() : 0.;
418 double tPomA = (isHardDiffB) ? hardDiffraction.getTPomeronA() : 0.;
419 double tPomB = (isHardDiffA) ? hardDiffraction.getTPomeronB() : 0.;
420 infoPtr->setHardDiff(
false,
false, isHardDiffA, isHardDiffB,
421 xPomA, xPomB, tPomA, tPomB);
424 if (!isHardDiff && sampleTypeDiff > 2) {
427 if (beamHasGamma) leaveResolvedLeptonGamma( process, event,
false);
433 if (sampleTypeDiff%2 == 1) setupHardDiff( process);
435 else nHardDiffLoop = 2;
441 for (
int i = 1; i < process.size(); ++i)
442 if (process[i].status() == -21) ++n21;
443 twoHard = (n21 == 4);
449 if (!isResolved) nHardLoop = (isDiff) ? decideResolvedDiff( process) : 0;
454 if (!isResolvedA || !isResolvedB || !isResolvedC) {
455 bool physical = setupUnresolvedSys( process, event);
457 if (!physical || nHardLoop == 0) {
458 if (beamHasGamma) leaveResolvedLeptonGamma( process, event, physical);
461 sizeProcess = process.size();
462 sizeEvent =
event.size();
468 int nBranchMax = (doTrial) ? nTrialEmissions : -1;
471 bool hasMergingHooks = (mergingHooksPtr != 0);
472 if ( hasMergingHooks && canRemoveEvent )
473 mergingHooksPtr->storeWeights(infoPtr->weightContainerPtr->
474 weightsMerging.weightValues);
477 if (userHooksPtr != 0) userHooksPtr->setEnhancedEventWeight(1.);
480 for (
int iHardDiffLoop = 1; iHardDiffLoop <= nHardDiffLoop;
485 for (
int iHardLoop = 1; iHardLoop <= nHardLoop; ++iHardLoop) {
486 infoPtr->setCounter(20, iHardLoop);
487 infoPtr->setCounter(21);
491 if (isDiffA || isDiffB) iDS = (iHardLoop == 2 || !isResolvedA) ? 2 : 1;
492 if (isDiffC) iDS = 3;
495 if (iHardLoop == 2) {
496 sizeProcess = process.size();
497 sizeEvent =
event.size();
498 partonSystemsPtr->clear();
499 if (event.lastColTag() > process.lastColTag())
500 process.initColTag(event.lastColTag());
506 event.saveJunctionSize();
509 setupResolvedDiff( process);
513 if (doMPIinit || doDiffraction) multiPtr->reset();
516 if (isNonDiff || isDiff) {
518 multiPtr->setupFirstSys( process);
523 bool physical =
true;
525 for (
int iTry = 0; iTry < NTRY; ++ iTry) {
526 infoPtr->addCounter(21);
527 for (
int i = 22; i < 32; ++i) infoPtr->setCounter(i);
531 nMPI = (twoHard) ? 2 : 1;
542 infoPtr->setPartEvolved(nMPI, nISR);
546 if (beamAPtr->isGamma() && ( doMPI || doISR ) ) beamAPtr->resetGamma();
547 if (beamBPtr->isGamma() && ( doMPI || doISR ) ) beamBPtr->resetGamma();
550 setupHardSys( process, event);
553 if (canVetoMPIStep) {
554 doVeto = userHooksPtr->doVetoMPIStep( 1, event);
557 if (isDiff) leaveResolvedDiff( iHardLoop, process, event);
558 if (beamHasResGamma) leaveResolvedLeptonGamma( process, event,
false);
564 double Q2Fac = infoPtr->Q2Fac();
565 double Q2Ren = infoPtr->Q2Ren();
566 bool limitPTmaxISR = (doISR)
567 ? spacePtr->limitPTmax( event, Q2Fac, Q2Ren) :
false;
568 bool limitPTmaxFSR = (doFSRduringProcess)
569 ? timesPtr->limitPTmax( event, Q2Fac, Q2Ren) :
false;
570 bool limitPTmaxMPI = (doMPI) ? multiPtr->limitPTmax( event) :
false;
573 timesPtr->prepareGlobal( event);
574 bool isFirstTrial =
true;
577 double pTscaleRad = process.scale();
578 double pTscaleMPI = (doMPI && pTmaxMatchMPI == 3)
579 ? multiPtr->scaleLimitPT() : pTscaleRad;
581 pTscaleRad = max( pTscaleRad, process.scaleSecond() );
582 pTscaleMPI = min( pTscaleMPI, process.scaleSecond() );
584 double pTmaxMPI = (limitPTmaxMPI) ? pTscaleMPI : infoPtr->eCM();
585 double pTmaxISR = (limitPTmaxISR) ? spacePtr->enhancePTmax() * pTscaleRad
587 double pTmaxFSR = (limitPTmaxFSR) ? timesPtr->enhancePTmax() * pTscaleRad
592 beamAPtr->pTMPI( process.scale() );
593 beamBPtr->pTMPI( process.scale() );
596 if ( hasMergingHooks && (doTrial || canRemoveEvent || canRemoveEmission) )
597 mergingHooksPtr->setShowerStartingScales( doTrial,
598 (canRemoveEvent || canRemoveEmission), pTscaleRad, process, pTmaxFSR,
599 limitPTmaxFSR, pTmaxISR, limitPTmaxISR, pTmaxMPI, limitPTmaxMPI );
600 double pTmax = max( pTmaxMPI, max( pTmaxISR, pTmaxFSR) );
601 pTsaveMPI = pTmaxMPI;
602 pTsaveISR = pTmaxISR;
603 pTsaveFSR = pTmaxFSR;
606 if (doMPI) multiPtr->prepare( event, pTmaxMPI, (iHardDiffLoop == 2) );
607 if (doISR) spacePtr->prepare( 0, event, limitPTmaxISR);
608 if (doFSRduringProcess) timesPtr->prepare( 0, event, limitPTmaxFSR);
609 if (twoHard && doISR) spacePtr->prepare( 1, event, limitPTmaxISR);
610 if (twoHard && doFSRduringProcess) timesPtr->prepare( 1, event,
615 if (!isDiff) infoPtr->setImpact( multiPtr->bMPI(),
616 multiPtr->enhanceMPI(), multiPtr->enhanceMPIavg(),
true,
617 (iHardDiffLoop == 2) );
621 double pTveto = pTvetoPT;
626 infoPtr->addCounter(22);
628 nRad = nISR + nFSRinProc;
631 bool unresolvedGammaA = (beamAPtr->isGamma()
632 && !(beamAPtr->resolvedGamma()) );
633 bool unresolvedGammaB = (beamBPtr->isGamma()
634 && !(beamBPtr->resolvedGamma()) );
635 bool unresolvedGamma = (unresolvedGammaA || unresolvedGammaB)
636 || gammaModeEvent == 4;
644 if ( hasMergingHooks && doTrial)
645 pTgen = max( pTgen, mergingHooksPtr->getShowerStoppingScale() );
647 double pTtimes = (doFSRduringProcess)
648 ? timesPtr->pTnext( event, pTmaxFSR, pTgen, isFirstTrial, doTrial)
650 pTgen = max( pTgen, pTtimes);
652 double pTmulti = (doMPI && !unresolvedGamma)
653 ? multiPtr->pTnext( pTmaxMPI, pTgen, event) : -1.;
654 pTgen = max( pTgen, pTmulti);
655 double pTspace = (doISR)
656 ? spacePtr->pTnext( event, pTmaxISR, pTgen, nRad, doTrial) : -1.;
657 double pTnow = max( pTtimes, max( pTmulti, pTspace));
660 infoPtr->setPTnow( pTnow);
661 isFirstTrial =
false;
664 if (pTveto > 0. && pTveto > pTnow) {
666 doVeto = userHooksPtr->doVetoPT( typeLatest, event);
669 if (isDiff) leaveResolvedDiff( iHardLoop, process, event);
671 leaveResolvedLeptonGamma( process, event,
false);
677 if (pTmulti > 0. && pTmulti > pTspace && pTmulti > pTtimes) {
678 infoPtr->addCounter(23);
679 if (multiPtr->scatter( event)) {
682 if (canVetoMPIStep && nMPI <= nVetoMPIStep) typeVetoStep = 1;
685 if (isHardDiff && sampleTypeDiff == 4 && iHardDiffLoop == 1) {
686 infoPtr->setHardDiff(
false,
false,
false,
false, 0., 0.,
691 leaveResolvedLeptonGamma( process, event,
false);
696 if (doISR) spacePtr->prepare( nMPI - 1, event);
697 if (doFSRduringProcess) timesPtr->prepare( nMPI - 1, event);
699 pTLastBranch = pTmulti;
705 pTmaxISR = min(pTmulti, pTmaxISR);
706 pTmaxFSR = min(pTmulti, pTmaxFSR);
711 else if (pTspace > 0. && pTspace > pTtimes) {
712 infoPtr->addCounter(24);
715 if (spacePtr->branch( event)
716 && ( !(nMPI > 1 && spacePtr->wasGamma2qqbar()) ) ) {
718 iSysNow = spacePtr->system();
720 if (iSysNow == 0) ++nISRhard;
721 if (canVetoStep && iSysNow == 0 && nISRhard <= nVetoStep)
725 if (doFSRduringProcess) timesPtr->update( iSysNow, event,
726 spacePtr->getHasWeaklyRadiated());
728 pTLastBranch = pTspace;
733 }
else if (spacePtr->doRestart()) {
739 pTmaxMPI = min( min(pTspace,pTmaxISR), pTmaxMPI);
740 pTmaxISR = min(pTspace,pTmaxISR);
741 pTmaxFSR = min( min(pTspace,pTmaxISR), pTmaxFSR);
746 else if (pTtimes > 0.) {
747 infoPtr->addCounter(25);
748 if (timesPtr->branch( event,
true)) {
750 iSysNow = timesPtr->system();
752 if (iSysNow == 0) ++nFSRhard;
753 if (canVetoStep && iSysNow == 0 && nFSRhard <= nVetoStep)
757 if (doISR) spacePtr->update( iSysNow, event,
758 timesPtr->getHasWeaklyRadiated());
760 pTLastBranch = pTtimes;
766 pTmaxMPI = min( min(pTtimes,pTmaxFSR), pTmaxMPI);
767 pTmaxISR = min( min(pTtimes,pTmaxFSR), pTmaxISR);
768 pTmaxFSR = min(pTtimes, pTmaxFSR);
777 if ( (infoPtr->code() == 221 || infoPtr->code() == 222) &&
778 nISRhard + nFSRhard == 2 && vetoWeakJets) {
779 int id1 =
event[partonSystemsPtr->getOut(0,0)].id();
780 int id2 =
event[partonSystemsPtr->getOut(0,1)].id();
781 int id3 =
event[partonSystemsPtr->getOut(0,2)].id();
782 Vec4 p1 =
event[partonSystemsPtr->getOut(0,0)].p();
783 Vec4 p2 =
event[partonSystemsPtr->getOut(0,1)].p();
784 Vec4 p3 =
event[partonSystemsPtr->getOut(0,2)].p();
788 bool doubleCountEvent =
true;
789 if (abs(id1) == 24 || abs(id1) == 23) {
790 if (abs(id2) > 21 || abs(id3) > 21)
791 doubleCountEvent =
false;
792 }
else if (abs(id2) == 24 || abs(id2) == 23) {
796 doubleCountEvent =
false;
797 }
else if ( abs(id3) == 24 || abs(id3) == 23) {
802 if (doubleCountEvent) {
805 if (p2.pT2() < d) {d = p2.pT2(); cut =
false;}
806 if (p3.pT2() < d) {d = p3.pT2(); cut =
false;}
811 double dij = min(p1.pT2(),p2.pT2())
812 * pow2(RRapPhi(p1,p2)) / vetoWeakDeltaR2;
820 double dij = min(p1.pT2(),p3.pT2())
821 * pow2(RRapPhi(p1,p3)) / vetoWeakDeltaR2;
831 if (abs(id2) == 21 || abs(id3) == 21 || id2 == - id3) {
832 double dij = min(p2.pT2(),p3.pT2())
833 * pow2(RRapPhi(p2,p3)) / vetoWeakDeltaR2;
841 if (cut)
return false;
847 if (typeVetoStep == 1) {
848 doVeto = userHooksPtr->doVetoMPIStep( nMPI, event);
849 }
else if (typeVetoStep > 1) {
850 doVeto = userHooksPtr->doVetoStep( typeVetoStep, nISRhard,
856 if (isDiff) leaveResolvedDiff( iHardLoop, process, event);
857 if (beamHasResGamma) leaveResolvedLeptonGamma( process, event);
862 if (typeLatest > 0 && typeLatest < 4)
863 infoPtr->addCounter(25 + typeLatest);
864 if (!isDiff) infoPtr->setPartEvolved( nMPI, nISR);
867 if ( canRemoveEvent && nISRhard + nFSRhard == 1 ) {
869 mergingHooksPtr->doVetoStep( process, event );
873 }
while (pTmax > 0. && (nBranchMax <= 0 || nBranch < nBranchMax) );
876 if (doFSRafterProcess && (nBranchMax <= 0 || nBranch < nBranchMax) ) {
880 for (
int i = 0; i <
event.size(); ++i)
881 if (event[i].isFinal() &&
event[i].scale() > pTmax)
882 pTmax = event[i].scale();
886 for (
int iSys = 0; iSys < partonSystemsPtr->sizeSys(); ++iSys)
887 timesPtr->prepare( iSys, event);
895 infoPtr->addCounter(29);
897 double pTtimes = timesPtr->pTnext( event, pTmax, 0.);
898 infoPtr->setPTnow( pTtimes);
901 if (pTveto > 0. && pTveto > pTtimes) {
903 doVeto = userHooksPtr->doVetoPT( 4, event);
906 if (isDiff) leaveResolvedDiff( iHardLoop, process, event);
907 if (beamHasResGamma) leaveResolvedLeptonGamma( process, event);
914 infoPtr->addCounter(30);
915 if (timesPtr->branch( event,
true)) {
916 iSysNow = timesPtr->system();
918 if (iSysNow == 0) ++nFSRhard;
919 if (canVetoStep && iSysNow == 0 && nFSRhard <= nVetoStep)
923 pTLastBranch = pTtimes;
934 if (typeVetoStep > 0) {
935 doVeto = userHooksPtr->doVetoStep( typeVetoStep, nISRhard,
939 if (isDiff) leaveResolvedDiff( iHardLoop, process, event);
940 if (beamHasResGamma) leaveResolvedLeptonGamma( process, event);
946 if ( canRemoveEvent && nISRhard + nFSRhard == 1 ) {
948 mergingHooksPtr->doVetoStep( process, event );
952 infoPtr->addCounter(31);
954 }
while (pTmax > 0. && (nBranchMax <= 0 || nBranch < nBranchMax) );
959 if (canVetoEarly && userHooksPtr->doVetoPartonLevelEarly( event)) {
961 if (isDiff) leaveResolvedDiff( iHardLoop, process, event);
962 if (beamHasResGamma) leaveResolvedLeptonGamma( process, event);
968 int oldSizeEvt =
event.size();
969 int oldSizeSys = partonSystemsPtr->sizeSys();
970 if (nBranchMax <= 0 || nBranch < nBranchMax)
971 doVeto = !resonanceShowers( process, event,
true);
973 if (doVeto)
return false;
977 for (
int iSys = oldSizeSys; iSys < partonSystemsPtr->sizeSys(); ++iSys)
978 for (
int iOut = 0; iOut < partonSystemsPtr->sizeOut(iSys); ++iOut)
979 partonSystemsPtr->addOut(0, partonSystemsPtr->getOut( iSys, iOut) );
980 partonSystemsPtr->setSizeSys( oldSizeSys);
984 if (!wzDecayShowers( event))
return false;
987 if (canReconResSys && !userHooksPtr->doReconnectResonanceSystems(
988 oldSizeEvt, event))
return false;
995 iFirst = (iHardLoop == 1) ? 5 + sizeEvent - sizeProcess : sizeEvent;
996 if (isDiffC) iFirst = 6 + sizeEvent - sizeProcess;
1000 if (infoPtr->hasPomPsystem()) {
1006 if (!doTrial && physical && doRemnants
1007 && (!beamHasGamma || gammaModeEvent != 4)
1008 && !remnants.add( event, iFirst, doDiffCR)) physical =
false;
1011 if (physical)
break;
1014 if (!isDiff)
event.clear();
1016 event.restoreSize();
1017 event.restoreJunctionSize();
1021 partonSystemsPtr->clear();
1024 if (beamAhasResGamma) beamHadAPtr->clear();
1025 if (beamBhasResGamma) beamHadBPtr->clear();
1026 if (infoPtr->isVMDstateA()) beamVMDAPtr->clear();
1027 if (infoPtr->isVMDstateB()) beamVMDBPtr->clear();
1031 if (isDiff) leaveResolvedDiff( iHardLoop, process, event);
1035 if (infoPtr->hasPomPsystem()) leaveHardDiff( process, event,
false);
1037 if (beamHasGamma) leaveResolvedLeptonGamma( process, event,
false);
1046 if (isHardDiff && sampleTypeDiff%2 == 0 && iHardDiffLoop == 1 && nMPI == 1) {
1050 partonSystemsPtr->clear();
1051 setupHardDiff( process);
1056 if ( colourReconnectionPtr && !doDiffCR && reconnectMode > 0) {
1057 Event eventSave = event;
1058 bool colCorrect =
false;
1059 for (
int i = 0; i < 10; ++i) {
1060 colourReconnectionPtr->next(event, 0);
1061 if (junctionSplitting.checkColours(event)) {
1065 else event = eventSave;
1068 infoPtr->errorMsg(
"Error in PartonLevel::next: "
1069 "Colour reconnection failed.");
1075 int oldSizeEvt =
event.size();
1077 if (nBranchMax <= 0 || nBranch < nBranchMax)
1078 doVeto = !resonanceShowers( process, event,
true);
1080 if (doVeto)
return false;
1084 if (!wzDecayShowers( event))
return false;
1087 if (canReconResSys && !userHooksPtr->doReconnectResonanceSystems(
1088 oldSizeEvt, event))
return false;
1092 if (!isDiff) infoPtr->setEvolution( pTsaveMPI, pTsaveISR, pTsaveFSR,
1093 nMPI, nISR, nFSRinProc, nFSRinRes);
1095 multiPtr->setEmpty();
1096 infoPtr->setImpact( multiPtr->bMPI(), multiPtr->enhanceMPI(),
1097 multiPtr->enhanceMPIavg(),
false);
1101 if (!earlyResDec && forceResonanceCR && colourReconnectionPtr &&
1102 !doDiffCR && reconnectMode != 0) {
1103 Event eventSave = event;
1104 bool colCorrect =
false;
1105 for (
int i = 0; i < 10; ++i) {
1106 colourReconnectionPtr->next(event, oldSizeEvt);
1107 if (junctionSplitting.checkColours(event)) {
1111 else event = eventSave;
1114 infoPtr->errorMsg(
"Error in PartonLevel::next: "
1115 "Colour reconnection failed.");
1125 if (sampleTypeDiff == 2 && iHardDiffLoop == 1 && nMPI > 1) {
1126 infoPtr->setHardDiff(
false,
false,
false,
false, 0., 0., 0., 0.);
1131 if (infoPtr->hasPomPsystem()) leaveHardDiff( process, event);
1139 if ( ( beamAPtr->isGamma() || beamBPtr->isGamma() )
1140 && ( !beamAPtr->resolvedGamma() || !beamBPtr->resolvedGamma() ) ) {
1141 if (!showUnresGamma && (gammaModeEvent != 4) ) cleanEventFromGamma( event);
1145 if (beamHasGamma) leaveResolvedLeptonGamma( process, event,
true);
1149 timesPtr->showerQEDafterRemnants(event);
1160 int PartonLevel::decideResolvedDiff(
Event& process) {
1164 int iDSmin = (isDiffC) ? 3 : 1;
1165 int iDSmax = (isDiffC) ? 3 : 2;
1166 for (
int iDSnow = iDSmin; iDSnow <= iDSmax; ++iDSnow) {
1169 int iDiffMot = iDSnow + 2 + gammaOffset;
1172 double mDiff = process[iDiffMot].m();
1173 bool isHighMass = ( mDiff > mMinDiff && rndmPtr->flat()
1174 < pMaxDiff * ( 1. - exp( -(mDiff - mMinDiff) / mWidthDiff ) ) );
1177 if (isHighMass) ++nHighMass;
1178 if (iDSnow == 1) isResolvedA = isHighMass;
1179 if (iDSnow == 2) isResolvedB = isHighMass;
1180 if (iDSnow == 3) isResolvedC = isHighMass;
1190 bool PartonLevel::setupUnresolvedSys(
Event& process,
Event& event) {
1196 for (
int i = 0; i < process.size(); ++ i) event.append( process[i]);
1199 for (iDS = 1; iDS < 4; ++iDS)
1200 if ( (iDS == 1 && isDiffA && !isResolvedA)
1201 || (iDS == 2 && isDiffB && !isResolvedB)
1202 || (iDS == 3 && isDiffC && !isResolvedC) ) {
1203 int iBeam = iDS + 2 + gammaOffset;
1208 double mDiff = process[iBeam].m();
1209 double m2Diff = mDiff * mDiff;
1210 Vec4 pDiffA = (iDS == 1) ? process[1 + gammaOffset].p()
1211 : process[1 + gammaOffset].p() - process[3 + gammaOffset].p();
1212 Vec4 pDiffB = (iDS == 2) ? process[2 + gammaOffset].p()
1213 : process[2 + gammaOffset].p() - process[4 + gammaOffset].p();
1215 MtoCM.fromCMframe( pDiffA, pDiffB);
1219 bool beamSideA = (iDS == 1 || (iDS == 3 && rndmPtr->flat() < 0.5));
1220 BeamParticle* beamPtr = (beamSideA) ? beamAPtr : beamBPtr;
1221 if (iDS == 3) beamPtr = (beamSideA) ? beamPomAPtr : beamPomBPtr;
1224 beamPtr->newValenceContent();
1225 bool gluonIsKicked = beamPtr->pickGluon(mDiff);
1226 int id1 = beamPtr->pickValence();
1227 int id2 = beamPtr->pickRemnant();
1230 double m1 = particleDataPtr->constituentMass(id1);
1231 double m2 = particleDataPtr->constituentMass(id2);
1232 if (m1 + m2 > 0.5 * mDiff) {
1233 double reduce = 0.5 * mDiff / (m1 + m2);
1239 if (!gluonIsKicked) {
1240 double pAbs = sqrt( pow2(m2Diff - m1*m1 - m2*m2)
1241 - pow2(2. * m1 * m2) ) / (2. * mDiff);
1242 if (!beamSideA) pAbs = -pAbs;
1243 double e1 = (m2Diff + m1*m1 - m2*m2) / (2. * mDiff);
1244 double e2 = (m2Diff + m2*m2 - m1*m1) / (2. * mDiff);
1245 Vec4 p1( 0., 0., -pAbs, e1);
1246 Vec4 p2( 0., 0., pAbs, e2);
1253 int col1, acol1, col2, acol2;
1254 if (particleDataPtr->colType(id1) == 1) {
1255 col1 =
event.nextColTag();
1261 acol1 =
event.nextColTag();
1266 process.nextColTag();
1269 int iDauBeg =
event.append( id1, 24, iBeam, 0, 0, 0, col1, acol1,
1271 int iDauEnd =
event.append( id2, 63, iBeam, 0, 0, 0, col2, acol2,
1273 event[iBeam].statusNeg();
1274 event[iBeam].daughters(iDauBeg, iDauEnd);
1278 double m2Sys, zSys, pxSys, pySys, mTS1, mTS2;
1279 zSys = beamPtr->zShare(mDiff, m1, m2);
1282 pxSys = beamPtr->pxShare();
1283 pySys = beamPtr->pyShare();
1284 mTS1 = m1*m1 + pxSys*pxSys + pySys*pySys;
1285 mTS2 = m2*m2 + pxSys*pxSys + pySys*pySys;
1286 m2Sys = mTS1 / zSys + mTS2 / (1. - zSys);
1289 double pAbs = (m2Diff - m2Sys) / (2. * mDiff);
1290 double pLRem = (beamSideA) ? pAbs : -pAbs;
1291 Vec4 pG( 0., 0., -pLRem, pAbs);
1292 Vec4 pRem(0., 0., pLRem, mDiff - pAbs);
1295 double e1 = 0.5 * (zSys * mDiff + mTS1 / (zSys * mDiff));
1296 double pL1 = 0.5 * (zSys * mDiff - mTS1 / (zSys * mDiff));
1297 if (!beamSideA) pL1 = -pL1;
1298 Vec4 p1(pxSys, pySys, pL1, e1);
1299 Vec4 p2 = pRem - p1;
1308 int colG, acolG, col1, acol1, col2, acol2;
1309 if (particleDataPtr->colType(id1) == 1) {
1310 col1 =
event.nextColTag();
1312 colG =
event.nextColTag();
1318 acol1 =
event.nextColTag();
1320 acolG =
event.nextColTag();
1325 process.nextColTag();
1326 process.nextColTag();
1329 int iDauBeg =
event.append( 21, 24, iBeam, 0, 0, 0, colG, acolG, pG, 0.);
1330 event.append( id1, 63, iBeam, 0, 0, 0, col1, acol1, p1, m1);
1331 int iDauEnd =
event.append( id2, 63, iBeam, 0, 0, 0, col2, acol2,
1333 event[iBeam].statusNeg();
1334 event[iBeam].daughters(iDauBeg, iDauEnd);
1347 void PartonLevel::setupHardSys(
Event& process,
Event& event) {
1355 int iDiffMot = iDS + 2;
1356 int iDiffDau = process.size() - 1;
1357 int nOffset = sizeEvent - sizeProcess;
1360 if (infoPtr->hasPomPsystem()) {
1361 iDiffMot = (isHardDiffB) ? 4 : 3;
1369 int nGammaOffset = 0;
1370 int nGammaDiffOffset = 0;
1371 if ( beamHasResGamma || (beamHasGamma && isGammaHadronDir) ) {
1374 inP += nGammaOffset;
1375 inM += nGammaOffset;
1377 iDiffMot += nGammaOffset;
1378 inS += nGammaOffset;
1380 if ( (isHardDiffA || isHardDiffB) && hardDiffSet ) nGammaDiffOffset = 4;
1390 event[inS].statusNeg();
1391 event[inS].daughters( inP - 2 + nOffset, inM - 2 + nOffset);
1395 int iBeginSecond = process.size();
1398 while (process[iBeginSecond].status() != -21) ++iBeginSecond;
1402 if (process[inP].m() != 0. || process[inM].m() != 0.) {
1403 double pPos = process[inP].pPos() + process[inM].pPos();
1404 double pNeg = process[inP].pNeg() + process[inM].pNeg();
1405 process[inP].pz( 0.5 * pPos);
1406 process[inP].e( 0.5 * pPos);
1407 process[inP].m( 0.);
1408 process[inM].pz(-0.5 * pNeg);
1409 process[inM].e( 0.5 * pNeg);
1410 process[inM].m( 0.);
1417 if ( (beamHasResGamma || (beamHasGamma && isGammaHadronDir) )
1420 beamHadAPtr->append( 3, process[3].
id(), beamHadAPtr->xGamma() );
1422 beamHadBPtr->append( 4, process[4].
id(), beamHadBPtr->xGamma() );
1423 x1 = process[inP].pPos() / ( process[3 + nGammaDiffOffset].p()
1424 + process[4 + nGammaDiffOffset].p() ).mCalc();
1425 x2 = process[inM].pNeg() / ( process[3 + nGammaDiffOffset].p()
1426 + process[4 + nGammaDiffOffset].p() ).mCalc();
1428 x1 = process[inP].pPos() / process[inS].m();
1429 x2 = process[inM].pNeg() / process[inS].m();
1431 beamAPtr->append( inP + nOffset, process[inP].
id(), x1);
1432 beamBPtr->append( inM + nOffset, process[inM].
id(), x2);
1438 double scale = process.scale();
1440 beamAPtr->xfISR( 0, process[inP].
id(), x1, scale*scale);
1441 if (isNonDiff && (vsc1 = multiPtr->getVSC1()) != 0)
1442 (*beamAPtr)[0].companion(vsc1);
1443 else if (beamAPtr->isGamma()) vsc1 = beamAPtr->gammaValSeaComp(0);
1444 else vsc1 = beamAPtr->pickValSeaComp();
1445 beamBPtr->xfISR( 0, process[inM].
id(), x2, scale*scale);
1446 if (isNonDiff && (vsc2 = multiPtr->getVSC2()) != 0)
1447 (*beamBPtr)[0].companion(vsc2);
1448 else if (beamBPtr->isGamma()) vsc2 = beamBPtr->gammaValSeaComp(0);
1449 else vsc2 = beamBPtr->pickValSeaComp();
1450 bool isVal1 = (vsc1 == -3);
1451 bool isVal2 = (vsc2 == -3);
1452 infoPtr->setValence( isVal1, isVal2);
1455 nHardDone = sizeProcess;
1456 iPosBefShow.resize( process.size() );
1457 fill( iPosBefShow.begin(), iPosBefShow.end(), 0);
1460 for (
int i = sizeProcess; i < iBeginSecond; ++i) {
1461 if (process[i].mother1() > inM)
break;
1462 int j =
event.append(process[i]);
1467 int iOrd = i - iBeginSecond + 7;
1468 if (iOrd == 1 || iOrd == 2)
1469 event[j].offsetHistory( 0, 0, 0, nOffset);
1470 else if (iOrd == 3 || iOrd == 4)
1471 event[j].offsetHistory( 0, nOffset, 0, nOffset);
1472 else if (iOrd == 5 || iOrd == 6)
1473 event[j].offsetHistory( 0, nOffset, 0, 0);
1477 if (event[j].status() == -22) {
1478 event[j].statusPos();
1479 event[j].daughters(0, 0);
1487 partonSystemsPtr->addSys();
1488 partonSystemsPtr->setInA(0, inP + nOffset);
1489 partonSystemsPtr->setInB(0, inM + nOffset);
1490 for (
int i = inM + 1; i < nHardDone; ++i)
1491 partonSystemsPtr->addOut(0, i + nOffset);
1492 partonSystemsPtr->setSHat( 0,
1493 (event[inP + nOffset].p() + event[inM + nOffset].p()).m2Calc() );
1494 partonSystemsPtr->setPTHat( 0, scale);
1499 int inP2 = iBeginSecond;
1500 int inM2 = iBeginSecond + 1;
1504 x1 = process[inP2].pPos() / process[0].e();
1505 beamAPtr->append( inP2, process[inP2].
id(), x1);
1506 x2 = process[inM2].pNeg() / process[0].e();
1507 beamBPtr->append( inM2, process[inM2].
id(), x2);
1510 scale = process.scaleSecond();
1511 beamAPtr->xfISR( 1, process[inP2].
id(), x1, scale*scale);
1512 beamAPtr->pickValSeaComp();
1513 beamBPtr->xfISR( 1, process[inM2].
id(), x2, scale*scale);
1514 beamBPtr->pickValSeaComp();
1517 for (
int i = inP2; i < process.size(); ++ i) {
1518 int mother = process[i].mother1();
1519 if ( (mother > 2 && mother < inP2) || mother > inM2 )
break;
1520 event.append(process[i]);
1524 if (event[i].status() == -22) {
1525 event[i].statusPos();
1526 event[i].daughters(0, 0);
1534 partonSystemsPtr->addSys();
1535 partonSystemsPtr->setInA(1, inP2);
1536 partonSystemsPtr->setInB(1, inM2);
1537 for (
int i = inM2 + 1; i < nHardDone; ++i)
1538 partonSystemsPtr->addOut(1, i);
1539 partonSystemsPtr->setSHat( 1,
1540 (event[inP2].p() + event[inM2].p()).m2Calc() );
1541 partonSystemsPtr->setPTHat( 1, scale);
1548 for (
int i = 0; i < process.size(); ++ i) {
1549 if (process[i].col() > maxColTag) maxColTag = process[i].col();
1550 if (process[i].acol() > maxColTag) maxColTag = process[i].acol();
1552 event.initColTag(maxColTag);
1555 for (
int iJun = 0; iJun < process.sizeJunction(); ++iJun) {
1558 int kindJunction = process.kindJunction(iJun);
1561 if (kindJunction <= 4) {
1562 int iLegF1 = (kindJunction - 1) / 2;
1563 for (
int iLeg = iLegF1; iLeg <= 2; ++iLeg) {
1564 bool colFound =
false;
1565 for (
int i = inM + 1; i <
event.size(); ++i) {
1566 int col = (kindJunction % 2 == 1) ? event[i].col() :
event[i].acol();
1567 if (col == process.colJunction(iJun,iLeg)) colFound =
true;
1569 if (!colFound) doCopy =
false;
1573 event.appendJunction( process.getJunction(iJun));
1584 void PartonLevel::setupShowerSys(
Event& process,
Event& event) {
1588 event.append( process[0]);
1592 iPosBefShow.resize( process.size());
1593 fill( iPosBefShow.begin(), iPosBefShow.end(), 0);
1596 for (
int i = 1; i < process.size(); ++i) {
1597 if (process[i].mother1() > 0)
break;
1598 int j =
event.append(process[i]);
1602 if (event[j].status() == -22) {
1603 event[j].statusPos();
1604 event[j].daughters(0, 0);
1612 partonSystemsPtr->clear();
1613 partonSystemsPtr->addSys();
1614 for (
int i = 1; i < nHardDone; ++i) partonSystemsPtr->addOut(0, i);
1615 partonSystemsPtr->setSHat( 0, pow2(process[0].m()) );
1616 partonSystemsPtr->setPTHat( 0, 0.5 * process[0].m() );
1619 for (
int iJun = 0; iJun < process.sizeJunction(); ++iJun) {
1622 int kindJunction = process.kindJunction(iJun);
1625 if (kindJunction <= 4) {
1626 int iLegF1 = (kindJunction - 1) / 2;
1627 for (
int iLeg = iLegF1; iLeg <= 2; ++iLeg) {
1628 bool colFound =
false;
1629 for (
int i = 1; i <
event.size(); ++i) {
1630 int col = (kindJunction % 2 == 1) ? event[i].col() :
event[i].acol();
1631 if (col == process.colJunction(iJun,iLeg)) colFound =
true;
1633 if (!colFound) doCopy =
false;
1637 event.appendJunction( process.getJunction(iJun));
1648 void PartonLevel::setupResolvedDiff(
Event& process) {
1651 int iDiffMot = iDS + 2 + gammaOffset;
1652 int iDiffDau = process.size() - 1;
1656 process[iDiffMot].statusNeg();
1657 process[iDiffMot].daughters( iDiffDau + 1, iDiffDau + 2);
1660 double mDiff = process[iDiffMot].m();
1661 double m2Diff = mDiff * mDiff;
1665 int idDiffA = (iDS == 1) ? process[1 + gammaOffset].
id() : 990;
1666 int idDiffB = (iDS == 2) ? process[2 + gammaOffset].
id() : 990;
1667 double mDiffA = (iDS == 1) ? process[1 + gammaOffset].m() : 0.;
1668 double mDiffB = (iDS == 2) ? process[2 + gammaOffset].m() : 0.;
1669 if (idDiffA == 22 && infoPtr->isVMDstateA()) {
1670 idDiffA = (iDS == 1) ? infoPtr->idVMDA() : 990;
1671 mDiffA = (iDS == 1) ? infoPtr->mVMDA() : 0.;
1673 if (idDiffB == 22 && infoPtr->isVMDstateB()) {
1674 idDiffB = (iDS == 2) ? infoPtr->idVMDB() : 990;
1675 mDiffB = (iDS == 2) ? infoPtr->mVMDB() : 0.;
1677 double m2DiffA = mDiffA * mDiffA;
1678 double m2DiffB = mDiffB * mDiffB;
1679 double eDiffA = 0.5 * (m2Diff + m2DiffA - m2DiffB) / mDiff;
1680 double eDiffB = 0.5 * (m2Diff + m2DiffB - m2DiffA) / mDiff;
1681 double pzDiff = 0.5 * sqrtpos( pow2(m2Diff - m2DiffA - m2DiffB)
1682 - 4. * m2DiffA * m2DiffB ) / mDiff;
1683 process.append( idDiffA, 13, iDiffMot, 0, 0, 0, 0, 0,
1684 0., 0., pzDiff, eDiffA, mDiffA);
1685 process.append( idDiffB, 13, iDiffMot, 0, 0, 0, 0, 0,
1686 0., 0., -pzDiff, eDiffB, mDiffB);
1690 beamAPtr = (iDS == 1) ? beamHadAPtr : beamPomAPtr;
1691 beamBPtr = (iDS == 2) ? beamHadBPtr : beamPomBPtr;
1692 if (infoPtr->isVMDstateA())
1693 beamAPtr = (iDS == 1) ? beamVMDAPtr : beamPomAPtr;
1694 if (infoPtr->isVMDstateB())
1695 beamBPtr = (iDS == 2) ? beamVMDBPtr : beamPomBPtr;
1698 eCMsave = infoPtr->eCM();
1699 infoPtr->setECM( mDiff);
1700 beamAPtr->newPzE( pzDiff, eDiffA);
1701 beamBPtr->newPzE( -pzDiff, eDiffB);
1704 if ( beamAPtr->id() == 990 )
1705 beamAPtr->xPom(pow2(mDiff/eCMsave));
1706 if ( beamBPtr->id() == 990 )
1707 beamBPtr->xPom(pow2(mDiff/eCMsave));
1710 int beamOffset = (sizeEvent > 0) ? sizeEvent - 1 : 4;
1713 timesPtr->reassignBeamPtrs( beamAPtr, beamBPtr, beamOffset);
1714 timesDecPtr->reassignBeamPtrs( beamAPtr, beamBPtr, beamOffset);
1715 spacePtr->reassignBeamPtrs( beamAPtr, beamBPtr, beamOffset);
1716 remnants.reassignBeamPtrs( beamAPtr, beamBPtr, iDS);
1717 if (colourReconnectionPtr)
1718 colourReconnectionPtr->reassignBeamPtrs( beamAPtr, beamBPtr);
1721 if (iDS == 1) multiPtr = &multiSDA;
1722 else if (iDS == 2) multiPtr = &multiSDB;
1723 else multiPtr = &multiCD;
1731 void PartonLevel::leaveResolvedDiff(
int iHardLoop,
Event& process,
1736 Vec4 pDiffA = (iDS == 1) ? process[1 + gammaOffset].p()
1737 : process[1 + gammaOffset].p() - process[3 + gammaOffset].p();
1738 Vec4 pDiffB = (iDS == 2) ? process[2 + gammaOffset].p()
1739 : process[2 + gammaOffset].p() - process[4 + gammaOffset].p();
1741 MtoCM.fromCMframe( pDiffA, pDiffB);
1744 for (
int i = sizeProcess; i < process.size(); ++i)
1745 process[i].rotbst( MtoCM);
1746 int iFirst = (iHardLoop == 1) ? 5 + sizeEvent - sizeProcess + gammaOffset
1748 if (isDiffC) iFirst = 6 + sizeEvent - sizeProcess;
1749 for (
int i = iFirst; i <
event.size(); ++i)
1750 event[i].rotbst( MtoCM);
1753 infoPtr->setECM( eCMsave);
1754 beamAPtr->newPzE( event[1].pz(), event[1].e());
1755 beamBPtr->newPzE( event[2].pz(), event[2].e());
1761 beamAPtr = beamHadAPtr;
1762 beamBPtr = beamHadBPtr;
1765 timesPtr->reassignBeamPtrs( beamAPtr, beamBPtr, 0);
1766 timesDecPtr->reassignBeamPtrs( beamAPtr, beamBPtr, 0);
1767 spacePtr->reassignBeamPtrs( beamAPtr, beamBPtr, 0);
1768 remnants.reassignBeamPtrs( beamAPtr, beamBPtr, 0);
1769 if (colourReconnectionPtr)
1770 colourReconnectionPtr->reassignBeamPtrs( beamAPtr, beamBPtr);
1773 multiPtr = &multiMB;
1781 void PartonLevel::setupHardDiff(
Event& process) {
1784 Event tmpProcess = process;
1786 process.scale(tmpProcess.scale());
1789 for (
int iEntry = 0; iEntry < 3; ++iEntry)
1790 process.append( tmpProcess[iEntry]);
1793 double eCM = infoPtr->eCM();
1794 double sNow = eCM * eCM;
1795 double xPom = (isHardDiffB) ? infoPtr->xPomeronA()
1796 : infoPtr->xPomeronB();
1797 double phiPom = 2. * M_PI * rndmPtr->flat();
1798 double thetaPom = (isHardDiffB) ? hardDiffraction.getThetaPomeronA()
1799 : hardDiffraction.getThetaPomeronB();
1800 double m2Diff = xPom * sNow;
1801 double mDiff = sqrt(m2Diff);
1804 if (beamAhasGamma || beamBhasGamma) {
1805 process.append( tmpProcess[3]);
1806 process.append( tmpProcess[4]);
1813 int id1 = process[1 + gammaOffset].id();
1814 int id2 = process[2 + gammaOffset].id();
1815 int idEl = (isHardDiffB) ? id1 : id2;
1816 if (idEl == 22) idEl = 113;
1817 int idX = (isHardDiffB) ? id2 : id1;
1818 double m1 = process[1 + gammaOffset].m();
1819 double m2 = process[2 + gammaOffset].m();
1820 double mEl = (isHardDiffB) ? m1 : m2;
1825 double m3, m4, s3, s4, lambda34;
1829 mEl = particleDataPtr->mSel(113);
1830 m3 = (isHardDiffB) ? mEl : mDiff;
1831 m4 = (isHardDiffA) ? mEl : mDiff;
1834 lambda34 = sqrtpos( pow2( sNow - s3 - s4) - 4. * s3 * s4 );
1836 }
while (lambda34 <= 0. && nTry < 10);
1838 m3 = (isHardDiffB) ? mEl : mDiff;
1839 m4 = (isHardDiffA) ? mEl : mDiff;
1842 lambda34 = sqrtpos( pow2( sNow - s3 - s4) - 4. * s3 * s4 );
1844 double pAbs = 0.5 * lambda34 / eCM;
1845 Vec4 p3 = Vec4( 0., 0., pAbs, 0.5 * (sNow + s3 - s4) / eCM);
1846 Vec4 p4 = Vec4( 0., 0., -pAbs, 0.5 * (sNow + s4 - s3) / eCM);
1851 p3.rot( thetaPom, phiPom);
1852 p4.rot( thetaPom, phiPom);
1855 int status3 = (isHardDiffB) ? 14 : 15;
1856 int status4 = (isHardDiffA) ? 14 : 15;
1857 int sign = (idX > 0) ? 1 : -1;
1858 int idDiff = (idX == 22) ? 9900020 : sign * 9902210;
1859 int id3 = (isHardDiffB) ? idEl : idDiff;
1860 int id4 = (isHardDiffA) ? idEl : idDiff;
1861 process.append( id3, status3, 1 + gammaOffset, 0, 0, 0, 0, 0, p3, m3);
1862 process.append( id4, status4, 2 + gammaOffset, 0, 0, 0, 0, 0, p4, m4);
1865 process[1 + gammaOffset].daughters(3 + gammaOffset, 0);
1866 process[2 + gammaOffset].daughters(4 + gammaOffset, 0);
1867 int iDiffMot = (isHardDiffB) ? 4 + gammaOffset: 3 + gammaOffset;
1868 int iDiffRad = process.size() - 1;
1869 process[iDiffMot].statusNeg();
1870 process[iDiffMot].daughters( iDiffRad + 1, iDiffRad + 2);
1874 int idDiffA = (isHardDiffB) ? 990 : process[1 + gammaOffset].
id();
1875 int idDiffB = (isHardDiffA) ? 990 : process[2 + gammaOffset].
id();
1876 double mDiffA = (isHardDiffB) ? 0. : process[1 + gammaOffset].m();
1877 double mDiffB = (isHardDiffA) ? 0. : process[2 + gammaOffset].m();
1878 double m2DiffA = mDiffA * mDiffA;
1879 double m2DiffB = mDiffB * mDiffB;
1880 double eDiffA = 0.5 * (m2Diff + m2DiffA - m2DiffB) / mDiff;
1881 double eDiffB = 0.5 * (m2Diff + m2DiffB - m2DiffA) / mDiff;
1882 double pzDiff = 0.5 * sqrtpos( pow2(m2Diff - m2DiffA - m2DiffB)
1883 - 4. * m2DiffA * m2DiffB ) / mDiff;
1884 process.append( idDiffA, 13, iDiffMot, 0, 0, 0, 0, 0,
1885 0., 0., pzDiff, eDiffA, mDiffA);
1886 process.append( idDiffB, 13, iDiffMot, 0, 0, 0, 0, 0,
1887 0., 0., -pzDiff, eDiffB, mDiffB);
1890 vector<int> hardParton;
1891 for (
int iHard = 3 + gammaOffset; iHard < tmpProcess.size(); ++iHard)
1892 hardParton.push_back( process.append(tmpProcess[iHard]) );
1895 Vec4 pDiffA = (isHardDiffA) ? process[1 + gammaOffset].p()
1896 : process[1 + gammaOffset].p() - pD3;
1897 Vec4 pDiffB = (isHardDiffB) ? process[2 + gammaOffset].p()
1898 : process[2 + gammaOffset].p() - pD4;
1900 MtoCM.toCMframe( pDiffA, pDiffB);
1901 for (
unsigned int i = 0; i < hardParton.size(); ++i)
1902 process[hardParton[i]].rotbst(MtoCM);
1905 for (
unsigned int j = 0; j < hardParton.size(); ++j) {
1906 int mother1 = (tmpProcess[j + 3 + gammaOffset].mother1() == 0)
1907 ? 0 : tmpProcess[j + 3 + gammaOffset].mother1() + 4;
1908 int mother2 = (tmpProcess[j + 3 + gammaOffset].mother2() == 0)
1909 ? 0 : tmpProcess[j + 3 + gammaOffset].mother2() + 4;
1910 int daughter1 = (tmpProcess[j + 3 + gammaOffset].daughter1() == 0)
1911 ? 0 : tmpProcess[j + 3 + gammaOffset].daughter1() + 4;
1912 int daughter2 = (tmpProcess[j + 3 + gammaOffset].daughter2() == 0)
1913 ? 0 : tmpProcess[j + 3 + gammaOffset].daughter2() + 4;
1914 process[hardParton[j]].mothers( mother1,mother2);
1915 process[hardParton[j]].daughters( daughter1, daughter2);
1921 for (
int i = 0; i < process.size(); ++i) {
1922 if (process[i].
id() == 990 && process[i].status() == 13) iPomeron = i;
1923 if (process[i].idAbs() == idX && process[i].status() == 13) iPrtcl = i;
1927 process[iPomeron].daughters(hardParton[0], 0);
1928 process[iPrtcl].daughters(hardParton[1],0);
1929 process[hardParton[0]].mothers(iPomeron,0);
1930 process[hardParton[1]].mothers(iPrtcl, 0);
1932 process[iPomeron].daughters(hardParton[1], 0);
1933 process[iPrtcl].daughters(hardParton[0],0);
1934 process[hardParton[1]].mothers(iPomeron,0);
1935 process[hardParton[0]].mothers(iPrtcl, 0);
1939 process[iPomeron].statusNeg();
1940 process[iPrtcl].statusNeg();
1943 infoPtr->setHasUnresolvedBeams(
true);
1947 beamAPtr = (isHardDiffB) ? beamPomAPtr
1948 : (beamAhasGamma ? beamGamAPtr : beamHadAPtr);
1949 beamBPtr = (isHardDiffA) ? beamPomBPtr
1950 : (beamBhasGamma ? beamGamBPtr : beamHadBPtr);
1953 eCMsave = infoPtr->eCM();
1954 infoPtr->setECM( mDiff);
1955 beamAPtr->newPzE( pzDiff, eDiffA);
1956 beamBPtr->newPzE( -pzDiff, eDiffB);
1959 int beamOffset = 4 + gammaOffset;
1960 int beamRemnOffset = (isHardDiffB) ? 2 : 1;
1963 timesPtr->reassignBeamPtrs( beamAPtr, beamBPtr, beamOffset);
1964 timesDecPtr->reassignBeamPtrs( beamAPtr, beamBPtr, beamOffset);
1965 spacePtr->reassignBeamPtrs( beamAPtr, beamBPtr, beamOffset);
1966 remnants.reassignBeamPtrs( beamAPtr, beamBPtr, beamRemnOffset);
1967 if (colourReconnectionPtr)
1968 colourReconnectionPtr->reassignBeamPtrs( beamAPtr, beamBPtr);
1971 if (isHardDiffA) multiPtr = &multiSDA;
1972 else if (isHardDiffB) multiPtr = &multiSDB;
1975 multiPtr->setBeamOffset(beamOffset);
1981 infoPtr->setHasPomPsystem(
true);
1989 void PartonLevel::leaveHardDiff(
Event& process,
Event& event,
1996 Vec4 pDiffA = (isHardDiffA) ? process[1 + gammaOffset].p()
1997 : process[1 + gammaOffset].p() - process[3 + gammaOffset].p();
1998 Vec4 pDiffB = (isHardDiffB) ? process[2 + gammaOffset].p()
1999 : process[2 + gammaOffset].p() - process[4 + gammaOffset].p();
2001 MtoCM.fromCMframe( pDiffA, pDiffB);
2004 for (
int i = 5 + gammaOffset; i < process.size(); ++i)
2005 process[i].rotbst( MtoCM);
2006 for (
int i = 5 + gammaOffset; i <
event.size(); ++i)
2007 event[i].rotbst( MtoCM);
2010 beamAPtr->newPzE( event[1 + gammaOffset].pz(), event[1 + gammaOffset].e());
2011 beamBPtr->newPzE( event[2 + gammaOffset].pz(), event[2 + gammaOffset].e());
2016 isHardDiffA = isHardDiffB = isHardDiff =
false;
2019 infoPtr->setECM( eCMsave);
2023 beamAPtr = beamAhasGamma ? beamGamAPtr : beamHadAPtr;
2024 beamBPtr = beamBhasGamma ? beamGamBPtr : beamHadBPtr;
2027 timesPtr->reassignBeamPtrs( beamAPtr, beamBPtr, 0);
2028 timesDecPtr->reassignBeamPtrs( beamAPtr, beamBPtr, 0);
2029 spacePtr->reassignBeamPtrs( beamAPtr, beamBPtr, 0);
2030 remnants.reassignBeamPtrs( beamAPtr, beamBPtr, 0);
2031 if (colourReconnectionPtr)
2032 colourReconnectionPtr->reassignBeamPtrs( beamAPtr, beamBPtr);
2035 multiPtr->setBeamOffset(0);
2038 multiPtr = &multiMB;
2047 bool PartonLevel::setupResolvedLeptonGamma(
Event& process) {
2050 eCMsaveGamma = infoPtr->eCM();
2056 gammaOffset = beamOffset;
2059 double mGmGm = (infoPtr->nFinal() > 1) || (gammaModeEvent != 4)
2060 ? infoPtr->eCMsub() : sqrt( infoPtr->sHat());
2061 double m2GmGm = pow2(mGmGm);
2064 double m2Gamma1 = hasGammaA ? 0. : pow2(beamAPtr->m());
2065 double m2Gamma2 = hasGammaB ? 0. : pow2(beamBPtr->m());
2068 double eGamA = 0.5 * (m2GmGm + m2Gamma1 - m2Gamma2) / mGmGm;
2069 double eGamB = 0.5 * (m2GmGm + m2Gamma2 - m2Gamma1) / mGmGm;
2070 double pzGam = 0.5 * sqrtpos( pow2(m2GmGm - m2Gamma1 - m2Gamma2)
2071 - 4. * m2Gamma1 * m2Gamma2 ) / mGmGm;
2072 Vec4 pGammaANew( 0, 0, pzGam, eGamA);
2073 Vec4 pGammaBNew( 0, 0, -pzGam, eGamB);
2076 beamGamAPtr->newPzE( pzGam, eGamA);
2077 beamGamBPtr->newPzE( -pzGam, eGamB);
2080 Vec4 pGammaA = process[iBeamA].p();
2081 Vec4 pGammaB = process[iBeamB].p();
2085 RotBstMatrix MtoGammaGamma;
2086 MtoGammaGamma.toCMframe( pGammaA, pGammaB);
2087 if (!isDiff && !isElastic) process.rotbst(MtoGammaGamma);
2089 for (
int i = 0; i < 5; ++i) process[i].rotbst(MtoGammaGamma);
2093 process[iBeamA].p(pGammaANew);
2094 process[iBeamB].p(pGammaBNew);
2097 if ( !hasGammaA && !(beamBPtr->getGammaMode() == 2) )
2098 process[iBeamA].m( sqrt(m2Gamma1) );
2099 if ( !hasGammaB && !(beamAPtr->getGammaMode() == 2) )
2100 process[iBeamB].m( sqrt(m2Gamma2) );
2104 if ( (gammaModeEvent == 4) || isElastic )
return true;
2107 if (infoPtr->isVMDstateA() ) beamGamAPtr->setVMDstate(
true,
2108 infoPtr->idVMDA(), infoPtr->mVMDA(), infoPtr->scaleVMDA(),
false);
2109 if (infoPtr->isVMDstateB() ) beamGamBPtr->setVMDstate(
true,
2110 infoPtr->idVMDB(), infoPtr->mVMDB(), infoPtr->scaleVMDB(),
false);
2113 if ( hasGammaA) beamAPtr = beamGamAPtr;
2114 else beamAPtr->newPzE( pzGam, eGamA);
2115 if ( hasGammaB) beamBPtr = beamGamBPtr;
2116 else beamBPtr->newPzE( -pzGam, eGamB);
2119 if ( (beamAhasResGamma && (!beamBhasResGamma && hasGammaB))
2120 || ( (!beamAhasResGamma && hasGammaA) && beamBhasResGamma) )
2121 infoPtr->setHasUnresolvedBeams(
true);
2124 infoPtr->setECM( mGmGm);
2127 timesPtr->reassignBeamPtrs( beamAPtr, beamBPtr, beamOffset);
2128 timesDecPtr->reassignBeamPtrs( beamAPtr, beamBPtr, beamOffset);
2129 spacePtr->reassignBeamPtrs( beamAPtr, beamBPtr, beamOffset);
2130 remnants.reassignBeamPtrs( beamAPtr, beamBPtr, 0);
2131 if (colourReconnectionPtr)
2132 colourReconnectionPtr->reassignBeamPtrs( beamAPtr, beamBPtr);
2135 multiPtr = &multiGmGm;
2136 multiPtr->setBeamOffset(beamOffset);
2148 void PartonLevel::leaveResolvedLeptonGamma(
Event& process,
Event& event,
2152 if ( hasGammaA) beamAPtr = beamHadAPtr;
2153 if ( hasGammaB) beamBPtr = beamHadBPtr;
2156 infoPtr->setECM( eCMsaveGamma);
2162 Vec4 pLeptonA = process[1].p();
2163 Vec4 pLeptonB = process[2].p();
2170 int iSkipHardDiff = -1;
2173 RotBstMatrix MtoLeptonLepton;
2174 MtoLeptonLepton.toCMframe( pLeptonA, pLeptonB);
2177 process.rotbst(MtoLeptonLepton);
2178 event.rotbst(MtoLeptonLepton);
2181 double m2BeamA = pow2( beamAPtr->m());
2182 double m2BeamB = pow2( beamBPtr->m());
2185 double sCM = infoPtr->s();
2186 double eCM2A = 0.25 * pow2(sCM + m2BeamA - m2BeamB) / sCM;
2187 double eCM2B = 0.25 * pow2(sCM - m2BeamA + m2BeamB) / sCM;
2190 Vec4 pGamma1Orig = process[3].p();
2191 Vec4 pGamma2Orig = process[4].p();
2192 Vec4 pGamma1 = pGamma1Orig;
2193 Vec4 pGamma2 = pGamma2Orig;
2194 double mGamma1 = sqrt(m2BeamA);
2195 double mGamma2 = sqrt(m2BeamB);
2200 if ( (infoPtr->nFinal() == 1) && (gammaModeEvent == 4)
2201 && hasGammaA && hasGammaB ) {
2204 mGamma1 = -sqrt( beamAPtr->Q2Gamma());
2205 mGamma2 = -sqrt( beamBPtr->Q2Gamma());
2206 double kTxA = beamAPtr->gammaKTx();
2207 double kTyA = beamAPtr->gammaKTy();
2208 double kTxB = beamBPtr->gammaKTx();
2209 double kTyB = beamBPtr->gammaKTy();
2212 double mT2A = pow2( beamAPtr->gammaKT() ) - pow2(mGamma1);
2213 double mT2B = pow2( beamBPtr->gammaKT() ) - pow2(mGamma2);
2214 double sHatBef = infoPtr->sHat();
2215 double sHatAft = infoPtr->sHat() + pow2(kTxA + kTxB)
2216 + pow2(kTyA + kTyB);
2217 double lambda = pow2(sHatAft) + pow2(mT2A) + pow2(mT2B)
2218 - 2. * ( sHatAft * (mT2A + mT2B) + mT2A * mT2B );
2219 double kz2New = 0.25 * lambda / sHatAft;
2222 Vec4 pGamma1New(kTxA, kTyA, sqrt(kz2New), sqrt(kz2New + mT2A) );
2223 Vec4 pGamma2New(kTxB, kTyB, -sqrt(kz2New), sqrt(kz2New + mT2B) );
2226 RotBstMatrix MfromGmGmOrig;
2227 MfromGmGmOrig.toCMframe( pGamma1Orig, pGamma2Orig);
2228 MfromGmGmOrig.invert();
2229 pGamma1New.rotbst(MfromGmGmOrig);
2230 pGamma2New.rotbst(MfromGmGmOrig);
2233 pGamma1 = pGamma1New;
2234 pGamma2 = pGamma2New;
2237 event[3].p( pGamma1);
2238 event[3].m( mGamma1);
2239 event[4].p( pGamma2);
2240 event[4].m( mGamma2);
2243 double rescale = sqrt(sHatAft / sHatBef);
2244 double wPosBef = beamAPtr->xGamma() * infoPtr->eCM();
2245 double wNegBef = beamBPtr->xGamma() * infoPtr->eCM();
2248 double w2BeamA = pow2(beamAPtr->gammaKT()) + m2BeamA;
2249 double w2BeamB = pow2(beamBPtr->gammaKT()) + m2BeamB;
2250 double wPosRem = infoPtr->eCM() - rescale * wPosBef;
2251 double wNegRem = infoPtr->eCM() - rescale * wNegBef;
2252 double w2Rem = wPosRem * wNegRem;
2253 double xLepA = 1. - beamAPtr->xGamma();
2254 double xLepB = 1. - beamBPtr->xGamma();
2257 double lambdaRoot = sqrtpos( pow2(w2Rem - w2BeamA - w2BeamB)
2258 - 4. * w2BeamA * w2BeamB );
2259 double rescaleA = (w2Rem + w2BeamA - w2BeamB + lambdaRoot)
2260 / (2. * w2Rem * xLepA);
2261 double rescaleB = (w2Rem + w2BeamB - w2BeamA + lambdaRoot)
2262 / (2. * w2Rem * xLepB);
2265 double pPosA = rescaleA * xLepA * wPosRem;
2266 double pNegA = w2BeamA / pPosA;
2267 double eLepA = 0.5 * (pPosA + pNegA);
2268 double pzLepA = 0.5 * (pPosA - pNegA);
2269 double pNegB = rescaleB * xLepB * wNegRem;
2270 double pPosB = w2BeamB / pNegB;
2271 double eLepB = 0.5 * (pPosB + pNegB);
2272 double pzLepB = 0.5 * (pPosB - pNegB);
2273 Vec4 pLeptonANew( -kTxA, -kTyA, pzLepA, eLepA);
2274 Vec4 pLeptonBNew( -kTxB, -kTyB, pzLepB, eLepB);
2277 pLepton1scat = pLeptonANew;
2278 pLepton2scat = pLeptonBNew;
2281 double theta1 = pLepton1scat.theta();
2282 double theta2 = M_PI - pLepton2scat.theta();
2283 infoPtr->setTheta1(theta1);
2284 infoPtr->setTheta2(theta2);
2285 infoPtr->setECMsub(sqrt(sHatBef));
2286 infoPtr->setsHatNew(sHatBef);
2295 double xGamma1 = beamAPtr->xGamma();
2296 double Q2gamma1 = beamAPtr->Q2Gamma();
2297 mGamma1 = -sqrt( Q2gamma1);
2298 beamGamAPtr->newM( mGamma1);
2301 double eGamma1 = xGamma1 * sqrt( eCM2A);
2302 double kz1 = (eCM2A * xGamma1 + 0.5 * Q2gamma1)
2303 / sqrt(eCM2A - m2BeamA);
2307 pGamma1 = Vec4( beamAPtr->gammaKTx(), beamAPtr->gammaKTy(),
2309 if (!sampleQ2gamma) mGamma1 = pGamma1.mCalc();
2310 event[3].p( pGamma1);
2311 event[3].m( mGamma1);
2314 if (infoPtr->isHardDiffractiveA()) {
2315 event[7].p( pGamma1);
2316 event[7].m( mGamma1);
2325 double xGamma2 = beamBPtr->xGamma();
2326 double Q2gamma2 = beamBPtr->Q2Gamma();
2327 mGamma2 = -sqrt( Q2gamma2);
2328 beamGamBPtr->newM( mGamma2);
2331 double eGamma2 = xGamma2 * sqrt( eCM2B);
2332 double kz2 = (eCM2B * xGamma2 + 0.5 * Q2gamma2)
2333 / sqrt(eCM2B - m2BeamB);
2337 pGamma2 = Vec4( beamBPtr->gammaKTx(), beamBPtr->gammaKTy(),
2339 if (!sampleQ2gamma) mGamma2 = pGamma2.mCalc();
2340 event[4].p( pGamma2);
2341 event[4].m( mGamma2);
2344 if (infoPtr->isHardDiffractiveB()) {
2345 event[8].p( pGamma2);
2346 event[8].m( mGamma2);
2352 Vec4 pLepton1 = process[1].p();
2353 Vec4 pLepton2 = process[2].p();
2354 pLepton1scat = pLepton1 - pGamma1;
2355 pLepton2scat = pLepton2 - pGamma2;
2361 if ( hasGammaA && !hasGammaB) pGamma2 =
event[2].p();
2362 else if (!hasGammaA && hasGammaB) pGamma1 =
event[1].p();
2366 RotBstMatrix MfromGmGm;
2367 MfromGmGm.toCMframe( pGamma1, pGamma2);
2368 MfromGmGm.fromCMframe( pGamma1Orig, pGamma2Orig);
2373 int iSkipGamma = -1;
2374 if ( gammaModeEvent == 3 ) {
2376 event[iSkipGamma].m( mGamma1);
2377 event[iSkipGamma].p( pGamma1);
2378 }
else if ( gammaModeEvent == 2 ) {
2380 event[iSkipGamma].m( mGamma2);
2381 event[iSkipGamma].p( pGamma2);
2387 int iProcessBegin = 5;
2388 int iSkipGammaEl = -1;
2391 if (hasGammaA) iSkipGamma = 3;
2392 if (hasGammaB) iSkipGammaEl = 4;
2394 for (
int i = iProcessBegin; i <
event.size(); ++i) {
2395 if ( (i != iSkipGamma) && (i != iSkipHardDiff) && (i != iSkipGammaEl) )
2396 event[i].rotbst( MfromGmGm);
2401 if ( hasGammaA && !hasGammaB)
event[4].p(pGamma2);
2402 else if (!hasGammaA && hasGammaB)
event[3].p(pGamma1);
2409 int iPosLepton1 =
event.append( beamAPtr->id(), 63, 1, 0, 0, 0, 0, 0,
2410 pLepton1scat, beamAPtr->m());
2411 event[1].daughter2( event[1].daughter1());
2412 event[1].daughter1( iPosLepton1);
2415 int iPosLepton2 =
event.append( beamBPtr->id(), 63, 2, 0, 0, 0, 0, 0,
2416 pLepton2scat, beamBPtr->m());
2417 event[2].daughter2( event[2].daughter1());
2418 event[2].daughter1( iPosLepton2);
2426 if ( (gammaModeEvent == 4) || isElastic )
return;
2429 timesPtr->reassignBeamPtrs( beamAPtr, beamBPtr, 0);
2430 timesDecPtr->reassignBeamPtrs( beamAPtr, beamBPtr, 0);
2431 spacePtr->reassignBeamPtrs( beamAPtr, beamBPtr, 0);
2432 remnants.reassignBeamPtrs( beamAPtr, beamBPtr, 0);
2433 if (colourReconnectionPtr)
2434 colourReconnectionPtr->reassignBeamPtrs( beamAPtr, beamBPtr);
2437 multiPtr = &multiMB;
2438 multiPtr->setBeamOffset(0);
2446 void PartonLevel::cleanEventFromGamma(
Event& event) {
2451 if (infoPtr->isHardDiffractiveA() || infoPtr->isHardDiffractiveB())
2453 int iPosBeam1 = 1 + beamOffset;
2454 int iPosBeam2 = 2 + beamOffset;
2459 for (
int i = event.size() - 1; i > 0; --i) {
2460 if ( (event[i].
id() == 22 && event[i].mother1() == iPosBeam1)
2461 && beamAhasResGamma ) iPosGamma1 = i;
2462 if ( (event[i].
id() == 22 && event[i].mother1() == iPosBeam2)
2463 && beamBhasResGamma ) iPosGamma2 = i;
2468 if (iPosGamma1 > 0) ++nGamma;
2469 if (iPosGamma2 > 0) ++nGamma;
2472 if ( nGamma == 0 )
return;
2475 for (
int i = 0; i < nGamma; ++i) {
2478 int iPosGamma = (iPosGamma1 > 0 && i == 0) ? iPosGamma1 : iPosGamma2;
2479 int iPosBeam = (iPosGamma1 > 0 && i == 0) ? iPosBeam1 : iPosBeam2;
2482 while ( iPosGamma > iPosBeam ) {
2483 int iDaughter1 =
event[iPosGamma].daughter1();
2484 int iDaughter2 =
event[iPosGamma].daughter2();
2485 int iMother1 =
event[iPosGamma].mother1();
2486 int iMother2 =
event[iPosGamma].mother2();
2489 if ( iDaughter1 == iDaughter2 ) {
2490 event[iDaughter1].mothers( iMother1, iMother2 );
2491 event.remove( iPosGamma, iPosGamma);
2492 iPosGamma = iDaughter1;
2496 event[iMother1].daughters( iDaughter1, iDaughter2 );
2497 event[iDaughter1].mother1( iMother1 );
2498 event[iDaughter2].mother1( iMother1 );
2499 event.remove( iPosGamma, iPosGamma);
2500 iPosGamma = iMother1;
2504 if ( (i == 0 && nGamma > 1) && iPosGamma2 > iPosGamma ) --iPosGamma2;
2514 bool PartonLevel::resonanceShowers(
Event& process,
Event& event,
2520 nHardDoneRHad = nHardDone;
2521 inRHadDecay.resize(0);
2522 for (
int i = 0; i < process.size(); ++i)
2523 inRHadDecay.push_back(
false);
2524 }
else nHardDone = nHardDoneRHad;
2531 int nBranchMax = (doTrial) ? nTrialEmissions : -1;
2533 vector<int> iJunCopied;
2535 while (nHardDone < process.size()) {
2537 int iBegin = nHardDone;
2543 bool comesFromR =
false;
2544 int iTraceUp = process[iBegin].mother1();
2546 if ( rHadronsPtr->givesRHadron(process[iTraceUp].id()) )
2548 iTraceUp = process[iTraceUp].mother1();
2549 }
while (iTraceUp > 0 && !comesFromR);
2551 inRHadDecay[iBegin] =
true;
2558 }
else if (!inRHadDecay[iBegin]) {
2565 int iHardMother = process[iBegin].mother1();
2566 Particle& hardMother = process[iHardMother];
2567 int iBefMother = iPosBefShow[iHardMother];
2568 if (event[iBefMother].daughter1() >= event.size())
2569 event[iBefMother].daughters( 0, 0);
2570 int iAftMother =
event[iBefMother].iBotCopyId();
2573 int iTraceRHadron = rHadronsPtr->trace( iAftMother);
2574 if (iTraceRHadron > 0) iAftMother = iTraceRHadron;
2576 Particle& aftMother =
event[iAftMother];
2579 aftMother.statusNeg();
2583 int colBef = hardMother.col();
2584 int acolBef = hardMother.acol();
2585 int colAft = aftMother.col();
2586 int acolAft = aftMother.acol();
2588 M.bst( hardMother.p(), aftMother.p());
2592 if ( (colBef != 0 || acolBef != 0) && doReconnect && reconnectMode == 1
2593 && forceResonanceCR && !earlyResDec) {
2594 infoPtr->errorMsg(
"Abort from PartonLevel::resonanceShower: "
2595 "new CR can't handle separate CR for coloured resonance decays");
2596 infoPtr->setAbortPartonLevel(
true);
2601 vector<bool> doCopyJun;
2602 for (
int i = iBegin; i < process.size(); ++i) {
2603 if (process[i].mother1() != iHardMother)
break;
2604 int iNow =
event.append( process[i] );
2605 iPosBefShow[i] = iNow;
2606 Particle& now =
event.back();
2609 if (now.status() == -22) {
2611 now.daughters(0, 0);
2615 if (i == iBegin)
event[iAftMother].daughter1( iNow);
2616 else event[iAftMother].daughter2( iNow);
2617 now.mother1(iAftMother);
2620 for (
int iJun = 0; iJun < process.sizeJunction(); ++iJun) {
2621 if (iJun >=
int(doCopyJun.size())) doCopyJun.push_back(
false);
2623 if (doCopyJun[iJun])
continue;
2625 int kindJunction = process.kindJunction(iJun);
2626 if (kindJunction <= 2) {
2630 int iDau1 = hardMother.daughter1();
2631 int iDau2 = hardMother.daughter2();
2633 if (iDau1 == 0 || iDau2 - iDau1 < 2)
continue;
2634 for (
int iDau=iDau1; iDau<=iDau2; ++iDau) {
2635 int colDau = (kindJunction == 1 ? process[iDau].col()
2636 : process[iDau].acol());
2637 for (
int iLeg = 0; iLeg <= 2; ++iLeg)
2638 if ( process.colJunction(iJun,iLeg) == colDau ) nMatch += 1;
2641 if (nMatch == 3) doCopyJun[iJun] =
true;
2642 }
else if (kindJunction <= 4) {
2645 int col = (kindJunction == 3 ? hardMother.acol() : hardMother.col());
2646 if ( process.colJunction(iJun,0) == col ) doCopyJun[iJun] =
true;
2650 for (
int kJun = 0; kJun <
event.sizeJunction(); ++kJun) {
2652 for (
int iLeg = 0; iLeg <= 2; ++iLeg)
2653 if (event.colJunction(kJun,iLeg) == process.colJunction(iJun,iLeg))
2655 if (nMatch == 3) doCopyJun[iJun] =
false;
2660 if (now.col() == colBef) now.col( colAft);
2661 if (now.acol() == acolBef) now.acol( acolAft);
2663 if (now.col() == -acolBef) now.col( -acolAft);
2664 if (now.acol() == -colBef) now.acol( -colAft);
2668 if (now.hasVertex()) now.vProd( event[iAftMother].vDec() );
2673 int iEnd = nHardDone - 1;
2676 for (
int iJun = 0; iJun < int(doCopyJun.size()); ++iJun) {
2678 for (
int jJun = 0; jJun < int(iJunCopied.size()); ++jJun)
2679 if (iJunCopied[jJun] == iJun) doCopyJun[iJun] =
false;
2681 if (!doCopyJun[iJun])
continue;
2683 Junction junCopy = process.getJunction(iJun);
2684 for (
int iLeg = 0; iLeg <= 2; ++iLeg) {
2685 int colLeg = junCopy.col(iLeg);
2686 if (colLeg == colBef) junCopy.col(iLeg, colAft);
2687 if (colLeg == acolBef) junCopy.col(iLeg, acolAft);
2689 event.appendJunction(junCopy);
2691 iJunCopied.push_back(iJun);
2698 int iSys = partonSystemsPtr->addSys();
2699 partonSystemsPtr->setInRes( iSys,iAftMother);
2700 partonSystemsPtr->setSHat( iSys, pow2(hardMother.m()) );
2701 partonSystemsPtr->setPTHat( iSys, 0.5 * hardMother.m() );
2704 for (
int i = iPosBefShow[iBegin]; i <= iPosBefShow[iEnd]; ++i)
2705 if (event[i].isFinal()) partonSystemsPtr->addOut( iSys, i);
2708 if (doFSRinResonances) {
2709 double pTmax = 0.5 * hardMother.m();
2710 if (canSetScale) pTmax
2711 = userHooksPtr->scaleResonance( iAftMother, event);
2715 if (doTrial) pTmax = process.scale();
2719 int iMother1 = hardMother.mother1();
2720 int iMother2 = hardMother.mother2();
2722 && event[iMother1].colType() == 0 && event[iMother2].colType() == 0)
2723 pTmax = process.scale();
2726 timesDecPtr->prepare( iSys, event);
2733 double pTveto = pTvetoPT;
2738 double pTtimes = timesDecPtr->pTnext( event, pTmax, 0.);
2741 if (pTveto > 0. && pTveto > pTtimes) {
2743 doVeto = userHooksPtr->doVetoPT( 5, event);
2745 if (doVeto)
return false;
2750 if (timesDecPtr->branch( event)) {
2753 if (canVetoStep && nFSRhard <= nVetoStep) typeVetoStep = 5;
2756 pTLastBranch = pTtimes;
2767 if (typeVetoStep > 0) {
2768 doVeto = userHooksPtr->doVetoStep( typeVetoStep, 0, nFSRhard,
2771 if (doVeto)
return false;
2775 if ( canRemoveEvent && nFSRhard == 1 ) {
2777 mergingHooksPtr->doVetoStep( process, event,
true );
2781 }
while (pTmax > 0. && (nBranchMax <= 0 || nBranch < nBranchMax) );
2787 if (skipForR) nFSRinRes = nFSRres;
2796 bool PartonLevel::wzDecayShowers(
Event& event) {
2799 for (
int iWZ = 0; iWZ <
event.size(); ++iWZ)
2800 if (event[iWZ].isFinal()
2801 && (
event[iWZ].id() == 23 ||
event[iWZ].idAbs() == 24) ) {
2804 if ( event[iWZ].canDecay() &&
event[iWZ].mayDecay()
2805 &&
event[iWZ].isResonance() ) ;
2808 int iWZtop =
event[iWZ].iTopCopy();
2810 if (event[iWZtop].statusAbs() == 56) typeWZ = 1;
2811 if (event[iWZtop].statusAbs() == 47) typeWZ = 2;
2812 int sizeSave =
event.size();
2817 int idSave =
event[iWZ].id();
2818 event[iWZ].id( (idSave > 0) ? idSave + 70 : idSave - 70);
2819 int statusSave =
event[iWZ].status();
2820 resonanceDecays.next( event, iWZ);
2821 event[iWZ].id( idSave);
2822 if (event.size() - sizeSave != 2)
return true;
2823 event[iWZ].status( -statusSave);
2830 vector<int> iSisters =
event[iWZtop].sisterList();
2831 if (iSisters.size() != 1) {
2832 infoPtr->errorMsg(
"Error in PartonLevel::wzDecayShowers: "
2833 "Not able to find a single sister particle");
2836 int iEmitter = iSisters[0];
2839 RotBstMatrix MtoNew, MtoRest, MtoCM;
2840 MtoNew.bst( event[iWZtop].p(), event[iWZ].p());
2841 MtoRest.bstback( event[iWZ].p());
2842 MtoCM.bst( event[iWZ].p());
2845 Vec4 pEmitter =
event[iEmitter].p();
2846 pEmitter.rotbst( MtoNew);
2847 pEmitter.rotbst( MtoRest);
2848 if (event[iWZtop + 1].statusAbs() != 52) {
2849 infoPtr->errorMsg(
"Error in PartonLevel::wzDecayShowers: "
2850 "Found wrong recoiler");
2853 Vec4 pRecoiler =
event[iWZtop + 1].p();
2854 pRecoiler.rotbst( MtoNew);
2855 pRecoiler.rotbst( MtoRest);
2856 Vec4 pWZRest =
event[iWZ].p();
2857 pWZRest.rotbst( MtoRest);
2861 Vec4 p5 = pRecoiler;
2862 if (event[iEmitter].
id() < 0) swap( p4, p5);
2866 Vec4 pDec1 =
event[sizeSave].p();
2867 Vec4 pDec2 =
event[sizeSave + 1].p();
2868 if (event[sizeSave].
id() < 0) swap( pDec1, pDec2);
2869 pDec1.rotbst( MtoRest);
2870 pDec2.rotbst( MtoRest);
2873 double li2, ri2, lf2, rf2;
2875 if (event[iWZ].
id() == 23) {
2876 li2 = pow2(coupSMPtr->lf( event[iEmitter].idAbs() ));
2877 ri2 = pow2(coupSMPtr->rf( event[iEmitter].idAbs() ));
2878 lf2 = pow2(coupSMPtr->lf( event[sizeSave].idAbs() ));
2879 rf2 = pow2(coupSMPtr->rf( event[sizeSave].idAbs() ));
2880 if ( abs( event[iEmitter].pol() + 1.) < 0.1) ri2 = 0.;
2881 if ( abs( event[iEmitter].pol() - 1.) < 0.1) li2 = 0.;
2891 double sWZER = (p4 + pWZRest + p5).m2Calc();
2892 double x1 = 2. * p4 * (p4 + pWZRest + p5) / sWZER;
2893 double x2 = 2. * p5 * (p4 + pWZRest + p5) / sWZER;
2894 double x1s = x1 * x1;
2895 double x2s = x2 * x2;
2896 double m2Sel = pWZRest.m2Calc();
2897 double rWZER = m2Sel / sWZER;
2901 con[0] = 2. * m2Sel * (1.-x1) * ((x2s+1.-x1-x2) - rWZER * (1.-x2))
2902 * (li2 * lf2 + ri2 * rf2);
2903 con[1] = 2. * m2Sel * (1.-x2) * ((x1s+1.-x1-x2) - rWZER * (1.-x1))
2904 * (li2 * rf2 + ri2 * lf2);
2905 con[2] = 2. * m2Sel * (1.-x1) * ((x2s+1.-x1-x2) - rWZER * (1.-x2))
2906 * (li2 * rf2 + ri2 * lf2);
2907 con[3] = 2. * m2Sel * (1.-x2) * ((x1s+1.-x1-x2) - rWZER * (1.-x1))
2908 * (li2 * lf2 + ri2 * rf2);
2909 con[4] = m2Sel * sWZER * (1.-x1) * (1.-x2) * ((x1+x2-1.) + rWZER)
2910 * (li2 + ri2) * (lf2 + rf2);
2911 con[5] = -4. * (1.-x1) * (1.-x2) * (li2 + ri2) * (lf2 + rf2);
2912 con[6] = -4. * (1.-x1) * (1.-x2) * (li2 + ri2) * (lf2 + rf2);
2913 con[7] = 4. * (1.-x1) * ((1.-x1) - rWZER * (1.-x2))
2914 * (li2 + ri2) * (lf2 + rf2);
2915 con[8] = 4. * (1.-x2) * ((1.-x2) - rWZER * (1.-x1))
2916 * (li2 + ri2) * (lf2 + rf2);
2920 double pAbs12 = pDec1.pAbs();
2921 for (
int j = 0; j < 6; ++j) {
2922 Vec4 pDec1Test( 0., 0., 0., pDec1.e());
2923 Vec4 pDec2Test( 0., 0., 0., pDec2.e());
2924 if (j == 0) { pDec1Test.px( pAbs12); pDec1Test.px( -pAbs12);}
2925 else if (j == 1) { pDec1Test.px( -pAbs12); pDec1Test.px( pAbs12);}
2926 else if (j == 2) { pDec1Test.py( pAbs12); pDec1Test.py( -pAbs12);}
2927 else if (j == 3) { pDec1Test.py( -pAbs12); pDec1Test.py( pAbs12);}
2928 else if (j == 4) { pDec1Test.pz( pAbs12); pDec1Test.pz( -pAbs12);}
2929 else if (j == 5) { pDec1Test.pz( -pAbs12); pDec1Test.pz( pAbs12);}
2932 double p2p4Test = p4 * pDec1Test;
2933 double p3p4Test = p4 * pDec2Test;
2934 double p2p5Test = p5 * pDec1Test;
2935 double p3p5Test = p5 * pDec2Test;
2936 double testValues[9] = { p2p4Test, p2p5Test, p3p4Test, p3p5Test, 1.,
2937 p2p5Test * p3p4Test, p2p4Test * p3p5Test, p2p4Test * p3p4Test,
2938 p2p5Test * p3p5Test};
2940 for (
int i = 0; i < 9; ++i) wtTest += con[i] * testValues[i];
2941 if (wtTest > wtMax) wtMax = wtTest;
2953 RotBstMatrix MrndmRot;
2954 MrndmRot.rot( acos(2. * rndmPtr->flat() - 1.),
2955 2. * M_PI * rndmPtr->flat());
2956 pDec1.rotbst(MrndmRot);
2957 pDec2.rotbst(MrndmRot);
2963 double p2p4 = p4 * pDec1;
2964 double p3p4 = p4 * pDec2;
2965 double p2p5 = p5 * pDec1;
2966 double p3p5 = p5 * pDec2;
2969 double wtValues[9] = { p2p4, p2p5, p3p4, p3p5, 1., p2p5 * p3p4,
2970 p2p4 * p3p5, p2p4 * p3p4, p2p5 * p3p5};
2972 for (
int i = 0; i < 9; ++i) wt += con[i] * wtValues[i];
2973 if (wt > wtMax || wt < 0.) {
2974 infoPtr->errorMsg(
"Error in PartonLevel::wzDecayShowers: "
2975 "wt bigger than wtMax or less than zero");
2978 }
while (wt < wtMax * rndmPtr->flat());
2982 pDec1.rotbst( MtoCM);
2983 pDec2.rotbst( MtoCM);
2984 if (event[sizeSave].
id() > 0) {
2985 event[sizeSave].p( pDec1);
2986 event[sizeSave + 1].p( pDec2);
2989 event[sizeSave].p( pDec2);
2990 event[sizeSave + 1].p( pDec1);
2999 double iMother =
event[iWZtop].mother1();
3002 RotBstMatrix MtoNew, MtoRest, MtoCM;
3003 MtoNew.bst( event[iWZtop].p(), event[iWZ].p());
3004 MtoRest.bstback( event[iWZ].p());
3005 MtoCM.bst( event[iWZ].p());
3009 if (event[iMother + 1].statusAbs() == 42) iRecoiler = iMother + 1;
3010 else if (event[iMother - 1].statusAbs() == 42) iRecoiler = iMother - 1;
3012 infoPtr->errorMsg(
"Error in PartonLevel::wzDecayShowers: "
3013 "Found wrong recoiler");
3018 Vec4 pMother =
event[iMother].p();
3019 pMother.rotbst( MtoNew);
3020 pMother.rotbst( MtoRest);
3021 Vec4 pRecoiler =
event[iRecoiler].p();
3022 pRecoiler.rotbst( MtoNew);
3023 pRecoiler.rotbst( MtoRest);
3024 Vec4 pWZRest =
event[iWZ].p();
3025 pWZRest.rotbst( MtoRest);
3030 Vec4 p2 = pRecoiler;
3031 if (event[iMother].
id() < 0) swap( p1, p2);
3035 Vec4 pDec1 =
event[sizeSave].p();
3036 Vec4 pDec2 =
event[sizeSave + 1].p();
3037 if (event[sizeSave].
id() < 0) swap( pDec1, pDec2);
3038 pDec1.rotbst( MtoRest);
3039 pDec2.rotbst( MtoRest);
3042 double li2, ri2, lf2, rf2;
3044 if (event[iWZ].
id() == 23) {
3045 li2 = pow2(coupSMPtr->lf( event[iMother].idAbs() ));
3046 ri2 = pow2(coupSMPtr->rf( event[iMother].idAbs() ));
3047 lf2 = pow2(coupSMPtr->lf( event[sizeSave].idAbs() ));
3048 rf2 = pow2(coupSMPtr->rf( event[sizeSave].idAbs() ));
3049 if ( abs( event[iMother].pol() + 1.) < 0.1) ri2 = 0.;
3050 if ( abs( event[iMother].pol() - 1.) < 0.1) li2 = 0.;
3060 double s = (p1 + p2).m2Calc();
3061 double t = (p1-pWZRest).m2Calc();
3062 double u = (p2-pWZRest).m2Calc();
3063 double m2Sel = pWZRest.m2Calc();
3064 double m2Final = t + u + s - m2Sel;
3068 con[0] = 2. * m2Sel * (u * (1. - m2Final / t) + s)
3069 * (li2 * rf2 + ri2 * lf2);
3070 con[1] = 2. * m2Sel * (u * (1. - m2Final / t) + s)
3071 * (li2 * lf2 + ri2 * rf2);
3072 con[2] = 2. * m2Sel * (t * (1. - m2Final / u) + s)
3073 * (li2 * lf2 + ri2 * rf2);
3074 con[3] = 2. * m2Sel * (t * (1. - m2Final / u) + s)
3075 * (li2 * rf2 + ri2 * lf2);
3076 con[4] = m2Sel * m2Final * s * (li2 + ri2) * (lf2 + rf2);
3077 con[5] = -4. * m2Final * (li2 + ri2) * (lf2 + rf2);
3078 con[6] = -4. * m2Final * (li2 + ri2) * (lf2 + rf2);
3079 con[7] = 4. * (m2Final * u / t - m2Sel) * (li2 + ri2) * (lf2 + rf2);
3080 con[8] = 4. * (m2Final * t / u - m2Sel) * (li2 + ri2) * (lf2 + rf2);
3084 double pAbs12 = pDec1.pAbs();
3085 for (
int j = 0; j < 6; ++j) {
3086 Vec4 pDec1Test( 0., 0., 0., pDec1.e());
3087 Vec4 pDec2Test( 0., 0., 0., pDec2.e());
3088 if (j == 0) { pDec1Test.px( pAbs12); pDec1Test.px( -pAbs12);}
3089 else if (j == 1) { pDec1Test.px( -pAbs12); pDec1Test.px( pAbs12);}
3090 else if (j == 2) { pDec1Test.py( pAbs12); pDec1Test.py( -pAbs12);}
3091 else if (j == 3) { pDec1Test.py( -pAbs12); pDec1Test.py( pAbs12);}
3092 else if (j == 4) { pDec1Test.pz( pAbs12); pDec1Test.pz( -pAbs12);}
3093 else if (j == 5) { pDec1Test.pz( -pAbs12); pDec1Test.pz( pAbs12);}
3096 double p1p4Test = p1 * pDec1Test;
3097 double p1p5Test = p1 * pDec2Test;
3098 double p2p4Test = p2 * pDec1Test;
3099 double p2p5Test = p2 * pDec2Test;
3100 double testValues[9] = { p1p4Test, p1p5Test, p2p4Test, p2p5Test, 1.,
3101 p1p4Test * p2p5Test, p1p5Test * p2p4Test, p1p4Test * p1p5Test,
3102 p2p4Test * p2p5Test};
3104 for (
int i = 0; i < 9; ++i) wtTest += con[i] * testValues[i];
3105 if (wtTest > wtMax) wtMax = wtTest;
3117 RotBstMatrix MrndmRot;
3118 MrndmRot.rot( acos(2. * rndmPtr->flat() - 1.),
3119 2. * M_PI * rndmPtr->flat());
3120 pDec1.rotbst(MrndmRot);
3121 pDec2.rotbst(MrndmRot);
3127 double p1p4 = p1 * pDec1;
3128 double p1p5 = p1 * pDec2;
3129 double p2p4 = p2 * pDec1;
3130 double p2p5 = p2 * pDec2;
3133 double wtValues[9] = { p1p4, p1p5, p2p4, p2p5, 1., p1p4 * p2p5,
3134 p1p5 * p2p4, p1p4 * p1p5, p2p4 * p2p5};
3136 for (
int i = 0; i < 9; ++i) wt += con[i] * wtValues[i];
3137 if (wt > wtMax || wt < 0.) {
3138 infoPtr->errorMsg(
"Error in PartonLevel::wzDecayShowers: "
3139 "wt bigger than wtMax or less than zero");
3142 }
while (wt < wtMax * rndmPtr->flat());
3146 pDec1.rotbst( MtoCM);
3147 pDec2.rotbst( MtoCM);
3148 if (event[sizeSave].
id() > 0) {
3149 event[sizeSave].p( pDec1);
3150 event[sizeSave + 1].p( pDec2);
3153 event[sizeSave].p( pDec2);
3154 event[sizeSave + 1].p( pDec1);
3162 double pTmax = 0.5 *
event[iWZ].m();
3163 int iSys = partonSystemsPtr->addSys();
3164 partonSystemsPtr->setInRes( iSys, iWZ);
3165 partonSystemsPtr->setSHat( iSys, pow2(event[iWZ].m()) );
3166 partonSystemsPtr->setPTHat( iSys, pTmax);
3167 for (
int i = sizeSave; i <
event.size(); ++i)
3168 partonSystemsPtr->addOut( iSys, i);
3171 if (doFSRinResonances) {
3174 timesDecPtr->prepare( iSys, event);
3178 double pTtimes = timesDecPtr->pTnext( event, pTmax, 0.);
3182 timesDecPtr->branch( event);
3190 }
while (pTmax > 0.);