diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx index 90b4efa7eae0d8e130014bf25763361693c685f6..fdfd625c2154190e3c0846fd85f90b63902e13cf 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx @@ -112,12 +112,11 @@ namespace Muon { m_sameSideOfPerigeeTrk(0), m_otherSideOfPerigeeTrk(0), m_segmentTrackMatches(0), - m_segmentTrackMatchesTight(0), - m_reasonsForMatchOk(TrackSegmentMatchResult::NumberOfReasons, 0), - m_reasonsForMatchNotOk(TrackSegmentMatchResult::NumberOfReasons, 0) + m_segmentTrackMatchesTight(0) { declareInterface<MooCandidateMatchingTool>(this); declareInterface<IMuonTrackSegmentMatchingTool>(this); + declareProperty("SLExtrapolator", m_slExtrapolator ); declareProperty("Extrapolator", m_atlasExtrapolator ); declareProperty("MagFieldSvc", m_magFieldSvc ); @@ -141,6 +140,11 @@ namespace Muon { declareProperty("SegmentMatchingToolTight", m_segmentMatchingToolTight); declareProperty("DoTrackSegmentMatching", m_doTrackSegmentMatching = false, "Apply dedicated track-segment matching"); declareProperty("TrackSegmentPreMatching", m_trackSegmentPreMatchingStrategy = 0, "0=no segments match,1=any segment match,2=all segment match"); + + for (unsigned int i=0; i<TrackSegmentMatchResult::NumberOfReasons; i++) { + m_reasonsForMatchOk[i].store(0, std::memory_order_relaxed); + m_reasonsForMatchNotOk[i].store(0, std::memory_order_relaxed); + } } MooCandidateMatchingTool::~MooCandidateMatchingTool() { } @@ -197,7 +201,6 @@ namespace Muon { if ( w > width ) width = w; } // print it - std::lock_guard<std::mutex> lock(m_mutex); msg(MSG::INFO) << " Reasons for match failures:" << endmsg; for ( unsigned int i = 0; i < nReasons ; ++i ) { int cnt = m_reasonsForMatchNotOk[i]; @@ -361,7 +364,6 @@ namespace Muon { if ( !haveMatch ) { ATH_MSG_VERBOSE("track-segment match: -> Failed in comparing segments on track"); - std::lock_guard<std::mutex> lock(m_mutex); ++m_reasonsForMatchNotOk[TrackSegmentMatchResult::SegmentMatch]; return false; } @@ -373,7 +375,6 @@ namespace Muon { TrackSegmentMatchCuts cuts = getMatchingCuts( entry1, entry2, useTightCuts ); haveMatch = applyTrackSegmentCuts( info, cuts ); // update counters - std::lock_guard<std::mutex> lock(m_mutex); if (haveMatch) { ++m_reasonsForMatchOk[info.reason]; } else { diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h index bb857ff70b02848c70b32b782d102ff55fc2ff87..1a83df35951b44e060f6cc342c1043dabc396b0c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h @@ -17,8 +17,8 @@ #include "MuonRecToolInterfaces/IMuonTrackSegmentMatchingTool.h" #include "MuonTrackFindingEvent/MuonTrackSegmentMatchResult.h" +#include <array> #include <atomic> -#include <mutex> #include <string> #include <set> @@ -193,9 +193,8 @@ namespace Muon { mutable std::atomic_uint m_otherSideOfPerigeeTrk; mutable std::atomic_uint m_segmentTrackMatches; mutable std::atomic_uint m_segmentTrackMatchesTight; - mutable std::vector<unsigned int> m_reasonsForMatchOk ATLAS_THREAD_SAFE; // Guarded by m_mutex - mutable std::vector<unsigned int> m_reasonsForMatchNotOk ATLAS_THREAD_SAFE; // Guarded by m_mutex - mutable std::mutex m_mutex; + mutable std::array<std::atomic_uint, TrackSegmentMatchResult::NumberOfReasons> m_reasonsForMatchOk ATLAS_THREAD_SAFE; // Guarded by atomicity + mutable std::array<std::atomic_uint, TrackSegmentMatchResult::NumberOfReasons> m_reasonsForMatchNotOk ATLAS_THREAD_SAFE; // Guarded by atomicity double m_caloMatchZ; //!< Z position of calo end-cap disks. Used to determine if segments are on same side of Calo