CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
Pythia8::PowhegHooksBB4L Class Reference

#include <PowhegHooksBB4L.h>

Inheritance diagram for Pythia8::PowhegHooksBB4L:

Public Member Functions

bool canSetResonanceScale ()
 
bool canVetoFSREmission ()
 
bool canVetoProcessLevel ()
 
bool doVetoFSR (bool condition, double scale)
 
bool doVetoFSREmission (int sizeOld, const Event &e, int iSys, bool inResonance)
 
bool doVetoProcessLevel (Event &e)
 
double findresscale (const int iRes, const Event &event)
 
int getNInResonanceFSRVeto ()
 
double gSplittingScale (Vec4 pt, Vec4 p1, Vec4 p2)
 
bool initAfterBeams ()
 
bool match_decay (int iparticle, const Event &e, const vector< int > &ids, vector< int > &positions, vector< Vec4 > &momenta, bool exitOnExtraLegs=true)
 
 PowhegHooksBB4L ()
 
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)
 
 ~PowhegHooksBB4L ()
 

Private Attributes

double atopresscale
 
bool debug
 
int nInResonanceFSRveto
 
double pTmin
 
bool pTpythiaVeto
 
int radtype
 
double scaleResonanceVeto
 
double topresscale
 
bool vetoAllRadtypes
 
bool vetoDipoleFrame
 
bool vetoFSREmission
 
bool vetoQED
 
double wmresscale
 
double wpresscale
 

Detailed Description

Definition at line 108 of file PowhegHooksBB4L.h.

Constructor & Destructor Documentation

◆ PowhegHooksBB4L()

Pythia8::PowhegHooksBB4L::PowhegHooksBB4L ( )
inline

Definition at line 110 of file PowhegHooksBB4L.h.

110 {}

◆ ~PowhegHooksBB4L()

Pythia8::PowhegHooksBB4L::~PowhegHooksBB4L ( )
inline

Definition at line 111 of file PowhegHooksBB4L.h.

References gather_cfg::cout, and nInResonanceFSRveto.

111 { std::cout << "Number of FSR vetoed in BB4l = " << nInResonanceFSRveto << std::endl; }

Member Function Documentation

◆ canSetResonanceScale()

bool Pythia8::PowhegHooksBB4L::canSetResonanceScale ( )
inline

Definition at line 267 of file PowhegHooksBB4L.h.

References scaleResonanceVeto.

267 { return scaleResonanceVeto; }

◆ canVetoFSREmission()

bool Pythia8::PowhegHooksBB4L::canVetoFSREmission ( )
inline

Definition at line 171 of file PowhegHooksBB4L.h.

References vetoFSREmission.

◆ canVetoProcessLevel()

bool Pythia8::PowhegHooksBB4L::canVetoProcessLevel ( )
inline

Definition at line 131 of file PowhegHooksBB4L.h.

131 { return true; }

◆ doVetoFSR()

bool Pythia8::PowhegHooksBB4L::doVetoFSR ( bool  condition,
double  scale 
)
inline

Definition at line 255 of file PowhegHooksBB4L.h.

References nInResonanceFSRveto, radtype, and vetoAllRadtypes.

Referenced by doVetoFSREmission().

255  {
256  if (!vetoAllRadtypes && radtype == 2)
257  return false;
258  if (condition) {
260  return true;
261  }
262  return false;
263  }

◆ doVetoFSREmission()

bool Pythia8::PowhegHooksBB4L::doVetoFSREmission ( int  sizeOld,
const Event e,
int  iSys,
bool  inResonance 
)
inline

Definition at line 172 of file PowhegHooksBB4L.h.

References funct::abs(), atopresscale, gather_cfg::cout, debug, doVetoFSR(), MillePedeFileConverter_cfg::e, beamvalidation::exit(), gSplittingScale(), AlCaHLTBitMon_ParallelJobs::p, pTpythia(), pTpythiaVeto, qSplittingScale(), l1tEGammaCrystalsEmulatorProducer_cfi::scale, topresscale, vetoDipoleFrame, vetoFSREmission, vetoQED, wmresscale, and wpresscale.

