From 1ff8d2cffa85790e149da8e195586a7288f72e7d Mon Sep 17 00:00:00 2001 From: ssdetlab Date: Tue, 12 Nov 2024 14:25:38 +0200 Subject: [PATCH] thread safety --- .../Acts/TrackFinding/TrackParamsLookupAccumulator.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Core/include/Acts/TrackFinding/TrackParamsLookupAccumulator.hpp b/Core/include/Acts/TrackFinding/TrackParamsLookupAccumulator.hpp index 504c528bfd1..804a0d5b9e7 100644 --- a/Core/include/Acts/TrackFinding/TrackParamsLookupAccumulator.hpp +++ b/Core/include/Acts/TrackFinding/TrackParamsLookupAccumulator.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -90,6 +91,8 @@ class TrackParamsLookupAccumulator { void addTrack(const TrackParameters& ipTrackParameters, const TrackParameters& refTrackParameters, const Vector2& position) { + std::lock_guard lock(m_gridMutex); + auto bin = m_grid.localBinsFromPosition(position); if (m_countGrid[bin] == 0) { @@ -208,6 +211,9 @@ class TrackParamsLookupAccumulator { /// layer track parameters LookupGrid m_grid; + /// Mutex for protecting grid access + std::mutex m_gridMutex; + /// Map to keep the accumulation count /// in the occupied grid bins std::map, std::size_t> m_countGrid;