From f78ecceb96d0f944bfad19740d34581d4c60707c Mon Sep 17 00:00:00 2001 From: Susumu Oda <susumu.oda@cern.ch> Date: Tue, 30 Jun 2020 16:31:59 +0200 Subject: [PATCH] Add ATLAS_CHECK_THREAD_SAFETY to TRT_G4Utilities package. Add ATLAS_THREAD_SAFE to mutable Athena::MsgStreamMember m_msg. Add ATLAS_NOT_THREAD_SAFE to thread unsafe classes and methods and their clients including TRT_G4_SD package. Add ATLAS_NO_CHECK_FILE_THREAD_SAFETY to unit tests of TRT_G4Utilities and TRT_G4_SD packages. --- .../InDetG4/TRT_G4Utilities/CMakeLists.txt | 2 +- .../TRT_G4Utilities/ATLAS_CHECK_THREAD_SAFETY | 1 + .../TRT_G4Utilities/TRTOutputFile.hh | 8 ++++---- .../TRT_G4Utilities/TRTParameters.hh | 8 ++++---- .../TRTParametersOfBarrelStraws.hh | 7 ++++--- .../TRTParametersOfModulesA.hh | 7 ++++--- .../TRTParametersOfModulesB.hh | 7 ++++--- .../TRTParametersOfModulesC.hh | 7 ++++--- .../TRTParametersOfStrawPlanes.hh | 7 ++++--- .../TRT_G4Utilities/TRTParametersOfWheelsA.hh | 7 ++++--- .../TRT_G4Utilities/TRTParametersOfWheelsB.hh | 7 ++++--- .../TRT_G4Utilities/TRTParametersOfWheelsC.hh | 7 ++++--- .../TRT_G4Utilities/TRTUtilities.hh | 7 ++++--- .../TRT_G4Utilities/TRTVisualization.hh | 7 ++++--- .../TRT_G4Utilities/src/TRTParameters.cc | 20 +++++++++---------- .../src/TRTParametersOfBarrelStraws.cc | 4 ++-- .../src/TRTParametersOfStrawPlanes.cc | 4 ++-- .../src/TRTParametersOfWheelsA.cc | 4 ++-- .../src/TRTParametersOfWheelsB.cc | 4 ++-- .../src/TRTParametersOfWheelsC.cc | 4 ++-- .../test/ut_TRTParametersTest.cxx | 4 +++- .../src/TRTParametersForBarrelHits.cxx | 4 ++-- .../src/TRTParametersForBarrelHits.h | 6 ++++-- .../src/TRTParametersForEndCapHits.cxx | 4 ++-- .../src/TRTParametersForEndCapHits.h | 6 ++++-- .../InDetG4/TRT_G4_SD/src/TRTPrintingOfHits.h | 2 +- .../TRT_G4_SD/src/TRTProcessingOfBarrelHits.h | 6 ++++-- .../TRT_G4_SD/src/TRTProcessingOfEndCapHits.h | 6 ++++-- .../TRT_G4_SD/src/TRTSensitiveDetector.cxx | 4 ++-- .../TRT_G4_SD/src/TRTSensitiveDetector.h | 6 +++--- .../src/TRTSensitiveDetectorTool.cxx | 4 ++-- .../test/TRTSensitiveDetector_gtest.cxx | 4 +++- 32 files changed, 104 insertions(+), 81 deletions(-) create mode 100644 InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/ATLAS_CHECK_THREAD_SAFETY diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt b/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt index 0dac0e461601..0c3fdb7f128f 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt +++ b/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt @@ -17,7 +17,7 @@ atlas_add_library( TRT_G4Utilities PUBLIC_HEADERS TRT_G4Utilities PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES AthenaKernel + LINK_LIBRARIES AthenaKernel CxxUtils PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} PathResolver ) # Install files from the package: diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 000000000000..f158b05b7ce3 --- /dev/null +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +InnerDetector/InDetG4/TRT_G4Utilities diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTOutputFile.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTOutputFile.hh index 8a5a66939bc5..1ffa44e9a93f 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTOutputFile.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTOutputFile.hh @@ -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 */ @@ -9,9 +9,9 @@ #include "globals.hh" #include <fstream> #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" - -class TRTOutputFile +class ATLAS_NOT_THREAD_SAFE TRTOutputFile // This class needs give non-const reference for output streaming. static TRTOutputFile* m_pOutputFile cannot be static const. Thread unsafe exit is also used. { public: ~TRTOutputFile(); @@ -38,7 +38,7 @@ private: static TRTOutputFile* m_pOutputFile; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParameters.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParameters.hh index b5b5070c9424..70e8f70f714e 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParameters.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParameters.hh @@ -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 */ @@ -9,9 +9,9 @@ #include "globals.hh" #include <map> #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" - -class TRTParameters +class ATLAS_NOT_THREAD_SAFE TRTParameters // static variable and thread unsafe exit are used. { public: ~TRTParameters(); @@ -49,7 +49,7 @@ private: static TRTParameters* s_pParameters; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfBarrelStraws.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfBarrelStraws.hh index bf69026c77f0..62d1cb3ec7d9 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfBarrelStraws.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfBarrelStraws.hh @@ -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 */ @@ -8,11 +8,12 @@ #include "globals.hh" #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" class TRTParameters; -class TRTParametersOfBarrelStraws +class ATLAS_NOT_THREAD_SAFE TRTParametersOfBarrelStraws // Thread unsafe TRTParameters class is used. { friend class TRTConstructionOfBarrelStraws; @@ -62,7 +63,7 @@ class TRTParametersOfBarrelStraws TRTParameters* m_pParameters; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesA.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesA.hh index 3e04472a3f64..61cc54b44570 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesA.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesA.hh @@ -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 */ @@ -8,11 +8,12 @@ #include "globals.hh" #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" class TRTParameters; -class TRTParametersOfModulesA +class ATLAS_NOT_THREAD_SAFE TRTParametersOfModulesA // Thread unsafe TRTParameters class is used. { friend class TRTConstructionOfModulesA; @@ -73,7 +74,7 @@ private: TRTParameters* m_pParameters; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesB.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesB.hh index 22a3ed10c7d3..95b7c0e93bd8 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesB.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesB.hh @@ -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 */ @@ -8,11 +8,12 @@ #include "globals.hh" #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" class TRTParameters; -class TRTParametersOfModulesB +class ATLAS_NOT_THREAD_SAFE TRTParametersOfModulesB // Thread unsafe TRTParameters class is used. { friend class TRTConstructionOfModulesB; @@ -76,7 +77,7 @@ class TRTParametersOfModulesB TRTParameters* m_pParameters; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesC.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesC.hh index ea284bac9c22..10a02d6d2d3f 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesC.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfModulesC.hh @@ -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 */ @@ -8,11 +8,12 @@ #include "globals.hh" #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" class TRTParameters; -class TRTParametersOfModulesC +class ATLAS_NOT_THREAD_SAFE TRTParametersOfModulesC // Thread unsafe TRTParameters class is used. { friend class TRTConstructionOfModulesC; @@ -76,7 +77,7 @@ private: TRTParameters* m_pParameters; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfStrawPlanes.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfStrawPlanes.hh index 9b32a16d0d5c..98373f53ff22 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfStrawPlanes.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfStrawPlanes.hh @@ -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 */ @@ -8,11 +8,12 @@ #include "globals.hh" #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" class TRTParameters; -class TRTParametersOfStrawPlanes +class ATLAS_NOT_THREAD_SAFE TRTParametersOfStrawPlanes // Thread unsafe TRTParameters class is used. { friend class TRTConstructionOfStrawPlanes; @@ -73,7 +74,7 @@ class TRTParametersOfStrawPlanes TRTParameters* m_pParameters; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsA.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsA.hh index ea24aae7b016..7076b52b4e87 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsA.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsA.hh @@ -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 */ @@ -8,11 +8,12 @@ #include "globals.hh" #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" class TRTParameters; -class TRTParametersOfWheelsA +class ATLAS_NOT_THREAD_SAFE TRTParametersOfWheelsA // Thread unsafe TRTParameters class is used. { friend class TRTConstructionOfWheelsA; @@ -67,7 +68,7 @@ class TRTParametersOfWheelsA TRTParameters* m_pParameters; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; #endif diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsB.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsB.hh index 4f0988bfba8d..fbd27905e4da 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsB.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsB.hh @@ -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 */ @@ -8,11 +8,12 @@ #include "globals.hh" #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" class TRTParameters; -class TRTParametersOfWheelsB +class ATLAS_NOT_THREAD_SAFE TRTParametersOfWheelsB // Thread unsafe TRTParameters class is used. { friend class TRTConstructionOfWheelsB; @@ -74,7 +75,7 @@ class TRTParametersOfWheelsB TRTParameters* m_pParameters; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; #endif diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsC.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsC.hh index 841cfcd0708f..a3b79e86d930 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsC.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTParametersOfWheelsC.hh @@ -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 */ @@ -8,11 +8,12 @@ #include "globals.hh" #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" class TRTParameters; -class TRTParametersOfWheelsC +class ATLAS_NOT_THREAD_SAFE TRTParametersOfWheelsC // Thread unsafe TRTParameters class is used. { friend class TRTConstructionOfWheelsC; @@ -67,7 +68,7 @@ class TRTParametersOfWheelsC TRTParameters* m_pParameters; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; #endif diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTUtilities.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTUtilities.hh index 14c224166c47..4f0aaf3bf3cf 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTUtilities.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTUtilities.hh @@ -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 TRTUtilities_hh @@ -8,11 +8,12 @@ #include "globals.hh" #include <fstream> #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" class TRTOutputFile; -class TRTUtilities +class ATLAS_NOT_THREAD_SAFE TRTUtilities // This class uses thread unsafe TRTOutputFile. static TRTUtilities utilities cannot be static const for output streaming. { public: ~TRTUtilities(); @@ -42,7 +43,7 @@ private: static TRTUtilities* s_pUtilities; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTVisualization.hh b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTVisualization.hh index 32cf5355654e..2e469b410c9f 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTVisualization.hh +++ b/InnerDetector/InDetG4/TRT_G4Utilities/TRT_G4Utilities/TRTVisualization.hh @@ -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 */ @@ -8,12 +8,13 @@ #include "globals.hh" #include "AthenaKernel/MsgStreamMember.h" +#include "CxxUtils/checker_macros.h" class G4LogicalVolume; class G4VisAttributes; -class TRTVisualization +class ATLAS_NOT_THREAD_SAFE TRTVisualization // static variable and thread unsafe exit are used. { public: ~TRTVisualization(); @@ -45,7 +46,7 @@ class TRTVisualization static TRTVisualization* s_pVisualization; - mutable Athena::MsgStreamMember m_msg; + mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParameters.cc b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParameters.cc index d3588766d225..b8692eea93f5 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParameters.cc +++ b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParameters.cc @@ -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 "TRT_G4Utilities/TRTParameters.hh" @@ -42,7 +42,7 @@ TRTParameters::~TRTParameters() // Called by TRTParameters -void TRTParameters::ReadInputFile(std::string fileName) +void TRTParameters::ReadInputFile ATLAS_NOT_THREAD_SAFE (std::string fileName) // Thread unsafe exit function is used. { if (msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "######### Method TRTParameters::ReadInputFile" << endmsg; @@ -149,7 +149,7 @@ void TRTParameters::ReadInputFile(std::string fileName) // Called by TRTParameters -void TRTParameters::PrintListOfParameters() const +void TRTParameters::PrintListOfParameters ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTOutputFile class is used. { if (msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "######### Method TRTParameters::PrintListOfParameters" << endmsg; @@ -171,7 +171,7 @@ void TRTParameters::PrintListOfParameters() const // Called on demand -int TRTParameters::GetInteger(std::string parameterName) const +int TRTParameters::GetInteger ATLAS_NOT_THREAD_SAFE (std::string parameterName) const // Thread unsafe exit function is used. { int numberOfItems = m_multimapOfParameters.count(parameterName); @@ -203,7 +203,7 @@ int TRTParameters::GetInteger(std::string parameterName) const // Called on demand -double TRTParameters::GetDouble(std::string parameterName) const +double TRTParameters::GetDouble ATLAS_NOT_THREAD_SAFE (std::string parameterName) const // Thread unsafe exit function is used. { int numberOfItems = m_multimapOfParameters.count(parameterName); @@ -235,7 +235,7 @@ double TRTParameters::GetDouble(std::string parameterName) const // Called on demand -void TRTParameters::GetIntegerArray(std::string arrayName, int arraySize, +void TRTParameters::GetIntegerArray ATLAS_NOT_THREAD_SAFE (std::string arrayName, int arraySize, // Thread unsafe exit function is used. int* array) const { int numberOfItems = m_multimapOfParameters.count(arrayName); @@ -269,7 +269,7 @@ void TRTParameters::GetIntegerArray(std::string arrayName, int arraySize, // Called on demand -void TRTParameters::GetDoubleArray(std::string arrayName, int arraySize, +void TRTParameters::GetDoubleArray ATLAS_NOT_THREAD_SAFE (std::string arrayName, int arraySize, // Thread unsafe exit function is used. double* array) const { int numberOfItems = m_multimapOfParameters.count(arrayName); @@ -303,7 +303,7 @@ void TRTParameters::GetDoubleArray(std::string arrayName, int arraySize, // Called on demand -void TRTParameters::GetPartOfIntegerArray(std::string arrayName, +void TRTParameters::GetPartOfIntegerArray ATLAS_NOT_THREAD_SAFE (std::string arrayName, // Thread unsafe exit function is used. int numberOfDemandedElements, int* array) const { int numberOfItems = m_multimapOfParameters.count(arrayName); @@ -338,7 +338,7 @@ void TRTParameters::GetPartOfIntegerArray(std::string arrayName, // Called on demand -void TRTParameters::GetPartOfDoubleArray(std::string arrayName, +void TRTParameters::GetPartOfDoubleArray ATLAS_NOT_THREAD_SAFE (std::string arrayName, // Thread unsafe exit function is used. int numberOfDemandedElements, double* array) const { int numberOfItems = m_multimapOfParameters.count(arrayName); @@ -373,7 +373,7 @@ void TRTParameters::GetPartOfDoubleArray(std::string arrayName, // Called on demand -int TRTParameters::GetElementOfIntegerArray(std::string arrayName, +int TRTParameters::GetElementOfIntegerArray ATLAS_NOT_THREAD_SAFE (std::string arrayName, // Thread unsafe exit function is used. int elementIndex) const { int numberOfItems = m_multimapOfParameters.count(arrayName); diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfBarrelStraws.cc b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfBarrelStraws.cc index 4fe73f26018e..028f16c49ae4 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfBarrelStraws.cc +++ b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfBarrelStraws.cc @@ -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 "TRT_G4Utilities/TRTParametersOfBarrelStraws.hh" @@ -91,7 +91,7 @@ void TRTParametersOfBarrelStraws::DefineParameters() // Called by TRTParametersOfBarrelStraws -void TRTParametersOfBarrelStraws::PrintParameters() const +void TRTParametersOfBarrelStraws::PrintParameters ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTUtilities and TRTOutputFile classes are used. { if (msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "######### Method TRTParametersOfBarrelStraws::PrintParameters" << endmsg; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfStrawPlanes.cc b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfStrawPlanes.cc index 570957533d51..660ccce57294 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfStrawPlanes.cc +++ b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfStrawPlanes.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-20120 CERN for the benefit of the ATLAS collaboration */ @@ -130,7 +130,7 @@ void TRTParametersOfStrawPlanes::DefineParameters() // Called by TRTParametersOfStrawPlanes -void TRTParametersOfStrawPlanes::PrintParameters() const +void TRTParametersOfStrawPlanes::PrintParameters ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTUtilities and TRTOutputFile classes are used. { if (msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "######### Method TRTParametersOfStrawPlanes::PrintParameters" << endmsg; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsA.cc b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsA.cc index f24e8aeb1968..234e8fd99325 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsA.cc +++ b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsA.cc @@ -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 */ @@ -134,7 +134,7 @@ void TRTParametersOfWheelsA::DefineParameters() // Called by TRTParametersOfWheelsA -void TRTParametersOfWheelsA::PrintParameters() const +void TRTParametersOfWheelsA::PrintParameters ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTUtilities and TRTOutputFile classes are used. { if (msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "######### Method TRTParametersOfWheelsA::PrintParameters" << endmsg; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsB.cc b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsB.cc index 050246fdb82f..f466a0cc18f0 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsB.cc +++ b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsB.cc @@ -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 */ @@ -146,7 +146,7 @@ void TRTParametersOfWheelsB::DefineParameters() // Called by TRTParametersOfWheelsB -void TRTParametersOfWheelsB::PrintParameters() const +void TRTParametersOfWheelsB::PrintParameters ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTUtilities and TRTOutputFile classes are used. { if (msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "######### Method TRTParametersOfWheelsB::PrintParameters" << endmsg; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsC.cc b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsC.cc index 801a5534be7a..7edacf4ed66e 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsC.cc +++ b/InnerDetector/InDetG4/TRT_G4Utilities/src/TRTParametersOfWheelsC.cc @@ -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 */ @@ -134,7 +134,7 @@ void TRTParametersOfWheelsC::DefineParameters() // Called by TRTParametersOfWheelsC -void TRTParametersOfWheelsC::PrintParameters() const +void TRTParametersOfWheelsC::PrintParameters ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTUtilities and TRTOutputFile classes are used. { if (msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "######### Method TRTParametersOfWheelsC::PrintParameters" << endmsg; diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/test/ut_TRTParametersTest.cxx b/InnerDetector/InDetG4/TRT_G4Utilities/test/ut_TRTParametersTest.cxx index b697f5213c96..ab30309f4b96 100644 --- a/InnerDetector/InDetG4/TRT_G4Utilities/test/ut_TRTParametersTest.cxx +++ b/InnerDetector/InDetG4/TRT_G4Utilities/test/ut_TRTParametersTest.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 */ #define BOOST_TEST_DYN_LINK @@ -9,6 +9,8 @@ #include "TRT_G4Utilities/TRTParameters.hh" #include "TRT_G4Utilities/TRTOutputFile.hh" +ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // This unit test uses thread unsafe TRTParameters and TRTOutputFile classes. + namespace utf = boost::unit_test; struct setupParameters{ diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.cxx b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.cxx index 20979f06e826..c5ca836bcee8 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.cxx +++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.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 */ // Class header @@ -154,7 +154,7 @@ void TRTParametersForBarrelHits::DefineParameters() const // Called by TRTParametersForBarrelHits -void TRTParametersForBarrelHits::PrintParameters() const +void TRTParametersForBarrelHits::PrintParameters ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTOutputFile is used. { if (m_verboseLevel>5) { G4cout << "######### Method TRTParametersForBarrelHits::PrintParameters" << G4endl; } diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.h index f1a40f0ccfd3..541580f50800 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.h +++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForBarrelHits.h @@ -1,14 +1,16 @@ /* - 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 TRT_G4_SD_TRTParametersForBarrelHits_hh #define TRT_G4_SD_TRTParametersForBarrelHits_hh +#include "CxxUtils/checker_macros.h" + class TRTParameters; class TRTProcessingOfBarrelHits; -class TRTParametersForBarrelHits +class ATLAS_NOT_THREAD_SAFE TRTParametersForBarrelHits // Thread unsafe TRTParameters and TRTProcessingOfBarrelHits classes are used. { public: TRTParametersForBarrelHits(TRTProcessingOfBarrelHits*); diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.cxx b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.cxx index c27b83c12722..080e2776426c 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.cxx +++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.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 */ // Class header @@ -102,7 +102,7 @@ void TRTParametersForEndCapHits::DefineParameters() const // Called by TRTParametersForEndCapHits -void TRTParametersForEndCapHits::PrintParameters() const +void TRTParametersForEndCapHits::PrintParameters ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTOutputFile class is used. { if (m_verboseLevel>5) { G4cout << "######### Method TRTParametersForEndCapHits::PrintParameters" << G4endl; } diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.h index 01ddaee4e73f..af25dcf46a0e 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.h +++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTParametersForEndCapHits.h @@ -1,14 +1,16 @@ /* - 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 TRT_G4_SD_TRTParametersForEndCapHits_hh #define TRT_G4_SD_TRTParametersForEndCapHits_hh +#include "CxxUtils/checker_macros.h" + class TRTParameters; class TRTProcessingOfEndCapHits; -class TRTParametersForEndCapHits +class ATLAS_NOT_THREAD_SAFE TRTParametersForEndCapHits // Thread unsafe TRTParameters and TRTProcessingOfEndCapHits classes are used. { public: TRTParametersForEndCapHits(TRTProcessingOfEndCapHits*); diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTPrintingOfHits.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTPrintingOfHits.h index 02c6169617e2..abe80a0441e4 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTPrintingOfHits.h +++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTPrintingOfHits.h @@ -12,7 +12,7 @@ class TRTUncompressedHit; class TRTOutputFile; -class TRTPrintingOfHits +class ATLAS_NOT_THREAD_SAFE TRTPrintingOfHits // Thread unsafe TRTOutputFile class is used. { public: TRTPrintingOfHits(); diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfBarrelHits.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfBarrelHits.h index b6220defffb6..03308dd8cc8d 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfBarrelHits.h +++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfBarrelHits.h @@ -1,16 +1,18 @@ /* - 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 TRT_G4_SD_TRTProcessingOfBarrelHits_hh #define TRT_G4_SD_TRTProcessingOfBarrelHits_hh +#include "CxxUtils/checker_macros.h" + class TRTParameters; class TRTSensitiveDetector; class G4Step; -class TRTProcessingOfBarrelHits +class ATLAS_NOT_THREAD_SAFE TRTProcessingOfBarrelHits // Thread unsafe TRTParameters and TRTSensitiveDetector classes are used. { friend class TRTParametersForBarrelHits; diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.h index bf9a8559ad68..56cc07d087dd 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.h +++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTProcessingOfEndCapHits.h @@ -1,16 +1,18 @@ /* - 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 TRT_G4_SD_TRTProcessingOfEndCapHits_hh #define TRT_G4_SD_TRTProcessingOfEndCapHits_hh +#include "CxxUtils/checker_macros.h" + class TRTParameters; class TRTSensitiveDetector; class G4Step; -class TRTProcessingOfEndCapHits +class ATLAS_NOT_THREAD_SAFE TRTProcessingOfEndCapHits // Thread unsafe TRTParameters and TRTSensitiveDetector classes are used. { friend class TRTParametersForEndCapHits; diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.cxx b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.cxx index cd207b7dfee7..db06ee735f9d 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.cxx +++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.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 */ @@ -70,7 +70,7 @@ TRTSensitiveDetector::TRTSensitiveDetector(const std::string& name, const std::s // Called by TRTSensitiveDetector // Once per run -void TRTSensitiveDetector::InitializeHitProcessing() +void TRTSensitiveDetector::InitializeHitProcessing ATLAS_NOT_THREAD_SAFE () // Thread unsafe TRTParametersForBarrelHits, TRTParametersForEndCapHits classes are used. { if(verboseLevel>4) { diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.h b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.h index f95cc4f8776b..50dfe58d5b82 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.h +++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetector.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 TRT_G4_SD_TRTSensitiveDetector_h @@ -8,6 +8,7 @@ // Base class #include "G4VSensitiveDetector.hh" +#include "CxxUtils/checker_macros.h" #include "InDetSimEvent/TRTUncompressedHitCollection.h" #include "StoreGate/WriteHandle.h" #include <gtest/gtest_prod.h> @@ -15,13 +16,12 @@ class TRTParameters; class TRTProcessingOfBarrelHits; class TRTProcessingOfEndCapHits; -class TRTOutputFile; class G4HCofThisEvent; class G4Step; class G4TouchableHistory; -class TRTSensitiveDetector : public G4VSensitiveDetector +class ATLAS_NOT_THREAD_SAFE TRTSensitiveDetector : public G4VSensitiveDetector // Thread unsafe TRTParameters, TRTProcessingOfBarrelHits, TRTProcessingOfEndCapHits classes is used. { FRIEND_TEST( TRTSensitiveDetectortest, Initialize); FRIEND_TEST( TRTSensitiveDetectortest, ProcessHits ); diff --git a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetectorTool.cxx b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetectorTool.cxx index a871c236f7a9..d2d769c6f438 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetectorTool.cxx +++ b/InnerDetector/InDetG4/TRT_G4_SD/src/TRTSensitiveDetectorTool.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 */ @@ -18,7 +18,7 @@ TRTSensitiveDetectorTool::TRTSensitiveDetectorTool(const std::string& type, cons //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4VSensitiveDetector* TRTSensitiveDetectorTool::makeSD() const +G4VSensitiveDetector* TRTSensitiveDetectorTool::makeSD ATLAS_NOT_THREAD_SAFE () const // Thread unsafe TRTSensitiveDetector class is used. { ATH_MSG_DEBUG( "Initializing SD" ); diff --git a/InnerDetector/InDetG4/TRT_G4_SD/test/TRTSensitiveDetector_gtest.cxx b/InnerDetector/InDetG4/TRT_G4_SD/test/TRTSensitiveDetector_gtest.cxx index 13033f63ac69..5d54bfeb834e 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/test/TRTSensitiveDetector_gtest.cxx +++ b/InnerDetector/InDetG4/TRT_G4_SD/test/TRTSensitiveDetector_gtest.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 "src/TRTSensitiveDetector.h" @@ -32,6 +32,8 @@ #include "G4AtlasTools/DerivedG4SensitiveDetectorTestSetting.h" #include "MCTruth/TrackHelper.h" +ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // Thread unsafe TRTSensitiveDetector class is tested in this unit test. + //set environment class GaudiEnvironment : public ::testing::Environment { protected: -- GitLab