CMS 3D CMS Logo

AlcaBeamSpotFromDB.cc
Go to the documentation of this file.
1 
12 // C++ standard
13 #include <string>
14 // CMS
17 
19 
22 
29 
31  produces<reco::BeamSpot, edm::Transition::EndLuminosityBlock>("alcaBeamSpot");
32 }
33 
35 
36 //--------------------------------------------------------------------------------------------------
38 
39 //--------------------------------------------------------------------------------------------------
41  // read DB object
43  iSetup.get<BeamSpotObjectsRcd>().get(beamhandle);
44  const BeamSpotObjects *spotDB = beamhandle.product();
45 
46  // translate from BeamSpotObjects to reco::BeamSpot
47  reco::BeamSpot::Point apoint(spotDB->GetX(), spotDB->GetY(), spotDB->GetZ());
48 
50  for (int i = 0; i < 7; ++i) {
51  for (int j = 0; j < 7; ++j) {
52  matrix(i, j) = spotDB->GetCovariance(i, j);
53  }
54  }
55 
56  reco::BeamSpot aSpot;
57  // this assume beam width same in x and y
58  aSpot = reco::BeamSpot(
59  apoint, spotDB->GetSigmaZ(), spotDB->Getdxdz(), spotDB->Getdydz(), spotDB->GetBeamWidthX(), matrix);
60  aSpot.setBeamWidthY(spotDB->GetBeamWidthY());
61  aSpot.setEmittanceX(spotDB->GetEmittanceX());
62  aSpot.setEmittanceY(spotDB->GetEmittanceY());
63  aSpot.setbetaStar(spotDB->GetBetaStar());
64 
65  if (spotDB->GetBeamType() == 2) {
67  } else {
69  }
70 
71  auto result = std::make_unique<reco::BeamSpot>();
72  *result = aSpot;
73  lumiSeg.put(std::move(result), std::string("alcaBeamSpot"));
74 
75  // std::cout << " for runs: " << iEvent.id().run() << " - " <<
76  // iEvent.id().run() << std::endl;
77  std::cout << aSpot << std::endl;
78 }
79 
81 
83 
84 // define this as a plug-in
double Getdydz() const
get dydz slope, crossing angle in YZ
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:29
double GetY() const
get Y beam position
void setbetaStar(double v)
Definition: BeamSpot.h:138
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:27
double GetBeamWidthY() const
get average transverse beam width
double GetEmittanceX() const
get emittance
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:124
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setBeamWidthY(double v)
Definition: BeamSpot.h:105
void setEmittanceY(double v)
Definition: BeamSpot.h:137
int GetBeamType() const
get beam type
void put(std::unique_ptr< PROD > product)
Put a new product.
void endLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) final
double GetZ() const
get Z beam position
AlcaBeamSpotFromDB(const edm::ParameterSet &)
~AlcaBeamSpotFromDB() override
double Getdxdz() const
get dxdz slope, crossing angle in XZ
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) final
double GetX() const
get X beam position
double GetBetaStar() const
get beta star
double GetCovariance(int i, int j) const
get i,j element of the full covariance matrix 7x7
T get() const
Definition: EventSetup.h:73
double GetEmittanceY() const
get emittance
void setEmittanceX(double v)
Definition: BeamSpot.h:136
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511