CMS 3D CMS Logo

FlatEvtVtxGenerator.cc
Go to the documentation of this file.
1 
2 
5 
7 
8 #include "CLHEP/Random/RandFlat.h"
9 #include "CLHEP/Units/GlobalSystemOfUnits.h"
10 #include "CLHEP/Units/GlobalPhysicalConstants.h"
11 //#include "CLHEP/Vector/ThreeVector.h"
12 #include "HepMC/SimpleVector.h"
13 
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;
23 
24  if (fMinX > fMaxX) {
25  throw cms::Exception("Configuration") << "Error in FlatEvtVtxGenerator: "
26  << "MinX is greater than MaxX";
27  }
28  if (fMinY > fMaxY) {
29  throw cms::Exception("Configuration") << "Error in FlatEvtVtxGenerator: "
30  << "MinY is greater than MaxY";
31  }
32  if (fMinZ > fMaxZ) {
33  throw cms::Exception("Configuration") << "Error in FlatEvtVtxGenerator: "
34  << "MinZ is greater than MaxZ";
35  }
36  if (fMinT > fMaxT) {
37  throw cms::Exception("Configuration") << "Error in FlatEvtVtxGenerator: "
38  << "MinT is greater than MaxT";
39  }
40 }
41 
43 
44 //Hep3Vector * FlatEvtVtxGenerator::newVertex() {
45 HepMC::FourVector FlatEvtVtxGenerator::newVertex(CLHEP::HepRandomEngine* engine) const {
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);
51 
52  return HepMC::FourVector(aX, aY, aZ, aT);
53 }
54 
56 
58 
60 
62 
64 
FlatEvtVtxGenerator::maxY
void maxY(double m=0)
set max in Y in cm
Definition: FlatEvtVtxGenerator.cc:63
FlatEvtVtxGenerator::fMinZ
double fMinZ
Definition: FlatEvtVtxGenerator.h:54
min
T min(T a, T b)
Definition: MathUtil.h:58
FlatEvtVtxGenerator::~FlatEvtVtxGenerator
~FlatEvtVtxGenerator() override
Definition: FlatEvtVtxGenerator.cc:42
FlatEvtVtxGenerator::minY
void minY(double m=0.0)
set min in Y in cm
Definition: FlatEvtVtxGenerator.cc:57
FlatEvtVtxGenerator::newVertex
HepMC::FourVector newVertex(CLHEP::HepRandomEngine *) const override
return a new event vertex
Definition: FlatEvtVtxGenerator.cc:45
FlatEvtVtxGenerator::fMaxX
double fMaxX
Definition: FlatEvtVtxGenerator.h:55
FlatEvtVtxGenerator::minZ
void minZ(double m=0.0)
set min in Z in cm
Definition: FlatEvtVtxGenerator.cc:59
FlatEvtVtxGenerator::fMinY
double fMinY
Definition: FlatEvtVtxGenerator.h:54
FlatEvtVtxGenerator::fMaxT
double fMaxT
Definition: FlatEvtVtxGenerator.h:55
FlatEvtVtxGenerator::fMinT
double fMinT
Definition: FlatEvtVtxGenerator.h:54
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
FlatEvtVtxGenerator::FlatEvtVtxGenerator
FlatEvtVtxGenerator(const edm::ParameterSet &p)
Definition: FlatEvtVtxGenerator.cc:14
FlatEvtVtxGenerator.h
Exception
Definition: hltDiff.cc:245
FlatEvtVtxGenerator::minX
void minX(double m=0.0)
set min in X in cm
Definition: FlatEvtVtxGenerator.cc:55
Exception.h
ParameterSet.h
FlatEvtVtxGenerator::fMaxZ
double fMaxZ
Definition: FlatEvtVtxGenerator.h:55
FlatEvtVtxGenerator::maxX
void maxX(double m=0)
set max in X in cm
Definition: FlatEvtVtxGenerator.cc:61
BaseEvtVtxGenerator
Definition: BaseEvtVtxGenerator.h:23
FlatEvtVtxGenerator::fMaxY
double fMaxY
Definition: FlatEvtVtxGenerator.h:55
FlatEvtVtxGenerator::maxZ
void maxZ(double m=0)
set max in Z in cm
Definition: FlatEvtVtxGenerator.cc:65
FlatEvtVtxGenerator::fMinX
double fMinX
Definition: FlatEvtVtxGenerator.h:54