Skip to content

Commit

Permalink
put fake beamspot in the event if the arbitration returns a fake BS, …
Browse files Browse the repository at this point in the history
…by letting the BeamSpotOnlineProducer deal automatically with the arbitrated one
  • Loading branch information
mmusich committed May 9, 2023
1 parent b35249a commit 4b35c95
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions RecoVertex/BeamSpotProducer/plugins/BeamSpotOnlineProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,39 +103,39 @@ void BeamSpotOnlineProducer::produce(Event& iEvent, const EventSetup& iSetup) {
bool fallBackToDB = false;
if (useTransientRecord_) {
auto const& spotDB = iSetup.getData(beamTransientToken_);

if (spotDB.beamType() != 2) {
if (shoutMODE && beamTransientRcdESWatcher_.check(iSetup)) {
edm::LogWarning("BeamSpotFromDB")
<< "Online Beam Spot producer falls back to DB value because the ESProducer returned a fake beamspot ";
edm::LogWarning("BeamSpotFromDB") << "Online Beam Spot producer writes a fake beamspot value because the "
"ESProducer returned a fake beamspot!";
}
fallBackToDB = true;
} else {
// translate from BeamSpotObjects to reco::BeamSpot
// in case we need to switch to LHC reference frame
// ignore for the moment rotations, and translations
double f = 1.;
if (changeFrame_)
f = -1.;
reco::BeamSpot::Point apoint(f * spotDB.x(), f * spotDB.y(), f * spotDB.z());
}

reco::BeamSpot::CovarianceMatrix matrix;
for (int i = 0; i < 7; ++i) {
for (int j = 0; j < 7; ++j) {
matrix(i, j) = spotDB.covariance(i, j);
}
}
double sigmaZ = spotDB.sigmaZ();
if (theSetSigmaZ > 0)
sigmaZ = theSetSigmaZ;
// translate from BeamSpotObjects to reco::BeamSpot
// in case we need to switch to LHC reference frame
// ignore for the moment rotations, and translations
double f = 1.;
if (changeFrame_)
f = -1.;
reco::BeamSpot::Point apoint(f * spotDB.x(), f * spotDB.y(), f * spotDB.z());

// this assume beam width same in x and y
aSpot = reco::BeamSpot(apoint, sigmaZ, spotDB.dxdz(), spotDB.dydz(), spotDB.beamWidthX(), matrix);
aSpot.setBeamWidthY(spotDB.beamWidthY());
aSpot.setEmittanceX(spotDB.emittanceX());
aSpot.setEmittanceY(spotDB.emittanceY());
aSpot.setbetaStar(spotDB.betaStar());
aSpot.setType(reco::BeamSpot::Tracker);
reco::BeamSpot::CovarianceMatrix matrix;
for (int i = 0; i < 7; ++i) {
for (int j = 0; j < 7; ++j) {
matrix(i, j) = spotDB.covariance(i, j);
}
}
double sigmaZ = spotDB.sigmaZ();
if (theSetSigmaZ > 0)
sigmaZ = theSetSigmaZ;

// this assume beam width same in x and y
aSpot = reco::BeamSpot(apoint, sigmaZ, spotDB.dxdz(), spotDB.dydz(), spotDB.beamWidthX(), matrix);
aSpot.setBeamWidthY(spotDB.beamWidthY());
aSpot.setEmittanceX(spotDB.emittanceX());
aSpot.setEmittanceY(spotDB.emittanceY());
aSpot.setbetaStar(spotDB.betaStar());
aSpot.setType(static_cast<reco::BeamSpot::BeamType>(spotDB.beamType()));
} else {
// get scalar collection
Handle<BeamSpotOnlineCollection> handleScaler;
Expand Down

0 comments on commit 4b35c95

Please sign in to comment.