From e0626262bae821330a568af052da43ee2981db19 Mon Sep 17 00:00:00 2001
From: Susumu Oda <susumu.oda@cern.ch>
Date: Thu, 18 Jun 2020 08:13:04 +0200
Subject: [PATCH] Add ATLAS_CHECK_THREAD_SAFETY to InDetServMatGeoModel package
 with fixing some constness problems.

---
 .../InDetGeoModelUtils/IInDetServMatBuilderTool.h      |  4 ++--
 .../InDetDetDescr/InDetServMatGeoModel/CMakeLists.txt  |  3 ++-
 .../InDetServMatGeoModel/ComputeStaveServices.h        |  5 +++--
 .../InDetServMatGeoModel/EndPlateFactoryFS.h           |  5 +++--
 .../InDetServMatGeoModel/InDetServMatGeoModel/HRoute.h |  4 ++--
 .../InDetServMatGeoModel/InDetServMatAthenaComps.h     |  4 ++--
 .../InDetServMatGeoModel/InDetServMatBuilderToolSLHC.h |  4 ++--
 .../InDetServMatGeoModel/InDetServMatFactoryDC2.h      |  7 ++++---
 .../InDetServMatGeoModel/InDetServMatFactoryFS.h       | 10 +++++-----
 .../InDetServMatGeoModel/InDetServMatGeometryManager.h |  2 +-
 .../InDetServMatGeoModel/PixelServMatFactoryDC2.h      |  5 +++--
 .../InDetServMatGeoModel/PixelServMatFactoryFS.h       |  3 ++-
 .../InDetServMatGeoModel/InDetServMatGeoModel/Route.h  |  4 ++--
 .../InDetServMatGeoModel/SCT_ServMatFactoryDC2.h       |  5 +++--
 .../InDetServMatGeoModel/SCT_ServMatFactoryFS.h        |  3 ++-
 .../InDetServMatGeoModel/ServiceVolume.h               |  4 ++--
 .../InDetServMatGeoModel/SquirrelCageFactoryFS.h       |  5 +++--
 .../InDetServMatGeoModel/SupportRailFactoryFS.h        |  5 +++--
 .../InDetServMatGeoModel/TRT_ServMatFactoryDC2.h       |  5 +++--
 .../InDetServMatGeoModel/TRT_ServMatFactoryFS.h        |  3 ++-
 .../InDetServMatGeoModel/InDetServMatGeoModel/VRoute.h |  4 ++--
 .../src/InDetServMatAthenaComps.cxx                    |  6 +++---
 .../src/InDetServMatBuilderToolSLHC.cxx                |  5 +++--
 23 files changed, 59 insertions(+), 46 deletions(-)

