CMS 3D CMS Logo

BeamSpotProducer.cc
Go to the documentation of this file.
1 
4 
12 
15 
16 //
17 // constructors and destructor
18 //
20  edm::LogInfo("RecoVertex/BeamSpotProducer") << "Initializing Beam Spot producer "
21  << "\n";
22 
23  //fVerbose=conf.getUntrackedParameter<bool>("verbose", false);
24 
25  produces<reco::BeamSpot>();
26 }
27 
29 
30 //
31 // member functions
32 //
33 
34 // ------------ method called to produce the data ------------
36  using namespace edm;
37 
38  auto result = std::make_unique<reco::BeamSpot>();
39 
40  reco::BeamSpot aSpot;
41 
42  //typedef math::XYZPoint Point;
43  //enum { dimension = 7 };
44  //typedef math::Error<dimension>::type CovarianceMatrix;
45 
46  //try {
47  edm::LogInfo("RecoVertex/BeamSpotProducer") << "Reconstructing event number: " << iEvent.id() << "\n";
48 
50  iSetup.get<BeamSpotObjectsRcd>().get(beamhandle);
51  const BeamSpotObjects* spotDB = beamhandle.product();
52 
53  // translate from BeamSpotObjects to reco::BeamSpot
54  reco::BeamSpot::Point apoint(spotDB->GetX(), spotDB->GetY(), spotDB->GetZ());
55 
57  for (int i = 0; i < 7; ++i) {
58  for (int j = 0; j < 7; ++j) {
59  matrix(i, j) = spotDB->GetCovariance(i, j);
60  }
61  }
62 
63  // this assume beam width same in x and y
64  aSpot = reco::BeamSpot(
65  apoint, spotDB->GetSigmaZ(), spotDB->Getdxdz(), spotDB->Getdydz(), spotDB->GetBeamWidthX(), matrix);
66  aSpot.setBeamWidthY(spotDB->GetBeamWidthY());
67  aSpot.setEmittanceX(spotDB->GetEmittanceX());
68  aSpot.setEmittanceY(spotDB->GetEmittanceY());
69  aSpot.setbetaStar(spotDB->GetBetaStar());
70 
71  //}
72  //
73  //catch (std::exception & err) {
74  // edm::LogInfo("RecoVertex/BeamSpotProducer")
75  // << "Exception during event number: " << iEvent.id()
76  // << "\n" << err.what() << "\n";
77  //}
78 
79  *result = aSpot;
80 
81  iEvent.put(std::move(result));
82 }
83 
84 //define this as a plug-in
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
BeamSpotObjects::GetBeamWidthY
double GetBeamWidthY() const
get average transverse beam width
Definition: BeamSpotObjects.h:77
BeamSpotObjects::Getdxdz
double Getdxdz() const
get dxdz slope, crossing angle in XZ
Definition: BeamSpotObjects.h:79
mps_fire.i
i
Definition: mps_fire.py:355
reco::BeamSpot::setBeamWidthY
void setBeamWidthY(double v)
Definition: BeamSpot.h:105
MessageLogger.h
makeMuonMisalignmentScenario.matrix
list matrix
Definition: makeMuonMisalignmentScenario.py:141
reco::BeamSpot::setEmittanceY
void setEmittanceY(double v)
Definition: BeamSpot.h:137
ESHandle.h
align::BeamSpot
Definition: StructureType.h:89
BeamSpotProducer::BeamSpotProducer
BeamSpotProducer(const edm::ParameterSet &iConf)
constructor
Definition: BeamSpotProducer.cc:19
BeamSpotObjects::GetSigmaZ
double GetSigmaZ() const
get sigma Z, RMS bunch length
Definition: BeamSpotObjects.h:73
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::LogInfo
Definition: MessageLogger.h:254
BeamSpotObjects::GetZ
double GetZ() const
get Z beam position
Definition: BeamSpotObjects.h:71
BeamSpotProducer
Definition: BeamSpotProducer.h:21
BeamSpotProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
produce a beam spot class
Definition: BeamSpotProducer.cc:35
MakerMacros.h
BeamSpotObjects.h
BeamSpotObjectsRcd.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
BeamSpot.h
reco::BeamSpot
Definition: BeamSpot.h:21
BeamSpotProducer.h
edm::ESHandle
Definition: DTSurvey.h:22
BeamSpotObjects::GetCovariance
double GetCovariance(int i, int j) const
get i,j element of the full covariance matrix 7x7
Definition: BeamSpotObjects.h:83
reco::BeamSpot::setEmittanceX
void setEmittanceX(double v)
Definition: BeamSpot.h:136
BeamSpotProducer::~BeamSpotProducer
~BeamSpotProducer() override
destructor
Definition: BeamSpotProducer.cc:28
BeamSpotObjects::GetBetaStar
double GetBetaStar() const
get beta star
Definition: BeamSpotObjects.h:107
Error.h
BeamSpotObjects::GetEmittanceX
double GetEmittanceX() const
get emittance
Definition: BeamSpotObjects.h:103
edm::ParameterSet
Definition: ParameterSet.h:36
BeamSpotObjects::GetY
double GetY() const
get Y beam position
Definition: BeamSpotObjects.h:69
reco::BeamSpot::setbetaStar
void setbetaStar(double v)
Definition: BeamSpot.h:138
iEvent
int iEvent
Definition: GenABIO.cc:224
BeamSpotObjectsRcd
Definition: BeamSpotObjectsRcd.h:24
BeamSpotObjects
Definition: BeamSpotObjects.h:20
edm::EventSetup
Definition: EventSetup.h:57
reco::BeamSpot::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:29
get
#define get
BeamSpotObjects::GetBeamWidthX
double GetBeamWidthX() const
get average transverse beam width
Definition: BeamSpotObjects.h:75
eostools.move
def move(src, dest)
Definition: eostools.py:511
BeamSpotObjects::GetEmittanceY
double GetEmittanceY() const
get emittance
Definition: BeamSpotObjects.h:105
BeamSpotObjects::Getdydz
double Getdydz() const
get dydz slope, crossing angle in YZ
Definition: BeamSpotObjects.h:81
Point3D.h
EventSetup.h
mps_fire.result
result
Definition: mps_fire.py:303
reco::BeamSpot::Point
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
IOVSyncValue.h
BeamSpotObjects::GetX
double GetX() const
get X beam position
Definition: BeamSpotObjects.h:67