15 #ifndef Pythia8_aMCatNLOHooks_H
16 #define Pythia8_aMCatNLOHooks_H
18 #include "Pythia8/Pythia.h"
35 : mergingScheme(mergingSchemeIn), normFactor(1.) {}
38 double getNormFactor(){
return normFactor;}
41 bool canVetoProcessLevel() {
return true;}
43 bool doVetoProcessLevel(
Event& process) {
49 omitResonanceDecays(process);
52 int nQuarksMerge = settingsPtr->mode(
"Merging:nQuarksMerge");
55 if ( settingsPtr->word(
"Merging:Process") ==
"guess" ) {
56 string processString =
"";
58 int beamAid = beamAPtr->id();
59 int beamBid = beamBPtr->id();
60 if (abs(beamAid) == 2212) processString +=
"p";
61 if (beamAid == 11) processString +=
"e-";
62 if (beamAid ==-11) processString +=
"e+";
63 if (abs(beamBid) == 2212) processString +=
"p";
64 if (beamBid == 11) processString +=
"e-";
65 if (beamBid ==-11) processString +=
"e+";
68 bool foundOutgoing =
false;
69 for(
int i=0; i < int(workEvent.size()); ++i)
70 if ( workEvent[i].isFinal()
71 && ( workEvent[i].colType() == 0
72 || workEvent[i].idAbs() > 21
73 || ( workEvent[i].id() != 21
74 && workEvent[i].idAbs() > nQuarksMerge) ) ) {
77 proc <<
"{" << workEvent[i].name() <<
"," << workEvent[i].id()
79 processString += proc.str();
82 if (foundOutgoing) settingsPtr->word(
"Merging:Process", processString);
86 for(
int i=0; i < int(workEvent.size()); ++i)
87 if ( workEvent[i].isFinal()
88 && workEvent[i].colType()!= 0
89 && ( workEvent[i].id() == 21 || workEvent[i].idAbs() <= nQuarksMerge))
93 bool isumeps = (mergingScheme == 1);
94 bool isunlops = (mergingScheme == 2);
97 string nps_nlo = infoPtr->getEventAttribute(
"npNLO",
true);
98 int np_nlo = (nps_nlo !=
"") ? atoi((
char*)nps_nlo.c_str()) : -1;
99 string nps_lo = infoPtr->getEventAttribute(
"npLO",
true);
100 int np_lo = (nps_lo !=
"") ? atoi((
char*)nps_lo.c_str()) : -1;
102 if ( (settingsPtr->flag(
"Merging:doUNLOPSTree")
103 || settingsPtr->flag(
"Merging:doUNLOPSSubt")) && np_lo == 0)
106 if (settingsPtr->word(
"Merging:process").compare(
"pp>aj") == 0)
108 if (settingsPtr->word(
"Merging:process").compare(
"pp>jj") == 0)
113 settingsPtr->mode(
"Merging:nRequested", np_nlo);
115 }
else if (np_lo > -1){
116 settingsPtr->mode(
"Merging:nRequested", np_lo);
119 settingsPtr->mode(
"Merging:nRequested", nPartons);
125 bool updateWgt = settingsPtr->flag(
"Merging:includeWeightInXsection");
126 double norm = (abs(infoPtr->lhaStrategy()) == 4) ? 1./1e9 : 1.;
130 if (isunlops && np_nlo == 0 && np_lo == -1) {
131 settingsPtr->flag(
"Merging:doUNLOPSTree",
false);
132 settingsPtr->flag(
"Merging:doUNLOPSSubt",
false);
133 settingsPtr->flag(
"Merging:doUNLOPSLoop",
true);
134 settingsPtr->flag(
"Merging:doUNLOPSSubtNLO",
false);
135 settingsPtr->mode(
"Merging:nRecluster",0);
137 }
else if (isunlops && np_nlo > 0 && np_lo == -1) {
139 if (rndmPtr->flat() < 0.5) {
141 settingsPtr->flag(
"Merging:doUNLOPSTree",
false);
142 settingsPtr->flag(
"Merging:doUNLOPSSubt",
false);
143 settingsPtr->flag(
"Merging:doUNLOPSLoop",
false);
144 settingsPtr->flag(
"Merging:doUNLOPSSubtNLO",
true);
145 settingsPtr->mode(
"Merging:nRecluster",1);
147 settingsPtr->flag(
"Merging:doUNLOPSTree",
false);
148 settingsPtr->flag(
"Merging:doUNLOPSSubt",
false);
149 settingsPtr->flag(
"Merging:doUNLOPSLoop",
true);
150 settingsPtr->flag(
"Merging:doUNLOPSSubtNLO",
false);
151 settingsPtr->mode(
"Merging:nRecluster",0);
153 }
else if (isunlops && np_nlo == -1 && np_lo > -1) {
155 if (rndmPtr->flat() < 0.5) {
157 settingsPtr->flag(
"Merging:doUNLOPSTree",
false);
158 settingsPtr->flag(
"Merging:doUNLOPSSubt",
true);
159 settingsPtr->flag(
"Merging:doUNLOPSLoop",
false);
160 settingsPtr->flag(
"Merging:doUNLOPSSubtNLO",
false);
161 settingsPtr->mode(
"Merging:nRecluster",1);
164 bool isnlotilde = settingsPtr->flag(
"Merging:doUNLOPSTilde");
165 int nmaxNLO = settingsPtr->mode(
"Merging:nJetMaxNLO");
168 && np_lo <= nmaxNLO+1
171 if (rndmPtr->flat() < 0.5)
172 settingsPtr->mode(
"Merging:nRecluster",2);
175 settingsPtr->flag(
"Merging:doUNLOPSTree",
true);
176 settingsPtr->flag(
"Merging:doUNLOPSSubt",
false);
177 settingsPtr->flag(
"Merging:doUNLOPSLoop",
false);
178 settingsPtr->flag(
"Merging:doUNLOPSSubtNLO",
false);
179 settingsPtr->mode(
"Merging:nRecluster",0);
181 }
else if (isumeps && np_lo == 0) {
182 settingsPtr->flag(
"Merging:doUMEPSTree",
true);
183 settingsPtr->flag(
"Merging:doUMEPSSubt",
false);
184 settingsPtr->mode(
"Merging:nRecluster",0);
185 }
else if (isumeps && np_lo > 0) {
187 if (rndmPtr->flat() < 0.5) {
189 settingsPtr->flag(
"Merging:doUMEPSTree",
false);
190 settingsPtr->flag(
"Merging:doUMEPSSubt",
true);
191 settingsPtr->mode(
"Merging:nRecluster",1);
193 settingsPtr->flag(
"Merging:doUMEPSTree",
true);
194 settingsPtr->flag(
"Merging:doUMEPSSubt",
false);
195 settingsPtr->mode(
"Merging:nRecluster",0);
199 infoPtr->updateWeight(infoPtr->weight()*norm*normFactor);
218 #endif // end Pythia8_aMCatNLOHooks_H