From e06342c5784660ef3ea78442e957eb902d15fffa Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Mon, 26 Feb 2024 16:52:38 +0100 Subject: [PATCH] fix: Fix `TruthVertexFinder` for not reconstructed particles (#2979) This fixes an overlook in https://github.com/acts-project/acts/pull/2937. Non reconstructed particles result in an exception which is fixed here --- .../ActsExamples/TruthTracking/TruthVertexFinder.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthVertexFinder.cpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthVertexFinder.cpp index 3b28a9acb57..9c73b49f267 100644 --- a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthVertexFinder.cpp +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthVertexFinder.cpp @@ -151,10 +151,11 @@ ProcessCode TruthVertexFinder::execute(const AlgorithmContext& ctx) const { std::unordered_map> protoVertexTrackMap; for (const auto& [particle, trackMatch] : particleTrackMatching) { - auto vtxId = - SimBarcode(particle).setParticle(0).setGeneration(0).setSubParticle(0); + auto vtxId = SimBarcode(particle).setParticle(0).setSubParticle(0); - protoVertexTrackMap[vtxId].push_back(trackMatch.track.value()); + if (trackMatch.track) { + protoVertexTrackMap[vtxId].push_back(trackMatch.track.value()); + } } ProtoVertexContainer protoVertices;