24 #include "CLHEP/Random/RandGaussQ.h" 25 #include "CLHEP/Units/GlobalSystemOfUnits.h" 26 #include "CLHEP/Units/GlobalPhysicalConstants.h" 28 #include "HepMC/SimpleVector.h" 33 readDB_ =
p.getParameter<
bool>(
"readDB");
35 fX0 =
p.getParameter<
double>(
"X0") * cm;
36 fY0 =
p.getParameter<
double>(
"Y0") * cm;
37 fZ0 =
p.getParameter<
double>(
"Z0") * cm;
38 fSigmaZ =
p.getParameter<
double>(
"SigmaZ") * cm;
39 fbetastar =
p.getParameter<
double>(
"BetaStar") * cm;
40 femittance =
p.getParameter<
double>(
"Emittance") * cm;
41 fTimeOffset =
p.getParameter<
double>(
"TimeOffset") * ns * c_light;
43 setBoost(
p.getParameter<
double>(
"Alpha") * radian,
p.getParameter<
double>(
"Phi") * radian);
45 throw cms::Exception(
"Configuration") <<
"Error in BetafuncEvtVtxGenerator: " 46 <<
"Illegal resolution in Z (SigmaZ is negative)";
52 beamToken_ = esConsumes<SimBeamSpotObjects, SimBeamSpotObjectsRcd, edm::Transition::BeginLuminosityBlock>();
65 fX0 = beamhandle->
x() * cm;
66 fY0 = beamhandle->
y() * cm;
67 fZ0 = beamhandle->
z() * cm;
79 double tmp_sigz = CLHEP::RandGaussQ::shoot(engine, 0.,
fSigmaZ);
84 tmp_sigx /=
sqrt(2.0);
85 X = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigx) +
fX0;
89 tmp_sigy /=
sqrt(2.0);
90 Y = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigy) +
fY0;
92 double tmp_sigt = CLHEP::RandGaussQ::shoot(engine, 0.,
fSigmaZ);
95 return HepMC::FourVector(
X,
Y,
Z,
T);
105 TMatrixD tmpboost(4, 4);
113 tmpboost(0, 0) = 1. /
cos(
phi);
123 tmpboost(2, 2) =
cos(
phi);
139 throw cms::Exception(
"LogicError") <<
"Error in BetafuncEvtVtxGenerator::sigmaZ: " 140 <<
"Illegal resolution in Z (negative)";
double sigmaZ() const
get sigmaZ
void sigmaZ(double s=1.0)
set resolution in Z in cm
~BetafuncEvtVtxGenerator() override
double BetaFunction(double z, double z0) const
beta function
BetafuncEvtVtxGenerator(const edm::ParameterSet &p)
Sin< T >::type sin(const T &t)
void setBoost(double alpha, double phi)
double alpha() const
get Alpha
TMatrixD const * GetInvLorentzBoost() const override
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)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
double timeOffset() const
get TimeOffset
HepMC::FourVector newVertex(CLHEP::HepRandomEngine *) const override
return a new event vertex
edm::ESWatcher< SimBeamSpotObjectsRcd > parameterWatcher_
bool check(const edm::EventSetup &iSetup)
double z() const
get Z position
double emittance() const
get Emittance
double phi() const
get Phi
double betaStar() const
get BetaStar
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
double x() const
get X position
double y() const
get Y position