172  {
173  // FSR VETO INSIDE THE RESONANCE (if it is switched on)
174  if (inResonance && vetoFSREmission) {
175  // get the participants of the splitting: the recoiler, the radiator and the emitted
176  int iRecAft = e.size() - 1;
177  int iEmt = e.size() - 2;
178  int iRadAft = e.size() - 3;
179  int iRadBef = e[iEmt].mother1();
180 
181  // find the resonance the radiator originates from
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();
185  }
186  if (iRes == 0) {
187  infoPtr->errorMsg(
188  "Warning in PowhegHooksBB4L::doVetoFSREmission: emission in resonance not from the top quark or from the "
189  "W boson, not vetoing");
190  return doVetoFSR(false, 0);
191  }
192  int iResId = e[iRes].id();
193 
194  // calculate the scale of the emission
195  double scale;
196  //using pythia pT definition ...
197  if (pTpythiaVeto)
198  scale = pTpythia(e, iRadAft, iEmt, iRecAft);
199  //.. or using POWHEG pT definition
200  else {
201  Vec4 pr(e[iRadAft].p()), pe(e[iEmt].p()), pres(e[iRes].p()), prec(e[iRecAft].p()), psystem;
202  // The computation of the POWHEG pT can be done in the top rest frame or in the diple one.
203  // pdipole = pemt +prec +prad (after the emission)
204  // For the first emission off the top resonance pdipole = pw +pb (before the emission) = ptop
205  if (vetoDipoleFrame)
206  psystem = pr + pe + prec;
207  else
208  psystem = pres;
209 
210  // gluon splitting into two partons
211  if (e[iRadBef].id() == 21)
212  scale = gSplittingScale(psystem, pr, pe);
213  // quark emitting a gluon (or a photon)
214  else if (abs(e[iRadBef].id()) <= 5 && ((e[iEmt].id() == 21) && !vetoQED))
215  scale = qSplittingScale(psystem, pr, pe);
216  // other stuff (which we should not veto)
217  else {
218  scale = 0;
219  }
220  }
221 
222  // compare the current splitting scale to the correct resonance scale
223  if (iResId == 6) {
224  if (debug && scale > topresscale)
225  cout << iResId << ": " << e[iRadBef].id() << " > " << e[iRadAft].id() << " + " << e[iEmt].id() << "; "
226  << scale << endl;
227  return doVetoFSR(scale > topresscale, scale);
228  } else if (iResId == -6) {
229  if (debug && scale > atopresscale)
230  cout << iResId << ": " << e[iRadBef].id() << " > " << e[iRadAft].id() << " + " << e[iEmt].id() << "; "
231  << scale << endl;
232  return doVetoFSR(scale > atopresscale, scale);
233  } else if (iResId == 24) {
234  if (debug && scale > wpresscale)
235  cout << iResId << ": " << e[iRadBef].id() << " > " << e[iRadAft].id() << " + " << e[iEmt].id() << "; "
236  << scale << endl;
237  return doVetoFSR(scale > wpresscale, scale);
238  } else if (iResId == -24) {
239  if (debug && scale > wmresscale)
240  cout << iResId << ": " << e[iRadBef].id() << " > " << e[iRadAft].id() << " + " << e[iEmt].id() << "; "
241  << scale << endl;
242  return doVetoFSR(scale > wmresscale, scale);
243  } else {
244  infoPtr->errorMsg("Error in PowhegHooksBB4L::doVetoFSREmission: unimplemented case");
245  exit(-1);
246  }
247  }
248  // In CMSSW, the production process veto is done in EmissionVetoHook1.cc
249  // so for events outside resonance, nothing needs to be done here
250  else {
251  return false;
252  }
253  }
double pTpythia(const Event &e, int RadAfterBranch, int EmtAfterBranch, int RecAfterBranch)
double qSplittingScale(Vec4 pt, Vec4 p1, Vec4 p2)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ExtVec< T, 4 > Vec4
Definition: ExtVec.h:60
double gSplittingScale(Vec4 pt, Vec4 p1, Vec4 p2)
bool doVetoFSR(bool condition, double scale)
def exit(msg="")

◆ doVetoProcessLevel()

bool Pythia8::PowhegHooksBB4L::doVetoProcessLevel ( Event e)
inline

Definition at line 132 of file PowhegHooksBB4L.h.

References cms::cuda::assert(), atopresscale, MillePedeFileConverter_cfg::e, findresscale(), mps_fire::i, radtype, contentValuesCheck::ss, groupFilesInBlocks::temp, topresscale, vetoAllRadtypes, wmresscale, and wpresscale.

