ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Pythia8::PowhegBB4L Class Reference
Inheritance diagram for Pythia8::PowhegBB4L:
Collaboration diagram for Pythia8::PowhegBB4L:

Public Member Functions

 PowhegBB4L ()
 
 ~PowhegBB4L ()
 
double findresscale (const int iRes, const Event &event)
 
bool match_decay (int iparticle, const Event &e, const std::vector< int > &ids, std::vector< int > &positions, std::vector< Vec4 > &momenta, bool exitOnExtraLegs=true)
 
double qSplittingScale (Vec4 pt, Vec4 p1, Vec4 p2)
 
double gSplittingScale (Vec4 pt, Vec4 p1, Vec4 p2)
 
double getdechardness (int topcharge, const Event &e)
 
bool canVetoPartonLevel ()
 
bool doVetoPartonLevel (const Event &e)
 
bool canSetResonanceScale ()
 
double scaleResonance (int iRes, const Event &e)
 
bool canVetoFSREmission ()
 
bool doVetoFSREmission (int, const Event &e, int, bool inResonance)
 

Private Attributes

double m_topresscale
 
double m_atopresscale
 
Pythia8_UserHooks::UserSetting< int > m_onlyDistance1
 
Pythia8_UserHooks::UserSetting< int > m_useScaleResonanceInstead
 

Detailed Description

Definition at line 22 of file PowhegBB4L.cxx.

Constructor & Destructor Documentation

◆ PowhegBB4L()

Pythia8::PowhegBB4L::PowhegBB4L ( )
inline

Definition at line 28 of file PowhegBB4L.cxx.

28  : m_topresscale(-1.), m_atopresscale(-1.),
29  m_onlyDistance1("Powheg:bb4l:onlyDistance1", 0),
30  m_useScaleResonanceInstead("Powheg:bb4l:useScaleResonanceInstead", 0){}

◆ ~PowhegBB4L()

Pythia8::PowhegBB4L::~PowhegBB4L ( )
inline

Definition at line 31 of file PowhegBB4L.cxx.

31 {}

Member Function Documentation

◆ canSetResonanceScale()

bool Pythia8::PowhegBB4L::canSetResonanceScale ( )
inline

Definition at line 215 of file PowhegBB4L.cxx.

215 { return true; }

◆ canVetoFSREmission()

bool Pythia8::PowhegBB4L::canVetoFSREmission ( )
inline

Definition at line 233 of file PowhegBB4L.cxx.

233  {
234  if (m_useScaleResonanceInstead(settingsPtr))
235  return false;
236  else
237  return true;
238  }

◆ canVetoPartonLevel()

bool Pythia8::PowhegBB4L::canVetoPartonLevel ( )
inline

Definition at line 196 of file PowhegBB4L.cxx.

196 { return true; }

◆ doVetoFSREmission()

bool Pythia8::PowhegBB4L::doVetoFSREmission ( int  ,
const Event e,
int  ,
bool  inResonance 
)
inline

Definition at line 242 of file PowhegBB4L.cxx.

242  {
243 
244  if (inResonance) {
245 
246  // get the participants of the splitting: the radiator and the emitted
247  int iEmt = e.size() - 2;
248  int iRadAft = e.size() - 3;
249  int iRadBef = e[iEmt].mother1();
250 
251  // find the top resonance the radiator originates from
252  int iTop = e[iRadBef].mother1();
253  int distance = 1;
254  while (std::abs(e[iTop].id()) != 6 && iTop > 0) {
255  iTop = e[iTop].mother1();
256  distance ++;
257  }
258  if (iTop == 0) {
259 #if PYTHIA_VERSION_INTEGER >= 8310
260  loggerPtr->ERROR_MSG("Warning in PowhegHooksBB4L::doVetoFSREmission: emission in resonance not from top quark, not vetoing");
261 #else
262  infoPtr->errorMsg("Warning in PowhegHooksBB4L::doVetoFSREmission: emission in resonance not from top quark, not vetoing");
263 #endif
264  return false;
265  }
266  int iTopCharge = (e[iTop].id()>0)?1:-1;
267 
268 
269  // calculate the scale of the emission
270  Vec4 pr(e[iRadAft].p()), pe(e[iEmt].p()), pt(e[iTop].p());
271  double scale;
272  // gluon splitting into two partons
273  if (e[iRadBef].id() == 21)
275  // quark emitting a gluon
276  else if (std::abs(e[iRadBef].id()) <= 5)
278  // other stuff (which we should not veto)
279  else {
280  scale = 0;
281  }
282 
283  if (iTopCharge > 0) {
284  if (m_onlyDistance1(settingsPtr))
285  return (distance == 1) && scale > m_topresscale;
286  else
287  return scale > m_topresscale;
288  }
289  else {
290  if (m_onlyDistance1(settingsPtr))
291  return (distance == 1) && scale > m_atopresscale;
292  else
293  return scale > m_atopresscale;
294  }
295  } else {
296  return false;
297  }
298 
299  return false;
300  }

◆ doVetoPartonLevel()

bool Pythia8::PowhegBB4L::doVetoPartonLevel ( const Event e)
inline

