diff --git a/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt
index 4fdadae06b4abf9f7cebfc1e78a95e25d702c45e..bf0295291ee714974c3e2ad6a1fabf7ac0a09c83 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: BCM_G4_SD
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( BCM_G4_SD )
@@ -8,21 +6,20 @@ atlas_subdir( BCM_G4_SD )
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
-find_package( XercesC )
 find_package( GTest )
 
 # Component(s) in the package:
 atlas_add_library( BCM_G4_SDLib
                    src/*.cxx
-                   NO_PUBLIC_HEADERS BCM_G4_SD
-                   INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils AthenaKernel StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth                 )
+                   NO_PUBLIC_HEADERS
+                   INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} AthenaKernel G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib )
 
 atlas_add_component( BCM_G4_SD
                      src/components/*.cxx
-                     INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth BCM_G4_SDLib )
+                     LINK_LIBRARIES BCM_G4_SDLib )
 
+# Test(s) in the package:
 atlas_add_test( BCM_G4_SDToolConfig_test
                 SCRIPT test/BCM_G4_SDToolConfig_test.py
                 PROPERTIES TIMEOUT 300 )
@@ -30,10 +27,9 @@ atlas_add_test( BCM_G4_SDToolConfig_test
 atlas_add_test( BCMSensorSD_gtest
                 SOURCES
                 test/BCMSensorSD_gtest.cxx
-                INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES TestTools BCM_G4_SDLib ${GTEST_LIBRARIES} ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils AthenaKernel StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth
-              )
+                INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
+                LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib TestTools BCM_G4_SDLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/optionForTest.txt )
diff --git a/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfig.py b/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfig.py
index c4e84b014481f7aedeccd591dbdbe90500efa5cf..c548363d8cb4ca5df5bc28e16546120865d0b65b 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfig.py
+++ b/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfig.py
@@ -1,7 +1,6 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon import CfgMgr
-from G4AtlasApps.SimFlags import simFlags
 
 from ISF_Algorithms.collection_merger_helpers import generate_mergeable_collection_name
 
diff --git a/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt
index d1a06d3dce1c3b9a37c3e1de8633fe378e2909f6..64e1d3e4b87bb39c6a0f72ecac507c8b65ac1f4a 100644
--- a/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: BLM_G4_SD
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( BLM_G4_SD )
@@ -8,22 +6,20 @@ atlas_subdir( BLM_G4_SD )
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
-find_package( XercesC )
 find_package( GTest )
 
 # Component(s) in the package:
 atlas_add_library( BLM_G4_SDLib
                    src/*.cxx
-                   NO_PUBLIC_HEADERS BLM_G4_SD
-                   INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth
-                 )
+                   NO_PUBLIC_HEADERS
+                   INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib )
 
 atlas_add_component( BLM_G4_SD
                      src/components/*.cxx
-                     INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth BLM_G4_SDLib )
+                     LINK_LIBRARIES BLM_G4_SDLib )
 
+# Test(s) in the package:
 atlas_add_test( BLM_G4_SDToolConfig_test
                 SCRIPT test/BLM_G4_SDToolConfig_test.py
                 PROPERTIES TIMEOUT 300 )
@@ -31,10 +27,9 @@ atlas_add_test( BLM_G4_SDToolConfig_test
 atlas_add_test( BLMSensorSD_gtest
                 SOURCES
                 test/BLMSensorSD_gtest.cxx
-                INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES TestTools BLM_G4_SDLib ${GTEST_LIBRARIES} ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth
-              )
+                INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
+                LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} AtlasHepMCLib G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib TestTools BLM_G4_SDLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/optionForTest.txt )
diff --git a/InnerDetector/InDetG4/BLM_G4_SD/python/BLM_G4_SDConfig.py b/InnerDetector/InDetG4/BLM_G4_SD/python/BLM_G4_SDConfig.py
index 79b99735924da032f1ae26151555c343cda4b824..4f3632de6adddc74126831acc17c454a8a86c5f7 100644
--- a/InnerDetector/InDetG4/BLM_G4_SD/python/BLM_G4_SDConfig.py
+++ b/InnerDetector/InDetG4/BLM_G4_SD/python/BLM_G4_SDConfig.py
@@ -1,7 +1,6 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon import CfgMgr
-from G4AtlasApps.SimFlags import simFlags
 
 from ISF_Algorithms.collection_merger_helpers import generate_mergeable_collection_name
 
diff --git a/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt b/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt
index 78b27e8cf51b797462134be935fc5982212660c5..348e883dbaa3db65e344e6a65fb082f8d5310514 100644
--- a/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: PixelG4_SD
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( PixelG4_SD )
@@ -8,21 +6,20 @@ atlas_subdir( PixelG4_SD )
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
-find_package( XercesC )
 find_package( GTest )
 
 # Component(s) in the package:
 atlas_add_library( PixelG4_SDLib
                    src/*.cxx
-                   NO_PUBLIC_HEADERS PixelG4_SD
-                   INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth )
+                   NO_PUBLIC_HEADERS
+                   INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib )
 
 atlas_add_component( PixelG4_SD
                      src/components/*.cxx
-                     INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth PixelG4_SDLib )
+                     LINK_LIBRARIES PixelG4_SDLib )
 
+# Test(s) in the package:
 atlas_add_test( PixelG4_SDToolConfig_test
                 SCRIPT test/PixelG4_SDToolConfig_test.py
                 PROPERTIES TIMEOUT 300 )
@@ -30,10 +27,9 @@ atlas_add_test( PixelG4_SDToolConfig_test
 atlas_add_test( PixelSensorSD_gtest
                 SOURCES
                 test/PixelSensorSD_gtest.cxx
-                INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES TestTools G4AtlasToolsLib ${GTEST_LIBRARIES} ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} PixelG4_SDLib
-)  
+                INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
+                LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib TestTools  PixelG4_SDLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/optionForTest.txt )
diff --git a/InnerDetector/InDetG4/PixelG4_SD/python/PixelG4_SDConfig.py b/InnerDetector/InDetG4/PixelG4_SD/python/PixelG4_SDConfig.py
index 161d2683335e946429427c6dda5edc3b0fb1ea0f..821987c9a7d31a4e36d70cea0060fdeeae6584d1 100644
--- a/InnerDetector/InDetG4/PixelG4_SD/python/PixelG4_SDConfig.py
+++ b/InnerDetector/InDetG4/PixelG4_SD/python/PixelG4_SDConfig.py
@@ -1,7 +1,6 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon import CfgMgr
-from G4AtlasApps.SimFlags import simFlags
 
 from ISF_Algorithms.collection_merger_helpers import generate_mergeable_collection_name
 
diff --git a/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt
index 4ebd128dd22e4e65d401f6433e9cf75d8704ad57..b1e17394c2aa8a77e7461f81ff011562f2ec33e0 100644
--- a/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: SCT_G4_SD
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( SCT_G4_SD )
@@ -8,37 +6,34 @@ atlas_subdir( SCT_G4_SD )
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
-find_package( XercesC )
 find_package( GTest )
 
 # Component(s) in the package:
 atlas_add_library( SCT_G4_SDLib
                    src/*.cxx
-                   NO_PUBLIC_HEADERS SCT_G4_SD
-                   INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth )
+                   NO_PUBLIC_HEADERS
+                   INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib )
 
 atlas_add_component( SCT_G4_SD
                      src/components/*.cxx
-                     INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth SCT_G4_SDLib )
+                     LINK_LIBRARIES SCT_G4_SDLib )
 
+# Test(s) in the package:
 atlas_add_test( SCT_G4_SDToolConfig_test
                 SCRIPT test/SCT_G4_SDToolConfig_test.py
                 PROPERTIES TIMEOUT 300 )
 
 atlas_add_test( SctSensorSD_gtest
                 SOURCES test/SctSensorSD_gtest.cxx
-                INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES TestTools  ${GTEST_LIBRARIES} ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} SCT_G4_SDLib CxxUtils StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth
-)
+                INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
+                LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib TestTools SCT_G4_SDLib )
 
 atlas_add_test( SctSensor_CTB_gtest
                 SOURCES test/SctSensor_CTB_gtest.cxx
-                INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES TestTools  ${GTEST_LIBRARIES} ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} SCT_G4_SDLib CxxUtils StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth
-)
+                INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
+                LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib TestTools SCT_G4_SDLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/optionForTest.txt )
diff --git a/InnerDetector/InDetG4/SCT_G4_SD/python/SCT_G4_SDConfig.py b/InnerDetector/InDetG4/SCT_G4_SD/python/SCT_G4_SDConfig.py
index 676485a8d918b69ab21b56177e1ce9d88e73435b..e318f8e9e33dfc3a05e5821d5031ef86c3749bb7 100644
--- a/InnerDetector/InDetG4/SCT_G4_SD/python/SCT_G4_SDConfig.py
+++ b/InnerDetector/InDetG4/SCT_G4_SD/python/SCT_G4_SDConfig.py
@@ -1,7 +1,6 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon import CfgMgr
-from G4AtlasApps.SimFlags import simFlags
 
 from ISF_Algorithms.collection_merger_helpers import generate_mergeable_collection_name
 
diff --git a/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt b/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt
index 0c3fdb7f128f357163c0afec50fb5b59cf8911d5..8ab25c8b600091271ecc5c3c0a483ffa6f3fee60 100644
--- a/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt
+++ b/InnerDetector/InDetG4/TRT_G4Utilities/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: TRT_G4Utilities
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TRT_G4Utilities )
@@ -8,17 +6,17 @@ atlas_subdir( TRT_G4Utilities )
 # External dependencies:
 find_package( CLHEP )
 find_package( Geant4 )
-find_package( XercesC )
 find_package( Boost COMPONENTS unit_test_framework )
 
 # Component(s) in the package:
 atlas_add_library( TRT_G4Utilities
                    src/*.cc
                    PUBLIC_HEADERS TRT_G4Utilities
-                   PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
+                   INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS}
+                   PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
-                   LINK_LIBRARIES AthenaKernel CxxUtils
-                   PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} PathResolver )
+                   LINK_LIBRARIES ${GEANT4_LIBRARIES} AthenaKernel CxxUtils
+                   PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} PathResolver )
 
 # Install files from the package:
 atlas_install_runtime( share/TRT_G4Utilities_management.txt share/TRT_G4Utilities_geometry.txt )
@@ -26,6 +24,4 @@ atlas_install_runtime( share/TRT_G4Utilities_management.txt share/TRT_G4Utilitie
 atlas_add_test( ut_TRT_G4UtilitiesTest
    SOURCES test/ut_TRTParametersTest.cxx
    INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-   PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS}
    LINK_LIBRARIES ${Boost_LIBRARIES} TRT_G4Utilities )
-
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt
index 4e70daec0f73f43435efb86e91eb3b259604fe44..ac62adb0acacd8c0219c807089c31a4511396ef3 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt
+++ b/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt
@@ -1,28 +1,24 @@
-################################################################################
-# Package: TRT_G4_SD
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TRT_G4_SD )
 
 # External dependencies:
-find_package( CLHEP )
 find_package( Geant4 )
-#find_package( XercesC )
 find_package( GTest )
 
 # Component(s) in the package:
 atlas_add_library( TRT_G4_SDLib
                    src/*.cxx
-                   NO_PUBLIC_HEADERS TRT_G4_SD
-                   INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel CxxUtils StoreGateLib SGtests GaudiKernel TRT_G4Utilities InDetSimEvent G4AtlasToolsLib MCTruth )
+                   NO_PUBLIC_HEADERS
+                   INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} AthenaKernel CxxUtils G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib TRT_G4Utilities )
 
 atlas_add_component( TRT_G4_SD
                      src/components/*.cxx
-                     INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel StoreGateLib SGtests GaudiKernel TRT_G4Utilities InDetSimEvent G4AtlasToolsLib MCTruth TRT_G4_SDLib )
+                     LINK_LIBRARIES TRT_G4_SDLib )
 
+# Test(s) in the package:
 atlas_add_test( TRT_G4_SDToolConfig_test
                 SCRIPT test/TRT_G4_SDToolConfig_test.py
                 PROPERTIES TIMEOUT 300 )
@@ -30,10 +26,9 @@ atlas_add_test( TRT_G4_SDToolConfig_test
 atlas_add_test( TRTSensitiveDetector_gtest
                 SOURCES
                 test/TRTSensitiveDetector_gtest.cxx
-                INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                LINK_LIBRARIES TestTools TRT_G4_SDLib ${GTEST_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel CxxUtils StoreGateLib SGtests GaudiKernel TRT_G4Utilities InDetSimEvent G4AtlasToolsLib MCTruth
-              )
+                INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
+                LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} CxxUtils G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib TestTools TRT_G4_SDLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/optionForTest.txt )
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/python/TRT_G4_SDConfig.py b/InnerDetector/InDetG4/TRT_G4_SD/python/TRT_G4_SDConfig.py
index d14cdc5417644177ca2a4002c59c2a0895ce4400..cd9118fe87c3df7c4d7ff47fbc7222af4d099b68 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/python/TRT_G4_SDConfig.py
+++ b/InnerDetector/InDetG4/TRT_G4_SD/python/TRT_G4_SDConfig.py
@@ -1,7 +1,6 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon import CfgMgr
-from G4AtlasApps.SimFlags import simFlags
 
 from ISF_Algorithms.collection_merger_helpers import generate_mergeable_collection_name