35 #include "CLHEP/Random/RandGaussQ.h" 36 #include "CLHEP/Units/GlobalSystemOfUnits.h" 37 #include "CLHEP/Units/GlobalPhysicalConstants.h" 39 #include "HepMC/SimpleVector.h" 46 using namespace CLHEP;
49 class HepRandomEngine;
59 virtual HepMC::FourVector* newVertex(CLHEP::HepRandomEngine*);
61 virtual TMatrixD* GetInvLorentzBoost();
67 void X0(
double m = 0) { fX0 =
m; }
69 void Y0(
double m = 0) { fY0 =
m; }
71 void Z0(
double m = 0) { fZ0 =
m; }
74 void Phi(
double m = 0) { phi_ =
m; }
77 void Beta(
double m = 0) { beta_ =
m; }
85 double BetaFunction(
double z,
double z0);
116 verbosity_(p.getUntrackedParameter<
bool>(
"verbosity",
false)) {
128 throw cms::Exception(
"Configuration") <<
"Error in BetaBoostEvtVtxGenerator: " 129 <<
"Illegal resolution in Z (SigmaZ is negative)";
132 produces<edm::HepMCProduct>();
145 double tmp_sigz = CLHEP::RandGaussQ::shoot(engine, 0.0,
fSigmaZ);
150 tmp_sigx /=
sqrt(2.0);
151 X = CLHEP::RandGaussQ::shoot(engine, 0.0, tmp_sigx) +
fX0;
155 tmp_sigy /=
sqrt(2.0);
156 Y = CLHEP::RandGaussQ::shoot(engine, 0.0, tmp_sigy) +
fY0;
158 double tmp_sigt = CLHEP::RandGaussQ::shoot(engine, 0.0,
fSigmaZ);
162 fVertex =
new HepMC::FourVector();
176 throw cms::Exception(
"LogicError") <<
"Error in BetaBoostEvtVtxGenerator::sigmaZ: " 177 <<
"Illegal resolution in Z (negative)";
188 TMatrixD tmpboost(4, 4);
189 TMatrixD tmpboostZ(4, 4);
190 TMatrixD tmpboostXYZ(4, 4);
198 tmpboost(0, 0) = 1. /
cos(
phi_);
216 tmpboostZ(0, 0) = gama;
217 tmpboostZ(0, 1) = 0.;
218 tmpboostZ(0, 2) = -1.0 * beta_ * gama;
219 tmpboostZ(0, 3) = 0.;
220 tmpboostZ(1, 0) = 0.;
221 tmpboostZ(1, 1) = 1.;
222 tmpboostZ(1, 2) = 0.;
223 tmpboostZ(1, 3) = 0.;
224 tmpboostZ(2, 0) = -1.0 * beta_ * gama;
225 tmpboostZ(2, 1) = 0.;
226 tmpboostZ(2, 2) = gama;
227 tmpboostZ(2, 3) = 0.;
228 tmpboostZ(3, 0) = 0.;
229 tmpboostZ(3, 1) = 0.;
230 tmpboostZ(3, 2) = 0.;
231 tmpboostZ(3, 3) = 1.;
233 tmpboostXYZ = tmpboostZ * tmpboost;
234 tmpboostXYZ.Invert();
236 boost_ =
new TMatrixD(tmpboostXYZ);
248 <<
"Attempt to get a random engine when the RandomNumberGeneratorService is not configured.\n" 249 "You must configure the service if you want an engine.\n";
262 HepMCEvt->applyVtxGen(
newVertex(engine));
T getParameter(std::string const &) const
void Y0(double m=0)
set mean in Y in cm
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void emittance(double m=0)
emittance (no the normalized)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual HepMC::FourVector * newVertex(CLHEP::HepRandomEngine *)
return a new event vertex
Sin< T >::type sin(const T &t)
edm::EDGetTokenT< HepMCProduct > sourceLabel
void X0(double m=0)
set mean in X in cm
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
void sigmaZ(double s=1.0)
set resolution in Z in cm
HepMC::FourVector * fVertex
BetaBoostEvtVtxGenerator(const edm::ParameterSet &p)
void Phi(double m=0)
set half crossing angle
#define DEFINE_FWK_MODULE(type)
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
void produce(edm::Event &, const edm::EventSetup &) override
void betastar(double m=0)
set beta_star
double BetaFunction(double z, double z0)
beta function
void Alpha(double m=0)
angle between crossing plane and horizontal plane
const HepMC::GenEvent * GetEvent() const
~BetaBoostEvtVtxGenerator() override
StreamID streamID() const
void Z0(double m=0)
set mean in Z in cm
virtual TMatrixD * GetInvLorentzBoost()