From ac60b2c276a5a78e8aca0077082f9158ef2202be Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 12 Jun 2023 17:16:07 +0200 Subject: [PATCH] add protection to ParticleNetJetTagMonitor, removed unused struct --- .../Trigger/plugins/ParticleNetJetTagMonitor.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc b/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc index fb0fc10540379..c920d3ce5b7d7 100644 --- a/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc +++ b/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc @@ -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& j1, const edm::RefToBase& j2) const { - return (j1.id() < j2.id()) || ((j1.id() == j2.id()) && (j1.key() < j2.key())); - } - }; - private: // folder for output histograms const std::string folderName_; @@ -843,6 +837,14 @@ void ParticleNetJetTagMonitor::analyze(edm::Event const& iEvent, edm::EventSetup std::vector jetPNETScoreValuesHLT; std::vector 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);