CMS 3D CMS Logo

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->GetX(), spotDB->GetY(), spotDB->GetZ());
43 
45  for (int i = 0; i < 7; ++i) {
46  for (int j = 0; j < 7; ++j) {
47  matrix(i, j) = spotDB->GetCovariance(i, j);
48  }
49  }
50 
51  reco::BeamSpot aSpot;
52  // this assume beam width same in x and y
53  aSpot = reco::BeamSpot(
54  apoint, spotDB->GetSigmaZ(), spotDB->Getdxdz(), spotDB->Getdydz(), spotDB->GetBeamWidthX(), matrix);
55  aSpot.setBeamWidthY(spotDB->GetBeamWidthY());
56  aSpot.setEmittanceX(spotDB->GetEmittanceX());
57  aSpot.setEmittanceY(spotDB->GetEmittanceY());
58  aSpot.setbetaStar(spotDB->GetBetaStar());
59 
60  if (spotDB->GetBeamType() == 2) {
62  } else {
64  }
65 
66  auto result = std::make_unique<reco::BeamSpot>();
67  *result = aSpot;
68  lumiSeg.put(std::move(result), std::string("alcaBeamSpot"));
69 
70  // std::cout << " for runs: " << iEvent.id().run() << " - " <<
71  // iEvent.id().run() << std::endl;
72  std::cout << aSpot << std::endl;
73 }
74 
76 
78 
79 // define this as a plug-in
BeamSpotObjects::GetBeamWidthY
double GetBeamWidthY() const
get average transverse beam width
Definition: BeamSpotObjects.h:77
BeamSpotObjects::Getdxdz
double Getdxdz() const
get dxdz slope, crossing angle in XZ
Definition: BeamSpotObjects.h:79
mps_fire.i
i
Definition: mps_fire.py:428
reco::BeamSpot::setBeamWidthY
void setBeamWidthY(double v)
Definition: BeamSpot.h:105
MessageLogger.h
makeMuonMisalignmentScenario.matrix
list matrix
Definition: makeMuonMisalignmentScenario.py:141
reco::BeamSpot::setEmittanceY
void setEmittanceY(double v)
Definition: BeamSpot.h:137
align::BeamSpot
Definition: StructureType.h:95
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
BeamSpotObjects::GetSigmaZ
double GetSigmaZ() const
get sigma Z, RMS bunch length
Definition: BeamSpotObjects.h:73
LuminosityBlock.h
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
BeamSpotObjects::GetBeamType
int GetBeamType() const
get beam type
Definition: BeamSpotObjects.h:101
BeamSpotObjects::GetZ
double GetZ() const
get Z beam position
Definition: BeamSpotObjects.h:71
AlcaBeamSpotFromDB::beginJob
void beginJob() final
Definition: AlcaBeamSpotFromDB.cc:75
AlcaBeamSpotFromDB::endLuminosityBlockProduce
void endLuminosityBlockProduce(edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) final
Definition: AlcaBeamSpotFromDB.cc:37
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
BeamSpot.h
Service.h
reco::BeamSpot
Definition: BeamSpot.h:21
reco::BeamSpot::Tracker
Definition: BeamSpot.h:24
BeamSpotObjects::GetCovariance
double GetCovariance(int i, int j) const
get i,j element of the full covariance matrix 7x7
Definition: BeamSpotObjects.h:83
reco::BeamSpot::Fake
Definition: BeamSpot.h:24
reco::BeamSpot::setEmittanceX
void setEmittanceX(double v)
Definition: BeamSpot.h:136
AlcaBeamSpotFromDB::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) final
Definition: AlcaBeamSpotFromDB.cc:34
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BeamSpotObjects::GetBetaStar
double GetBetaStar() const
get beta star
Definition: BeamSpotObjects.h:107
BeamSpotObjects::GetEmittanceX
double GetEmittanceX() const
get emittance
Definition: BeamSpotObjects.h:103
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Transition
Transition
Definition: Transition.h:12
BeamSpotObjects::GetY
double GetY() const
get Y beam position
Definition: BeamSpotObjects.h:69
reco::BeamSpot::setbetaStar
void setbetaStar(double v)
Definition: BeamSpot.h:138
AlcaBeamSpotFromDB::endJob
void endJob() final
Definition: AlcaBeamSpotFromDB.cc:77
iEvent
int iEvent
Definition: GenABIO.cc:224
BeamSpotObjectsRcd
Definition: BeamSpotObjectsRcd.h:24
BeamSpotObjects
Definition: BeamSpotObjects.h:20
edm::EventSetup
Definition: EventSetup.h:58
reco::BeamSpot::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:29
edm::LuminosityBlock::put
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: LuminosityBlock.h:116
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
BeamSpotObjects::GetBeamWidthX
double GetBeamWidthX() const
get average transverse beam width
Definition: BeamSpotObjects.h:75
AlcaBeamSpotFromDB::AlcaBeamSpotFromDB
AlcaBeamSpotFromDB(const edm::ParameterSet &)
Definition: AlcaBeamSpotFromDB.cc:26
eostools.move
def move(src, dest)
Definition: eostools.py:511
BeamSpotObjects::GetEmittanceY
double GetEmittanceY() const
get emittance
Definition: BeamSpotObjects.h:105
AlcaBeamSpotFromDB::~AlcaBeamSpotFromDB
~AlcaBeamSpotFromDB() override
Definition: AlcaBeamSpotFromDB.cc:31
BeamSpotObjects::Getdydz
double Getdydz() const
get dydz slope, crossing angle in YZ
Definition: BeamSpotObjects.h:81
EventSetup.h
AlcaBeamSpotFromDB
Definition: AlcaBeamSpotFromDB.h:25
mps_fire.result
result
Definition: mps_fire.py:311
reco::BeamSpot::Point
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
reco::BeamSpot::setType
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:124
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
AlcaBeamSpotFromDB::beamSpotToken_
const edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > beamSpotToken_
Definition: AlcaBeamSpotFromDB.h:31
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
IOVSyncValue.h
AlcaBeamSpotFromDB.h
BeamSpotObjects::GetX
double GetX() const
get X beam position
Definition: BeamSpotObjects.h:67