41 int nDau =
event[iRes].daughterList().size();
52 else if (std::abs(event[iRes].
id()) == 6) {
54 int idw = -1, idb = -1, idg = -1;
56 for (
int i = 0; i < nDau; i++) {
57 int iDau =
event[iRes].daughterList()[i];
58 if (std::abs(event[iDau].
id()) == 24) idw = iDau;
59 if (std::abs(event[iDau].
id()) == 5) idb = iDau;
60 if (std::abs(event[iDau].
id()) == 21) idg = iDau;
64 Vec4 pw(event[idw].p());
65 pw.bstback(event[iRes].p());
67 Vec4 pb(event[idb].p());
68 pb.bstback(event[iRes].p());
70 Vec4 pg(event[idg].p());
71 pg.bstback(event[iRes].p());
74 scale = std::sqrt(2*pg*pb*pg.e()/pb.e());
89 inline bool match_decay(
int iparticle,
const Event &e,
const std::vector<int> &ids, std::vector<int> &positions, std::vector<Vec4> &momenta,
bool exitOnExtraLegs =
true){
91 if (e[iparticle].daughterList().size() != ids.size()) {
92 if (exitOnExtraLegs && e[iparticle].daughterList().size() > ids.size()) exit(-1);
96 for (
size_t i = 0; i < e[iparticle].daughterList().size(); i++) {
97 int di = e[iparticle].daughterList()[i];
98 if (ids[i] != 0 && e[di].
id() != ids[i])
105 for (
size_t i = 0; i < e[iparticle].daughterList().size(); i++) {
106 int di = e[iparticle].daughterList()[i];
107 positions.push_back(di);
108 momenta.push_back(e[di].p());
127 int tid = 6*topcharge, wid = 24*topcharge, bid = 5*topcharge,
gid = 21,
wildcard = 0;
130 Vec4 p_top, p_b, p_g, p_g1, p_g2;
131 for (
int i = 0; i < e.size(); i++)
132 if (e[i].
id() == tid) {
136 if (i_top == -1)
return -1.0;
154 vector<Vec4> momenta;
155 vector<int> positions;
158 if (
match_decay(i_top, e, std::vector<int> {wid, bid}, positions, momenta,
false) ) {
160 int i_b = positions[1];
162 if (
match_decay(i_b, e, std::vector<int> {bid,
gid}, positions, momenta) )
170 else if (
match_decay(i_top, e, std::vector<int> {wid, bid,
gid}, positions, momenta,
false) ) {
172 int i_b = positions[1], i_g = positions[2];
174 if (
match_decay(i_b, e, std::vector<int> {bid,
gid}, positions, momenta) )
247 int iEmt = e.size() - 2;
248 int iRadAft = e.size() - 3;
249 int iRadBef = e[iEmt].mother1();
252 int iTop = e[iRadBef].mother1();
254 while (std::abs(e[iTop].
id()) != 6 && iTop > 0) {
255 iTop = e[iTop].mother1();
259#if PYTHIA_VERSION_INTEGER >= 8310
260 loggerPtr->ERROR_MSG(
"Warning in PowhegHooksBB4L::doVetoFSREmission: emission in resonance not from top quark, not vetoing");
262 infoPtr->errorMsg(
"Warning in PowhegHooksBB4L::doVetoFSREmission: emission in resonance not from top quark, not vetoing");
266 int iTopCharge = (e[iTop].id()>0)?1:-1;
270 Vec4 pr(e[iRadAft].p()), pe(e[iEmt].p()), pt(e[iTop].p());
273 if (e[iRadBef].
id() == 21)
276 else if (std::abs(e[iRadBef].
id()) <= 5)
283 if (iTopCharge > 0) {