132  {
133  // extract the radtype from the event comment
134  stringstream ss;
135  // use eventattribute as comments not filled when using edm input
136  ss << infoPtr->getEventAttribute("#rwgt");
137  string temp;
138  ss >> temp >> radtype;
139  assert(temp == "#rwgt");
140  // we only calculate resonance scales for btilde events (radtype==1)
141  // remnant events are not vetoed
142  if (!vetoAllRadtypes && radtype == 2)
143  return false;
144  // find last top and the last anti-top in the record
145  int i_top = -1, i_atop = -1, i_wp = -1, i_wm = -1;
146  for (int i = 0; i < e.size(); i++) {
147  if (e[i].id() == 6)
148  i_top = i;
149  if (e[i].id() == -6)
150  i_atop = i;
151  if (e[i].id() == 24)
152  i_wp = i;
153  if (e[i].id() == -24)
154  i_wm = i;
155  }
156  // if found calculate the resonance scale
157  topresscale = findresscale(i_top, e);
158  // similarly for anti-top
159  atopresscale = findresscale(i_atop, e);
160  // and for W^+ and W^-
161  wpresscale = findresscale(i_wp, e);
162  wmresscale = findresscale(i_wm, e);
163 
164  // do not veto, ever
165  return false;
166  }
assert(be >=bs)
double findresscale(const int iRes, const Event &event)

◆ findresscale()

double Pythia8::PowhegHooksBB4L::findresscale ( const int  iRes,
const Event event 
)
inline

Definition at line 294 of file PowhegHooksBB4L.h.

References funct::abs(), mps_fire::i, SiStripPI::min, AlCaHLTBitMon_ParallelJobs::p, L1TauEmu::pow2(), pTmin, and mathSSE::sqrt().

Referenced by doVetoProcessLevel().

294  {
295  // return large scale if the resonance position is ill defined
296  if (iRes < 0)
297  return 1e30;
298 
299  // get number of resonance decay products
300  int nDau = event[iRes].daughterList().size();
301 
302  // iRes is not decayed, return high scale equivalent to
303  // unrestricted shower
304  if (nDau == 0) {
305  return 1e30;
306  }
307  // iRes did not radiate, this means that POWHEG pt scale has
308  // evolved all the way down to pTmin
309  else if (nDau < 3) {
310  return pTmin;
311  }
312  // iRes is a (anti-)top quark
313  else if (abs(event[iRes].id()) == 6) {
314  // find top daughters
315  int idw = -1, idb = -1, idg = -1;
316  for (int i = 0; i < nDau; i++) {
317  int iDau = event[iRes].daughterList()[i];
318  if (abs(event[iDau].id()) == 24)
319  idw = iDau;
320  if (abs(event[iDau].id()) == 5)
321  idb = iDau;
322  if (abs(event[iDau].id()) == 21)
323  idg = iDau;
324  }
325 
326  // Get daughter 4-vectors in resonance frame
327  Vec4 pw(event[idw].p());
328  pw.bstback(event[iRes].p());
329  Vec4 pb(event[idb].p());
330  pb.bstback(event[iRes].p());
331  Vec4 pg(event[idg].p());
332  pg.bstback(event[iRes].p());
333 
334  // Calculate scale and return it
335  return sqrt(2 * pg * pb * pg.e() / pb.e());
336  }
337  // iRes is a W+(-) boson
338  else if (abs(event[iRes].id()) == 24) {
339  // Find W daughters
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)
344  idg = iDau;
345  else if (event[iDau].id() > 0)
346  idq = iDau;
347  else if (event[iDau].id() < 0)
348  ida = iDau;
349  }
350 
351  // Get daughter 4-vectors in resonance frame
352  Vec4 pq(event[idq].p());
353  pq.bstback(event[iRes].p());
354  Vec4 pa(event[ida].p());
355  pa.bstback(event[iRes].p());
356  Vec4 pg(event[idg].p());
357  pg.bstback(event[iRes].p());
358 
359  // Calculate scale
360  Vec4 pw = pq + pa + pg;
361  double q2 = pw * pw;
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());
365  // and return it
366  return sqrt(min(1 - yq, 1 - ya) * pow2(csi) * q2 / 2);
367  }
368  // in any other case just return a high scale equivalent to
369  // unrestricted shower
370  return 1e30;
371  }
constexpr int pow2(int x)
Definition: TauNNIdHW.h:51
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ExtVec< T, 4 > Vec4
Definition: ExtVec.h:60
Definition: event.py:1

◆ getNInResonanceFSRVeto()

int Pythia8::PowhegHooksBB4L::getNInResonanceFSRVeto ( )
inline

Definition at line 461 of file PowhegHooksBB4L.h.

References nInResonanceFSRveto.

◆ gSplittingScale()

double Pythia8::PowhegHooksBB4L::gSplittingScale ( Vec4  pt,
Vec4  p1,
Vec4  p2 
)
inline

Definition at line 415 of file PowhegHooksBB4L.h.

References LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, funct::pow(), DiDispStaMuonMonitor_cfi::pt, and mathSSE::sqrt().

Referenced by doVetoFSREmission().

