Skip to content

Commit

Permalink
fix: Make SeedingPerformanceWriter thread-safe (acts-project#3850)
Browse files Browse the repository at this point in the history
Not sure if the lock got lost by accident at some point or if it was never there. But the lock is definitely necessary to make the performance writer thread-safe.
  • Loading branch information
andiwand authored and Rosie-Hasan committed Nov 13, 2024
1 parent 21a8225 commit 00cb0ea
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Examples/Io/Root/src/SeedingPerformanceWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "ActsExamples/Utilities/EventDataTransforms.hpp"
#include "ActsExamples/Validation/TrackClassification.hpp"
#include "ActsFatras/EventData/Barcode.hpp"
#include "ActsFatras/EventData/Particle.hpp"

#include <cstddef>
#include <ostream>
Expand All @@ -28,10 +27,6 @@
using Acts::VectorHelpers::eta;
using Acts::VectorHelpers::phi;

namespace ActsExamples {
struct AlgorithmContext;
} // namespace ActsExamples

ActsExamples::SeedingPerformanceWriter::SeedingPerformanceWriter(
ActsExamples::SeedingPerformanceWriter::Config config,
Acts::Logging::Level level)
Expand Down Expand Up @@ -127,6 +122,9 @@ ActsExamples::ProcessCode ActsExamples::SeedingPerformanceWriter::writeT(
const auto& particles = m_inputParticles(ctx);
const auto& hitParticlesMap = m_inputMeasurementParticlesMap(ctx);

// Exclusive access to the tree while writing
std::lock_guard<std::mutex> lock(m_writeMutex);

std::size_t nSeeds = seeds.size();
std::size_t nMatchedSeeds = 0;
// Map from particles to how many times they were successfully found by a seed
Expand Down

0 comments on commit 00cb0ea

Please sign in to comment.