diff --git a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..a9d77b528163027a841363d9fbf594b3ef1ceee7 --- /dev/null +++ b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +InnerDetector/InDetRecTools/InDetTrackHoleSearch diff --git a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h index 11a0d9e691eef026d886239d015651b08271d426..32e167c5771021801c0ffa2975d70c3531c7e61c 100644 --- a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -16,6 +16,7 @@ #include "TrkEventPrimitives/ParticleHypothesis.h" #include "InDetConditionsSummaryService/IInDetConditionsTool.h" #include "TrkParameters/TrackParameters.h" +#include <atomic> #include <vector> #include <map> @@ -139,7 +140,7 @@ namespace InDet float m_etatol, m_phitol; /** number of warnings printed when no track parameters available **/ - mutable int m_warning; + mutable std::atomic_int m_warning; /** Input: track Output: changes in mapOfHits (filling it) and hasTRT diff --git a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx index 20fb0e6b5ea165bb499fe90841b4a82bdc6c97a2..dd71686355e461dea9ebdff551c309c20b91c17b 100644 --- a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx @@ -908,27 +908,21 @@ const Trk::Track* InDet::InDetTrackHoleSearchTool::addHolesToTrack(const Trk::T if (perigee) { - Trk::TrackStateOnSurfaceComparisonFunction* CompFunc = - new Trk::TrackStateOnSurfaceComparisonFunction(perigee->momentum()); + Trk::TrackStateOnSurfaceComparisonFunction CompFunc(perigee->momentum()); // we always have to sort holes in - // if (!is_sorted(trackTSOS->begin(),trackTSOS->end(), *CompFunc)) { + // if (!is_sorted(trackTSOS->begin(),trackTSOS->end(), CompFunc)) { if (fabs(perigee->parameters()[Trk::qOverP]) > 0.002) { /* invest n*(logN)**2 sorting time for lowPt, coping with a possibly not 100% transitive comparison functor. - DataVector doesn't have stable sort, so we need to tamper with - its vector content in order to avoid sort to get caught in DV full - object ownership */ + */ ATH_MSG_DEBUG("sorting vector with stable_sort "); - std::vector<const Trk::TrackStateOnSurface*>* PtrVector - = const_cast<std::vector<const Trk::TrackStateOnSurface*>* > (&trackTSOS->stdcont()); - stable_sort(PtrVector->begin(), PtrVector->end(), *CompFunc); + stable_sort(trackTSOS->begin(), trackTSOS->end(), CompFunc); } else { - trackTSOS->sort(*CompFunc); // respects DV object ownership + trackTSOS->sort(CompFunc); // respects DV object ownership } - delete CompFunc; } // create copy of track