diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/DiscOverlapDescriptor.h b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/DiscOverlapDescriptor.h index 818ee14e49359970b326e39576f9fdab719b6c44..992f1940236582b15d6763d3a3dbe84abf31be16 100644 --- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/DiscOverlapDescriptor.h +++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/DiscOverlapDescriptor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -17,6 +17,9 @@ #include "TrkDetDescrUtils/BinnedArray1D1D.h" #include "TrkDetDescrUtils/Intersection.h" +// STL include +#include <atomic> + #ifndef INDETTRACKINGGEOMETRY_DISCDETADDNEXTPHIETA #define INDETTRACKINGGEOMETRY_DISCDETADDNEXTPHIETA #define addSurfaceDO(cur,surfaces) if (cur) surfaces.push_back(Trk::SurfaceIntersection(Trk::Intersection(Amg::Vector3D(0.,0.,0.),0.,true),&(cur->surface(cur->identify())))) @@ -27,6 +30,8 @@ #define addPrevInEtaDO(cur, surfaces) addSurfaceDO(cur->prevInEta(), surfaces); addOtherSideDO(cur->prevInEta(),surfaces) #endif // INDETTRACKINGGEOMETRY_DISCDETADDNEXTPHIETA +class SCT_ID; + namespace Trk { class Surface; } @@ -87,7 +92,7 @@ namespace InDet { const Trk::BinnedArray<Trk::Surface>* m_bin_array; std::vector<Trk::BinUtility*>* m_singleBinUtils; - + mutable std::atomic<const SCT_ID*> m_sctIdHelper{nullptr}; }; diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/DiscOverlapDescriptor.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/DiscOverlapDescriptor.cxx index 8891d9fdd6bd224974d2afba4870ef8df77f4dea..d00d5be8191e949c03cef5923afecea01bad9c3b 100644 --- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/DiscOverlapDescriptor.cxx +++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/DiscOverlapDescriptor.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -32,18 +32,20 @@ bool InDet::DiscOverlapDescriptor::reachableSurfaces(std::vector<Trk::SurfaceInt { // Get Storegate, ID helpers, and so on - ISvcLocator* svcLocator = Gaudi::svcLocator(); + if (m_sctIdHelper==nullptr) { + ISvcLocator* svcLocator = Gaudi::svcLocator(); - // get DetectorStore service - StoreGateSvc* detStore; - StatusCode sc = svcLocator->service("DetectorStore",detStore); - if (sc.isFailure()) { - return 0; - } + // get DetectorStore service + StoreGateSvc* detStore = nullptr; + if (svcLocator->service("DetectorStore", detStore).isFailure()) { + return false; + } - const SCT_ID* sctIdHelper = 0; - if (detStore->retrieve(sctIdHelper, "SCT_ID").isFailure()) { - return 0; + const SCT_ID* sctIdHelper = nullptr; + if (detStore->retrieve(sctIdHelper, "SCT_ID").isFailure()) { + return false; + } + m_sctIdHelper = sctIdHelper; } // get the according detector element @@ -51,7 +53,7 @@ bool InDet::DiscOverlapDescriptor::reachableSurfaces(std::vector<Trk::SurfaceInt // first add the target surface surfaces.push_back(Trk::SurfaceIntersection(Trk::Intersection(pos, 0., true),&tsf)); - int etaModule = sctIdHelper->eta_module(tsf.associatedDetectorElementIdentifier()); + int etaModule = m_sctIdHelper.load()->eta_module(tsf.associatedDetectorElementIdentifier()); // return empty cell vector if (pElement) {