test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  std::auto_ptr<reco::BeamSpot> result(new 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(result);
94 
95 }
96 
97 //define this as a plug-in
99 
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:31
int i
Definition: DBlmapReader.cc:9
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:29
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
produce a beam spot class
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
tuple result
Definition: query.py:137
BeamSpotProducer(const edm::ParameterSet &iConf)
constructor
int j
Definition: DBlmapReader.cc:9
~BeamSpotProducer()
destructor
const T & get() const
Definition: EventSetup.h:56
edm::EventID id() const
Definition: EventBase.h:60