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