13 #ifndef Pythia8_MergingHooks_H
14 #define Pythia8_MergingHooks_H
16 #include "Pythia8/Basics.h"
17 #include "Pythia8/BeamParticle.h"
18 #include "Pythia8/Event.h"
19 #include "Pythia8/Info.h"
20 #include "Pythia8/ParticleData.h"
21 #include "Pythia8/PartonSystems.h"
22 #include "Pythia8/PythiaStdlib.h"
23 #include "Pythia8/Settings.h"
43 vector<int> hardOutgoing1;
44 vector<int> hardOutgoing2;
46 vector<int> hardIntermediate;
51 vector<int> PosOutgoing1;
52 vector<int> PosOutgoing2;
54 vector<int> PosIntermediate;
65 HardProcess(
const HardProcess& hardProcessIn )
66 : state(hardProcessIn.state),
67 tms(hardProcessIn.tms) {
68 hardIncoming1 = hardProcessIn.hardIncoming1;
69 hardIncoming2 = hardProcessIn.hardIncoming2;
70 for(
int i =0; i < int(hardProcessIn.hardOutgoing1.size());++i)
71 hardOutgoing1.push_back( hardProcessIn.hardOutgoing1[i]);
72 for(
int i =0; i < int(hardProcessIn.hardOutgoing2.size());++i)
73 hardOutgoing2.push_back( hardProcessIn.hardOutgoing2[i]);
74 for(
int i =0; i < int(hardProcessIn.hardIntermediate.size());++i)
75 hardIntermediate.push_back( hardProcessIn.hardIntermediate[i]);
76 for(
int i =0; i < int(hardProcessIn.PosOutgoing1.size());++i)
77 PosOutgoing1.push_back( hardProcessIn.PosOutgoing1[i]);
78 for(
int i =0; i < int(hardProcessIn.PosOutgoing2.size());++i)
79 PosOutgoing2.push_back( hardProcessIn.PosOutgoing2[i]);
80 for(
int i =0; i < int(hardProcessIn.PosIntermediate.size());++i)
81 PosIntermediate.push_back( hardProcessIn.PosIntermediate[i]);
85 HardProcess(
string LHEfile, ParticleData* particleData) {
87 state.init(
"(hard process)", particleData);
88 translateLHEFString(LHEfile);
92 void initOnProcess(
string process, ParticleData* particleData);
95 void initOnLHEF(
string LHEfile, ParticleData* particleData);
98 void translateLHEFString(
string LHEpath);
101 void translateProcessString(
string process);
108 bool allowCandidates(
int iPos, vector<int> Pos1, vector<int> Pos2,
111 void storeCandidates(
const Event& event,
string process);
114 bool matchesAnyOutgoing(
int iPos,
const Event& event);
118 bool findOtherCandidates(
int iPos,
const Event& event,
bool doReplace);
120 bool exchangeCandidates( vector<int> candidates1, vector<int> candidates2,
121 map<int,int> further1, map<int,int> further2);
141 int hasResInCurrent();
151 void listCandidates()
const;
165 doUserMergingSave(false),
166 doMGMergingSave(false),
167 doKTMergingSave(false),
168 doPTLundMergingSave(false),
169 doCutBasedMergingSave(false),
170 doNL3TreeSave(false),
171 doNL3LoopSave(false),
172 doNL3SubtSave(false),
173 doUNLOPSTreeSave(false),
174 doUNLOPSLoopSave(false),
175 doUNLOPSSubtSave(false),
176 doUNLOPSSubtNLOSave(false),
177 doUMEPSTreeSave(false),
178 doUMEPSSubtSave(false),
179 doEstimateXSection(false),
180 doRemoveDecayProducts(false),
181 doOrderHistoriesSave(true),
182 doCutOnRecStateSave(false),
183 doWClusteringSave(false),
184 doSQCDClusteringSave(false),
185 doIgnoreEmissionsSave(true),
186 doIgnoreStepSave(true) {
187 inputEvent =
Event(); resonances.resize(0); infoPtr = 0;
188 particleDataPtr = 0; partonSystemsPtr = 0;}
191 friend class History;
195 friend class PartonLevel;
197 friend class SpaceShower;
199 friend class TimeShower;
201 friend class Merging;
208 virtual ~MergingHooks(){}
210 virtual double tmsDefinition(
const Event& event){
return event[0].e();}
213 virtual double dampenIfFailCuts(
const Event& inEvent ) {
215 if(
false) cout << inEvent[0].e();
221 virtual bool canCutOnRecState() {
return doCutOnRecStateSave; }
226 virtual bool doCutOnRecState(
const Event& event ) {
228 if(
false) cout <<
event[0].e();
231 for(
int i=0; i < int(event.size()); ++i)
232 if( event[i].isFinal()
233 && (
event[i].isGluon() ||
event[i].isQuark()) )
236 if( hasEffectiveG2EW() && nPartons < 2){
237 if(event[3].
id() != 21 &&
event[4].id() != 21)
243 virtual bool canVetoTrialEmission() {
return false;}
245 virtual bool doVetoTrialEmission(
const Event&,
const Event& ) {
249 virtual double hardProcessME(
const Event& inEvent ) {
251 if (
false ) cout << inEvent[0].e();
return 1.; }
259 if(doCutBasedMergingSave)
return 0.;
260 else return tmsValueSave;
265 return ((tmsListSave.size() == 3) ? tmsListSave[0] : 0.);
270 return ((tmsListSave.size() == 3) ? tmsListSave[1] : 0.);
275 return ((tmsListSave.size() == 3) ? tmsListSave[2] : 0.);
278 int nMaxJets() {
return nJetMaxSave;}
281 int nMaxJetsNLO() {
return nJetMaxNLOSave;}
283 string getProcessString() {
return processSave;}
285 int nHardOutPartons(){
return hardProcess.nQuarksOut();}
287 int nHardOutLeptons(){
return hardProcess.nLeptonOut();}
290 int nHardOutBosons(){
return hardProcess.nBosonsOut();}
293 int nHardInPartons(){
return hardProcess.nQuarksIn();}
295 int nHardInLeptons(){
return hardProcess.nLeptonIn();}
298 int nResInCurrent(){
return hardProcess.nResInCurrent();}
300 bool doUserMerging(){
return doUserMergingSave;}
302 bool doMGMerging() {
return doMGMergingSave;}
304 bool doKTMerging() {
return doKTMergingSave;}
306 bool doPTLundMerging() {
return doPTLundMergingSave;}
308 bool doCutBasedMerging() {
return doCutBasedMergingSave;}
309 bool doCKKWLMerging() {
return (doUserMergingSave || doMGMergingSave
310 || doKTMergingSave || doPTLundMergingSave || doCutBasedMergingSave); }
313 bool doUMEPSTree() {
return doUMEPSTreeSave;}
314 bool doUMEPSSubt() {
return doUMEPSSubtSave;}
315 bool doUMEPSMerging() {
return (doUMEPSTreeSave || doUMEPSSubtSave);}
318 bool doNL3Tree() {
return doNL3TreeSave;}
319 bool doNL3Loop() {
return doNL3LoopSave;}
320 bool doNL3Subt() {
return doNL3SubtSave;}
321 bool doNL3Merging() {
return (doNL3TreeSave || doNL3LoopSave
325 bool doUNLOPSTree() {
return doUNLOPSTreeSave;}
326 bool doUNLOPSLoop() {
return doUNLOPSLoopSave;}
327 bool doUNLOPSSubt() {
return doUNLOPSSubtSave;}
328 bool doUNLOPSSubtNLO() {
return doUNLOPSSubtNLOSave;}
329 bool doUNLOPSMerging() {
return (doUNLOPSTreeSave || doUNLOPSLoopSave
330 || doUNLOPSSubtSave || doUNLOPSSubtNLOSave); }
332 int nRecluster() {
return nReclusterSave;}
340 bool isFirstEmission(
const Event& event);
343 bool hasEffectiveG2EW() {
344 if ( getProcessString().compare(
"pp>h") == 0 )
return true;
348 Event bareEvent(
const Event& inputEventIn,
bool storeInputEvent );
350 bool reattachResonanceDecays(
Event& process );
353 bool isInHard(
int iPos,
const Event& event);
356 int getNumberOfClusteringSteps(
const Event& event);
365 void orderHistories(
bool doOrderHistoriesIn) {
366 doOrderHistoriesSave = doOrderHistoriesIn; }
369 void allowCutOnRecState(
bool doCutOnRecStateIn) {
370 doCutOnRecStateSave = doCutOnRecStateIn; }
373 void doWClustering(
bool doWClusteringIn ) {
374 doWClusteringSave = doWClusteringIn; }
382 bool checkAgainstCut(
const Particle& particle);
385 double tmsNow(
const Event& event );
387 double rhoms(
const Event& event,
bool withColour);
389 double kTms(
const Event & event);
392 double cutbasedms(
const Event& event );
401 HardProcess hardProcess;
407 ParticleData* particleDataPtr;
410 PartonSystems* partonSystemsPtr;
413 AlphaStrong AlphaS_FSRSave;
414 AlphaStrong AlphaS_ISRSave;
415 AlphaEM AlphaEM_FSRSave;
421 bool doUserMergingSave, doMGMergingSave, doKTMergingSave,
422 doPTLundMergingSave, doCutBasedMergingSave,
423 includeMassiveSave, enforceStrongOrderingSave, orderInRapiditySave,
424 pickByFullPSave, pickByPoPT2Save, includeRedundantSave,
425 pickBySumPTSave, allowColourShufflingSave, resetHardQRenSave,
427 int unorderedScalePrescipSave, unorderedASscalePrescipSave,
428 unorderedPDFscalePrescipSave, incompleteScalePrescipSave,
429 ktTypeSave, nReclusterSave, nQuarksMergeSave;
430 double scaleSeparationFactorSave, nonJoinedNormSave,
431 fsrInRecNormSave, herwigAcollFSRSave, herwigAcollISRSave,
432 pT0ISRSave, pTcutSave;
433 bool doNL3TreeSave, doNL3LoopSave, doNL3SubtSave;
434 bool doUNLOPSTreeSave, doUNLOPSLoopSave, doUNLOPSSubtSave,
436 bool doUMEPSTreeSave, doUMEPSSubtSave;
439 bool doEstimateXSection;
443 vector< pair<int,int> > resonances;
444 bool doRemoveDecayProducts;
450 double kFactor0jSave;
451 double kFactor1jSave;
452 double kFactor2jSave;
455 double tmsValueSave, DparameterSave;
464 vector<double> tmsListSave;
468 bool doOrderHistoriesSave;
473 bool doCutOnRecStateSave;
476 bool doWClusteringSave, doSQCDClusteringSave;
487 bool doIgnoreEmissionsSave;
489 bool doIgnoreStepSave;
492 double weightCKKWL1Save, weightCKKWL2Save;
495 double weightCKKWLSave, weightFIRSTSave;
503 void init( Settings settings, Info* infoPtrIn,
504 ParticleData* particleDataPtrIn, PartonSystems* partonSystemsPtrIn,
509 void storeHardProcessCandidates(
const Event& event){
510 hardProcess.storeCandidates(event,getProcessString());
518 void setLHEInputFile(
string lheFile) {
519 lheInputFile = lheFile.substr(0,lheFile.size()-6); }
526 AlphaStrong* AlphaS_FSR() {
return &AlphaS_FSRSave;}
527 AlphaStrong* AlphaS_ISR() {
return &AlphaS_ISRSave;}
528 AlphaEM* AlphaEM_FSR() {
return &AlphaEM_FSRSave;}
532 bool includeMassive() {
return includeMassiveSave;}
534 bool enforceStrongOrdering() {
return enforceStrongOrderingSave;}
536 bool orderInRapidity() {
return orderInRapiditySave;}
538 bool pickByFull() {
return pickByFullPSave;}
540 bool pickByPoPT2() {
return pickByPoPT2Save;}
542 bool includeRedundant(){
return includeRedundantSave;}
544 bool pickBySumPT(){
return pickBySumPTSave;}
549 int unorderedScalePrescip() {
return unorderedScalePrescipSave;}
553 int unorderedASscalePrescip() {
return unorderedASscalePrescipSave;}
558 int unorderedPDFscalePrescip() {
return unorderedPDFscalePrescipSave;}
563 int incompleteScalePrescip() {
return incompleteScalePrescipSave;}
566 bool allowColourShuffling() {
return allowColourShufflingSave;}
569 bool resetHardQRen() {
return resetHardQRenSave; }
571 bool resetHardQFac() {
return resetHardQFacSave; }
575 double scaleSeparationFactor() {
return scaleSeparationFactorSave;}
578 double nonJoinedNorm() {
return nonJoinedNormSave;}
581 double fsrInRecNorm() {
return fsrInRecNormSave;}
584 double herwigAcollFSR() {
return herwigAcollFSRSave;}
587 double herwigAcollISR() {
return herwigAcollISRSave;}
589 double pT0ISR() {
return pT0ISRSave;}
591 double pTcut() {
return pTcutSave;}
594 void muMI(
double mu) { muMISave = mu; }
595 double muMI() {
return muMISave;}
598 double kFactor(
int njet = 0) {
599 return (njet == 0) ? kFactor0jSave
600 :(njet == 1) ? kFactor1jSave
604 double k1Factor(
int njet = 0) {
605 return (kFactor(njet) - 1)/infoPtr->alphaS();
610 bool orderHistories() {
return doOrderHistoriesSave;}
615 bool allowCutOnRecState() {
return doCutOnRecStateSave;}
618 bool doWClustering() {
return doWClusteringSave;}
620 bool doSQCDClustering() {
return doSQCDClusteringSave;}
623 double muF() {
return (muFSave > 0.) ? muFSave : infoPtr->QFac();}
624 double muR() {
return (muRSave > 0.) ? muRSave : infoPtr->QRen();}
626 double muFinME() {
return (muFinMESave > 0.) ? muFinMESave
628 double muRinME() {
return (muRinMESave > 0.) ? muRinMESave
636 void doIgnoreEmissions(
bool doIgnoreIn ) {
637 doIgnoreEmissionsSave = doIgnoreIn;
640 bool canVetoEmission() {
return !doIgnoreEmissionsSave; }
642 bool doVetoEmission(
const Event& );
645 void doIgnoreStep(
bool doIgnoreIn ) { doIgnoreStepSave = doIgnoreIn; }
647 bool canVetoStep() {
return !doIgnoreStepSave; }
649 bool doVetoStep(
const Event& process,
const Event& event,
650 bool doResonance =
false );
653 void storeWeights(
double weight ){ weightCKKWL1Save = weightCKKWL2Save
657 bool setShowerStartingScales(
bool isTrial,
bool doMergeFirstEmm,
658 double& pTscaleIn,
const Event& event,
659 double& pTmaxFSRIn,
bool& limitPTmaxFSRin,
660 double& pTmaxISRIn,
bool& limitPTmaxISRin,
661 double& pTmaxMPIIn,
bool& limitPTmaxMPIin );
662 void nMinMPI(
int nMinMPIIn ) { nMinMPISave = nMinMPIIn; }
663 int nMinMPI() {
return nMinMPISave;}
670 double kTdurham(
const Particle& RadAfterBranch,
671 const Particle& EmtAfterBranch,
int Type,
double D );
673 double rhoPythia(
const Particle& RadAfterBranch,
674 const Particle& EmtAfterBranch,
const Particle& RecAfterBranch,
678 int findColour(
int col,
int iExclude1,
int iExclude2,
679 const Event& event,
int type,
bool isHardIn);
681 double deltaRij(Vec4 jet1, Vec4 jet2);
688 double getWeightNLO() {
return (weightCKKWLSave - weightFIRSTSave);}
690 double getWeightCKKWL() {
return weightCKKWLSave; }
692 double getWeightFIRST() {
return weightFIRSTSave; }
694 void setWeightCKKWL(
double weightIn){
695 weightCKKWLSave = weightIn;
696 infoPtr->setWeightCKKWL(weightIn); }
698 void setWeightFIRST(
double weightIn){
699 weightFIRSTSave = weightIn;
700 infoPtr->setWeightFIRST(weightIn); }
708 #endif // Pythia8_MergingHooks_H