CMS 3D CMS Logo

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