From a89ab5eb1809830957e0129b7965c2e12c1f9086 Mon Sep 17 00:00:00 2001
From: Susumu Oda <susumu.oda@cern.ch>
Date: Wed, 1 Jul 2020 09:57:09 +0000
Subject: [PATCH] Remove ATLAS_NO_CHECK_FILE_THREAD_SAFETY from
 SiHitIdHelper.h/cxx and TRTHitIdHelper.h/.cxx. Add const to static
 Si/TRTHitIdHelper helper. Add const to return type of
 Si/TRTHelper::GetHelper.

---
 .../TRT_Digitization/src/TRTDigCondBase.cxx   |  4 ++--
 .../TRT_Digitization/src/TRTNoise.cxx         |  4 ++--
 .../InDetSimEvent/SiHitIdHelper.h             |  7 ++-----
 .../InDetSimEvent/TRTHitIdHelper.h            |  8 ++------
 .../InDetSimEvent/src/SiHitIdHelper.cxx       | 19 ++++++++-----------
 .../InDetSimEvent/src/TRTHitIdHelper.cxx      |  9 +++------
 .../ISF_FatrasToolsID/src/HitCreatorTRT.cxx   |  4 ++--
 7 files changed, 21 insertions(+), 34 deletions(-)

diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.cxx
index fd2809d1307..cea5fd2dc40 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigCondBase.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TRTDigCondBase.h"
@@ -69,7 +69,7 @@ void TRTDigCondBase::initialize(CLHEP::HepRandomEngine* rndmEngine) {
   ATH_MSG_INFO ( "TRTDigCondBase::initialize()" );
 
   //id helpers:
-  TRTHitIdHelper *hitid_helper(TRTHitIdHelper::GetHelper());
+  const TRTHitIdHelper *hitid_helper(TRTHitIdHelper::GetHelper());
 
   //We loop through all of the detector elements registered in the manager
   InDetDD::TRT_DetElementCollection::const_iterator it(m_detmgr->getDetectorElementBegin());
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.cxx
index 79f118a697e..1d26891dac3 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTNoise.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TRTNoise.h"
@@ -376,7 +376,7 @@ void TRTNoise::appendCrossTalkNoiseToProperDigits(std::vector<TRTDigit>& digitVe
                                                   CLHEP::HepRandomEngine* noiseRndmEngine) {
 
   //id helper:
-  TRTHitIdHelper* hitid_helper = TRTHitIdHelper::GetHelper();
+  const TRTHitIdHelper* hitid_helper = TRTHitIdHelper::GetHelper();
 
   std::vector<Identifier> IdsFromChip;
   std::vector<Identifier> CrossTalkIds;
diff --git a/InnerDetector/InDetSimEvent/InDetSimEvent/SiHitIdHelper.h b/InnerDetector/InDetSimEvent/InDetSimEvent/SiHitIdHelper.h
index 1e93a436c45..54d08670080 100755
--- a/InnerDetector/InDetSimEvent/InDetSimEvent/SiHitIdHelper.h
+++ b/InnerDetector/InDetSimEvent/InDetSimEvent/SiHitIdHelper.h
@@ -1,5 +1,5 @@
 /*
-  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 INDETSIMEVENT_SIHITIDHELPER
@@ -21,15 +21,12 @@
 // Base Class
 #include "HitManagement/HitIdHelper.h"
 
-// This class is singleton and static method and variable are used.
-#include "CxxUtils/checker_macros.h"
-ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
 
 class SiHitIdHelper : HitIdHelper {
  public:
   //
   // Access to the helper
-  static SiHitIdHelper* GetHelper();
+  static const SiHitIdHelper* GetHelper();
   //
   // Info retrieval:
   // Pixel or SCT
diff --git a/InnerDetector/InDetSimEvent/InDetSimEvent/TRTHitIdHelper.h b/InnerDetector/InDetSimEvent/InDetSimEvent/TRTHitIdHelper.h
index 18f3c381c72..5144eb3d99e 100755
--- a/InnerDetector/InDetSimEvent/InDetSimEvent/TRTHitIdHelper.h
+++ b/InnerDetector/InDetSimEvent/InDetSimEvent/TRTHitIdHelper.h
@@ -1,5 +1,5 @@
 /*
-  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 INDETSIMEVENT_TRTHITIDHELPER
@@ -21,16 +21,12 @@
 // Base Class
 #include "HitManagement/HitIdHelper.h"
 
-// This class is singleton and static method and variable are used.
-#include "CxxUtils/checker_macros.h"
-ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
-
 
 class TRTHitIdHelper : HitIdHelper {
  public:
   //
   // Access to the helper
-  static TRTHitIdHelper* GetHelper();
+  static const TRTHitIdHelper* GetHelper();
   //
   // Info retrieval:
   // Barrel or Endcap
diff --git a/InnerDetector/InDetSimEvent/src/SiHitIdHelper.cxx b/InnerDetector/InDetSimEvent/src/SiHitIdHelper.cxx
index 5836be31e74..5add7978d97 100755
--- a/InnerDetector/InDetSimEvent/src/SiHitIdHelper.cxx
+++ b/InnerDetector/InDetSimEvent/src/SiHitIdHelper.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include <mutex>
@@ -16,25 +16,22 @@
 
 static std::mutex sgMutex;
 
-// This class is singleton and static method and variable are used.
-ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
-
 //
 // private constructor
 SiHitIdHelper::SiHitIdHelper() :HitIdHelper() {
   Initialize();
 }
 
-SiHitIdHelper* SiHitIdHelper::GetHelper() {
-#ifdef G4MULTITHREADED
+const SiHitIdHelper* SiHitIdHelper::GetHelper ATLAS_NOT_THREAD_SAFE () { // static variable helperPtr is used.
+  #ifdef G4MULTITHREADED
   // Context-specific singleton
-  static Gaudi::Hive::ContextSpecificPtr<SiHitIdHelper> helperPtr;
-  if(!helperPtr) helperPtr = new SiHitIdHelper();
+  static Gaudi::Hive::ContextSpecificPtr<const SiHitIdHelper> helperPtr;
+  if (!helperPtr) helperPtr = new SiHitIdHelper();
   return helperPtr.get();
-#else
-  static SiHitIdHelper helper;
+  #else
+  static const SiHitIdHelper helper;
   return &helper;
-#endif
+  #endif
 }
 
 void SiHitIdHelper::Initialize() {
diff --git a/InnerDetector/InDetSimEvent/src/TRTHitIdHelper.cxx b/InnerDetector/InDetSimEvent/src/TRTHitIdHelper.cxx
index 4926b00e3b7..385ff95e360 100755
--- a/InnerDetector/InDetSimEvent/src/TRTHitIdHelper.cxx
+++ b/InnerDetector/InDetSimEvent/src/TRTHitIdHelper.cxx
@@ -1,20 +1,17 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "InDetSimEvent/TRTHitIdHelper.h"
 
-// This class is singleton and static method and variable are used.
-ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
-
 //
 // private constructor
 TRTHitIdHelper::TRTHitIdHelper() :HitIdHelper() {
   Initialize();
 }
 
-TRTHitIdHelper* TRTHitIdHelper::GetHelper() {
-  static TRTHitIdHelper helper;
+const TRTHitIdHelper* TRTHitIdHelper::GetHelper() {
+  static const TRTHitIdHelper helper;
   return &helper;
 }
 
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsID/src/HitCreatorTRT.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsID/src/HitCreatorTRT.cxx
index cee72e2a68f..1e1ab847b0a 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsID/src/HitCreatorTRT.cxx
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsID/src/HitCreatorTRT.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
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -210,7 +210,7 @@ void iFatras::HitCreatorTRT::createSimHit(const ISF::ISFParticle& isp, const Trk
            int layer     = m_trtIdHelper->straw_layer(hitId);
            int istraw    = m_trtIdHelper->straw(hitId);
                       
-           TRTHitIdHelper* hitid_helper = TRTHitIdHelper::GetHelper();
+           const TRTHitIdHelper* hitid_helper = TRTHitIdHelper::GetHelper();
            int hitID = hitid_helper->buildHitId( barrel_endcap, ispos, ringwheel, phisector,layer,istraw);
            
            TRTUncompressedHit
-- 
GitLab