CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AlcaBeamSpotFromDB.cc
Go to the documentation of this file.
1 
13 // C++ standard
14 #include <string>
15 // CMS
18 
20 
23 
30 
31 
33 {
34 
35  produces<reco::BeamSpot, edm::InLumi>("alcaBeamSpot");
36 }
37 
38 
40 {
41 
42 }
43 
44 //--------------------------------------------------------------------------------------------------
46 
47 }
48 
49 //--------------------------------------------------------------------------------------------------
51 {
52  // read DB object
54  iSetup.get<BeamSpotObjectsRcd>().get(beamhandle);
55  const BeamSpotObjects *spotDB = beamhandle.product();
56 
57  // translate from BeamSpotObjects to reco::BeamSpot
58  reco::BeamSpot::Point apoint( spotDB->GetX(), spotDB->GetY(), spotDB->GetZ() );
59 
61  for ( int i=0; i<7; ++i ) {
62  for ( int j=0; j<7; ++j ) {
63  matrix(i,j) = spotDB->GetCovariance(i,j);
64  }
65  }
66 
67  reco::BeamSpot aSpot;
68  // this assume beam width same in x and y
69  aSpot = reco::BeamSpot( apoint,
70  spotDB->GetSigmaZ(),
71  spotDB->Getdxdz(),
72  spotDB->Getdydz(),
73  spotDB->GetBeamWidthX(),
74  matrix );
75  aSpot.setBeamWidthY( spotDB->GetBeamWidthY() );
76  aSpot.setEmittanceX( spotDB->GetEmittanceX() );
77  aSpot.setEmittanceY( spotDB->GetEmittanceY() );
78  aSpot.setbetaStar( spotDB->GetBetaStar() );
79 
80  if ( spotDB->GetBeamType() == 2 ) {
82  } else{
84  }
85 
86  std::auto_ptr<reco::BeamSpot> result(new reco::BeamSpot);
87  *result = aSpot;
88  lumiSeg.put(result, std::string("alcaBeamSpot"));
89 
90  //std::cout << " for runs: " << iEvent.id().run() << " - " << iEvent.id().run() << std::endl;
91  std::cout << aSpot << std::endl;
92 
93 }
94 
95 
96 void
98 {
99 }
100 
101 void
103 }
104 
105 //define this as a plug-in
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) overridefinal
double Getdydz() const
get dydz slope, crossing angle in YZ
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:31
int i
Definition: DBlmapReader.cc:9
double GetY() const
get Y beam position
void setbetaStar(double v)
Definition: BeamSpot.h:145
#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
virtual void endLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) overridefinal
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:29
double GetBeamWidthY() const
get average transverse beam width
double GetEmittanceX() const
get emittance
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:131
int iEvent
Definition: GenABIO.cc:230
void setBeamWidthY(double v)
Definition: BeamSpot.h:109
void setEmittanceY(double v)
Definition: BeamSpot.h:144
int GetBeamType() const
get beam type
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
double GetZ() const
get Z beam position
AlcaBeamSpotFromDB(const edm::ParameterSet &)
double Getdxdz() const
get dxdz slope, crossing angle in XZ
virtual void beginJob() overridefinal
double GetX() const
get X beam position
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
double GetBetaStar() const
get beta star
double GetCovariance(int i, int j) const
get i,j element of the full covariance matrix 7x7
virtual void endJob() overridefinal
tuple cout
Definition: gather_cfg.py:121
double GetEmittanceY() const
get emittance
void setEmittanceX(double v)
Definition: BeamSpot.h:143
void put(std::auto_ptr< PROD > product)
Put a new product.