CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AlcaBeamSpotFromDB.cc
Go to the documentation of this file.
1 
12 // C++ standard
13 #include <string>
14 // CMS
17 
19 
25 
27  : beamSpotToken_(esConsumes<BeamSpotObjects, BeamSpotObjectsRcd, edm::Transition::EndLuminosityBlock>()) {
28  produces<reco::BeamSpot, edm::Transition::EndLuminosityBlock>("alcaBeamSpot");
29 }
30 
32 
33 //--------------------------------------------------------------------------------------------------
35 
36 //--------------------------------------------------------------------------------------------------
38  // read DB object
39  const BeamSpotObjects *spotDB = &iSetup.getData(beamSpotToken_);
40 
41  // translate from BeamSpotObjects to reco::BeamSpot
42  reco::BeamSpot::Point apoint(spotDB->x(), spotDB->y(), spotDB->z());
43 
45  for (int i = 0; i < 7; ++i) {
46  for (int j = 0; j < 7; ++j) {
47  matrix(i, j) = spotDB->covariance(i, j);
48  }
49  }
50 
51  reco::BeamSpot aSpot;
52  // this assume beam width same in x and y
53  aSpot = reco::BeamSpot(apoint, spotDB->sigmaZ(), spotDB->dxdz(), spotDB->dydz(), spotDB->beamWidthX(), matrix);
54  aSpot.setBeamWidthY(spotDB->beamWidthY());
55  aSpot.setEmittanceX(spotDB->emittanceX());
56  aSpot.setEmittanceY(spotDB->emittanceY());
57  aSpot.setbetaStar(spotDB->betaStar());
58 
59  if (spotDB->beamType() == 2) {
61  } else {
63  }
64 
65  auto result = std::make_unique<reco::BeamSpot>();
66  *result = aSpot;
67  lumiSeg.put(std::move(result), std::string("alcaBeamSpot"));
68 
69  // std::cout << " for runs: " << iEvent.id().run() << " - " <<
70  // iEvent.id().run() << std::endl;
71  std::cout << aSpot << std::endl;
72 }
73 
75 
77 
78 // define this as a plug-in
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:29
double z() const
get Z beam position
const edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > beamSpotToken_
double emittanceY() const
get emittance
double emittanceX() const
get emittance
void setbetaStar(double v)
Definition: BeamSpot.h:138
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
double beamWidthY() const
get average transverse beam width
double y() const
get Y beam position
double dxdz() const
get dxdz slope, crossing angle in XZ
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
double covariance(int i, int j) const
get i,j element of the full covariance matrix 7x7
tuple result
Definition: mps_fire.py:311
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:124
double sigmaZ() const
get sigma Z, RMS bunch length
bool getData(T &iHolder) const
Definition: EventSetup.h:122
int iEvent
Definition: GenABIO.cc:224
void setBeamWidthY(double v)
Definition: BeamSpot.h:105
void setEmittanceY(double v)
Definition: BeamSpot.h:137
void put(std::unique_ptr< PROD > product)
Put a new product.
double beamWidthX() const
get average transverse beam width
def move
Definition: eostools.py:511
void endLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) final
Transition
Definition: Transition.h:12
AlcaBeamSpotFromDB(const edm::ParameterSet &)
~AlcaBeamSpotFromDB() override
double x() const
get X beam position
double betaStar() const
get beta star
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) final
double dydz() const
get dydz slope, crossing angle in YZ
int beamType() const
get beam type
tuple cout
Definition: gather_cfg.py:144
void setEmittanceX(double v)
Definition: BeamSpot.h:136
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283