10 #include "CLHEP/Random/RandGaussZiggurat.h"
13 #include "CLHEP/Vector/LorentzVector.h"
14 #include "CLHEP/Units/PhysicalConstants.h"
38 if (!m_randomEngine) {
39 ATH_MSG_ERROR(
"Could not get random number engine from RandomNumberService. Abort.");
40 return StatusCode::FAILURE;
42 return StatusCode::SUCCESS;
50 return StatusCode::SUCCESS;
74 return StatusCode::SUCCESS;
83 m_randomEngine->setSeed(
name(), ctx );
84 CLHEP::HepRandomEngine* randomEngine(m_randomEngine->getEngine(ctx));
89 const double pz1 = CLHEP::RandGaussZiggurat::shoot(randomEngine, sqrt(
m_pbeam1*
m_pbeam1 - px1*px1 - py1*py1),
m_dE);
91 CLHEP::HepLorentzVector pp1(px1, py1, pz1,
e1);
95 const double pz2 = CLHEP::RandGaussZiggurat::shoot(randomEngine, -sqrt(
m_pbeam2*
m_pbeam2 - px2*px2 - py2*py2),
m_dE);
97 CLHEP::HepLorentzVector pp2(px2, py2, pz2,
e2);
100 const CLHEP::HepLorentzVector psum = pp1 + pp2;
101 const CLHEP::HepLorentzVector&
dir = pp1;
103 const double betaX = -psum.x() / psum.t();
104 const double betaY = -psum.y() / psum.t();
105 const double betaZ = -psum.z() / psum.t();
106 const double beta2 = betaX*betaX + betaY*betaY + betaZ*betaZ;
107 const double gamma = 1. / sqrt(1. - beta2);
108 const double prod1 = betaX *
dir.x() + betaY *
dir.y() + betaZ *
dir.z();
111 const CLHEP::HepLorentzVector back(
dir.x() + prod2 * betaX,
112 dir.y() + prod2 * betaY,
113 dir.z() + prod2 * betaZ,
115 const double thback = back.theta();
116 const double phback = back.phi();
118 const double sph =
sin(phback), cph =
cos(phback), sth =
sin(thback), cth =
cos(thback);
119 const CLHEP::HepRotation rot1(CLHEP::HepRep3x3(cph, sph, 0.0, -sph, cph, 0.0, 0.0, 0.0, 1.0));
120 const CLHEP::HepRotation rot2(CLHEP::HepRep3x3(cth*cph, -sph, sth*cph, cth*sph, cph, sth*sph, -sth, 0.0, cth));
121 const CLHEP::HepBoost bst(psum.px()/psum.e(), psum.py()/psum.e(), psum.pz()/psum.e());
123 const CLHEP::HepRotation rot = rot2*rot1;
135 return StatusCode::SUCCESS;
142 CLHEP::HepLorentzRotation
transform = CLHEP::HepLorentzRotation();
145 for(
auto particleIter: ge) {
148 return StatusCode::SUCCESS;
152 const CLHEP::HepLorentzRotation&
transform)
const
155 const HepMC::FourVector &
mom =
p->momentum();
156 CLHEP::HepLorentzVector hv(
mom.px(),
mom.py(),
mom.pz(),
mom.e());
160 p->set_momentum(HepMC::FourVector(hv.px(),hv.py(),hv.pz(),hv.e()));