9 #include "Pythia8/Merging.h"
21 const double Merging::TMSMISMATCH = 1.5;
27 void Merging::init( Settings* settingsPtrIn, Info* infoPtrIn,
28 ParticleData* particleDataPtrIn, Rndm* rndmPtrIn,
29 BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
30 MergingHooks* mergingHooksPtrIn, PartonLevel* trialPartonLevelPtrIn ){
33 settingsPtr = settingsPtrIn;
35 particleDataPtr = particleDataPtrIn;
37 mergingHooksPtr = mergingHooksPtrIn;
38 trialPartonLevelPtr = trialPartonLevelPtrIn;
39 beamAPtr = beamAPtrIn;
40 beamBPtr = beamBPtrIn;
42 tmsNowMin = infoPtr->eCM();
49 void Merging::statistics( ostream& os ) {
52 bool enforceCutOnLHE = settingsPtr->flag(
"Merging:enforceCutOnLHE");
54 double tmsval = mergingHooksPtr->tms();
55 bool printBanner = enforceCutOnLHE && tmsNowMin > TMSMISMATCH*tmsval;
57 tmsNowMin = infoPtr->eCM();
59 if (!printBanner)
return;
62 os <<
"\n *------- PYTHIA Matrix Element Merging Information ------"
63 <<
"-------------------------------------------------------*\n"
68 os <<
" | Warning in Merging::statistics: All Les Houches events"
69 <<
" significantly above Merging:TMS cut. Please check. |\n";
74 <<
" *------- End PYTHIA Matrix Element Merging Information -----"
75 <<
"-----------------------------------------------------*" << endl;
82 int Merging::mergeProcess(
Event& process){
87 mergingHooksPtr->hardProcess.clear();
88 mergingHooksPtr->processSave = settingsPtr->word(
"Merging:Process");
89 mergingHooksPtr->hardProcess.initOnProcess(
90 settingsPtr->word(
"Merging:Process"), particleDataPtr);
93 bool applyTMSCut = settingsPtr->flag(
"Merging:doXSectionEstimate");
94 if ( applyTMSCut && cutOnProcess(process) )
return -1;
96 if ( applyTMSCut )
return 1;
99 if ( mergingHooksPtr->doCKKWLMerging() )
100 vetoCode = mergeProcessCKKWL(process);
103 if ( mergingHooksPtr->doUMEPSMerging() )
104 vetoCode = mergeProcessUMEPS(process);
107 if ( mergingHooksPtr->doNL3Merging() )
108 vetoCode = mergeProcessNL3(process);
111 if ( mergingHooksPtr->doUNLOPSMerging() )
112 vetoCode = mergeProcessUNLOPS(process);
122 int Merging::mergeProcessCKKWL(
Event& process) {
125 mergingHooksPtr->doIgnoreStep(
true);
128 if ( mergingHooksPtr->getProcessString().compare(
"pp>h") == 0 )
129 mergingHooksPtr->allowCutOnRecState(
true);
131 mergingHooksPtr->orderHistories(
true);
135 mergingHooksPtr->setWeightCKKWL(1.);
136 mergingHooksPtr->muMI(-1.);
141 Event newProcess( mergingHooksPtr->bareEvent( process,
true) );
143 mergingHooksPtr->storeHardProcessCandidates( newProcess);
146 double tmsval = mergingHooksPtr->tms();
148 double tmsnow = mergingHooksPtr->tmsNow( newProcess );
150 int nSteps = mergingHooksPtr->getNumberOfClusteringSteps( newProcess);
155 int nRequested = settingsPtr->mode(
"Merging:nRequested");
156 if (nSteps < nRequested) {
157 mergingHooksPtr->setWeightCKKWL(0.);
162 tmsNowMin = (nSteps == 0) ? 0. : min(tmsNowMin, tmsnow);
165 double RN = rndmPtr->flat();
167 newProcess.scale(0.0);
169 History FullHistory( nSteps, 0.0, newProcess, Clustering(), mergingHooksPtr,
170 (*beamAPtr), (*beamBPtr), particleDataPtr, infoPtr,
true,
true,
173 FullHistory.projectOntoDesiredHistories();
177 bool applyCut = nSteps > 0 && FullHistory.select(RN)->nClusterings() > 0;
181 bool enforceCutOnLHE = settingsPtr->flag(
"Merging:enforceCutOnLHE");
182 if ( enforceCutOnLHE && applyCut && tmsnow < tmsval ) {
183 string message=
"Warning in Merging::mergeProcessCKKWL: Les Houches Event";
184 message+=
" fails merging scale cut. Reject event.";
185 infoPtr->errorMsg(message);
186 mergingHooksPtr->setWeightCKKWL(0.);
190 if ( FullHistory.select(RN)->nClusterings() < nSteps) {
191 string message=
"Warning in Merging::mergeProcessCKKWL: No clusterings";
192 message+=
" found. History incomplete.";
193 infoPtr->errorMsg(message);
199 wgt = FullHistory.weightTREE( trialPartonLevelPtr,
200 mergingHooksPtr->AlphaS_FSR(), mergingHooksPtr->AlphaS_ISR(), RN);
204 FullHistory.getStartingConditions( RN, process );
206 mergingHooksPtr->reattachResonanceDecays(process);
210 double dampWeight = mergingHooksPtr->dampenIfFailCuts(
211 FullHistory.lowestMultProc(RN) );
220 double muf = process[0].e();
221 for (
int i=0; i < process.size(); ++i )
222 if ( process[i].isFinal()
223 && (process[i].colType() != 0 || process[i].id() == 22 ) ) {
225 muf = min( muf, abs(process[i].mT()) );
229 if ( nSteps == 0 && nFinal == 2
230 && ( mergingHooksPtr->getProcessString().compare(
"pp>jj") == 0
231 || mergingHooksPtr->getProcessString().compare(
"pp>aj") == 0) )
235 mergingHooksPtr->setWeightCKKWL(wgt);
238 mergingHooksPtr->doIgnoreStep(
false);
241 if ( wgt == 0. )
return 0;
252 int Merging::mergeProcessUMEPS(
Event& process) {
255 bool doUMEPSTree = settingsPtr->flag(
"Merging:doUMEPSTree");
256 bool doUMEPSSubt = settingsPtr->flag(
"Merging:doUMEPSSubt");
258 mergingHooksPtr->nReclusterSave = settingsPtr->mode(
"Merging:nRecluster");
259 int nRecluster = settingsPtr->mode(
"Merging:nRecluster");
262 mergingHooksPtr->doIgnoreEmissions(
true);
265 if ( mergingHooksPtr->getProcessString().compare(
"pp>h") == 0 )
266 mergingHooksPtr->allowCutOnRecState(
true);
268 mergingHooksPtr->orderHistories(
true);
272 mergingHooksPtr->setWeightCKKWL(1.);
273 mergingHooksPtr->muMI(-1.);
278 Event newProcess( mergingHooksPtr->bareEvent( process,
true) );
280 mergingHooksPtr->storeHardProcessCandidates( newProcess );
283 double tmsval = mergingHooksPtr->tms();
285 double tmsnow = mergingHooksPtr->tmsNow( newProcess );
287 int nSteps = mergingHooksPtr->getNumberOfClusteringSteps( newProcess );
292 int nRequested = settingsPtr->mode(
"Merging:nRequested");
293 if (nSteps < nRequested) {
294 mergingHooksPtr->setWeightCKKWL(0.);
299 tmsNowMin = (nSteps == 0) ? 0. : min(tmsNowMin, tmsnow);
302 double RN = rndmPtr->flat();
304 newProcess.scale(0.0);
306 History FullHistory( nSteps, 0.0, newProcess, Clustering(), mergingHooksPtr,
307 (*beamAPtr), (*beamBPtr), particleDataPtr, infoPtr,
true,
true,
310 FullHistory.projectOntoDesiredHistories();
314 bool applyCut = nSteps > 0 && FullHistory.select(RN)->nClusterings() > 0;
318 bool enforceCutOnLHE = settingsPtr->flag(
"Merging:enforceCutOnLHE");
319 if ( enforceCutOnLHE && applyCut && tmsnow < tmsval ) {
320 string message=
"Warning in Merging::mergeProcessUMEPS: Les Houches Event";
321 message+=
" fails merging scale cut. Reject event.";
322 infoPtr->errorMsg(message);
323 mergingHooksPtr->setWeightCKKWL(0.);
329 if ( nSteps > 0 && doUMEPSSubt
330 && !FullHistory.getFirstClusteredEventAboveTMS( RN, nRecluster,
331 newProcess, nPerformed,
false ) ) {
333 mergingHooksPtr->setWeightCKKWL(0.);
337 mergingHooksPtr->nMinMPI(nSteps - nPerformed);
343 wgt = FullHistory.weight_UMEPS_TREE( trialPartonLevelPtr,
344 mergingHooksPtr->AlphaS_FSR(), mergingHooksPtr->AlphaS_ISR(), RN );
346 wgt = FullHistory.weight_UMEPS_SUBT( trialPartonLevelPtr,
347 mergingHooksPtr->AlphaS_FSR(), mergingHooksPtr->AlphaS_ISR(), RN );
352 if ( doUMEPSTree ) FullHistory.getStartingConditions( RN, process );
354 else FullHistory.getFirstClusteredEventAboveTMS( RN, nRecluster, process,
359 double dampWeight = mergingHooksPtr->dampenIfFailCuts(
360 FullHistory.lowestMultProc(RN) );
367 mergingHooksPtr->setWeightCKKWL(wgt);
372 double muf = process[0].e();
373 for (
int i=0; i < process.size(); ++i )
374 if ( process[i].isFinal()
375 && (process[i].colType() != 0 || process[i].id() == 22 ) ) {
377 muf = min( muf, abs(process[i].mT()) );
383 int nStepsNew = mergingHooksPtr->getNumberOfClusteringSteps( process );
385 && ( mergingHooksPtr->getProcessString().compare(
"pp>jj") == 0
386 || mergingHooksPtr->getProcessString().compare(
"pp>aj") == 0) )
390 mergingHooksPtr->storeHardProcessCandidates( process );
392 mergingHooksPtr->reattachResonanceDecays(process);
395 mergingHooksPtr->doIgnoreEmissions(
false);
398 if ( wgt == 0. )
return 0;
409 int Merging::mergeProcessNL3(
Event& process) {
412 bool doNL3Tree = settingsPtr->flag(
"Merging:doNL3Tree");
413 bool doNL3Loop = settingsPtr->flag(
"Merging:doNL3Loop");
414 bool doNL3Subt = settingsPtr->flag(
"Merging:doNL3Subt");
416 int nRequested = settingsPtr->mode(
"Merging:nRequested");
419 mergingHooksPtr->doIgnoreEmissions(
true);
421 mergingHooksPtr->doIgnoreStep(
true);
424 if ( mergingHooksPtr->getProcessString().compare(
"pp>h") == 0)
425 mergingHooksPtr->allowCutOnRecState(
true);
427 mergingHooksPtr->orderHistories(
true);
431 mergingHooksPtr->setWeightCKKWL(1.);
433 double wgtFIRST = 0.;
434 mergingHooksPtr->setWeightFIRST(0.);
435 mergingHooksPtr->muMI(-1.);
440 Event newProcess( mergingHooksPtr->bareEvent( process,
true) );
442 mergingHooksPtr->storeHardProcessCandidates( newProcess);
445 double tmsval = mergingHooksPtr->tms();
447 double tmsnow = mergingHooksPtr->tmsNow( newProcess );
449 int nSteps = mergingHooksPtr->getNumberOfClusteringSteps( newProcess);
454 if (nSteps < nRequested) {
455 mergingHooksPtr->setWeightCKKWL(0.);
456 mergingHooksPtr->setWeightFIRST(0.);
461 tmsNowMin = (nSteps == 0) ? 0. : min(tmsNowMin, tmsnow);
465 bool enforceCutOnLHE = settingsPtr->flag(
"Merging:enforceCutOnLHE");
466 if ( enforceCutOnLHE && nSteps > 0 && nSteps == nRequested
467 && tmsnow < tmsval ) {
468 string message=
"Warning in Merging::mergeProcessNL3: Les Houches Event";
469 message+=
" fails merging scale cut. Reject event.";
470 infoPtr->errorMsg(message);
471 mergingHooksPtr->setWeightCKKWL(0.);
472 mergingHooksPtr->setWeightFIRST(0.);
477 double RN = rndmPtr->flat();
479 newProcess.scale(0.0);
481 History FullHistory( nSteps, 0.0, newProcess, Clustering(), mergingHooksPtr,
482 (*beamAPtr), (*beamBPtr), particleDataPtr, infoPtr,
true,
true,
485 FullHistory.projectOntoDesiredHistories();
488 if ( nSteps > 0 && doNL3Subt
489 && FullHistory.select(RN)->nClusterings() == 0 ){
490 mergingHooksPtr->setWeightCKKWL(0.);
491 mergingHooksPtr->setWeightFIRST(0.);
497 bool containsRealKin = nSteps > nRequested && nSteps > 0;
501 if ( containsRealKin ) {
505 dummy.init(
"(hard process-modified)", particleDataPtr );
508 if ( !FullHistory.getClusteredEvent( RN, nSteps, dummy )) {
509 mergingHooksPtr->setWeightCKKWL(0.);
510 mergingHooksPtr->setWeightFIRST(0.);
513 double tnowNew = mergingHooksPtr->tmsNow( dummy );
515 if ( enforceCutOnLHE && nSteps > 0 && nRequested > 0
516 && tnowNew < tmsval ) {
517 mergingHooksPtr->setWeightCKKWL(0.);
518 mergingHooksPtr->setWeightFIRST(0.);
524 if ( doNL3Subt || containsRealKin ) mergingHooksPtr->nMinMPI(nSteps - 1);
525 else mergingHooksPtr->nMinMPI(nSteps);
532 wgt = FullHistory.weightTREE( trialPartonLevelPtr,
533 mergingHooksPtr->AlphaS_FSR(), mergingHooksPtr->AlphaS_ISR(), RN);
534 }
else if( doNL3Loop || doNL3Subt ) {
537 wgt = FullHistory.weightLOOP( trialPartonLevelPtr, RN);
542 if ( !doNL3Subt && !containsRealKin )
543 FullHistory.getStartingConditions(RN, process);
549 if ( !FullHistory.getClusteredEvent( RN, nSteps, process )) {
550 mergingHooksPtr->setWeightCKKWL(0.);
551 mergingHooksPtr->setWeightFIRST(0.);
558 double dampWeight = mergingHooksPtr->dampenIfFailCuts(
559 FullHistory.lowestMultProc(RN) );
569 if( nSteps > mergingHooksPtr->nMaxJetsNLO() )
570 kFactor = mergingHooksPtr->kFactor( mergingHooksPtr->nMaxJetsNLO() );
571 else kFactor = mergingHooksPtr->kFactor(nSteps);
577 mergingHooksPtr->setWeightCKKWL(wgt);
582 bool doOASTree = doNL3Tree && nSteps <= mergingHooksPtr->nMaxJetsNLO();
587 wgtFIRST = FullHistory.weightFIRST( trialPartonLevelPtr,
588 mergingHooksPtr->AlphaS_FSR(), mergingHooksPtr->AlphaS_ISR(), RN,
591 wgtFIRST *= dampWeight;
593 mergingHooksPtr->setWeightFIRST(wgtFIRST);
596 wgt = wgt - wgtFIRST;
602 for(
int i=0; i < process.size(); ++i)
603 if(process[i].isFinal() && process[i].colType() != 0) {
604 pT = sqrt(pow(process[i].px(),2) + pow(process[i].py(),2));
610 && mergingHooksPtr->getProcessString().compare(
"pp>jj") == 0)
614 mergingHooksPtr->storeHardProcessCandidates( process );
616 mergingHooksPtr->reattachResonanceDecays(process);
619 mergingHooksPtr->doIgnoreEmissions(
false);
621 mergingHooksPtr->doIgnoreStep(
false);
632 int Merging::mergeProcessUNLOPS(
Event& process) {
635 bool nloTilde = settingsPtr->flag(
"Merging:doUNLOPSTilde");
636 bool doUNLOPSTree = settingsPtr->flag(
"Merging:doUNLOPSTree");
637 bool doUNLOPSLoop = settingsPtr->flag(
"Merging:doUNLOPSLoop");
638 bool doUNLOPSSubt = settingsPtr->flag(
"Merging:doUNLOPSSubt");
639 bool doUNLOPSSubtNLO = settingsPtr->flag(
"Merging:doUNLOPSSubtNLO");
641 mergingHooksPtr->nReclusterSave = settingsPtr->mode(
"Merging:nRecluster");
642 int nRecluster = settingsPtr->mode(
"Merging:nRecluster");
643 int nRequested = settingsPtr->mode(
"Merging:nRequested");
646 mergingHooksPtr->doIgnoreEmissions(
true);
648 mergingHooksPtr->orderHistories(
true);
651 if ( mergingHooksPtr->getProcessString().compare(
"pp>h") == 0)
652 mergingHooksPtr->allowCutOnRecState(
true);
656 mergingHooksPtr->setWeightCKKWL(1.);
658 double wgtFIRST = 0.;
659 mergingHooksPtr->setWeightFIRST(0.);
660 mergingHooksPtr->muMI(-1.);
665 Event newProcess( mergingHooksPtr->bareEvent( process,
true) );
667 mergingHooksPtr->storeHardProcessCandidates( newProcess );
670 double tmsval = mergingHooksPtr->tms();
672 double tmsnow = mergingHooksPtr->tmsNow( newProcess );
674 int nSteps = mergingHooksPtr->getNumberOfClusteringSteps( newProcess);
679 if (nSteps < nRequested) {
680 mergingHooksPtr->setWeightCKKWL(0.);
681 mergingHooksPtr->setWeightFIRST(0.);
686 tmsNowMin = (nSteps == 0) ? 0. : min(tmsNowMin, tmsnow);
689 double RN = rndmPtr->flat();
691 newProcess.scale(0.0);
693 History FullHistory( nSteps, 0.0, newProcess, Clustering(), mergingHooksPtr,
694 (*beamAPtr), (*beamBPtr), particleDataPtr, infoPtr,
true,
true,
697 FullHistory.projectOntoDesiredHistories();
701 bool applyCut = nSteps > 0 && FullHistory.select(RN)->nClusterings() > 0;
705 bool enforceCutOnLHE = settingsPtr->flag(
"Merging:enforceCutOnLHE");
706 if ( enforceCutOnLHE && applyCut && nSteps == nRequested
707 && tmsnow < tmsval ) {
708 string message=
"Warning in Merging::mergeProcessUNLOPS: Les Houches Event";
709 message+=
" fails merging scale cut. Reject event.";
710 infoPtr->errorMsg(message);
711 mergingHooksPtr->setWeightCKKWL(0.);
712 mergingHooksPtr->setWeightFIRST(0.);
718 bool containsRealKin = nSteps > nRequested && nSteps > 0;
719 if ( containsRealKin ) nRecluster += nSteps - nRequested;
724 bool allowIncompleteReal =
725 settingsPtr->flag(
"Merging:allowIncompleteHistoriesInReal");
726 if ( doUNLOPSLoop && containsRealKin && !allowIncompleteReal
727 && FullHistory.select(RN)->nClusterings() == 0 ) {
728 mergingHooksPtr->setWeightCKKWL(0.);
729 mergingHooksPtr->setWeightFIRST(0.);
736 && ( doUNLOPSSubt || doUNLOPSSubtNLO || containsRealKin )
737 && !FullHistory.getFirstClusteredEventAboveTMS( RN, nRecluster,
738 newProcess, nPerformed,
false ) ) {
739 mergingHooksPtr->setWeightCKKWL(0.);
740 mergingHooksPtr->setWeightFIRST(0.);
744 mergingHooksPtr->nMinMPI(nSteps - nPerformed);
748 if ( containsRealKin ) {
752 dummy.init(
"(hard process-modified)", particleDataPtr );
755 FullHistory.getClusteredEvent( RN, nSteps, dummy );
756 double tnowNew = mergingHooksPtr->tmsNow( dummy );
758 if ( enforceCutOnLHE && nSteps > 0 && nRequested > 0
759 && tnowNew < tmsval ) {
760 mergingHooksPtr->setWeightCKKWL(0.);
761 mergingHooksPtr->setWeightFIRST(0.);
771 wgt = FullHistory.weight_UNLOPS_TREE( trialPartonLevelPtr,
772 mergingHooksPtr->AlphaS_FSR(), mergingHooksPtr->AlphaS_ISR(), RN);
773 }
else if( doUNLOPSLoop ) {
775 wgt = FullHistory.weight_UNLOPS_LOOP( trialPartonLevelPtr, RN);
776 }
else if( doUNLOPSSubtNLO ) {
779 wgt = FullHistory.weight_UNLOPS_SUBTNLO( trialPartonLevelPtr, RN);
780 }
else if( doUNLOPSSubt ) {
783 wgt = FullHistory.weight_UNLOPS_SUBT( trialPartonLevelPtr,
784 mergingHooksPtr->AlphaS_FSR(), mergingHooksPtr->AlphaS_ISR(), RN);
789 if (!doUNLOPSSubt && !doUNLOPSSubtNLO && !containsRealKin )
790 FullHistory.getStartingConditions(RN, process);
792 else FullHistory.getFirstClusteredEventAboveTMS( RN, nRecluster, process,
797 double dampWeight = mergingHooksPtr->dampenIfFailCuts(
798 FullHistory.lowestMultProc(RN) );
805 if ( doUNLOPSTree || doUNLOPSSubt ){
808 if ( nSteps > mergingHooksPtr->nMaxJetsNLO() )
809 kFactor = mergingHooksPtr->kFactor( mergingHooksPtr->nMaxJetsNLO() );
810 else kFactor = mergingHooksPtr->kFactor(nSteps);
812 wgt *= (nRecluster == 2 && nloTilde) ? 1. : kFactor;
816 mergingHooksPtr->setWeightCKKWL(wgt);
821 int nMaxNLO = mergingHooksPtr->nMaxJetsNLO();
822 bool doOASTree = doUNLOPSTree && nSteps <= nMaxNLO;
823 bool doOASSubt = doUNLOPSSubt && nSteps <= nMaxNLO+1 && nSteps > 0;
826 if ( doOASTree || doOASSubt ) {
829 int order = ( nSteps > 0 && nSteps <= nMaxNLO) ? 1 : -1;
834 if ( nloTilde && doUNLOPSSubt && nRecluster == 1
835 && nSteps == nMaxNLO+1 ) order = 0;
841 if (nloTilde && doUNLOPSSubt && ( nSteps > nMaxNLO+1
842 || (nSteps == nMaxNLO+1 && nPerformed != nRecluster) ))
846 wgtFIRST = FullHistory.weight_UNLOPS_CORRECTION( order,
847 trialPartonLevelPtr, mergingHooksPtr->AlphaS_FSR(),
848 mergingHooksPtr->AlphaS_ISR(), RN, rndmPtr );
853 if ( nloTilde && doUNLOPSSubt && nRecluster == 1
854 && nPerformed == nRecluster && nSteps <= nMaxNLO )
858 wgtFIRST *= dampWeight;
860 mergingHooksPtr->setWeightFIRST(wgtFIRST);
863 wgt = wgt - wgtFIRST;
869 double muf = process[0].e();
870 for (
int i=0; i < process.size(); ++i )
871 if ( process[i].isFinal()
872 && (process[i].colType() != 0 || process[i].id() == 22 ) ) {
874 muf = min( muf, abs(process[i].mT()) );
878 if ( nSteps == 0 && nFinal == 2
879 && ( mergingHooksPtr->getProcessString().compare(
"pp>jj") == 0
880 || mergingHooksPtr->getProcessString().compare(
"pp>aj") == 0) )
884 mergingHooksPtr->storeHardProcessCandidates( process );
888 vector <int> oldResonance;
889 for (
int i=0; i < newProcess.size(); ++i )
890 if ( newProcess[i].status() == 22 )
891 oldResonance.push_back(newProcess[i].id());
892 vector <int> newResonance;
893 for (
int i=0; i < process.size(); ++i )
894 if ( process[i].status() == 22 )
895 newResonance.push_back(process[i].id());
897 for (
int i=0; i < int(oldResonance.size()); ++i )
898 for (
int j=0; j < int(newResonance.size()); ++j )
899 if ( newResonance[j] == oldResonance[i] ) {
900 oldResonance[i] = 99;
903 bool hasNewResonances = (newResonance.size() != oldResonance.size());
904 for (
int i=0; i < int(oldResonance.size()); ++i )
905 hasNewResonances = (oldResonance[i] != 99);
908 if (!hasNewResonances) mergingHooksPtr->reattachResonanceDecays(process);
911 mergingHooksPtr->doIgnoreEmissions(
false);
914 if ( wgt == 0. )
return 0;
918 if (hasNewResonances)
return 2;
929 bool Merging::cutOnProcess(
Event& process) {
932 mergingHooksPtr->nReclusterSave = settingsPtr->mode(
"Merging:nRecluster");
933 int nRequested = settingsPtr->mode(
"Merging:nRequested");
936 mergingHooksPtr->orderHistories(
true);
939 if ( mergingHooksPtr->getProcessString().compare(
"pp>h") == 0)
940 mergingHooksPtr->allowCutOnRecState(
true);
945 Event newProcess( mergingHooksPtr->bareEvent( process,
true) );
947 mergingHooksPtr->storeHardProcessCandidates( newProcess );
950 double tmsval = mergingHooksPtr->tms();
952 double tmsnow = mergingHooksPtr->tmsNow( newProcess );
954 int nSteps = mergingHooksPtr->getNumberOfClusteringSteps( newProcess);
959 if (nSteps < nRequested)
return true;
962 tmsNowMin = (nSteps == 0) ? 0. : min(tmsNowMin, tmsnow);
966 bool containsRealKin = nSteps > nRequested && nSteps > 0;
969 double RN = rndmPtr->flat();
971 newProcess.scale(0.0);
973 History FullHistory( nSteps, 0.0, newProcess, Clustering(), mergingHooksPtr,
974 (*beamAPtr), (*beamBPtr), particleDataPtr, infoPtr,
true,
true,
977 FullHistory.projectOntoDesiredHistories();
982 bool allowIncompleteReal =
983 settingsPtr->flag(
"Merging:allowIncompleteHistoriesInReal");
984 if ( containsRealKin && !allowIncompleteReal
985 && FullHistory.select(RN)->nClusterings() == 0 )
989 double dampWeight = mergingHooksPtr->dampenIfFailCuts(
990 FullHistory.lowestMultProc(RN) );
991 if ( dampWeight == 0. )
return true;
995 if ( nSteps > 0 && FullHistory.select(RN)->nClusterings() == 0 )
1000 if ( nSteps > 0 && nSteps == nRequested && tmsnow < tmsval ) {
1001 string message=
"Warning in Merging::cutOnProcess: Les Houches Event";
1002 message+=
" fails merging scale cut. Reject event.";
1003 infoPtr->errorMsg(message);
1007 if ( FullHistory.select(RN)->nClusterings() < nSteps) {
1008 string message=
"Warning in Merging::cutOnProcess: No clusterings";
1009 message+=
" found. History incomplete.";
1010 infoPtr->errorMsg(message);
1014 if ( !containsRealKin )
return false;
1019 if ( containsRealKin ) {
1023 dummy.init(
"(hard process-modified)", particleDataPtr );
1026 FullHistory.getClusteredEvent( RN, nSteps, dummy );
1027 double tnowNew = mergingHooksPtr->tmsNow( dummy );
1029 if ( nSteps > 0 && nRequested > 0 && tnowNew < tmsval )
return true;