Definition at line 197 of file PowhegBB4L.cxx.

197  {
198  double topdechardness = getdechardness(1, e), atopdechardness = getdechardness(-1, e);
199  if ((topdechardness > m_topresscale) or (atopdechardness > m_atopresscale)) {
200 
201 #if PYTHIA_VERSION_INTEGER >= 8310
202  loggerPtr->ERROR_MSG("Warning in PowhegHooksBB4L::doVetoPartonLevel: passed doVetoFSREmission veto, but wouldn't have passed veto based on the full event listing");
203 #else
204  infoPtr->errorMsg("Warning in PowhegHooksBB4L::doVetoPartonLevel: passed doVetoFSREmission veto, but wouldn't have passed veto based on the full event listing");
205 #endif
206  }
207 // cout << " veto scales: " << fixed << setprecision(17) << setw(30) << topresscale << setw(30) << atopresscale << endl;
208  m_topresscale = -1;
209  m_atopresscale = -1;
210 
211  return false;
212  }

◆ findresscale()

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

Definition at line 38 of file PowhegBB4L.cxx.

38  {
39  double scale = 0.;
40 
41  int nDau = event[iRes].daughterList().size();
42 
43  if (nDau == 0) {
44  // No resonance found, set scale to high value
45  // Pythia will shower any MC generated resonance unrestricted
46  scale = 1e30;
47  }
48  else if (nDau < 3) {
49  // No radiating resonance found
50  scale = 0.8;
51  }
52  else if (std::abs(event[iRes].id()) == 6) {
53  // Find top daughters
54  int idw = -1, idb = -1, idg = -1;
55 
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;
61  }
62 
63  // Get daughter 4-vectors in resonance frame
64  Vec4 pw(event[idw].p());
65  pw.bstback(event[iRes].p());
66 
67  Vec4 pb(event[idb].p());
68  pb.bstback(event[iRes].p());
69 
70  Vec4 pg(event[idg].p());
71  pg.bstback(event[iRes].p());
72 
73  // Calculate scale
74  scale = std::sqrt(2*pg*pb*pg.e()/pb.e());
75  }
76  else {
77  scale = 1e30;
78  }
79 
80  return scale;
81  }

◆ getdechardness()

double Pythia8::PowhegBB4L::getdechardness ( int  topcharge,
const Event e 
)
inline

Definition at line 126 of file PowhegBB4L.cxx.

126  {
127  int tid = 6*topcharge, wid = 24*topcharge, bid = 5*topcharge, gid = 21, wildcard = 0;
128  // find last top in the record
129  int i_top = -1;
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) {
133  i_top = i;
134  p_top = e[i].p();
135  }
136  if (i_top == -1) return -1.0;
137 
138  // summary of cases
139  // 1.) t > W b
140  // a.) b > 3 ... error
141  // b.) b > b g ... h = sqrt(2*p_g*p_b*p_g.e()/p_b.e())
142  // c.) b > other ... h = -1
143  // return h
144  // 2.) t > W b g
145  // a.) b > 3 ... error
146  // b.) b > b g ... h1 = sqrt(2*p_g*p_b*p_g.e()/p_b.e())
147  // c.) b > other ... h1 = -1
148  // i.) g > 3 ... error
149  // ii.) g > 2 ... h2 = sqrt(2*p_g1*p_g2*p_g1.e()*p_g2.e()/(pow(p_g1.e(),2)+pow(p_g2.e(),2))) );
150  // iii.) g > other ... h2 = -1
151  // return max(h1,h2)
152  // 3.) else ... error
153 
154  vector<Vec4> momenta;
155  vector<int> positions;
156 
157  // 1.) t > b W
158  if ( match_decay(i_top, e, std::vector<int> {wid, bid}, positions, momenta, false) ) {
159  double h;
160  int i_b = positions[1];
161  // a.+b.) b > 3 or b > b g
162  if ( match_decay(i_b, e, std::vector<int> {bid, gid}, positions, momenta) )
163  h = qSplittingScale(e[i_top].p(), momenta[0], momenta[1]);
164  // c.) b > other
165  else
166  h = -1;
167  return h;
168  }
169  // 2.) t > b W g
170  else if ( match_decay(i_top, e, std::vector<int> {wid, bid, gid}, positions, momenta, false) ) {
171  double h1, h2;
172  int i_b = positions[1], i_g = positions[2];
173  // a.+b.) b > 3 or b > b g
174  if ( match_decay(i_b, e, std::vector<int> {bid, gid}, positions, momenta) )
175  h1 = qSplittingScale(e[i_top].p(), momenta[0], momenta[1]);
176  // c.) b > other
177  else
178  h1 = -1;
179  // i.+ii.) g > 3 or g > 2
180  if ( match_decay(i_g, e, std::vector<int> {wildcard, wildcard}, positions, momenta) )
181  h2 = gSplittingScale(e[i_top].p(), momenta[0], momenta[1]);
182  // c.) b > other
183  else
184  h2 = -1;
185  return max(h1, h2);
186  }
187  // 3.) else
188  else {
189  exit(-1);
190  }
191  }

