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)) {
117 fX0 =
p.getParameter<
double>(
"X0") * cm;
118 fY0 =
p.getParameter<
double>(
"Y0") * cm;
119 fZ0 =
p.getParameter<
double>(
"Z0") * cm;
120 fSigmaZ =
p.getParameter<
double>(
"SigmaZ") * cm;
121 alpha_ =
p.getParameter<
double>(
"Alpha") * radian;
122 phi_ =
p.getParameter<
double>(
"Phi") * radian;
123 fbetastar =
p.getParameter<
double>(
"BetaStar") * cm;
124 femittance =
p.getParameter<
double>(
"Emittance") * cm;
125 fTimeOffset =
p.getParameter<
double>(
"TimeOffset") * ns * c_light;
126 beta_ =
p.getParameter<
double>(
"Beta");
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));