From eb85b300a8e8c126b292699de00fa4f41cf95fb5 Mon Sep 17 00:00:00 2001 From: Raffaele Date: Wed, 31 Aug 2022 16:53:23 +0200 Subject: [PATCH 1/2] fixing minDR assignement and check index dimension --- .../Trigger/plugins/ParticleNetJetTagMonitor.cc | 13 ++++++++++--- .../python/ParticleNetAK4BTagMonitoring_cfi.py | 8 ++++---- .../python/ParticleNetAK8HbbTagMonitoring_cfi.py | 4 ++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc b/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc index 378aed0d893f3..5816bb1bb629c 100644 --- a/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc +++ b/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc @@ -668,6 +668,7 @@ void ParticleNetJetTagMonitor::analyze(edm::Event const& iEvent, edm::EventSetup std::fabs(e.gsfTrack()->dz(pv->position())) <= maxLeptonDzCut_) vetoElectrons.push_back(e); } + if (ntagelectrons_ >= 0 and int(tagElectrons.size()) != ntagelectrons_) return; selectionFlowStatus++; @@ -843,8 +844,8 @@ void ParticleNetJetTagMonitor::analyze(edm::Event const& iEvent, edm::EventSetup std::vector jetPNETScoreValuesHLT; std::vector jetHLTRefs; for (const auto& jtag : *jetPNETScoreHLTHandle) { - jetPNETScoreValuesHLT.push_back(jtag.second); - jetHLTRefs.push_back(jtag.first); + jetPNETScoreValuesHLT.push_back(jtag.second); + jetHLTRefs.push_back(jtag.first); } // sort in PNET score @@ -858,15 +859,21 @@ void ParticleNetJetTagMonitor::analyze(edm::Event const& iEvent, edm::EventSetup // match reco and hlt objects considering only the first ntrigobjecttomatch jets for both reco and HLT. Each of them must be matched std::vector matched_obj; for (size_t jreco = 0; jreco < ntrigobjecttomatch_; jreco++) { + if (jreco >= jetPNETScoreSortedIndices.size()) + break; float minDR = 1000; int match_index = -1; for (size_t jhlt = 0; jhlt < ntrigobjecttomatch_; jhlt++) { + if (jhlt >= jetPNETScoreSortedIndicesHLT.size()) + break; if (std::find(matched_obj.begin(), matched_obj.end(), jhlt) != matched_obj.end()) continue; float dR = reco::deltaR(selectedJets[jetPNETScoreSortedIndices.at(jreco)].p4(), jetHLTRefs.at(jetPNETScoreSortedIndicesHLT.at(jhlt))->p4()); - if (dR < hltRecoDeltaRmax_ and dR < minDR) + if (dR < hltRecoDeltaRmax_ and dR < minDR){ match_index = jhlt; + minDR = dR; + } } if (match_index >= 0) matched_obj.push_back(match_index); diff --git a/DQMOffline/Trigger/python/ParticleNetAK4BTagMonitoring_cfi.py b/DQMOffline/Trigger/python/ParticleNetAK4BTagMonitoring_cfi.py index 17fab3d7c6aff..4442298d60a35 100644 --- a/DQMOffline/Trigger/python/ParticleNetAK4BTagMonitoring_cfi.py +++ b/DQMOffline/Trigger/python/ParticleNetAK4BTagMonitoring_cfi.py @@ -70,16 +70,16 @@ jet2EtaBinning = [-2.5,-2.25,-2.0,-1.75,-1.5,-1.25,-1.0,-0.75,-0.5,-0.25,0.,0.25,0.5,0.75,1.0,1.25,1.5,1.75,2.0,2.25,2.5], jet1PNETscoreBinning = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.75,0.8,0.85,0.9,0.925,0.95,0.975,1], jet2PNETscoreBinning = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.75,0.8,0.85,0.9,0.925,0.95,0.975,1], - jet1PNETscoreTransBinning = [0,0.1,0.2,0.3,0.4,0.6,0.8,1.0,1.25,1.50,1.75,2.25,2.75,4], - jet2PNETscoreTransBinning = [0,0.1,0.2,0.3,0.4,0.6,0.8,1.0,1.25,1.50,1.75,2.25,2.75,4], + jet1PNETscoreTransBinning = [0,0.1,0.2,0.3,0.4,0.6,0.8,1.0,1.25,1.50,1.75,2.25,2.75,3.5,6], + jet2PNETscoreTransBinning = [0,0.1,0.2,0.3,0.4,0.6,0.8,1.0,1.25,1.50,1.75,2.25,2.75,3.5,6], jet1PtBinning2d = [20,30,40,50,75,100,150,250,500], jet2PtBinning2d = [20,30,40,50,75,100,125,150,250], jet1EtaBinning2d = [-2.5,-2.0,-1.5,-1.0,-0.5,0.,0.5,1.0,1.5,2.0,2.5], jet2EtaBinning2d = [-2.5,-2.0,-1.5,-1.0,-0.5,0.,0.5,1.0,1.5,2.0,2.5], jet1PNETscoreBinning2d = [0,0.15,0.30,0.45,0.60,0.75,0.85,0.90,0.95,0.975,1], jet2PNETscoreBinning2d = [0,0.15,0.30,0.45,0.60,0.75,0.85,0.90,0.95,0.975,1], - jet1PNETscoreTransBinning2d = [0,0.15,0.30,0.45,0.60,0.75,1,1.5,2,2.5,4], - jet2PNETscoreTransBinning2d = [0,0.15,0.30,0.45,0.60,0.75,1,1.5,2,2.5,4], + jet1PNETscoreTransBinning2d = [0,0.15,0.30,0.45,0.60,0.75,1,1.5,2,2.5,3.25,6], + jet2PNETscoreTransBinning2d = [0,0.15,0.30,0.45,0.60,0.75,1,1.5,2,2.5,3.25,6], ## trigger for numerator and denominator numGenericTriggerEvent = dict( hltPaths = ["HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_PFBTagParticleNet_2BTagSum0p65_v*"], diff --git a/DQMOffline/Trigger/python/ParticleNetAK8HbbTagMonitoring_cfi.py b/DQMOffline/Trigger/python/ParticleNetAK8HbbTagMonitoring_cfi.py index 7c09685e4aca2..91077617109f9 100644 --- a/DQMOffline/Trigger/python/ParticleNetAK8HbbTagMonitoring_cfi.py +++ b/DQMOffline/Trigger/python/ParticleNetAK8HbbTagMonitoring_cfi.py @@ -72,7 +72,7 @@ jet2EtaBinning = [], jet1PNETscoreBinning = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.75,0.8,0.85,0.9,0.925,0.95,0.975,1], jet2PNETscoreBinning = [], - jet1PNETscoreTransBinning = [0,0.1,0.2,0.3,0.4,0.6,0.8,1.0,1.25,1.50,1.75,2.25,2.75,4], + jet1PNETscoreTransBinning = [0,0.1,0.2,0.3,0.4,0.6,0.8,1.0,1.25,1.50,1.75,2.25,2.75,3.5,6], jet2PNETscoreTransBinning = [], jet1PtBinning2d = [180,220,260,300,340,400,500,750,1250], jet2PtBinning2d = [], @@ -80,7 +80,7 @@ jet2EtaBinning2d = [], jet1PNETscoreBinning2d = [0,0.15,0.30,0.45,0.60,0.75,0.85,0.90,0.95,0.975,1], jet2PNETscoreBinning2d = [], - jet1PNETscoreTransBinning2d = [0,0.15,0.30,0.45,0.60,0.75,1,1.5,2,2.5,4], + jet1PNETscoreTransBinning2d = [0,0.15,0.30,0.45,0.60,0.75,1,1.5,2,2.5,3.25,6], jet2PNETscoreTransBinning2d = [], ## trigger for numerator and denominator numGenericTriggerEvent = dict( From 0918ed51696aa85ef123eb739e87c7944cc36737 Mon Sep 17 00:00:00 2001 From: Raffaele Date: Wed, 31 Aug 2022 17:11:34 +0200 Subject: [PATCH 2/2] code-format fix --- DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc b/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc index 5816bb1bb629c..fb0fc10540379 100644 --- a/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc +++ b/DQMOffline/Trigger/plugins/ParticleNetJetTagMonitor.cc @@ -844,8 +844,8 @@ void ParticleNetJetTagMonitor::analyze(edm::Event const& iEvent, edm::EventSetup std::vector jetPNETScoreValuesHLT; std::vector jetHLTRefs; for (const auto& jtag : *jetPNETScoreHLTHandle) { - jetPNETScoreValuesHLT.push_back(jtag.second); - jetHLTRefs.push_back(jtag.first); + jetPNETScoreValuesHLT.push_back(jtag.second); + jetHLTRefs.push_back(jtag.first); } // sort in PNET score @@ -870,10 +870,10 @@ void ParticleNetJetTagMonitor::analyze(edm::Event const& iEvent, edm::EventSetup continue; float dR = reco::deltaR(selectedJets[jetPNETScoreSortedIndices.at(jreco)].p4(), jetHLTRefs.at(jetPNETScoreSortedIndicesHLT.at(jhlt))->p4()); - if (dR < hltRecoDeltaRmax_ and dR < minDR){ + if (dR < hltRecoDeltaRmax_ and dR < minDR) { match_index = jhlt; - minDR = dR; - } + minDR = dR; + } } if (match_index >= 0) matched_obj.push_back(match_index);