Skip to content

Commit cc33c28

Browse files
authored
Merge pull request #45679 from mmusich/mm_dev_morePrintOut_BeamSpotOnlineProducer
`BeamSpotOnlineProducer`: add more printouts in case of invalid errors
2 parents ff2f075 + 741abb1 commit cc33c28

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

RecoVertex/BeamSpotProducer/plugins/BeamSpotOnlineProducer.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ________________________________________________________________**/
1515
#include "CondFormats/DataRecord/interface/BeamSpotTransientObjectsRcd.h"
1616
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
1717
#include "DataFormats/Common/interface/Handle.h"
18+
#include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
1819
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
1920
#include "DataFormats/Scalers/interface/BeamSpotOnline.h"
2021
#include "FWCore/Framework/interface/ESHandle.h"
@@ -119,8 +120,8 @@ void BeamSpotOnlineProducer::produce(Event& iEvent, const EventSetup& iSetup) {
119120
reco::BeamSpot::Point apoint(f * spotDB.x(), f * spotDB.y(), f * spotDB.z());
120121

121122
reco::BeamSpot::CovarianceMatrix matrix;
122-
for (int i = 0; i < 7; ++i) {
123-
for (int j = 0; j < 7; ++j) {
123+
for (int i = 0; i < reco::BeamSpot::dimension; ++i) {
124+
for (int j = 0; j < reco::BeamSpot::dimension; ++j) {
124125
matrix(i, j) = spotDB.covariance(i, j);
125126
}
126127
}
@@ -209,8 +210,8 @@ void BeamSpotOnlineProducer::produce(Event& iEvent, const EventSetup& iSetup) {
209210
reco::BeamSpot::Point apoint(spotDB->x(), spotDB->y(), spotDB->z());
210211

211212
reco::BeamSpot::CovarianceMatrix matrix;
212-
for (int i = 0; i < 7; ++i) {
213-
for (int j = 0; j < 7; ++j) {
213+
for (int i = 0; i < reco::BeamSpot::dimension; ++i) {
214+
for (int j = 0; j < reco::BeamSpot::dimension; ++j) {
214215
matrix(i, j) = spotDB->covariance(i, j);
215216
}
216217
}
@@ -222,6 +223,11 @@ void BeamSpotOnlineProducer::produce(Event& iEvent, const EventSetup& iSetup) {
222223
aSpot.setEmittanceY(spotDB->emittanceY());
223224
aSpot.setbetaStar(spotDB->betaStar());
224225
aSpot.setType(reco::BeamSpot::Tracker);
226+
227+
GlobalError bse(aSpot.rotatedCovariance3D());
228+
if ((bse.cxx() <= 0.) || (bse.cyy() <= 0.) || (bse.czz() <= 0.)) {
229+
edm::LogError("UnusableBeamSpot") << "Beamspot from fallback to DB with invalid errors: " << aSpot.covariance();
230+
}
225231
}
226232

227233
*result = aSpot;

0 commit comments

Comments
 (0)