9 #include "CLHEP/Random/RandFlat.h" 10 #include "CLHEP/Units/GlobalSystemOfUnits.h" 11 #include "CLHEP/Units/GlobalPhysicalConstants.h" 13 #include "HepMC/SimpleVector.h" 16 fMinX =
p.getParameter<
double>(
"MinX") * cm;
17 fMinY =
p.getParameter<
double>(
"MinY") * cm;
18 fMinZ =
p.getParameter<
double>(
"MinZ") * cm;
19 fMaxX =
p.getParameter<
double>(
"MaxX") * cm;
20 fMaxY =
p.getParameter<
double>(
"MaxY") * cm;
21 fMaxZ =
p.getParameter<
double>(
"MaxZ") * cm;
22 fMinT =
p.getParameter<
double>(
"MinT") * ns * c_light;
23 fMaxT =
p.getParameter<
double>(
"MaxT") * ns * c_light;
26 throw cms::Exception(
"Configuration") <<
"Error in FlatEvtVtxGenerator: " 27 <<
"MinX is greater than MaxX";
30 throw cms::Exception(
"Configuration") <<
"Error in FlatEvtVtxGenerator: " 31 <<
"MinY is greater than MaxY";
34 throw cms::Exception(
"Configuration") <<
"Error in FlatEvtVtxGenerator: " 35 <<
"MinZ is greater than MaxZ";
38 throw cms::Exception(
"Configuration") <<
"Error in FlatEvtVtxGenerator: " 39 <<
"MinT is greater than MaxT";
43 <<
":" <<
fMaxT <<
"]";
50 double aX, aY, aZ, aT;
51 aX = CLHEP::RandFlat::shoot(engine,
fMinX,
fMaxX);
52 aY = CLHEP::RandFlat::shoot(engine,
fMinY,
fMaxY);
53 aZ = CLHEP::RandFlat::shoot(engine,
fMinZ,
fMaxZ);
54 aT = CLHEP::RandFlat::shoot(engine,
fMinT,
fMaxT);
56 edm::LogVerbatim(
"FlatEvtVtx") <<
"FlatEvtVtxGenerator Vertex at [" << aX <<
", " << aY <<
", " << aZ <<
", " << aT
59 return HepMC::FourVector(aX, aY, aZ, aT);
Log< level::Info, true > LogVerbatim
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