Skip to content

Commit ec5e2f5

Browse files
committed
protect for missing reco::BeamSpot
1 parent 7cdba48 commit ec5e2f5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Validation/RecoMuon/plugins/MuonTrackValidator.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,10 @@ void MuonTrackValidator::analyze(const edm::Event& event, const edm::EventSetup&
421421
TrackingParticleRefVector const& tPC = *ptr_TPrefV;
422422

423423
edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
424-
event.getByToken(bsSrc_Token, recoBeamSpotHandle);
425-
reco::BeamSpot bs = *recoBeamSpotHandle;
424+
bool bs_Available = event.getByToken(bsSrc_Token, recoBeamSpotHandle);
425+
reco::BeamSpot bs;
426+
if (bs_Available) bs = *recoBeamSpotHandle;
427+
edm::LogVerbatim("MuonTrackValidator") << bs;
426428

427429
std::vector<const reco::TrackToTrackingParticleAssociator*> associator;
428430
if (UseAssociators) {

0 commit comments

Comments
 (0)