CMS 3D CMS Logo

PowhegResHook.cc
Go to the documentation of this file.
1 // Hook for setting shower scale in top and W resonances
2 // for Powheg ttb_NLO_dec and b_bbar_4l processes
3 // C++ port of algorithm by Jezo et. al. (arXiv:1607.04538, Appendix B.2)
4 
5 #include "Pythia8/Pythia.h"
6 
7 using namespace Pythia8;
8 
10 
11 double PowhegResHook::scaleResonance(const int iRes, const Event& event) {
12  calcScales_ = settingsPtr->flag("POWHEGres:calcScales");
13 
14  double scale = 0.;
15 
16  int nDau = event[iRes].daughterList().size();
17 
18  if (!calcScales_ or nDau == 0) {
19  // No resonance found, set scale to high value
20  // Pythia will shower any MC generated resonance unrestricted
21  scale = 1e30;
22  }
23 
24  else if (nDau < 3) {
25  // No radiating resonance found
26  scale = 0.8;
27  }
28 
29  else if (abs(event[iRes].id()) == 6) {
30  // Find top daughters
31  int idw = -1, idb = -1, idg = -1;
32 
33  for (int i = 0; i < nDau; i++) {
34  int iDau = event[iRes].daughterList()[i];
35  if (abs(event[iDau].id()) == 24)
36  idw = iDau;
37  if (abs(event[iDau].id()) == 5)
38  idb = iDau;
39  if (abs(event[iDau].id()) == 21)
40  idg = iDau;
41  }
42 
43  // Get daughter 4-vectors in resonance frame
44  Vec4 pw(event[idw].p());
45  pw.bstback(event[iRes].p());
46 
47  Vec4 pb(event[idb].p());
48  pb.bstback(event[iRes].p());
49 
50  Vec4 pg(event[idg].p());
51  pg.bstback(event[iRes].p());
52 
53  // Calculate scale
54  scale = sqrt(2 * pg * pb * pg.e() / pb.e());
55  }
56 
57  else if (abs(event[iRes].id()) == 24) {
58  // Find W daughters
59  int idq = -1, ida = -1, idg = -1;
60 
61  for (int i = 0; i < nDau; i++) {
62  int iDau = event[iRes].daughterList()[i];
63  if (event[iDau].id() == 21)
64  idg = iDau;
65  else if (event[iDau].id() > 0)
66  idq = iDau;
67  else if (event[iDau].id() < 0)
68  ida = iDau;
69  }
70 
71  // Get daughter 4-vectors in resonance frame
72  Vec4 pq(event[idq].p());
73  pq.bstback(event[iRes].p());
74 
75  Vec4 pa(event[ida].p());
76  pa.bstback(event[iRes].p());
77 
78  Vec4 pg(event[idg].p());
79  pg.bstback(event[iRes].p());
80 
81  // Calculate scale
82  Vec4 pw = pq + pa + pg;
83  double q2 = pw * pw;
84  double csi = 2 * pg.e() / sqrt(q2);
85  double yq = 1 - pg * pq / (pg.e() * pq.e());
86  double ya = 1 - pg * pa / (pg.e() * pa.e());
87 
88  scale = sqrt(min(1 - yq, 1 - ya) * pow2(csi) * q2 / 2);
89  }
90 
91  return scale;
92 }
constexpr int pow2(int x)
Definition: TauNNIdHW.h:51
double scaleResonance(const int iRes, const Pythia8::Event &event) override
T sqrt(T t)
Definition: SSEVec.h:19
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ExtVec< T, 4 > Vec4
Definition: ExtVec.h:60
Definition: event.py:1