8 #include "PartonLevel.h"
22 const int PartonLevel::NTRY = 10;
28 bool PartonLevel::init( Info* infoPtrIn, Settings& settings,
29 ParticleData* particleDataPtrIn, Rndm* rndmPtrIn,
30 BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
31 BeamParticle* beamPomAPtrIn, BeamParticle* beamPomBPtrIn,
32 Couplings* couplingsPtrIn, PartonSystems* partonSystemsPtrIn,
33 SigmaTotal* sigmaTotPtr, TimeShower* timesDecPtrIn, TimeShower* timesPtrIn,
34 SpaceShower* spacePtrIn, RHadrons* rHadronsPtrIn,
35 UserHooks* userHooksPtrIn,
36 MergingHooks* mergingHooksPtrIn,
bool useAsTrial ) {
40 particleDataPtr = particleDataPtrIn;
42 beamAPtr = beamAPtrIn;
43 beamBPtr = beamBPtrIn;
44 beamHadAPtr = beamAPtr;
45 beamHadBPtr = beamBPtr;
46 beamPomAPtr = beamPomAPtrIn;
47 beamPomBPtr = beamPomBPtrIn;
48 couplingsPtr = couplingsPtrIn;
49 partonSystemsPtr = partonSystemsPtrIn;
50 timesDecPtr = timesDecPtrIn;
51 timesPtr = timesPtrIn;
52 spacePtr = spacePtrIn;
53 rHadronsPtr = rHadronsPtrIn;
54 userHooksPtr = userHooksPtrIn;
56 mergingHooksPtr = mergingHooksPtrIn;
59 doMinBias = settings.flag(
"SoftQCD:all")
60 || settings.flag(
"SoftQCD:minBias");
61 doDiffraction = settings.flag(
"SoftQCD:all")
62 || settings.flag(
"SoftQCD:singleDiffractive")
63 || settings.flag(
"SoftQCD:doubleDiffractive");
66 mMinDiff = settings.parm(
"Diffraction:mMinPert");
67 mWidthDiff = settings.parm(
"Diffraction:mWidthPert");
68 pMaxDiff = settings.parm(
"Diffraction:probMaxPert");
69 if (mMinDiff + mWidthDiff > infoPtr->eCM()) doDiffraction =
false;
73 doMPI = settings.flag(
"PartonLevel:MPI");
78 if (doMinBias || doDiffraction) doMPIinit =
true;
79 if (!settings.flag(
"PartonLevel:all")) doMPIinit =
false;
83 bool hasMergingHooks = (mergingHooksPtr > 0);
84 doMerging = settings.flag(
"Merging:doUserMerging")
85 || settings.flag(
"Merging:doMGMerging")
86 || settings.flag(
"Merging:doKTMerging");
87 doMerging = doMerging && hasMergingHooks;
89 doMergeFirstEmm = doMerging && !doTrial;
95 doISR = settings.flag(
"PartonLevel:ISR");
96 bool FSR = settings.flag(
"PartonLevel:FSR");
97 bool FSRinProcess = settings.flag(
"PartonLevel:FSRinProcess");
98 bool interleaveFSR = settings.flag(
"TimeShower:interleave");
99 doFSRduringProcess = FSR && FSRinProcess && interleaveFSR;
100 doFSRafterProcess = FSR && FSRinProcess && !interleaveFSR;
101 doFSRinResonances = FSR && settings.flag(
"PartonLevel:FSRinResonances");
104 doRemnants = settings.flag(
"PartonLevel:Remnants");
105 doSecondHard = settings.flag(
"SecondHard:generate");
108 allowRH = settings.flag(
"RHadrons:allow");
111 hasLeptonBeams = ( beamAPtr->isLepton() || beamBPtr->isLepton() );
112 hasPointLeptons = ( hasLeptonBeams
113 && (beamAPtr->isUnresolved() || beamBPtr->isUnresolved() ) );
114 if (hasLeptonBeams) {
120 if (hasPointLeptons) {
126 canVetoPT = (userHooksPtr > 0) ? userHooksPtr->canVetoPT() :
false;
127 pTvetoPT = (canVetoPT) ? userHooksPtr->scaleVetoPT() : -1.;
128 canVetoStep = (userHooksPtr > 0) ? userHooksPtr->canVetoStep() :
false;
129 nVetoStep = (canVetoStep) ? userHooksPtr->numberVetoStep() : -1;
130 canVetoMPIStep = (userHooksPtr > 0) ? userHooksPtr->canVetoMPIStep() :
false;
131 nVetoMPIStep = (canVetoStep) ? userHooksPtr->numberVetoMPIStep() : -1;
134 canSetScale = (userHooksPtr > 0) ? userHooksPtr->canSetResonanceScale()
138 timesPtr->init( beamAPtr, beamBPtr);
139 if (doISR) spacePtr->init( beamAPtr, beamBPtr);
140 doMPIMB = multiMB.init( doMPIinit, 0, infoPtr, settings, particleDataPtr,
141 rndmPtr, beamAPtr, beamBPtr, couplingsPtr, partonSystemsPtr, sigmaTotPtr,
143 if (doDiffraction) doMPISDA = multiSDA.init( doMPIinit, 1, infoPtr,
144 settings, particleDataPtr, rndmPtr, beamPomBPtr, beamAPtr, couplingsPtr,
145 partonSystemsPtr, sigmaTotPtr, userHooksPtr);
146 if (doDiffraction) doMPISDB = multiSDB.init( doMPIinit, 2, infoPtr,
147 settings, particleDataPtr, rndmPtr, beamPomAPtr, beamBPtr, couplingsPtr,
148 partonSystemsPtr, sigmaTotPtr, userHooksPtr);
149 remnants.init( infoPtr, settings, rndmPtr, beamAPtr, beamBPtr,
154 if (doMPIinit && !doMPIMB)
return false;
155 if (doMPIinit && doDiffraction && (!doMPISDA || !doMPISDB))
return false;
156 if (!doMPIMB || !doMPISDA || !doMPISDB) doMPI =
false;
164 void PartonLevel::resetTrial() {
167 partonSystemsPtr->clear();
170 beamHadAPtr->clear();
171 beamHadBPtr->clear();
172 beamPomAPtr->clear();
173 beamPomBPtr->clear();
185 bool PartonLevel::next(
Event& process,
Event& event) {
188 isResolved = infoPtr->isResolved();
189 isResolvedA = isResolved;
190 isResolvedB = isResolved;
191 isDiffA = infoPtr->isDiffractiveA();
192 isDiffB = infoPtr->isDiffractiveB();
193 isDiff = isDiffA || isDiffB;
194 isDoubleDiff = isDiffA && isDiffB;
195 isSingleDiff = isDiff && !isDoubleDiff;
196 isMinBias = infoPtr->isMinBias();
202 if (!isResolved) nHardLoop = (isDiff) ? decideResolvedDiff( process) : 0;
207 if (!isResolvedA || !isResolvedB) {
208 bool physical = setupUnresolvedSys( process, event);
209 if (!physical || nHardLoop == 0)
return physical;
210 sizeProcess = process.size();
211 sizeEvent =
event.size();
217 int nBranchMax = (doTrial) ? nTrialEmissions : -1;
221 for (
int iHardLoop = 1; iHardLoop <= nHardLoop; ++iHardLoop) {
222 infoPtr->setCounter(20, iHardLoop);
223 infoPtr->setCounter(21);
226 if (iHardLoop == 2) {
227 sizeProcess = process.size();
228 sizeEvent =
event.size();
229 partonSystemsPtr->clear();
235 event.saveJunctionSize();
239 if (isDiff) setupResolvedDiff(iHardLoop, process);
242 if (doMPIinit) multiPtr->reset();
245 if (isMinBias || isDiff) {
247 multiPtr->setupFirstSys( process);
252 bool physical =
true;
254 for (
int iTry = 0; iTry < NTRY; ++ iTry) {
255 infoPtr->addCounter(21);
256 for (
int i = 22; i < 32; ++i) infoPtr->setCounter(i);
260 nMPI = (doSecondHard) ? 2 : 1;
271 setupHardSys( iHardLoop, process, event);
274 if (canVetoMPIStep) {
275 doVeto = userHooksPtr->doVetoMPIStep( 1, event);
278 if (isDiff) leaveResolvedDiff( iHardLoop, event);
284 double Q2Fac = infoPtr->Q2Fac();
285 double Q2Ren = infoPtr->Q2Ren();
286 bool limitPTmaxISR = (doISR)
287 ? spacePtr->limitPTmax( event, Q2Fac, Q2Ren) :
false;
288 bool limitPTmaxFSR = (doFSRduringProcess)
289 ? timesPtr->limitPTmax( event, Q2Fac, Q2Ren) :
false;
290 bool limitPTmaxMPI = (doMPI) ? multiPtr->limitPTmax( event) :
false;
293 double pTscale = process.scale();
294 if (doSecondHard) pTscale = max( pTscale, process.scaleSecond() );
295 double pTmaxMPI = (limitPTmaxMPI) ? pTscale : infoPtr->eCM();
296 double pTmaxISR = (limitPTmaxISR) ? spacePtr->enhancePTmax() * pTscale
298 double pTmaxFSR = (limitPTmaxFSR) ? timesPtr->enhancePTmax() * pTscale
300 double pTmax = max( pTmaxMPI, max( pTmaxISR, pTmaxFSR) );
301 pTsaveMPI = pTmaxMPI;
302 pTsaveISR = pTmaxISR;
303 pTsaveFSR = pTmaxFSR;
306 if (doMPI) multiPtr->prepare( event, pTmaxMPI);
307 if (doISR) spacePtr->prepare( 0, event, limitPTmaxISR);
308 if (doFSRduringProcess) timesPtr->prepare( 0, event, limitPTmaxFSR);
309 if (doSecondHard && doISR) spacePtr->prepare( 1, event, limitPTmaxISR);
310 if (doSecondHard && doFSRduringProcess)
311 timesPtr->prepare( 1, event, limitPTmaxFSR);
314 if (!isDiff) infoPtr->setImpact( multiPtr->bMPI(), multiPtr->enhanceMPI());
318 double pTveto = pTvetoPT;
323 infoPtr->addCounter(22);
325 nRad = nISR + nFSRinProc;
330 double pTtimes = (doFSRduringProcess)
331 ? timesPtr->pTnext( event, pTmaxFSR, pTgen) : -1.;
332 pTgen = max( pTgen, pTtimes);
333 double pTmulti = (doMPI)
334 ? multiPtr->pTnext( pTmaxMPI, pTgen, event) : -1.;
335 pTgen = max( pTgen, pTmulti);
336 double pTspace = (doISR)
337 ? spacePtr->pTnext( event, pTmaxISR, pTgen, nRad) : -1.;
338 double pTnow = max( pTtimes, max( pTmulti, pTspace));
339 infoPtr->setPTnow( pTnow);
342 if (pTveto > 0. && pTveto > pTnow) {
344 doVeto = userHooksPtr->doVetoPT( typeLatest, event);
347 if (isDiff) leaveResolvedDiff( iHardLoop, event);
353 if (pTmulti > 0. && pTmulti > pTspace && pTmulti > pTtimes) {
354 infoPtr->addCounter(23);
355 if (multiPtr->scatter( event)) {
358 if (canVetoMPIStep && nMPI <= nVetoMPIStep) typeVetoStep = 1;
361 if (doISR) spacePtr->prepare( nMPI - 1, event);
362 if (doFSRduringProcess) timesPtr->prepare( nMPI - 1, event);
367 pTmaxISR = min( pTmulti, pTmaxISR);
368 pTmaxFSR = min( pTmulti, pTmaxFSR);
372 pTLastBranch = pTmulti;
377 else if (pTspace > 0. && pTspace > pTtimes) {
378 infoPtr->addCounter(24);
379 if (spacePtr->branch( event)) {
381 iSysNow = spacePtr->system();
383 if (iSysNow == 0) ++nISRhard;
384 if (canVetoStep && iSysNow == 0 && nISRhard <= nVetoStep)
388 if (doFSRduringProcess) timesPtr->update( iSysNow, event);
391 pTLastBranch = pTspace;
396 }
else if (spacePtr->doRestart()) {
402 pTmaxMPI = min( pTspace, pTmaxMPI);
404 pTmaxFSR = min( pTspace, pTmaxFSR);
409 else if (pTtimes > 0.) {
410 infoPtr->addCounter(25);
411 if (timesPtr->branch( event,
true)) {
413 iSysNow = timesPtr->system();
415 if (iSysNow == 0) ++nFSRhard;
416 if (canVetoStep && iSysNow == 0 && nFSRhard <= nVetoStep)
420 if (doISR) spacePtr->update( iSysNow, event);
423 pTLastBranch = pTtimes;
429 pTmaxMPI = min( pTtimes, pTmaxMPI);
430 pTmaxISR = min( pTtimes, pTmaxISR);
440 if (typeVetoStep == 1) {
441 doVeto = userHooksPtr->doVetoMPIStep( nMPI, event);
442 }
else if (typeVetoStep > 1) {
443 doVeto = userHooksPtr->doVetoStep( typeVetoStep, nISRhard,
449 if (isDiff) leaveResolvedDiff( iHardLoop, event);
454 if (typeLatest > 0 && typeLatest < 4)
455 infoPtr->addCounter(25 + typeLatest);
456 infoPtr->setPartEvolved( nMPI, nISR);
458 if(doMergeFirstEmm && (nISRhard + nFSRhard == 1)){
460 int nSteps = mergingHooksPtr->getNumberOfClusteringSteps(process);
462 int nJetMax = mergingHooksPtr->nMaxJets();
464 double tms = mergingHooksPtr->tms();
467 if(mergingHooksPtr->doKTMerging() || mergingHooksPtr->doMGMerging())
468 tnow = mergingHooksPtr->kTms(event);
470 tnow = mergingHooksPtr->tmsDefinition(event);
472 if(nSteps < nJetMax && tnow > tms){
473 mergingHooksPtr->setWeight(0.);
478 if (isDiff) leaveResolvedDiff( iHardLoop, event);
483 }
while (pTmax > 0. && (nBranchMax <= 0 || nBranch < nBranchMax) );
486 if (doFSRafterProcess && (nBranchMax <= 0 || nBranch < nBranchMax) ) {
490 for (
int i = 0; i <
event.size(); ++i)
491 if (event[i].isFinal() &&
event[i].scale() > pTmax)
492 pTmax = event[i].scale();
496 for (
int iSys = 0; iSys < partonSystemsPtr->sizeSys(); ++iSys)
497 timesPtr->prepare( iSys, event);
505 infoPtr->addCounter(29);
507 double pTtimes = timesPtr->pTnext( event, pTmax, 0.);
508 infoPtr->setPTnow( pTtimes);
511 if (pTveto > 0. && pTveto > pTtimes) {
513 doVeto = userHooksPtr->doVetoPT( 4, event);
516 if (isDiff) leaveResolvedDiff( iHardLoop, event);
523 infoPtr->addCounter(30);
524 if (timesPtr->branch( event,
true)) {
525 iSysNow = timesPtr->system();
527 if (iSysNow == 0) ++nFSRhard;
528 if (canVetoStep && iSysNow == 0 && nFSRhard <= nVetoStep)
532 pTLastBranch = pTtimes;
543 if (typeVetoStep > 0) {
544 doVeto = userHooksPtr->doVetoStep( typeVetoStep, nISRhard,
548 if (isDiff) leaveResolvedDiff( iHardLoop, event);
553 if(doMergeFirstEmm && (nISRhard + nFSRhard == 1)){
555 int nSteps = mergingHooksPtr->getNumberOfClusteringSteps(process);
557 int nJetMax = mergingHooksPtr->nMaxJets();
559 double tms = mergingHooksPtr->tms();
562 if(mergingHooksPtr->doKTMerging() || mergingHooksPtr->doMGMerging())
563 tnow = mergingHooksPtr->kTms(event);
565 tnow = mergingHooksPtr->tmsDefinition(event);
567 if(nSteps < nJetMax && tnow > tms){
568 mergingHooksPtr->setWeight(0.);
573 if (isDiff) leaveResolvedDiff( iHardLoop, event);
579 infoPtr->addCounter(31);
580 }
while (pTmax > 0. && (nBranchMax <= 0 || nBranch < nBranchMax) );
584 if (physical && doRemnants && !remnants.add( event)) physical =
false;
590 if (!isDiff)
event.clear();
593 event.restoreJunctionSize();
597 partonSystemsPtr->clear();
601 if (isDiff) leaveResolvedDiff( iHardLoop, event);
602 if (!physical)
return false;
608 if(nBranchMax <= 0 || nBranch < nBranchMax)
609 doVeto = !resonanceShowers( process, event,
true);
611 if (doVeto)
return false;
614 infoPtr->setEvolution( pTsaveMPI, pTsaveISR, pTsaveFSR,
615 nMPI, nISR, nFSRinProc, nFSRinRes);
617 multiPtr->setEmpty();
618 infoPtr->setImpact( multiPtr->bMPI(), multiPtr->enhanceMPI());
629 int PartonLevel::decideResolvedDiff(
Event& process) {
633 for (
int iDiffSys = 1; iDiffSys <= 2; ++iDiffSys) {
634 int iDiffMot = iDiffSys + 2;
637 double mDiff = process[iDiffMot].m();
638 bool isHighMass = ( mDiff > mMinDiff && rndmPtr->flat()
639 < pMaxDiff * ( 1. - exp( -(mDiff - mMinDiff) / mWidthDiff ) ) );
642 if (isHighMass) ++nHighMass;
643 if (iDiffSys == 1) isResolvedA = isHighMass;
644 if (iDiffSys == 2) isResolvedB = isHighMass;
654 bool PartonLevel::setupUnresolvedSys(
Event& process,
Event& event) {
660 for (
int i = 0; i < process.size(); ++ i) event.append( process[i]);
663 for (
int i = 0; i < 2; ++i)
664 if ( (i == 0 && isDiffA && !isResolvedA)
665 || (i == 1 && isDiffB && !isResolvedB) ) {
667 BeamParticle* beamPtr = (i == 0) ? beamAPtr : beamBPtr;
670 double mDiff = process[iBeam].m();
671 double m2Diff = mDiff*mDiff;
672 double beta = process[iBeam].pAbs() / process[iBeam].e();
673 double theta = process[iBeam].theta();
674 double phi = process[iBeam].phi();
677 bool gluonIsKicked = beamPtr->pickGluon(mDiff);
678 int id1 = beamPtr->pickValence();
679 int id2 = beamPtr->pickRemnant();
682 double m1 = particleDataPtr->constituentMass(id1);
683 double m2 = particleDataPtr->constituentMass(id2);
684 if (m1 + m2 > 0.5 * mDiff) {
685 double reduce = 0.5 * mDiff / (m1 + m2);
691 if (!gluonIsKicked) {
692 double pAbs = sqrt( pow2(m2Diff - m1*m1 - m2*m2)
693 - pow2(2. * m1 * m2) ) / (2. * mDiff);
694 double e1 = (m2Diff + m1*m1 - m2*m2) / (2. * mDiff);
695 double e2 = (m2Diff + m2*m2 - m1*m1) / (2. * mDiff);
696 Vec4 p1(0.,0., -pAbs, e1);
697 Vec4 p2(0.,0., pAbs, e2);
700 p1.bst(0., 0., beta); p1.rot(theta, phi);
701 p2.bst(0., 0., beta); p2.rot(theta, phi);
704 int col1, acol1, col2, acol2;
705 if (particleDataPtr->colType(id1) == 1) {
706 col1 =
event.nextColTag(); acol1 = 0;
707 col2 = 0; acol2 = col1;
709 col1 = 0; acol1 =
event.nextColTag();
710 col2 = acol1; acol2 = 0;
713 process.nextColTag();
716 int iDauBeg =
event.append( id1, 23, iBeam, 0, 0, 0, col1, acol1,
718 int iDauEnd =
event.append( id2, 63, iBeam, 0, 0, 0, col2, acol2,
720 event[iBeam].statusNeg();
721 event[iBeam].daughters(iDauBeg, iDauEnd);
726 double m2Sys, zSys, pxSys, pySys, mTS1, mTS2;
727 zSys = beamPtr->zShare(mDiff, m1, m2);
730 pxSys = beamPtr->pxShare();
731 pySys = beamPtr->pyShare();
732 mTS1 = m1*m1 + pxSys*pxSys + pySys*pySys;
733 mTS2 = m2*m2 + pxSys*pxSys + pySys*pySys;
734 m2Sys = mTS1 / zSys + mTS2 / (1. - zSys);
737 double pAbs = (m2Diff - m2Sys) / (2. * mDiff);
738 Vec4 pG(0., 0., -pAbs, pAbs);
739 Vec4 pRem(0., 0., pAbs, mDiff - pAbs);
742 double e1 = 0.5 * (zSys * mDiff + mTS1 / (zSys * mDiff));
743 double pL1 = 0.5 * (zSys * mDiff - mTS1 / (zSys * mDiff));
744 Vec4 p1(pxSys, pySys, pL1, e1);
748 pG.bst(0., 0., beta); pG.rot(theta, phi);
749 p1.bst(0., 0., beta); p1.rot(theta, phi);
750 p2.bst(0., 0., beta); p2.rot(theta, phi);
753 int colG, acolG, col1, acol1, col2, acol2;
754 if (particleDataPtr->colType(id1) == 1) {
755 col1 =
event.nextColTag(); acol1 = 0;
756 colG =
event.nextColTag(); acolG = col1;
757 col2 = 0; acol2 = colG;
759 col1 = 0; acol1 =
event.nextColTag();
760 colG = acol1; acolG =
event.nextColTag();
761 col2 = acolG; acol2 = 0;
764 process.nextColTag();
765 process.nextColTag();
768 int iDauBeg =
event.append( 21, 23, iBeam, 0, 0, 0, colG, acolG,
770 event.append( id1, 63, iBeam, 0, 0, 0, col1, acol1, p1, m1);
771 int iDauEnd =
event.append( id2, 63, iBeam, 0, 0, 0, col2, acol2,
773 event[iBeam].statusNeg();
774 event[iBeam].daughters(iDauBeg, iDauEnd);
787 void PartonLevel::setupHardSys(
int iHardLoop,
Event& process,
796 int iDiffSys = (iHardLoop == 2 || !isResolvedA) ? 2 : 1;
797 int iDiffMot = iDiffSys + 2;
798 int iDiffDau = process.size() - 1;
799 int nOffset = sizeEvent - sizeProcess;
808 event[inS].statusNeg();
809 event[inS].daughters( inP - 2 + nOffset, inM - 2 + nOffset);
813 int iBeginSecond = process.size();
816 while (process[iBeginSecond].status() != -21) ++iBeginSecond;
820 if (process[inP].m() != 0. || process[inM].m() != 0.) {
821 double pPos = process[inP].pPos() + process[inM].pPos();
822 double pNeg = process[inP].pNeg() + process[inM].pNeg();
823 process[inP].pz( 0.5 * pPos);
824 process[inP].e( 0.5 * pPos);
826 process[inM].pz(-0.5 * pNeg);
827 process[inM].e( 0.5 * pNeg);
832 double x1 = process[inP].pPos() / process[inS].m();
833 beamAPtr->append( inP + nOffset, process[inP].
id(), x1);
834 double x2 = process[inM].pNeg() / process[inS].m();
835 beamBPtr->append( inM + nOffset, process[inM].
id(), x2);
841 double scale = process.scale();
843 beamAPtr->xfISR( 0, process[inP].
id(), x1, scale*scale);
844 if (isMinBias && (vsc1 = multiPtr->getVSC1()) != 0)
845 (*beamAPtr)[0].companion(vsc1);
846 else vsc1 = beamAPtr->pickValSeaComp();
847 beamBPtr->xfISR( 0, process[inM].
id(), x2, scale*scale);
848 if (isMinBias && (vsc2 = multiPtr->getVSC2()) != 0)
849 (*beamBPtr)[0].companion(vsc2);
850 else vsc2 = beamBPtr->pickValSeaComp();
851 bool isVal1 = (vsc1 == -3);
852 bool isVal2 = (vsc2 == -3);
853 infoPtr->setValence( isVal1, isVal2);
856 nHardDone = sizeProcess;
857 iPosBefShow.resize( process.size() );
858 fill (iPosBefShow.begin(),iPosBefShow.end(),0);
861 for (
int i = sizeProcess; i < iBeginSecond; ++ i) {
862 if (process[i].mother1() > inM)
break;
863 int j =
event.append(process[i]);
868 int iOrd = i - iBeginSecond + 7;
869 if (iOrd == 1 || iOrd == 2)
870 event[j].offsetHistory( 0, 0, 0, nOffset);
871 else if (iOrd == 3 || iOrd == 4)
872 event[j].offsetHistory( 0, nOffset, 0, nOffset);
873 else if (iOrd == 5 || iOrd == 6)
874 event[j].offsetHistory( 0, nOffset, 0, 0);
878 if (event[j].status() == -22) {
879 event[j].statusPos();
880 event[j].daughters(0, 0);
888 partonSystemsPtr->addSys();
889 partonSystemsPtr->setInA(0, inP + nOffset);
890 partonSystemsPtr->setInB(0, inM + nOffset);
891 for (
int i = inM + 1; i < nHardDone; ++i)
892 partonSystemsPtr->addOut(0, i + nOffset);
893 partonSystemsPtr->setSHat( 0,
894 (event[inP + nOffset].p() + event[inM + nOffset].p()).m2Calc() );
899 int inP2 = iBeginSecond;
900 int inM2 = iBeginSecond + 1;
904 x1 = process[inP2].pPos() / process[0].e();
905 beamAPtr->append( inP2, process[inP2].
id(), x1);
906 x2 = process[inM2].pNeg() / process[0].e();
907 beamBPtr->append( inM2, process[inM2].
id(), x2);
910 scale = process.scaleSecond();
911 beamAPtr->xfISR( 1, process[inP2].
id(), x1, scale*scale);
912 beamAPtr->pickValSeaComp();
913 beamBPtr->xfISR( 1, process[inM2].
id(), x2, scale*scale);
914 beamBPtr->pickValSeaComp();
917 for (
int i = inP2; i < process.size(); ++ i) {
918 int mother = process[i].mother1();
919 if ( (mother > 2 && mother < inP2) || mother > inM2 )
break;
920 event.append(process[i]);
924 if (event[i].status() == -22) {
925 event[i].statusPos();
926 event[i].daughters(0, 0);
934 partonSystemsPtr->addSys();
935 partonSystemsPtr->setInA(1, inP2);
936 partonSystemsPtr->setInB(1, inM2);
937 for (
int i = inM2 + 1; i < nHardDone; ++i)
938 partonSystemsPtr->addOut(1, i);
939 partonSystemsPtr->setSHat( 1,
940 (event[inP2].p() + event[inM2].p()).m2Calc() );
947 for (
int i = 0; i < process.size(); ++ i) {
948 if (process[i].col() > maxColTag) maxColTag = process[i].col();
949 if (process[i].acol() > maxColTag) maxColTag = process[i].acol();
951 event.initColTag(maxColTag);
954 for (
int i = 0; i < process.sizeJunction(); ++i)
955 event.appendJunction( process.getJunction(i));
964 void PartonLevel::setupResolvedDiff(
int iHardLoop,
Event& process) {
967 int iDiffSys = (iHardLoop == 2 || !isResolvedA) ? 2 : 1;
968 int iDiffMot = iDiffSys + 2;
969 int iDiffDau = process.size() - 1;
972 double mDiff = process[iDiffMot].m();
973 double m2Diff = mDiff * mDiff;
976 process[iDiffMot].statusNeg();
977 process[iDiffMot].daughters( iDiffDau + 1, iDiffDau + 2);
980 int idHad = process[iDiffSys].id();
981 double mHad = process[iDiffSys].m();
982 double m2Had = mHad * mHad;
983 double m2Pom = (process[2].p() - process[4].p()).m2Calc();
984 double mPom = (m2Pom >= 0.) ? sqrt(m2Pom) : -sqrt(-m2Pom);
985 double eHad = 0.5 * (m2Diff + m2Had - m2Pom) / mDiff;
986 double ePom = 0.5 * (m2Diff + m2Pom - m2Had) / mDiff;
987 double pzHP = 0.5 * sqrtpos( pow2(m2Diff - m2Had - m2Pom)
988 - 4. * m2Had * m2Pom ) / mDiff;
989 process.append( 990, 13, iDiffMot, 0, 0, 0, 0, 0,
990 0., 0., pzHP, ePom, mPom);
991 process.append( idHad, 13, iDiffMot, 0, 0, 0, 0, 0,
992 0., 0., -pzHP, eHad, mHad);
995 multiPtr = (iDiffSys == 1) ? &multiSDA : &multiSDB;
999 beamAPtr = beamPomBPtr;
1000 beamBPtr = beamHadAPtr;
1002 beamAPtr = beamPomAPtr;
1003 beamBPtr = beamHadBPtr;
1007 int beamOffset = (sizeEvent > 0) ? sizeEvent - 1 : 4;
1010 timesPtr->reassignBeamPtrs( beamAPtr, beamBPtr, beamOffset);
1011 spacePtr->reassignBeamPtrs( beamAPtr, beamBPtr);
1012 remnants.reassignBeamPtrs( beamAPtr, beamBPtr);
1015 eCMsave = infoPtr->eCM();
1016 infoPtr->setECM( mDiff);
1017 beamAPtr->newPzE( pzHP, ePom);
1018 beamBPtr->newPzE( -pzHP, eHad);
1026 void PartonLevel::leaveResolvedDiff(
int iHardLoop,
Event& event) {
1029 int iDiffSys = (iHardLoop == 2 || !isResolvedA) ? 2 : 1;
1032 Vec4 pPom =
event[3 - iDiffSys].p() -
event[5 - iDiffSys].p();
1033 Vec4 pHad =
event[iDiffSys].p();
1035 MtoCM.fromCMframe( pPom, pHad);
1038 int iFirst = (iHardLoop == 1) ? 5 + sizeEvent - sizeProcess : sizeEvent;
1039 for (
int i = iFirst; i <
event.size(); ++i)
1040 event[i].rotbst( MtoCM);
1043 multiPtr = &multiMB;
1046 beamAPtr = beamHadAPtr;
1047 beamBPtr = beamHadBPtr;
1050 timesPtr->reassignBeamPtrs( beamAPtr, beamBPtr, 0);
1051 spacePtr->reassignBeamPtrs( beamAPtr, beamBPtr);
1052 remnants.reassignBeamPtrs( beamAPtr, beamBPtr);
1055 infoPtr->setECM( eCMsave);
1056 beamAPtr->newPzE( event[1].pz(), event[1].e());
1057 beamBPtr->newPzE( event[2].pz(), event[2].e());
1065 bool PartonLevel::resonanceShowers(
Event& process,
Event& event,
1071 nHardDoneRHad = nHardDone;
1072 inRHadDecay.resize(0);
1073 for (
int i = 0; i < process.size(); ++i)
1074 inRHadDecay.push_back(
false);
1075 }
else nHardDone = nHardDoneRHad;
1082 int nBranchMax = (doTrial) ? nTrialEmissions : -1;
1084 while (nHardDone < process.size()) {
1086 int iBegin = nHardDone;
1092 bool comesFromR =
false;
1093 int iTraceUp = iBegin;
1095 if ( rHadronsPtr->givesRHadron(process[iTraceUp].id()) )
1097 iTraceUp = process[iTraceUp].mother1();
1098 }
while (iTraceUp > 0 && !comesFromR);
1100 inRHadDecay[iBegin] =
true;
1107 }
else if (!inRHadDecay[iBegin]) {
1114 int iHardMother = process[iBegin].mother1();
1115 Particle& hardMother = process[iHardMother];
1116 int iBefMother = iPosBefShow[iHardMother];
1117 int iAftMother =
event.iBotCopyId(iBefMother);
1120 int iTraceRHadron = rHadronsPtr->trace( iAftMother);
1121 if (iTraceRHadron > 0) iAftMother = iTraceRHadron;
1123 Particle& aftMother =
event[iAftMother];
1126 aftMother.statusNeg();
1130 int colBef = hardMother.col();
1131 int acolBef = hardMother.acol();
1132 int colAft = aftMother.col();
1133 int acolAft = aftMother.acol();
1135 M.bst( hardMother.p(), aftMother.p());
1138 for (
int i = iBegin; i < process.size(); ++ i) {
1139 if (process[i].mother1() != iHardMother)
break;
1140 int iNow =
event.append( process[i] );
1141 iPosBefShow[i] = iNow;
1142 Particle& now =
event.back();
1145 if (now.status() == -22) {
1147 now.daughters(0, 0);
1151 if (i == iBegin)
event[iAftMother].daughter1( iNow);
1152 else event[iAftMother].daughter2( iNow);
1153 now.mother1(iAftMother);
1156 if (now.col() == colBef) now.col( colAft);
1157 if (now.acol() == acolBef) now.acol( acolAft);
1161 if (now.hasVertex()) now.vProd( aftMother.vDec() );
1166 int iEnd = nHardDone - 1;
1172 if (doFSRinResonances) {
1173 double pTmax = 0.5 * hardMother.m();
1174 if (canSetScale) pTmax
1175 = userHooksPtr->scaleResonance( iAftMother, event);
1179 int iSys = partonSystemsPtr->addSys();
1180 partonSystemsPtr->setSHat(iSys, pow2(hardMother.m()) );
1183 for (
int i = iPosBefShow[iBegin]; i <= iPosBefShow[iEnd]; ++i)
1184 if (event[i].isFinal()) partonSystemsPtr->addOut( iSys, i);
1187 timesDecPtr->prepare( iSys, event);
1194 double pTveto = pTvetoPT;
1199 double pTtimes = timesDecPtr->pTnext( event, pTmax, 0.);
1202 if (pTveto > 0. && pTveto > pTtimes) {
1204 doVeto = userHooksPtr->doVetoPT( 5, event);
1206 if (doVeto)
return false;
1211 if (timesDecPtr->branch( event)) {
1214 if (canVetoStep && nFSRhard <= nVetoStep) typeVetoStep = 5;
1217 pTLastBranch = pTtimes;
1228 if (typeVetoStep > 0) {
1229 doVeto = userHooksPtr->doVetoStep( typeVetoStep, 0, nFSRhard,
1232 if (doVeto)
return false;
1235 if(doMergeFirstEmm && nFSRhard == 1){
1237 int nSteps = mergingHooksPtr->getNumberOfClusteringSteps(process);
1239 int nJetMax = mergingHooksPtr->nMaxJets();
1241 double tms = mergingHooksPtr->tms();
1244 if(mergingHooksPtr->doKTMerging() || mergingHooksPtr->doMGMerging())
1245 tnow = mergingHooksPtr->kTms(event);
1247 tnow = mergingHooksPtr->tmsDefinition(event);
1249 if(nSteps < nJetMax && tnow > tms){
1250 mergingHooksPtr->setWeight(0.);
1254 if (doVeto)
return false;
1258 }
while (pTmax > 0. && (nBranchMax <= 0 || nBranch < nBranchMax) );
1264 if (skipForR) nFSRinRes = nFSRres;