diff --git a/InnerDetector/InDetDetDescr/InDetGeoModelUtils/InDetGeoModelUtils/IInDetServMatBuilderTool.h b/InnerDetector/InDetDetDescr/InDetGeoModelUtils/InDetGeoModelUtils/IInDetServMatBuilderTool.h
index 5cd2eeb8e3d..d3ac8a4d069 100644
--- a/InnerDetector/InDetDetDescr/InDetGeoModelUtils/InDetGeoModelUtils/IInDetServMatBuilderTool.h
+++ b/InnerDetector/InDetDetDescr/InDetGeoModelUtils/InDetGeoModelUtils/IInDetServMatBuilderTool.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -24,7 +24,7 @@ class IInDetServMatBuilderTool : virtual public IAlgTool {
 public:
   static const InterfaceID& interfaceID( ) ;
   
-  virtual const std::vector<const InDetDD::ServiceVolume *> & getServices() = 0;  
+  virtual const std::vector<const InDetDD::ServiceVolume *> & getServices() const = 0;  
 };
   
 inline const InterfaceID& IInDetServMatBuilderTool::interfaceID()
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/CMakeLists.txt b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/CMakeLists.txt
index 2f42a3c03c2..f8de9f5d402 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/CMakeLists.txt
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/CMakeLists.txt
@@ -9,6 +9,7 @@ atlas_subdir( InDetServMatGeoModel )
 atlas_depends_on_subdirs( PUBLIC
                           Control/AthenaBaseComps
                           Control/AthenaKernel
+                          Control/CxxUtils
                           Database/RDBAccessSvc
                           DetectorDescription/GeoPrimitives
                           DetectorDescription/GeoModel/GeoModelUtilities
@@ -31,7 +32,7 @@ atlas_add_component( InDetServMatGeoModel
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${CORAL_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${CORAL_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps AthenaKernel GeoModelUtilities GaudiKernel InDetGeoModelUtils SGTools StoreGateLib SGtests GeometryDBSvcLib )
+                     LINK_LIBRARIES ${CORAL_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps AthenaKernel CxxUtils GeoModelUtilities GaudiKernel InDetGeoModelUtils SGTools StoreGateLib SGtests GeometryDBSvcLib )
 
 # Install files from the package:
 atlas_install_headers( InDetServMatGeoModel )
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/ComputeStaveServices.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/ComputeStaveServices.h
index 4868d8df5dd..7ef824a5c21 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/ComputeStaveServices.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/ComputeStaveServices.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ComputeStaveServices_H
@@ -7,6 +7,7 @@
 
 #include "InDetServMatGeoModel/StaveServices.h"
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 
 class ComputeStaveServices {
 public:
@@ -21,7 +22,7 @@ public:
  private:
   // the message stream (same for all derived classes)
   MsgStream& msg (MSG::Level lvl) const { return m_msg << lvl; }
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
   
 };
 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/EndPlateFactoryFS.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/EndPlateFactoryFS.h
index 5dcd212f8a1..62323975ae3 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/EndPlateFactoryFS.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/EndPlateFactoryFS.h
@@ -1,11 +1,12 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef INDETSERVMATGEOMODEL_ENDPLATEFACTORYFS_H
 #define INDETSERVMATGEOMODEL_ENDPLATEFACTORYFS_H
 
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 #include "GaudiKernel/ServiceHandle.h"
 
 class StoreGateSvc;
@@ -39,7 +40,7 @@ class EndPlateFactoryFS {
   // private data
   StoreGateSvc                   *m_detStore;
   ServiceHandle<IRDBAccessSvc>    m_rdbAccess;
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 };
 
 #endif 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/HRoute.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/HRoute.h
index 3ac1effba67..75d2646365f 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/HRoute.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/HRoute.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef HRoute_H
@@ -29,7 +29,7 @@ public:
 
   virtual double exit() const {return zExit();}
 
-  virtual Route* nextRoute() const {return m_next;}
+  virtual Route* nextRoute() {return m_next;}
 
   const VolumeContainer& volumes() const {return m_volumes;}
 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatAthenaComps.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatAthenaComps.h
index 28076e6b370..5b4da5326f1 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatAthenaComps.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatAthenaComps.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef InDetServMatGeoModel_InDetServMatAthenaComps_H
@@ -18,7 +18,7 @@ public:
 
   //Add Builder Tool
   void setBuilderTool(IInDetServMatBuilderTool * builderTool);
-  IInDetServMatBuilderTool *builderTool() const;
+  const IInDetServMatBuilderTool *builderTool() const;
 
 private:
 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatBuilderToolSLHC.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatBuilderToolSLHC.h
index 1e961306b3a..3ee2ecd54af 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatBuilderToolSLHC.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatBuilderToolSLHC.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef InDetServMatBuilderToolSLHC_H
@@ -62,7 +62,7 @@ public:
   virtual StatusCode finalize();  
 
   /// Get the services
-  virtual const std::vector<const InDetDD::ServiceVolume *> & getServices();
+  virtual const std::vector<const InDetDD::ServiceVolume *> & getServices() const;
   
   /// General service adding method.
   void addService(InDetDD::ServiceVolume * param);
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatFactoryDC2.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatFactoryDC2.h
index a75d268b25e..0d243aed661 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatFactoryDC2.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatFactoryDC2.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef INDETSERVMATGEOMODEL_INDETSERVMATFACTORYDC2_H
@@ -7,12 +7,13 @@
 
 
 #include "AthenaKernel/MsgStreamMember.h"
-#include "GaudiKernel/ServiceHandle.h"
+#include "CxxUtils/checker_macros.h"
 #include "GeoModelKernel/GeoVDetectorFactory.h"
 //the following needed because the return type of getDetectorManager() is not 
 //the same as the method return type as specified in the baseclass
 #include "InDetServMatGeoModel/InDetServMatManager.h"
 
+#include "GaudiKernel/ServiceHandle.h"
 
 class StoreGateSvc;
 class IRDBAccessSvc;
@@ -45,7 +46,7 @@ class InDetServMatFactoryDC2 : public GeoVDetectorFactory  {
   StoreGateSvc                   *m_detStore;
   ServiceHandle<IRDBAccessSvc>    m_rdbAccess;
   InDetDD::InDetServMatManager   *m_manager;
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 };
 
 #endif //  INDETSERVMATGEOMODEL_INDETSERVMATFACTORYDC2_H
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatFactoryFS.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatFactoryFS.h
index 73ef0ddd046..a2342a598d7 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatFactoryFS.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatFactoryFS.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef INDETSERVMATGEOMODEL_INDETSERVMATFACTORYFS_H
@@ -7,10 +7,12 @@
 
 
 #include "AthenaKernel/MsgStreamMember.h"
-#include "GaudiKernel/ServiceHandle.h"
+#include "CxxUtils/checker_macros.h"
 #include "GeoModelKernel/GeoVDetectorFactory.h"
 #include "InDetServMatGeoModel/InDetServMatManager.h"
 
+#include "GaudiKernel/ServiceHandle.h"
+
 class StoreGateSvc;
 class IRDBAccessSvc;
 
@@ -43,9 +45,7 @@ class InDetServMatFactoryFS : public GeoVDetectorFactory  {
   StoreGateSvc                   *m_detStore;
   ServiceHandle<IRDBAccessSvc>    m_rdbAccess;
   InDetDD::InDetServMatManager   *m_manager;
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 };
 
 #endif
-
-
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatGeometryManager.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatGeometryManager.h
index 0492c528c46..100f00b8847 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatGeometryManager.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/InDetServMatGeometryManager.h
@@ -28,7 +28,7 @@ public:
   const IGeometryDBSvc * db() const {return m_athenaComps->geomDB();}
 
   // Access to material manager 
-  InDetMaterialManager * matMgr() const {return m_matMgr;}
+  InDetMaterialManager * matMgr() {return m_matMgr;}
   
   
   // Access to message stream
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/PixelServMatFactoryDC2.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/PixelServMatFactoryDC2.h
index e7128af3853..03de32713da 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/PixelServMatFactoryDC2.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/PixelServMatFactoryDC2.h
@@ -1,11 +1,12 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef INDETSERVMATGEOMODEL_PIXELSERVMATFACTORYDC2_H
 #define INDETSERVMATGEOMODEL_PIXELSERVMATFACTORYDC2_H
 
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 #include "GaudiKernel/ServiceHandle.h"
 
 class StoreGateSvc;
@@ -37,7 +38,7 @@ class PixelServMatFactoryDC2   {
   // private data
   StoreGateSvc                   *m_detStore;
   ServiceHandle<IRDBAccessSvc>    m_rdbAccess;
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 };
 
 #endif //  INDETSERVMATGEOMODEL_PIXELSERVMATFACTORYDC2_H
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/PixelServMatFactoryFS.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/PixelServMatFactoryFS.h
index 79f91d19cdc..dc8abbbc8c4 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/PixelServMatFactoryFS.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/PixelServMatFactoryFS.h
@@ -6,6 +6,7 @@
 #define INDETSERVMATGEOMODEL_PIXELSERVMATFACTORYFS_H
 
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 #include "GaudiKernel/ServiceHandle.h"
 
 class StoreGateSvc;
@@ -40,7 +41,7 @@ class PixelServMatFactoryFS   {
   StoreGateSvc                    *m_detStore;
   ServiceHandle<IRDBAccessSvc>     m_rdbAccess;
   std::unique_ptr<InDetMaterialManager> m_materialManager;
-  mutable Athena::MsgStreamMember  m_msg;
+  mutable Athena::MsgStreamMember  m_msg ATLAS_THREAD_SAFE;
 
 };
 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/Route.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/Route.h
index 4477275fbe9..cfc92db7cad 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/Route.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/Route.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef Route_H
@@ -33,7 +33,7 @@ public:
 
   //virtual int direction() = 0;
 
-  virtual Route* nextRoute() const = 0;
+  virtual Route* nextRoute() = 0;
 
   virtual const VolumeContainer& volumes() const = 0;
 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SCT_ServMatFactoryDC2.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SCT_ServMatFactoryDC2.h
index beb1a0949c8..abbdab708e9 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SCT_ServMatFactoryDC2.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SCT_ServMatFactoryDC2.h
@@ -1,11 +1,12 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef INDETSERVMATGEOMODEL_SCT_SERVMATFACTORYDC2_H
 #define INDETSERVMATGEOMODEL_SCT_SERVMATFACTORYDC2_H
 
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 #include "GaudiKernel/ServiceHandle.h"
 
 class StoreGateSvc;
@@ -57,7 +58,7 @@ class SCT_ServMatFactoryDC2   {
   StoreGateSvc                   *m_detStore;
   ServiceHandle<IRDBAccessSvc>    m_rdbAccess;
   const StoredMaterialManager    *m_materialManager;
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 };
 
 #endif //  INDETSERVMATGEOMODEL_SCT_SERVMATFACTORYDC2_H
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SCT_ServMatFactoryFS.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SCT_ServMatFactoryFS.h
index 3a4c3a0a493..f5f519f8077 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SCT_ServMatFactoryFS.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SCT_ServMatFactoryFS.h
@@ -6,6 +6,7 @@
 #define INDETSERVMATGEOMODEL_SCT_SERVMATFACTORYFS_H
 
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 #include "GaudiKernel/ServiceHandle.h"
 
 class StoreGateSvc;
@@ -42,7 +43,7 @@ class SCT_ServMatFactoryFS   {
   StoreGateSvc                    *m_detStore;
   ServiceHandle<IRDBAccessSvc>     m_rdbAccess;
   std::unique_ptr<InDetMaterialManager> m_materialManager;
-  mutable Athena::MsgStreamMember  m_msg;
+  mutable Athena::MsgStreamMember  m_msg ATLAS_THREAD_SAFE;
 
 };
 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/ServiceVolume.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/ServiceVolume.h
index 68b66819a6e..f5f5d14461d 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/ServiceVolume.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/ServiceVolume.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef ServiceVolume_H
@@ -77,7 +77,7 @@ public:
 
   LayerContainer layers() const {return m_layers;}
 
-  ServiceVolume* next() const {return m_next;}
+  ServiceVolume* next() {return m_next;}
 
   void addPrevious( ServiceVolume* prev) { m_previous.push_back(prev);}
 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SquirrelCageFactoryFS.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SquirrelCageFactoryFS.h
index ddaa209b7ed..991d968647f 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SquirrelCageFactoryFS.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SquirrelCageFactoryFS.h
@@ -1,11 +1,12 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef INDETSERVMATGEOMODEL_SQUIRRELCAGEFACTORYFS_H
 #define INDETSERVMATGEOMODEL_SQUIRRELCAGEFACTORYFS_H
 
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 #include "GaudiKernel/ServiceHandle.h"
 
 class StoreGateSvc;
@@ -37,7 +38,7 @@ class SquirrelCageFactoryFS {
   // private data
   StoreGateSvc                   *m_detStore;
   ServiceHandle<IRDBAccessSvc>    m_rdbAccess;
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 };
 
 #endif 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SupportRailFactoryFS.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SupportRailFactoryFS.h
index 74278e2230e..bc8f7ffb0ab 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SupportRailFactoryFS.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/SupportRailFactoryFS.h
@@ -1,11 +1,12 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef INDETSERVMATGEOMODEL_SUPPORTRAILFACTORYFS_H
 #define INDETSERVMATGEOMODEL_SUPPORTRAILFACTORYFS_H
 
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 #include "GaudiKernel/ServiceHandle.h"
 
 class StoreGateSvc;
@@ -37,7 +38,7 @@ class SupportRailFactoryFS {
   // private data
   StoreGateSvc                    *m_detStore;
   ServiceHandle<IRDBAccessSvc>     m_rdbAccess;
-  mutable Athena::MsgStreamMember  m_msg;
+  mutable Athena::MsgStreamMember  m_msg ATLAS_THREAD_SAFE;
 
 };
 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/TRT_ServMatFactoryDC2.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/TRT_ServMatFactoryDC2.h
index 4fddb6f6bae..3daf7df92fa 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/TRT_ServMatFactoryDC2.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/TRT_ServMatFactoryDC2.h
@@ -1,10 +1,11 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef INDETSERVMATGEOMODEL_TRT_SERVMATFACTORYDC2_H
 #define INDETSERVMATGEOMODEL_TRT_SERVMATFACTORYDC2_H
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 #include "GaudiKernel/ServiceHandle.h"
 
 class StoreGateSvc;
@@ -56,7 +57,7 @@ class TRT_ServMatFactoryDC2   {
   StoreGateSvc                   *m_detStore;
   ServiceHandle<IRDBAccessSvc>    m_rdbAccess;
   const StoredMaterialManager    *m_materialManager;
-  mutable Athena::MsgStreamMember m_msg;
+  mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE;
 };
 
 #endif //  INDETSERVMATGEOMODEL_TRT_SERVMATFACTORYDC2_H
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/TRT_ServMatFactoryFS.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/TRT_ServMatFactoryFS.h
index 34ba811ead0..4f7e28e66fe 100755
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/TRT_ServMatFactoryFS.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/TRT_ServMatFactoryFS.h
@@ -6,6 +6,7 @@
 #define INDETSERVMATGEOMODEL_TRT_SERVMATFACTORYFS_H
 
 #include "AthenaKernel/MsgStreamMember.h"
+#include "CxxUtils/checker_macros.h"
 #include "GaudiKernel/ServiceHandle.h"
 
 class StoreGateSvc;
@@ -42,7 +43,7 @@ class TRT_ServMatFactoryFS   {
   StoreGateSvc                    *m_detStore;
   ServiceHandle<IRDBAccessSvc>     m_rdbAccess;
   std::unique_ptr<InDetMaterialManager> m_materialManager;
-  mutable Athena::MsgStreamMember  m_msg;
+  mutable Athena::MsgStreamMember  m_msg ATLAS_THREAD_SAFE;
 };
 
 #endif 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/VRoute.h b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/VRoute.h
index 67d1cb6d18e..c10afdbb6cf 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/VRoute.h
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/InDetServMatGeoModel/VRoute.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef VRoute_H
@@ -29,7 +29,7 @@ public:
 
   virtual double exit() const {return rExit();}
 
-  virtual Route* nextRoute() const {return m_next;}
+  virtual Route* nextRoute() {return m_next;}
 
   virtual const VolumeContainer& volumes() const {return m_volumes;}
 
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatAthenaComps.cxx b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatAthenaComps.cxx
index a1e85356a64..e37a4958a67 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatAthenaComps.cxx
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatAthenaComps.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "InDetServMatGeoModel/InDetServMatAthenaComps.h"
@@ -17,8 +17,8 @@ InDetServMatAthenaComps::setBuilderTool(IInDetServMatBuilderTool * builderTool)
   m_builderTool = builderTool;
 }
 
-IInDetServMatBuilderTool * 
-InDetServMatAthenaComps::builderTool() const 
+const IInDetServMatBuilderTool * 
+InDetServMatAthenaComps::builderTool() const
 {
   return m_builderTool;
 }
diff --git a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatBuilderToolSLHC.cxx b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatBuilderToolSLHC.cxx
index c7e100403a0..c30a08e87c4 100644
--- a/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatBuilderToolSLHC.cxx
+++ b/InnerDetector/InDetDetDescr/InDetServMatGeoModel/src/InDetServMatBuilderToolSLHC.cxx
@@ -86,6 +86,8 @@ StatusCode InDetServMatBuilderToolSLHC::initialize()
   m_athenaComps->setRDBAccessSvc(&*m_rdbAccessSvc);
   m_athenaComps->setGeometryDBSvc(&*m_geometryDBSvc);
 
+  build();
+
   msg(MSG::INFO) << "initialize() successful in " << name() << endmsg;
   return StatusCode::SUCCESS;
 }
@@ -97,9 +99,8 @@ StatusCode InDetServMatBuilderToolSLHC::finalize()
   return sc;
 }
 	
-const std::vector<const InDetDD::ServiceVolume *> & InDetServMatBuilderToolSLHC::getServices()
+const std::vector<const InDetDD::ServiceVolume *> & InDetServMatBuilderToolSLHC::getServices() const
 {
-  if (!m_init) build();
   return m_services;
 }
 
-- 
GitLab