Skip to content

Commit

Permalink
fix: Make SeedingPerformanceWriter thread-safe (#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 Nov 12, 2024
1 parent a8f07b9 commit 6da9683
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 6da9683

Please sign in to comment.