Skip to content

Commit

Permalink
Merge pull request #41969 from mmusich/addProtectionPNetJetTagMonitor…
Browse files Browse the repository at this point in the history
…_13_1_X

[13.1.X] add protection to `ParticleNetJetTagMonitor`, removed unused struct
  • Loading branch information
cmsbuild authored Jun 15, 2023
2 parents 39ef7a1 + ac60b2c commit 425a5aa
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ class ParticleNetJetTagMonitor : public DQMEDAnalyzer, public TriggerDQMBase {
void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) override;

struct JetRefCompare {
inline bool operator()(const edm::RefToBase<reco::Jet>& j1, const edm::RefToBase<reco::Jet>& j2) const {
return (j1.id() < j2.id()) || ((j1.id() == j2.id()) && (j1.key() < j2.key()));
}
};

private:
// folder for output histograms
const std::string folderName_;
Expand Down Expand Up @@ -843,6 +837,14 @@ void ParticleNetJetTagMonitor::analyze(edm::Event const& iEvent, edm::EventSetup

std::vector<float> jetPNETScoreValuesHLT;
std::vector<reco::JetBaseRef> jetHLTRefs;

// protect for wrong event content
if (not jetPNETScoreHLTHandle->keyProduct().isAvailable()) {
edm::LogWarning("ParticleNetJetTagMonitor")
<< "Collection used as a key by HLT Jet tags collection is not available, will skip event";
return;
}

for (const auto& jtag : *jetPNETScoreHLTHandle) {
jetPNETScoreValuesHLT.push_back(jtag.second);
jetHLTRefs.push_back(jtag.first);
Expand Down

0 comments on commit 425a5aa

Please sign in to comment.