415  {
416  p1.bstback(pt);
417  p2.bstback(pt);
418  return sqrt(2 * p1 * p2 * p1.e() * p2.e() / (pow(p1.e() + p2.e(), 2)));
419  }
T sqrt(T t)
Definition: SSEVec.h:19
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ initAfterBeams()

bool Pythia8::PowhegHooksBB4L::initAfterBeams ( )
inline

Definition at line 114 of file PowhegHooksBB4L.h.

References debug, nInResonanceFSRveto, pTmin, pTpythiaVeto, scaleResonanceVeto, vetoAllRadtypes, vetoDipoleFrame, vetoFSREmission, and vetoQED.

114  {
115  // initialize settings of this class
116  vetoFSREmission = settingsPtr->flag("POWHEG:bb4l:FSREmission:veto");
117  vetoDipoleFrame = settingsPtr->flag("POWHEG:bb4l:FSREmission:vetoDipoleFrame");
118  pTpythiaVeto = settingsPtr->flag("POWHEG:bb4l:FSREmission:pTpythiaVeto");
119  vetoQED = settingsPtr->flag("POWHEG:bb4l:FSREmission:vetoQED");
120  scaleResonanceVeto = settingsPtr->flag("POWHEG:bb4l:ScaleResonance:veto");
121  debug = settingsPtr->flag("POWHEG:bb4l:DEBUG");
122  pTmin = settingsPtr->parm("POWHEG:bb4l:pTminVeto");
123  vetoAllRadtypes = settingsPtr->flag("POWHEG:bb4l:vetoAllRadtypes");
125  return true;
126  }

◆ match_decay()

bool Pythia8::PowhegHooksBB4L::match_decay ( int  iparticle,
const Event e,
const vector< int > &  ids,
vector< int > &  positions,
vector< Vec4 > &  momenta,
bool  exitOnExtraLegs = true 
)
inline

Definition at line 377 of file PowhegHooksBB4L.h.

References gather_cfg::cout, MillePedeFileConverter_cfg::e, beamvalidation::exit(), mps_fire::i, and AlCaHLTBitMon_ParallelJobs::p.

382  {
383  // compare sizes
384  if (e[iparticle].daughterList().size() != ids.size()) {
385  if (exitOnExtraLegs && e[iparticle].daughterList().size() > ids.size()) {
386  cout << "extra leg" << endl;
387  exit(-1);
388  }
389  return false;
390  }
391  // compare content
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])
395  return false;
396  }
397  // reset the positions and momenta vectors (because they may be reused)
398  positions.clear();
399  momenta.clear();
400  // construct the array of momenta
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());
405  }
406  return true;
407  }
size
Write out results.
def exit(msg="")

◆ pTpythia()

double Pythia8::PowhegHooksBB4L::pTpythia ( const Event e,
int  RadAfterBranch,
int  EmtAfterBranch,
int  RecAfterBranch 
)
inline

Definition at line 425 of file PowhegHooksBB4L.h.

References funct::abs(), gather_cfg::cout, MillePedeFileConverter_cfg::e, L1TauEmu::pow2(), and mathSSE::sqrt().

Referenced by doVetoFSREmission().

425  {
426  // Convenient shorthands for later
427  Vec4 radVec = e[RadAfterBranch].p();
428  Vec4 emtVec = e[EmtAfterBranch].p();
429  Vec4 recVec = e[RecAfterBranch].p();
430  int radID = e[RadAfterBranch].id();
431 
432  // Calculate virtuality of splitting
433  Vec4 Q(radVec + emtVec);
434  double Qsq = Q.m2Calc();
435 
436  // Mass term of radiator
437  double m2Rad = (abs(radID) >= 4 && abs(radID) < 7) ? pow2(particleDataPtr->m0(radID)) : 0.;
438 
439  // z values for FSR
440  double z, pTnow;
441  // Construct 2 -> 3 variables
442  Vec4 sum = radVec + recVec + emtVec;
443  double m2Dip = sum.m2Calc();
444 
445  double x1 = 2. * (sum * radVec) / m2Dip;
446  double x3 = 2. * (sum * emtVec) / m2Dip;
447  z = x1 / (x1 + x3);
448  pTnow = z * (1. - z);
449 
450  // Virtuality
451  pTnow *= (Qsq - m2Rad);
452 
453  if (pTnow < 0.) {
454  cout << "Warning: pTpythia was negative" << endl;
455  return -1.;
456  } else
457  return (sqrt(pTnow));
458  }
constexpr int pow2(int x)
Definition: TauNNIdHW.h:51
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ExtVec< T, 4 > Vec4
Definition: ExtVec.h:60

◆ qSplittingScale()

