15 #ifndef Pythia8_aMCatNLOHooks_H
16 #define Pythia8_aMCatNLOHooks_H
18 #include "Pythia8/Pythia.h"
28 class amcnlo_unitarised_interface :
public UserHooks {
33 amcnlo_unitarised_interface() : mergingScheme(0), normFactor(1.) {}
34 amcnlo_unitarised_interface(
int mergingSchemeIn)
35 : mergingScheme(mergingSchemeIn), normFactor(1.) {}
36 ~amcnlo_unitarised_interface() {}
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)
110 if (settingsPtr->word(
"Merging:process").compare(
"e+e->jj") == 0) {
118 settingsPtr->mode(
"Merging:nRequested", np_nlo);
120 }
else if (np_lo > -1){
121 settingsPtr->mode(
"Merging:nRequested", np_lo);
124 settingsPtr->mode(
"Merging:nRequested", nPartons);
130 bool updateWgt =
true;
134 if (isunlops && np_nlo == 0 && np_lo == -1) {
135 settingsPtr->flag(
"Merging:doUNLOPSTree",
false);
136 settingsPtr->flag(
"Merging:doUNLOPSSubt",
false);
137 settingsPtr->flag(
"Merging:doUNLOPSLoop",
true);
138 settingsPtr->flag(
"Merging:doUNLOPSSubtNLO",
false);
139 settingsPtr->mode(
"Merging:nRecluster",0);
141 }
else if (isunlops && np_nlo > 0 && np_lo == -1) {
143 if (rndmPtr->flat() < 0.5) {
145 settingsPtr->flag(
"Merging:doUNLOPSTree",
false);
146 settingsPtr->flag(
"Merging:doUNLOPSSubt",
false);
147 settingsPtr->flag(
"Merging:doUNLOPSLoop",
false);
148 settingsPtr->flag(
"Merging:doUNLOPSSubtNLO",
true);
149 settingsPtr->mode(
"Merging:nRecluster",1);
151 settingsPtr->flag(
"Merging:doUNLOPSTree",
false);
152 settingsPtr->flag(
"Merging:doUNLOPSSubt",
false);
153 settingsPtr->flag(
"Merging:doUNLOPSLoop",
true);
154 settingsPtr->flag(
"Merging:doUNLOPSSubtNLO",
false);
155 settingsPtr->mode(
"Merging:nRecluster",0);
157 }
else if (isunlops && np_nlo == -1 && np_lo > -1) {
159 if (rndmPtr->flat() < 0.5) {
161 settingsPtr->flag(
"Merging:doUNLOPSTree",
false);
162 settingsPtr->flag(
"Merging:doUNLOPSSubt",
true);
163 settingsPtr->flag(
"Merging:doUNLOPSLoop",
false);
164 settingsPtr->flag(
"Merging:doUNLOPSSubtNLO",
false);
165 settingsPtr->mode(
"Merging:nRecluster",1);
168 bool isnlotilde = settingsPtr->flag(
"Merging:doUNLOPSTilde");
169 int nmaxNLO = settingsPtr->mode(
"Merging:nJetMaxNLO");
172 && np_lo <= nmaxNLO+1
175 if (rndmPtr->flat() < 0.5)
176 settingsPtr->mode(
"Merging:nRecluster",2);
179 settingsPtr->flag(
"Merging:doUNLOPSTree",
true);
180 settingsPtr->flag(
"Merging:doUNLOPSSubt",
false);
181 settingsPtr->flag(
"Merging:doUNLOPSLoop",
false);
182 settingsPtr->flag(
"Merging:doUNLOPSSubtNLO",
false);
183 settingsPtr->mode(
"Merging:nRecluster",0);
185 }
else if (isumeps && np_lo == 0) {
186 settingsPtr->flag(
"Merging:doUMEPSTree",
true);
187 settingsPtr->flag(
"Merging:doUMEPSSubt",
false);
188 settingsPtr->mode(
"Merging:nRecluster",0);
189 }
else if (isumeps && np_lo > 0) {
191 if (rndmPtr->flat() < 0.5) {
193 settingsPtr->flag(
"Merging:doUMEPSTree",
false);
194 settingsPtr->flag(
"Merging:doUMEPSSubt",
true);
195 settingsPtr->mode(
"Merging:nRecluster",1);
197 settingsPtr->flag(
"Merging:doUMEPSTree",
true);
198 settingsPtr->flag(
"Merging:doUMEPSSubt",
false);
199 settingsPtr->mode(
"Merging:nRecluster",0);
204 infoPtr->weightContainerPtr->weightNominal *= normFactor;
222 #endif // end Pythia8_aMCatNLOHooks_H