Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0.X] add protection to ParticleNetJetTagMonitor, removed unused struct #41968

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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