84 m_randomEngine->setSeed(
name(), ctx );
85 CLHEP::HepRandomEngine* randomEngine(m_randomEngine->getEngine(ctx));
90 float vertexX = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(0);
91 float vertexY = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(1);
92 float vertexZ =
getZpos(randomEngine);
94 CLHEP::HepLorentzVector *vertexSmearing =
95 new CLHEP::HepLorentzVector( vertexX, vertexY, vertexZ, 0. );
98 const double tx =
tan( beamSpotHandle->beamTilt(1) );
99 const double ty =
tan( beamSpotHandle->beamTilt(0) );
101 const double sqrt_abc = sqrt(1. +
tx*
tx + ty*ty);
102 const double sqrt_fgh = sqrt(1. + ty*ty);
104 const double a = ty/sqrt_abc;
105 const double b =
tx/sqrt_abc;
106 const double c = 1./sqrt_abc;
108 HepGeom::Point3D<double> from1(0,0,1);
109 HepGeom::Point3D<double> to1(
a,
b,
c);
111 const double f = 1./sqrt_fgh;
113 const double h = -(ty)/sqrt_fgh;
115 HepGeom::Point3D<double> from2(1,0,0);
116 HepGeom::Point3D<double> to2(
f,
g,
h);
120 HepGeom::Rotate3D(from1, from2, to1, to2).getRotation(),
121 CLHEP::Hep3Vector( beamSpotHandle->beamPos().x(),
122 beamSpotHandle->beamPos().y(),
123 beamSpotHandle->beamPos().z() )
127 ATH_MSG_VERBOSE(
"BeamSpotSvc reported beam position as " << beamSpotHandle->beamPos() << std::endl
128 <<
"\tWidth is (" << beamSpotHandle->beamSigma(0)
129 <<
", " << beamSpotHandle->beamSigma(1) <<
", "
130 <<
m_L <<
")" << std::endl
131 <<
"\tTilts are " << beamSpotHandle->beamTilt(0) <<
" and " << beamSpotHandle->beamTilt(1) << std::endl
132 <<
"\tVertex Position before transform: " << *vertexSmearing);
135 *vertexSmearing =
transform * HepGeom::Point3D<double>(*vertexSmearing);
143 double bunch_length_z = (std::sqrt(2)*vertexZ)/0.9;
153 double time_offset = CLHEP::RandGaussZiggurat::shoot(
161 return vertexSmearing;