Skip to content

Commit

Permalink
Check if detector ID was found before adding the digi to the collection.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomreis committed Jun 11, 2022
1 parent 99e32f4 commit ef03458
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions HLTrigger/special/plugins/HLTEcalPhiSymFilter.cc
Expand Up @@ -4,6 +4,7 @@
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "Calibration/Tools/interface/EcalRingCalibrationTools.h"
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
Expand Down Expand Up @@ -126,7 +127,12 @@ bool HLTEcalPhiSymFilter::filter(edm::StreamID, edm::Event& event, const edm::Ev
float amplitude = hit.amplitude();
if (statusCode <= statusThreshold_ && amplitude > ampCut) {
const auto digiIt = EBDigis->find(hitDetId);
phiSymEBDigiCollection->push_back(digiIt->id(), digiIt->begin());
if (digiIt != EBDigis->end()) {
phiSymEBDigiCollection->push_back(digiIt->id(), digiIt->begin());
} else {
throw cms::Exception("DetIdNotFound") << "The detector ID " << hitDetId.rawId()
<< " is not in the EB digis collection or the collection is not sorted.";
}
}
}

Expand All @@ -149,7 +155,12 @@ bool HLTEcalPhiSymFilter::filter(edm::StreamID, edm::Event& event, const edm::Ev
float amplitude = hit.amplitude();
if (statusCode <= statusThreshold_ && amplitude > ampCut) {
const auto digiIt = EEDigis->find(hitDetId);
phiSymEEDigiCollection->push_back(digiIt->id(), digiIt->begin());
if (digiIt != EEDigis->end()) {
phiSymEEDigiCollection->push_back(digiIt->id(), digiIt->begin());
} else {
throw cms::Exception("DetIdNotFound") << "The detector ID " << hitDetId.rawId()
<< " is not in the EE digis collection or the collection is not sorted.";
}
}
}

Expand Down

0 comments on commit ef03458

Please sign in to comment.