From 221cd800967c439f6a4ab078aed93f2b91029b8a Mon Sep 17 00:00:00 2001 From: Andre Govinda Stahl Leiton Date: Tue, 8 Oct 2024 21:36:26 +0200 Subject: [PATCH] Fix crash in DeDxEstimatorRekeyer --- PhysicsTools/PatAlgos/plugins/DeDxEstimatorRekeyer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/PatAlgos/plugins/DeDxEstimatorRekeyer.cc b/PhysicsTools/PatAlgos/plugins/DeDxEstimatorRekeyer.cc index e5da77ce590e2..0a91c694ec94e 100644 --- a/PhysicsTools/PatAlgos/plugins/DeDxEstimatorRekeyer.cc +++ b/PhysicsTools/PatAlgos/plugins/DeDxEstimatorRekeyer.cc @@ -120,8 +120,10 @@ void DeDxEstimatorRekeyer::produce(edm::StreamID, edm::Event& iEvent, const edm: for (const auto& h : pcTrkMap) { std::vector indices(h.first->size(), -1); for (const auto& p : h.second) { - indices[p.first.key()] = resultdedxHitColl->size(); const auto& dedxHit = dedxHitAss[p.second]; + if (dedxHit.isNull()) + continue; + indices[p.first.key()] = resultdedxHitColl->size(); resultdedxHitColl->emplace_back(*dedxHit); momenta.emplace_back(dedxHitMom[dedxHit]); }