100 #ifndef Pythia8_PowhegHooksBB4L_H 101 #define Pythia8_PowhegHooksBB4L_H 103 #include "Pythia8/Pythia.h" 117 vetoDipoleFrame = settingsPtr->flag(
"POWHEG:bb4l:FSREmission:vetoDipoleFrame");
118 pTpythiaVeto = settingsPtr->flag(
"POWHEG:bb4l:FSREmission:pTpythiaVeto");
119 vetoQED = settingsPtr->flag(
"POWHEG:bb4l:FSREmission:vetoQED");
121 debug = settingsPtr->flag(
"POWHEG:bb4l:DEBUG");
122 pTmin = settingsPtr->parm(
"POWHEG:bb4l:pTminVeto");
136 ss << infoPtr->getEventAttribute(
"#rwgt");
145 int i_top = -1, i_atop = -1, i_wp = -1, i_wm = -1;
146 for (
int i = 0;
i <
e.size();
i++) {
153 if (
e[
i].
id() == -24)
176 int iRecAft =
e.size() - 1;
177 int iEmt =
e.size() - 2;
178 int iRadAft =
e.size() - 3;
179 int iRadBef =
e[iEmt].mother1();
182 int iRes =
e[iRadBef].mother1();
183 while (iRes > 0 && (
abs(
e[iRes].
id()) != 6 &&
abs(
e[iRes].
id()) != 24)) {
184 iRes =
e[iRes].mother1();
187 loggerPtr->errorMsg(
"PowhegHooksBB4L::doVetoFSREmission",
188 "Emission in resonance not from the top quark or from the " 189 "W boson, not vetoing");
192 int iResId =
e[iRes].id();
201 Vec4 pr(
e[iRadAft].
p()), pe(
e[iEmt].
p()), pres(
e[iRes].
p()), prec(
e[iRecAft].
p()), psystem;
206 psystem =
pr + pe + prec;
211 if (
e[iRadBef].
id() == 21)
214 else if (
abs(
e[iRadBef].
id()) <= 5 && ((
e[iEmt].
id() == 21) && !
vetoQED))
225 cout << iResId <<
": " <<
e[iRadBef].id() <<
" > " <<
e[iRadAft].id() <<
" + " <<
e[iEmt].id() <<
"; " 228 }
else if (iResId == -6) {
230 cout << iResId <<
": " <<
e[iRadBef].id() <<
" > " <<
e[iRadAft].id() <<
" + " <<
e[iEmt].id() <<
"; " 233 }
else if (iResId == 24) {
235 cout << iResId <<
": " <<
e[iRadBef].id() <<
" > " <<
e[iRadAft].id() <<
" + " <<
e[iEmt].id() <<
"; " 238 }
else if (iResId == -24) {
240 cout << iResId <<
": " <<
e[iRadBef].id() <<
" > " <<
e[iRadAft].id() <<
" + " <<
e[iEmt].id() <<
"; " 244 loggerPtr->errorMsg(
"PowhegHooksBB4L::doVetoFSREmissio",
"Unimplemented case");
276 return sqrt(
e[iRes].m2Calc());
278 if (
e[iRes].
id() == 6)
280 else if (
e[iRes].
id() == -6)
282 else if (
e[iRes].
id() == 24)
284 else if (
e[iRes].
id() == 24)
300 int nDau =
event[iRes].daughterList().size();
313 else if (
abs(
event[iRes].
id()) == 6) {
315 int idw = -1, idb = -1, idg = -1;
316 for (
int i = 0;
i < nDau;
i++) {
317 int iDau =
event[iRes].daughterList()[
i];
328 pw.bstback(
event[iRes].
p());
330 pb.bstback(
event[iRes].
p());
332 pg.bstback(
event[iRes].
p());
335 return sqrt(2 * pg * pb * pg.e() / pb.e());
338 else if (
abs(
event[iRes].
id()) == 24) {
340 int idq = -1, ida = -1, idg = -1;
341 for (
int i = 0;
i < nDau;
i++) {
342 int iDau =
event[iRes].daughterList()[
i];
343 if (
event[iDau].
id() == 21)
345 else if (
event[iDau].
id() > 0)
347 else if (
event[iDau].
id() < 0)
353 pq.bstback(
event[iRes].
p());
355 pa.bstback(
event[iRes].
p());
357 pg.bstback(
event[iRes].
p());
360 Vec4 pw = pq + pa + pg;
362 double csi = 2 * pg.e() /
sqrt(q2);
363 double yq = 1 - pg * pq / (pg.e() * pq.e());
364 double ya = 1 - pg * pa / (pg.e() * pa.e());
366 return sqrt(
min(1 - yq, 1 - ya) *
pow2(csi) * q2 / 2);
379 const vector<int> &ids,
380 vector<int> &positions,
381 vector<Vec4> &momenta,
382 bool exitOnExtraLegs =
true) {
384 if (
e[iparticle].daughterList().size() != ids.size()) {
385 if (exitOnExtraLegs &&
e[iparticle].daughterList().size() > ids.size()) {
386 cout <<
"extra leg" << endl;
392 for (
unsigned i = 0;
i <
e[iparticle].daughterList().size();
i++) {
393 int di =
e[iparticle].daughterList()[
i];
394 if (ids[
i] != 0 &&
e[di].
id() != ids[
i])
401 for (
unsigned i = 0;
i <
e[iparticle].daughterList().size();
i++) {
402 int di =
e[iparticle].daughterList()[
i];
403 positions.push_back(di);
404 momenta.push_back(
e[di].
p());
425 inline double pTpythia(
const Event &
e,
int RadAfterBranch,
int EmtAfterBranch,
int RecAfterBranch) {
427 Vec4 radVec =
e[RadAfterBranch].p();
428 Vec4 emtVec =
e[EmtAfterBranch].p();
429 Vec4 recVec =
e[RecAfterBranch].p();
430 int radID =
e[RadAfterBranch].id();
433 Vec4 Q(radVec + emtVec);
434 double Qsq = Q.m2Calc();
437 double m2Rad = (
abs(radID) >= 4 &&
abs(radID) < 7) ?
pow2(particleDataPtr->m0(radID)) : 0.;
442 Vec4 sum = radVec + recVec + emtVec;
443 double m2Dip = sum.m2Calc();
445 double x1 = 2. * (sum * radVec) / m2Dip;
446 double x3 = 2. * (sum * emtVec) / m2Dip;
448 pTnow = z * (1. - z);
451 pTnow *= (Qsq - m2Rad);
454 cout <<
"Warning: pTpythia was negative" << endl;
457 return (
sqrt(pTnow));
487 #endif // end Pythia8_PowhegHooksBB4L_H
bool canVetoProcessLevel()
bool doVetoFSREmission(int sizeOld, const Event &e, int iSys, bool inResonance)
int getNInResonanceFSRVeto()
bool canVetoFSREmission()
double pTpythia(const Event &e, int RadAfterBranch, int EmtAfterBranch, int RecAfterBranch)
double qSplittingScale(Vec4 pt, Vec4 p1, Vec4 p2)
double scaleResonance(int iRes, const Event &e)
constexpr int pow2(int x)
bool doVetoProcessLevel(Event &e)
bool canSetResonanceScale()
Abs< T >::type abs(const T &t)
double scaleResonanceVeto
double findresscale(const int iRes, const Event &event)
double gSplittingScale(Vec4 pt, Vec4 p1, Vec4 p2)
bool match_decay(int iparticle, const Event &e, const vector< int > &ids, vector< int > &positions, vector< Vec4 > &momenta, bool exitOnExtraLegs=true)
bool doVetoFSR(bool condition, double scale)
Power< A, B >::type pow(const A &a, const B &b)