8 #include "CLHEP/Random/RandFlat.h" 9 #include "CLHEP/Units/GlobalSystemOfUnits.h" 10 #include "CLHEP/Units/GlobalPhysicalConstants.h" 12 #include "HepMC/SimpleVector.h" 15 fMinX =
p.getParameter<
double>(
"MinX") * cm;
16 fMinY =
p.getParameter<
double>(
"MinY") * cm;
17 fMinZ =
p.getParameter<
double>(
"MinZ") * cm;
18 fMaxX =
p.getParameter<
double>(
"MaxX") * cm;
19 fMaxY =
p.getParameter<
double>(
"MaxY") * cm;
20 fMaxZ =
p.getParameter<
double>(
"MaxZ") * cm;
21 fMinT =
p.getParameter<
double>(
"MinT") * ns * c_light;
22 fMaxT =
p.getParameter<
double>(
"MaxT") * ns * c_light;
25 throw cms::Exception(
"Configuration") <<
"Error in FlatEvtVtxGenerator: " 26 <<
"MinX is greater than MaxX";
29 throw cms::Exception(
"Configuration") <<
"Error in FlatEvtVtxGenerator: " 30 <<
"MinY is greater than MaxY";
33 throw cms::Exception(
"Configuration") <<
"Error in FlatEvtVtxGenerator: " 34 <<
"MinZ is greater than MaxZ";
37 throw cms::Exception(
"Configuration") <<
"Error in FlatEvtVtxGenerator: " 38 <<
"MinT is greater than MaxT";
46 double aX, aY, aZ, aT;
47 aX = CLHEP::RandFlat::shoot(engine,
fMinX,
fMaxX);
48 aY = CLHEP::RandFlat::shoot(engine,
fMinY,
fMaxY);
49 aZ = CLHEP::RandFlat::shoot(engine,
fMinZ,
fMaxZ);
50 aT = CLHEP::RandFlat::shoot(engine,
fMinT,
fMaxT);
52 return HepMC::FourVector(aX, aY, aZ, aT);
void minZ(double m=0.0)
set min in Z in cm
HepMC::FourVector newVertex(CLHEP::HepRandomEngine *) const override
return a new event vertex
~FlatEvtVtxGenerator() override
void maxZ(double m=0)
set max in Z in cm
FlatEvtVtxGenerator(const edm::ParameterSet &p)
void minX(double m=0.0)
set min in X in cm
void minY(double m=0.0)
set min in Y in cm
void maxX(double m=0)
set max in X in cm
void maxY(double m=0)
set max in Y in cm