stablejet is hosted by Hepforge, IPPP Durham
StableJet
QCDSmear.cc
1 #include "QCDSmear.h"
2 #include "PythiaJetGun.hh"
3 #include "rk/rk.hh"
4 
5 
6 namespace stab {
7  bool QCDSmear::passesCut(const double prob, const unsigned recoNum,
8  const unsigned ihard, const unsigned isoft,
9  const PseudoJet& hard,
10  const PseudoJet& soft) const
11  {
12  const double softPt = soft.pt();
13 #ifdef STREAMVERB
14  std::cout << "QCDCut " << prob/alphaS_.alphaS(softPt*softPt) << std::endl;
15 #endif
16  return prob/alphaS_.alphaS(softPt*softPt) >= cutoff_;
17  }
18 
19  bool QCDSmear::operator()(const double prob, const unsigned recoNum,
20  const unsigned ihard, const unsigned isoft,
21  PseudoJet& hard, PseudoJet& soft)
22  {
23  if (passesCut(prob, recoNum, ihard, isoft, hard, soft))
24  {
25  const rk::P4 hardP4(geom3::Vector3(hard.px(),hard.py(),hard.pz()),hard.m());
26  const rk::P4 softP4(geom3::Vector3(soft.px(),soft.py(),soft.pz()),soft.m());
27  // These particles are coming from the common
28  // mother with sufficiently high probability.
29  // Fluctuate the energy flow.
30  const rk::P4& mother = hardP4 + softP4;
31  const double rnd0 = PythiaJetGun::pyrandom();
32  rk::P4 dau1, dau2;
33 
34  if (uniformPhaseSpace_)
35  {
36  // Redecay according to simple phase space
37  const rk::P4 parent(mother.momentum(), mother.m());
38  const double rnd1 = PythiaJetGun::pyrandom();
39  rk::phaseSpaceDecay(parent, hard.m(), soft.m(),
40  rnd0, rnd1, &dau1, &dau2);
41  }
42  else
43  {
44  // Rotate the decay around the boost axis by
45  // a random angle
46  const rk::Boost& motherBoost = mother.restBoost();
47  const rk::P4& boostedHard = motherBoost*hardP4;
48  const rk::P4& boostedSoft = motherBoost*hardP4;
49  geom3::Rotation3 rot(motherBoost.direction(), 2.0*M_PI*rnd0);
50  dau1 = rk::P4(rot*boostedHard.momentum(), hard.m());
51  dau2 = rk::P4(rot*boostedSoft.momentum(), soft.m());
52 
53  // Boost back to the lab
54  const rk::Boost& labBoost = motherBoost.inverse();
55  dau1.boost(labBoost);
56  dau2.boost(labBoost);
57  }
58 
59  if (dau1.pt() < dau2.pt())
60  {
61  hard = PseudoJet(dau2.px(),dau2.py(),dau2.pz(), dau2.e());
62  soft = PseudoJet(dau1.px(),dau1.py(),dau1.pz(), dau1.e());
63  }
64  else
65  {
66  hard = PseudoJet(dau1.px(),dau1.py(),dau1.pz(), dau1.e());
67  soft = PseudoJet(dau2.px(),dau2.py(),dau2.pz(), dau2.e());
68  }
69  }
70  return true;
71  }
72 
73 } // end stab namespace