CMS 3D CMS Logo

GaussEvtVtxGenerator.cc
Go to the documentation of this file.
1 
2 
5 
7 
8 #include "CLHEP/Random/RandGaussQ.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  fMeanX = p.getParameter<double>("MeanX") * cm;
16  fMeanY = p.getParameter<double>("MeanY") * cm;
17  fMeanZ = p.getParameter<double>("MeanZ") * cm;
18  fSigmaX = p.getParameter<double>("SigmaX") * cm;
19  fSigmaY = p.getParameter<double>("SigmaY") * cm;
20  fSigmaZ = p.getParameter<double>("SigmaZ") * cm;
21  fTimeOffset = p.getParameter<double>("TimeOffset") * ns * c_light;
22 
23  if (fSigmaX < 0) {
24  throw cms::Exception("Configuration") << "Error in GaussEvtVtxGenerator: "
25  << "Illegal resolution in X (SigmaX is negative)";
26  }
27  if (fSigmaY < 0) {
28  throw cms::Exception("Configuration") << "Error in GaussEvtVtxGenerator: "
29  << "Illegal resolution in Y (SigmaY is negative)";
30  }
31  if (fSigmaZ < 0) {
32  throw cms::Exception("Configuration") << "Error in GaussEvtVtxGenerator: "
33  << "Illegal resolution in Z (SigmaZ is negative)";
34  }
35 }
36 
38 
39 HepMC::FourVector GaussEvtVtxGenerator::newVertex(CLHEP::HepRandomEngine* engine) const {
40  double X, Y, Z, T;
41  X = CLHEP::RandGaussQ::shoot(engine, fMeanX, fSigmaX);
42  Y = CLHEP::RandGaussQ::shoot(engine, fMeanY, fSigmaY);
43  Z = CLHEP::RandGaussQ::shoot(engine, fMeanZ, fSigmaZ);
44  T = CLHEP::RandGaussQ::shoot(engine, fTimeOffset, fSigmaZ);
45 
46  return HepMC::FourVector(X, Y, Z, T);
47 }
48 
50  if (s >= 0) {
51  fSigmaX = s;
52  } else {
53  throw cms::Exception("LogicError") << "Error in GaussEvtVtxGenerator::sigmaX: "
54  << "Illegal resolution in X (negative)";
55  }
56 }
57 
59  if (s >= 0) {
60  fSigmaY = s;
61  } else {
62  throw cms::Exception("LogicError") << "Error in GaussEvtVtxGenerator::sigmaY: "
63  << "Illegal resolution in Y (negative)";
64  }
65 }
66 
68  if (s >= 0) {
69  fSigmaZ = s;
70  } else {
71  throw cms::Exception("LogicError") << "Error in GaussEvtVtxGenerator::sigmaZ: "
72  << "Illegal resolution in Z (negative)";
73  }
74 }
GaussEvtVtxGenerator::fMeanY
double fMeanY
Definition: GaussEvtVtxGenerator.h:49
X
#define X(str)
Definition: MuonsGrabber.cc:38
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
GaussEvtVtxGenerator::sigmaY
void sigmaY(double s=1.0)
set resolution in Y in cm
Definition: GaussEvtVtxGenerator.cc:58
GaussEvtVtxGenerator::fSigmaX
double fSigmaX
Definition: GaussEvtVtxGenerator.h:48
GaussEvtVtxGenerator::fMeanX
double fMeanX
Definition: GaussEvtVtxGenerator.h:49
GaussEvtVtxGenerator::fSigmaY
double fSigmaY
Definition: GaussEvtVtxGenerator.h:48
alignCSCRings.s
s
Definition: alignCSCRings.py:92
GaussEvtVtxGenerator::newVertex
HepMC::FourVector newVertex(CLHEP::HepRandomEngine *) const override
return a new event vertex
Definition: GaussEvtVtxGenerator.cc:39
GaussEvtVtxGenerator::~GaussEvtVtxGenerator
~GaussEvtVtxGenerator() override
Definition: GaussEvtVtxGenerator.cc:37
GaussEvtVtxGenerator::GaussEvtVtxGenerator
GaussEvtVtxGenerator(const edm::ParameterSet &p)
Definition: GaussEvtVtxGenerator.cc:14
GaussEvtVtxGenerator::sigmaX
void sigmaX(double s=1.0)
set resolution in X in cm
Definition: GaussEvtVtxGenerator.cc:49
edm::ParameterSet
Definition: ParameterSet.h:47
GaussEvtVtxGenerator::sigmaZ
void sigmaZ(double s=1.0)
set resolution in Z in cm
Definition: GaussEvtVtxGenerator.cc:67
GaussEvtVtxGenerator::fSigmaZ
double fSigmaZ
Definition: GaussEvtVtxGenerator.h:48
GaussEvtVtxGenerator.h
GaussEvtVtxGenerator::fTimeOffset
double fTimeOffset
Definition: GaussEvtVtxGenerator.h:50
T
long double T
Definition: Basic3DVectorLD.h:48
Exception
Definition: hltDiff.cc:246
GaussEvtVtxGenerator::fMeanZ
double fMeanZ
Definition: GaussEvtVtxGenerator.h:49
Exception.h
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:31
ParameterSet.h
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:32
BaseEvtVtxGenerator
Definition: BaseEvtVtxGenerator.h:23