25 #include "CLHEP/Random/RandGaussQ.h"
26 #include "CLHEP/Units/GlobalSystemOfUnits.h"
27 #include "CLHEP/Units/GlobalPhysicalConstants.h"
29 #include "HepMC/SimpleVector.h"
46 throw cms::Exception(
"Configuration") <<
"Error in BetafuncEvtVtxGenerator: "
47 <<
"Illegal resolution in Z (SigmaZ is negative)";
51 beamToken_ = esConsumes<SimBeamSpotObjects, SimBeamSpotObjectsRcd, edm::Transition::BeginLuminosityBlock>();
65 fX0 = beamhandle->fX0;
66 fY0 = beamhandle->fY0;
67 fZ0 = beamhandle->fZ0;
73 setBoost(beamhandle->fAlpha, beamhandle->fPhi);
80 double tmp_sigz = CLHEP::RandGaussQ::shoot(engine, 0.,
fSigmaZ);
85 tmp_sigx /=
sqrt(2.0);
86 X = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigx) +
fX0;
90 tmp_sigy /=
sqrt(2.0);
91 Y = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigy) +
fY0;
93 double tmp_sigt = CLHEP::RandGaussQ::shoot(engine, 0.,
fSigmaZ);
96 return HepMC::FourVector(X, Y, Z, T);
106 TMatrixD tmpboost(4, 4);
114 tmpboost(0, 0) = 1. /
cos(phi);
115 tmpboost(0, 1) = -
cos(alpha) *
sin(phi);
116 tmpboost(0, 2) = -
tan(phi) *
sin(phi);
117 tmpboost(0, 3) = -
sin(alpha) *
sin(phi);
118 tmpboost(1, 0) = -
cos(alpha) *
tan(phi);
120 tmpboost(1, 2) =
cos(alpha) *
tan(phi);
123 tmpboost(2, 1) = -
cos(alpha) *
sin(phi);
124 tmpboost(2, 2) =
cos(phi);
125 tmpboost(2, 3) = -
sin(alpha) *
sin(phi);
126 tmpboost(3, 0) = -
sin(alpha) *
tan(phi);
128 tmpboost(3, 2) =
sin(alpha) *
tan(phi);
140 throw cms::Exception(
"LogicError") <<
"Error in BetafuncEvtVtxGenerator::sigmaZ: "
141 <<
"Illegal resolution in Z (negative)";
void sigmaZ(double s=1.0)
set resolution in Z in cm
~BetafuncEvtVtxGenerator() override
TMatrixD const * GetInvLorentzBoost() const override
BetafuncEvtVtxGenerator(const edm::ParameterSet &p)
Sin< T >::type sin(const T &t)
void setBoost(double alpha, double phi)
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
edm::ESGetToken< SimBeamSpotObjects, SimBeamSpotObjectsRcd > beamToken_
void update(const edm::EventSetup &iEventSetup)
HepMC::FourVector newVertex(CLHEP::HepRandomEngine *) const override
return a new event vertex
edm::ESWatcher< SimBeamSpotObjectsRcd > parameterWatcher_
double BetaFunction(double z, double z0) const
beta function
T getParameter(std::string const &) const
bool check(const edm::EventSetup &iSetup)
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const