From c4b36726bd64a0c118770f37489273ec03099f77 Mon Sep 17 00:00:00 2001 From: Nurfikri Norjoharuddeen Date: Fri, 2 Jun 2023 17:16:18 +0200 Subject: [PATCH] Move average calculations outside of jet constituents loop --- RecoJets/JetProducers/src/PileupJetIdAlgo.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RecoJets/JetProducers/src/PileupJetIdAlgo.cc b/RecoJets/JetProducers/src/PileupJetIdAlgo.cc index 855905875f8ea..51b2ccea43760 100644 --- a/RecoJets/JetProducers/src/PileupJetIdAlgo.cc +++ b/RecoJets/JetProducers/src/PileupJetIdAlgo.cc @@ -571,10 +571,10 @@ PileupJetIdentifier PileupJetIdAlgo::computeIdVariables(const reco::Jet* jet, float dphi = reco::deltaPhi(*icand, *jet); sum_deta += deta * weight2; sum_dphi += dphi * weight2; - if (sumW2 > 0) { - ave_deta = sum_deta / sumW2; - ave_dphi = sum_dphi / sumW2; - } + } + if (sumW2 > 0) { + ave_deta = sum_deta / sumW2; + ave_dphi = sum_dphi / sumW2; } // // Finalize all variables