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;