From 73a87c23d56cfa788840bc6bae82ce589d2aecbb Mon Sep 17 00:00:00 2001 From: Marino Missiroli Date: Tue, 9 Nov 2021 17:27:59 +0100 Subject: [PATCH] technical fix for PixelJetPuId --- HLTrigger/JetMET/plugins/PixelJetPuId.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/HLTrigger/JetMET/plugins/PixelJetPuId.cc b/HLTrigger/JetMET/plugins/PixelJetPuId.cc index 252213bde5bae..38b7bec94c8ab 100644 --- a/HLTrigger/JetMET/plugins/PixelJetPuId.cc +++ b/HLTrigger/JetMET/plugins/PixelJetPuId.cc @@ -20,6 +20,7 @@ If the sum of the tracks momentum is under a threshold the jet is tagged as "PUj // system include files #include +#include // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -149,13 +150,13 @@ void PixelJetPuId::produce(edm::StreamID sid, edm::Event& iEvent, const edm::Eve //get tracks Handle > tracks; iEvent.getByToken(tracksToken, tracks); - unsigned int tsize = tracks->size(); - float teta[tsize], tphi[tsize]; - unsigned int i = 0; + uint const asize = std::max(1u, (uint)tracks->size()); + float teta[asize], tphi[asize]; + uint tsize = 0; for (auto const& tr : *tracks) { - teta[i] = tr.eta(); - tphi[i] = tr.phi(); - ++i; + teta[tsize] = tr.eta(); + tphi[tsize] = tr.phi(); + ++tsize; } //get jets