double Pythia8::PowhegHooksBB4L::qSplittingScale ( Vec4  pt,
Vec4  p1,
Vec4  p2 
)
inline

Definition at line 409 of file PowhegHooksBB4L.h.

References LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, DiDispStaMuonMonitor_cfi::pt, and mathSSE::sqrt().

Referenced by doVetoFSREmission().

409  {
410  p1.bstback(pt);
411  p2.bstback(pt);
412  return sqrt(2 * p1 * p2 * p2.e() / p1.e());
413  }
T sqrt(T t)
Definition: SSEVec.h:19

◆ scaleResonance()

double Pythia8::PowhegHooksBB4L::scaleResonance ( int  iRes,
const Event e 
)
inline

Definition at line 274 of file PowhegHooksBB4L.h.

References atopresscale, MillePedeFileConverter_cfg::e, radtype, mathSSE::sqrt(), topresscale, vetoAllRadtypes, wmresscale, and wpresscale.

274  {
275  if (!vetoAllRadtypes && radtype == 2)
276  return sqrt(e[iRes].m2Calc());
277  else {
278  if (e[iRes].id() == 6)
279  return topresscale;
280  else if (e[iRes].id() == -6)
281  return atopresscale;
282  else if (e[iRes].id() == 24)
283  return wpresscale;
284  else if (e[iRes].id() == 24)
285  return wmresscale;
286  else
287  return 1e30;
288  }
289  }
T sqrt(T t)
Definition: SSEVec.h:19

Member Data Documentation

◆ atopresscale

double Pythia8::PowhegHooksBB4L::atopresscale
private

Definition at line 479 of file PowhegHooksBB4L.h.

Referenced by doVetoFSREmission(), doVetoProcessLevel(), and scaleResonance().

◆ debug

bool Pythia8::PowhegHooksBB4L::debug
private

◆ nInResonanceFSRveto

int Pythia8::PowhegHooksBB4L::nInResonanceFSRveto
private

◆ pTmin

double Pythia8::PowhegHooksBB4L::pTmin
private

Definition at line 474 of file PowhegHooksBB4L.h.

Referenced by findresscale(), and initAfterBeams().

◆ pTpythiaVeto

bool Pythia8::PowhegHooksBB4L::pTpythiaVeto
private

Definition at line 473 of file PowhegHooksBB4L.h.

Referenced by doVetoFSREmission(), and initAfterBeams().

◆ radtype

int Pythia8::PowhegHooksBB4L::radtype
private

Definition at line 480 of file PowhegHooksBB4L.h.

Referenced by doVetoFSR(), doVetoProcessLevel(), and scaleResonance().

◆ scaleResonanceVeto

double Pythia8::PowhegHooksBB4L::scaleResonanceVeto
private

Definition at line 469 of file PowhegHooksBB4L.h.

Referenced by canSetResonanceScale(), and initAfterBeams().

◆ topresscale

double Pythia8::PowhegHooksBB4L::topresscale
private

Definition at line 479 of file PowhegHooksBB4L.h.

Referenced by doVetoFSREmission(), doVetoProcessLevel(), and scaleResonance().

◆ vetoAllRadtypes

bool Pythia8::PowhegHooksBB4L::vetoAllRadtypes
private

Definition at line 475 of file PowhegHooksBB4L.h.

Referenced by doVetoFSR(), doVetoProcessLevel(), initAfterBeams(), and scaleResonance().

◆ vetoDipoleFrame

bool Pythia8::PowhegHooksBB4L::vetoDipoleFrame
private

Definition at line 472 of file PowhegHooksBB4L.h.

Referenced by doVetoFSREmission(), and initAfterBeams().

◆ vetoFSREmission

bool Pythia8::PowhegHooksBB4L::vetoFSREmission
private

Definition at line 467 of file PowhegHooksBB4L.h.

Referenced by canVetoFSREmission(), doVetoFSREmission(), and initAfterBeams().

◆ vetoQED

bool Pythia8::PowhegHooksBB4L::vetoQED
private

Definition at line 467 of file PowhegHooksBB4L.h.

Referenced by doVetoFSREmission(), and initAfterBeams().

◆ wmresscale

double Pythia8::PowhegHooksBB4L::wmresscale
private

Definition at line 479 of file PowhegHooksBB4L.h.

Referenced by doVetoFSREmission(), doVetoProcessLevel(), and scaleResonance().

◆ wpresscale

double Pythia8::PowhegHooksBB4L::wpresscale
private

Definition at line 479 of file PowhegHooksBB4L.h.

Referenced by doVetoFSREmission(), doVetoProcessLevel(), and scaleResonance().