◆ gSplittingScale()

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

Definition at line 119 of file PowhegBB4L.cxx.

119  {
120  p1.bstback(pt);
121  p2.bstback(pt);
122  return std::sqrt( 2*p1*p2*p1.e()*p2.e()/(std::pow(p1.e(),2)+std::pow(p2.e(),2)) );
123  }

◆ match_decay()

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

Definition at line 89 of file PowhegBB4L.cxx.

89  {
90  // compare sizes
91  if (e[iparticle].daughterList().size() != ids.size()) {
92  if (exitOnExtraLegs && e[iparticle].daughterList().size() > ids.size()) exit(-1);
93  return false;
94  }
95  // compare content
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])
99  return false;
100  }
101  // reset the positions and momenta vectors (because they may be reused)
102  positions.clear();
103  momenta.clear();
104  // construct the array of momenta
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());
109  }
110  return true;
111  }

◆ qSplittingScale()

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

Definition at line 113 of file PowhegBB4L.cxx.

113  {
114  p1.bstback(pt);
115  p2.bstback(pt);
116  return std::sqrt( 2*p1*p2*p2.e()/p1.e() );
117  }

◆ scaleResonance()

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

Definition at line 216 of file PowhegBB4L.cxx.

216  {
217  double scale = 0.;
218 
219  if (e[iRes].id() == 6){
220  scale = m_topresscale = findresscale(iRes, e);
221  }else if (e[iRes].id() == -6){
222  scale = m_atopresscale = findresscale(iRes, e);
223  }
224 
225  if (m_useScaleResonanceInstead(settingsPtr)) return scale;
226 
227  return 1e30;
228  }

Member Data Documentation

◆ m_atopresscale

double Pythia8::PowhegBB4L::m_atopresscale
private

Definition at line 313 of file PowhegBB4L.cxx.

◆ m_onlyDistance1

Pythia8_UserHooks::UserSetting<int> Pythia8::PowhegBB4L::m_onlyDistance1
private

Definition at line 314 of file PowhegBB4L.cxx.

◆ m_topresscale

double Pythia8::PowhegBB4L::m_topresscale
private

Definition at line 312 of file PowhegBB4L.cxx.

◆ m_useScaleResonanceInstead

Pythia8_UserHooks::UserSetting<int> Pythia8::PowhegBB4L::m_useScaleResonanceInstead
private

Definition at line 315 of file PowhegBB4L.cxx.


The documentation for this class was generated from the following file:
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
max
#define max(a, b)
Definition: cfImp.cxx:41
Pythia8::PowhegBB4L::m_useScaleResonanceInstead
Pythia8_UserHooks::UserSetting< int > m_useScaleResonanceInstead
Definition: PowhegBB4L.cxx:315
keylayer_zslicemap.pb
pb
Definition: keylayer_zslicemap.py:188
Pythia8::PowhegBB4L::match_decay
bool match_decay(int iparticle, const Event &e, const std::vector< int > &ids, std::vector< int > &positions, std::vector< Vec4 > &momenta, bool exitOnExtraLegs=true)
Definition: PowhegBB4L.cxx:89
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
test_pyathena.pt
pt
Definition: test_pyathena.py:11
Pythia8::PowhegBB4L::qSplittingScale
double qSplittingScale(Vec4 pt, Vec4 p1, Vec4 p2)
Definition: PowhegBB4L.cxx:113
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
LArG4AODNtuplePlotter.pe
pe
Definition: LArG4AODNtuplePlotter.py:116
HitType::wildcard
@ wildcard
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Pythia8::PowhegBB4L::m_onlyDistance1
Pythia8_UserHooks::UserSetting< int > m_onlyDistance1
Definition: PowhegBB4L.cxx:314
Pythia8::PowhegBB4L::gSplittingScale
double gSplittingScale(Vec4 pt, Vec4 p1, Vec4 p2)
Definition: PowhegBB4L.cxx:119
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
Pythia8::PowhegBB4L::getdechardness
double getdechardness(int topcharge, const Event &e)
Definition: PowhegBB4L.cxx:126
lumiFormat.i
int i
Definition: lumiFormat.py:92
vector
Definition: MultiHisto.h:13
extractSporadic.h
list h
Definition: extractSporadic.py:97
TileDCSDataPlotter.pr
pr
Definition: TileDCSDataPlotter.py:922
gid
Acts::GeometryIdentifier gid
Definition: ActsWriteTrackingGeometryTransforms.cxx:27
Pythia8::PowhegBB4L::m_atopresscale
double m_atopresscale
Definition: PowhegBB4L.cxx:313
calibdata.exit
exit
Definition: calibdata.py:236
ParticleGun_EoverP_Config.pg
pg
Definition: ParticleGun_EoverP_Config.py:61
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
h
Pythia8::PowhegBB4L::m_topresscale
double m_topresscale
Definition: PowhegBB4L.cxx:312
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
Pythia8::PowhegBB4L::findresscale
double findresscale(const int iRes, const Event &event)
Definition: PowhegBB4L.cxx:38
BchCleanup.idb
idb
Definition: BchCleanup.py:152