From d434793bd54332af952583cdf832c7125b41ff08 Mon Sep 17 00:00:00 2001
From: John Chapman <jchapman@cern.ch>
Date: Fri, 14 Aug 2020 12:48:26 +0200
Subject: [PATCH] Matching changes to for new-style configuration

---
 .../BCM_G4_SD/python/BCM_G4_SDToolConfig.py   | 11 ++-
 .../BLM_G4_SD/python/BLM_G4_SDToolConfig.py   | 13 +--
 .../PixelG4_SD/python/PixelG4_SDToolConfig.py | 12 +--
 .../SCT_G4_SD/python/SCT_G4_SDToolConfig.py   | 11 ++-
 .../TRT_G4_SD/python/TRT_G4_SDToolConfig.py   | 13 +--
 .../LArG4/LArG4SD/python/LArG4SDToolConfig.py | 38 ++++++---
 .../MuonG4SD/python/MuonG4SDToolConfig.py     | 79 ++++++++++++-------
 .../G4AtlasApps/python/SimConfigFlags.py      |  2 +-
 .../python/collection_merger_helpersNew.py    | 18 +++--
 .../ISF_FastCaloSimServicesConfigNew.py       | 16 ++--
 .../python/MinBiasScintillatorToolConfig.py   | 13 +--
 .../python/TileGeoG4SDToolConfig.py           |  8 +-
 12 files changed, 150 insertions(+), 84 deletions(-)

diff --git a/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDToolConfig.py b/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDToolConfig.py
index 5bcf6ddf9b1..4da290d67b2 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDToolConfig.py
+++ b/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDToolConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
@@ -12,9 +12,12 @@ def BCMSensorSDCfg(ConfigFlags, name="BCMSensorSD", **kwargs):
     bare_collection_name = "BCMHits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "BCMHits"
-    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "ID"
+    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                    bare_collection_name,
+                                                    mergeable_collection_suffix,
+                                                    merger_input_property,
+                                                    region)
     kwargs.setdefault("LogicalVolumeNames", ["Pixel::bcmDiamondLog"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
diff --git a/InnerDetector/InDetG4/BLM_G4_SD/python/BLM_G4_SDToolConfig.py b/InnerDetector/InDetG4/BLM_G4_SD/python/BLM_G4_SDToolConfig.py
index f816bda346c..f9aa423cde5 100644
--- a/InnerDetector/InDetG4/BLM_G4_SD/python/BLM_G4_SDToolConfig.py
+++ b/InnerDetector/InDetG4/BLM_G4_SD/python/BLM_G4_SDToolConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
@@ -8,14 +8,17 @@ BLMSensorSDTool=CompFactory.BLMSensorSDTool
 
 
 def BLMSensorSDCfg(ConfigFlags, name="BLMSensorSD", **kwargs):
-    
+
     result = ComponentAccumulator()
     bare_collection_name = "BLMHits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "BLMHits"
-    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "ID"
+    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                    bare_collection_name,
+                                                    mergeable_collection_suffix,
+                                                    merger_input_property,
+                                                    region)
     kwargs.setdefault("LogicalVolumeNames", ["Pixel::blmDiamondLog"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
diff --git a/InnerDetector/InDetG4/PixelG4_SD/python/PixelG4_SDToolConfig.py b/InnerDetector/InDetG4/PixelG4_SD/python/PixelG4_SDToolConfig.py
index bfe0d3c14a5..6f7b6b78961 100644
--- a/InnerDetector/InDetG4/PixelG4_SD/python/PixelG4_SDToolConfig.py
+++ b/InnerDetector/InDetG4/PixelG4_SD/python/PixelG4_SDToolConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
@@ -13,11 +13,13 @@ def PixelSensorSDCfg(ConfigFlags, name="PixelSensorSD", **kwargs):
     bare_collection_name = "PixelHits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "PixelHits"
-    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "ID"
+    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                    bare_collection_name,
+                                                    mergeable_collection_suffix,
+                                                    merger_input_property,
+                                                    region)
     kwargs.setdefault("LogicalVolumeNames", ["Pixel::siBLayLog","Pixel::siLog","Pixel::dbmDiamondLog"])
-    #kwargs.setdefault("LogicalVolumeNames", ["Pixel::siBLayLog","Pixel::siLog"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
     result.merge(acc)
diff --git a/InnerDetector/InDetG4/SCT_G4_SD/python/SCT_G4_SDToolConfig.py b/InnerDetector/InDetG4/SCT_G4_SD/python/SCT_G4_SDToolConfig.py
index d3af78ebff4..e222d82afde 100644
--- a/InnerDetector/InDetG4/SCT_G4_SD/python/SCT_G4_SDToolConfig.py
+++ b/InnerDetector/InDetG4/SCT_G4_SD/python/SCT_G4_SDToolConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
@@ -14,8 +14,12 @@ def SctSensorSDCfg(ConfigFlags, name="SctSensorSD", **kwargs):
     bare_collection_name = "SCT_Hits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "SCTHits"
-
-    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name, mergeable_collection_suffix, merger_input_property)
+    region = "ID"
+    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                    bare_collection_name,
+                                                    mergeable_collection_suffix,
+                                                    merger_input_property,
+                                                    region)
     kwargs.setdefault("LogicalVolumeNames", ["SCT::BRLSensor","SCT::ECSensor0","SCT::ECSensor1",
                                               "SCT::ECSensor2","SCT::ECSensor3"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
@@ -41,4 +45,3 @@ def SctSensor_CTBCfg(name="SctSensor_CTB", **kwargs):
     kwargs.setdefault("LogicalVolumeNames", ["SCT::ECSensor0"])
     kwargs.setdefault("OutputCollectionNames", ["SCT_Hits"])
     return SctSensor_CTBTool(name, **kwargs)
-  
diff --git a/InnerDetector/InDetG4/TRT_G4_SD/python/TRT_G4_SDToolConfig.py b/InnerDetector/InDetG4/TRT_G4_SD/python/TRT_G4_SDToolConfig.py
index 365eada3388..f641e92c522 100644
--- a/InnerDetector/InDetG4/TRT_G4_SD/python/TRT_G4_SDToolConfig.py
+++ b/InnerDetector/InDetG4/TRT_G4_SD/python/TRT_G4_SDToolConfig.py
@@ -1,11 +1,11 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaConfiguration.ComponentFactory import CompFactory
 
 from ISF_Algorithms.collection_merger_helpersNew import CollectionMergerCfg
 
-TRTSensitiveDetectorTool =CompFactory.TRTSensitiveDetectorTool 
+TRTSensitiveDetectorTool =CompFactory.TRTSensitiveDetectorTool
 
 def TRTSensitiveDetectorCfg(ConfigFlags, name="TRTSensitiveDetector", **kwargs):
 
@@ -13,9 +13,12 @@ def TRTSensitiveDetectorCfg(ConfigFlags, name="TRTSensitiveDetector", **kwargs):
     bare_collection_name = "TRTUncompressedHits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "TRTUncompressedHits"
-    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "ID"
+    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                    bare_collection_name,
+                                                    mergeable_collection_suffix,
+                                                    merger_input_property,
+                                                    region)
     result.merge(acc)
 
     logicalVolumeNames = ["TRT::Gas","TRT::GasMA"]
diff --git a/LArCalorimeter/LArG4/LArG4SD/python/LArG4SDToolConfig.py b/LArCalorimeter/LArG4/LArG4SD/python/LArG4SDToolConfig.py
index 9a32083059e..9aa1dbdd5fc 100644
--- a/LArCalorimeter/LArG4/LArG4SD/python/LArG4SDToolConfig.py
+++ b/LArCalorimeter/LArG4/LArG4SD/python/LArG4SDToolConfig.py
@@ -176,9 +176,12 @@ def LArEMBSensitiveDetectorCfg(ConfigFlags,name="LArEMBSensitiveDetector", **kwa
     bare_collection_name = "LArHitEMB"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "LArEMBHits"
-    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "CALO"
+    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                    bare_collection_name,
+                                                    mergeable_collection_suffix,
+                                                    merger_input_property,
+                                                    region)
 
     result.merge(acc)
     ## Main configuration
@@ -195,7 +198,7 @@ def LArEMBSensitiveDetectorCfg(ConfigFlags,name="LArEMBSensitiveDetector", **kwa
 
     result.merge(EMBCalculatorCfg(ConfigFlags))
     kwargs.setdefault("EMBCalculator", result.getService("EMBCalculator"))
-    
+
     result.setPrivateTools( LArG4__EMBSDTool(name, **kwargs) )
     return result
 
@@ -204,9 +207,12 @@ def LArEMECSensitiveDetectorCfg(ConfigFlags, name="LArEMECSensitiveDetector", **
     bare_collection_name = "LArHitEMEC"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "LArEMECHits"
-    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "CALO"
+    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                    bare_collection_name,
+                                                    mergeable_collection_suffix,
+                                                    merger_input_property,
+                                                    region)
     result.merge(acc)
 
     if ConfigFlags.GeoModel.AtlasVersion not in ["tb_LArH6_2002","tb_LArH6EC_2002"]:
@@ -254,9 +260,12 @@ def LArFCALSensitiveDetectorCfg(ConfigFlags, name="LArFCALSensitiveDetector", **
     bare_collection_name = "LArHitFCAL"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "LArFCALHits"
-    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "CALO"
+    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                    bare_collection_name,
+                                                    mergeable_collection_suffix,
+                                                    merger_input_property,
+                                                    region)
     result.merge(acc)
 
     kwargs.setdefault("FCAL1Volumes",["LArMgr::LAr::FCAL::Module1::Gap"])
@@ -287,9 +296,12 @@ def LArHECSensitiveDetectorCfg(ConfigFlags, name="LArHECSensitiveDetector", **kw
     bare_collection_name = "LArHitHEC"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "LArHECHits"
-    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "CALO"
+    acc, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                    bare_collection_name,
+                                                    mergeable_collection_suffix,
+                                                    merger_input_property,
+                                                    region)
     result.merge(acc)
 
     kwargs.setdefault("WheelVolumes",["LArMgr::LAr::HEC::Module::Depth::Slice"])
diff --git a/MuonSpectrometer/MuonG4/MuonG4SD/python/MuonG4SDToolConfig.py b/MuonSpectrometer/MuonG4/MuonG4SD/python/MuonG4SDToolConfig.py
index 2141f9f5f5c..e89eaea0c28 100644
--- a/MuonSpectrometer/MuonG4/MuonG4SD/python/MuonG4SDToolConfig.py
+++ b/MuonSpectrometer/MuonG4/MuonG4SD/python/MuonG4SDToolConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 from ISF_Algorithms.collection_merger_helpersNew import CollectionMergerCfg
 from AthenaConfiguration.ComponentFactory import CompFactory
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
@@ -9,9 +9,12 @@ def CSCSensitiveDetectorCosmicsCfg(ConfigFlags, name="CSCSensitiveDetectorCosmic
     bare_collection_name = "CSC_Hits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "CSCHits"
-    result, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "MUON"
+    result, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                       bare_collection_name,
+                                                       mergeable_collection_suffix,
+                                                       merger_input_property,
+                                                       region)
     kwargs.setdefault("LogicalVolumeNames", ["Muon::CscArCO2"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
@@ -21,9 +24,12 @@ def CSCSensitiveDetectorCfg(ConfigFlags, name="CSCSensitiveDetector", **kwargs):
     bare_collection_name = "CSC_Hits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "CSCHits"
-    result, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "MUON"
+    result, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                       bare_collection_name,
+                                                       mergeable_collection_suffix,
+                                                       merger_input_property,
+                                                       region)
     kwargs.setdefault("LogicalVolumeNames", ["Muon::CscArCO2"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
@@ -43,9 +49,12 @@ def MDTSensitiveDetectorCosmicsCfg(ConfigFlags, name="MDTSensitiveDetectorCosmic
     bare_collection_name = "MDT_Hits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "MDTHits"
-    result, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "MUON"
+    result, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                       bare_collection_name,
+                                                       mergeable_collection_suffix,
+                                                       merger_input_property,
+                                                       region)
     kwargs.setdefault("LogicalVolumeNames", ["Muon::SensitiveGas"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
@@ -57,9 +66,12 @@ def MDTSensitiveDetectorCfg(ConfigFlags, name="MDTSensitiveDetector", **kwargs):
     bare_collection_name = "MDT_Hits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "MDTHits"
-    result, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "MUON"
+    result, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                       bare_collection_name,
+                                                       mergeable_collection_suffix,
+                                                       merger_input_property,
+                                                       region)
     kwargs.setdefault("LogicalVolumeNames", ["Muon::SensitiveGas"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
@@ -69,7 +81,8 @@ def MDTSensitiveDetectorCfg(ConfigFlags, name="MDTSensitiveDetector", **kwargs):
 
 def MicromegasSensitiveDetectorCfg(ConfigFlags, name="MicromegasSensitiveDetector", **kwargs):
     kwargs.setdefault("LogicalVolumeNames", ["Muon::MM_Sensitive"])
-    kwargs.setdefault("OutputCollectionNames", ["MicromegasSensitiveDetector"]) # need ISF_Collection merger in acc?
+    kwargs.setdefault("OutputCollectionNames", ["MicromegasSensitiveDetector"])
+    # TODO add support for Micromegas to ISF_CollectionMerger
     result=ComponentAccumulator()
     result.setPrivateTools( MicromegasSensitiveDetectorTool(name, **kwargs) )
     return result
@@ -79,9 +92,12 @@ def RPCSensitiveDetectorCosmicsCfg(ConfigFlags, name="RPCSensitiveDetectorCosmic
     bare_collection_name = "RPC_Hits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "RPCHits"
-    result, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "MUON"
+    result, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                       bare_collection_name,
+                                                       mergeable_collection_suffix,
+                                                       merger_input_property,
+                                                       region)
     kwargs.setdefault("LogicalVolumeNames", ["Muon::gazGap"])
     kwargs.setdefault("OutputCollectionNames", [bare_collection_name]) #is this correct?
 
@@ -93,9 +109,12 @@ def RPCSensitiveDetectorCfg(ConfigFlags, name="RPCSensitiveDetector", **kwargs):
     bare_collection_name = "RPC_Hits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "RPCHits"
-    result, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "MUON"
+    result, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                       bare_collection_name,
+                                                       mergeable_collection_suffix,
+                                                       merger_input_property,
+                                                       region)
     kwargs.setdefault("LogicalVolumeNames", ["Muon::gazGap"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
@@ -107,9 +126,12 @@ def TGCSensitiveDetectorCosmicsCfg(ConfigFlags, name="TGCSensitiveDetectorCosmic
     bare_collection_name = "TGC_Hits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "TGCHits"
-    result, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "MUON"
+    result, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                       bare_collection_name,
+                                                       mergeable_collection_suffix,
+                                                       merger_input_property,
+                                                       region)
     kwargs.setdefault("LogicalVolumeNames", ["Muon::muo::TGCGas"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
@@ -121,9 +143,12 @@ def TGCSensitiveDetectorCfg(ConfigFlags, name="TGCSensitiveDetector", **kwargs):
     bare_collection_name = "TGC_Hits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "TGCHits"
-    result, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    region = "MUON"
+    result, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                       bare_collection_name,
+                                                       mergeable_collection_suffix,
+                                                       merger_input_property,
+                                                       region)
     kwargs.setdefault("LogicalVolumeNames", ["Muon::muo::TGCGas"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
@@ -134,7 +159,7 @@ def TGCSensitiveDetectorCfg(ConfigFlags, name="TGCSensitiveDetector", **kwargs):
 def sTGCSensitiveDetectorCfg(ConfigFlags, name="sTGCSensitiveDetector", **kwargs):
     kwargs.setdefault("LogicalVolumeNames", ["Muon::sTGC_Sensitive"])
     kwargs.setdefault("OutputCollectionNames", ["sTGCSensitiveDetector"])
-
+    # TODO add support for Micromegas to ISF_CollectionMerger
     result=ComponentAccumulator()
     result.setPrivateTools( sTGCSensitiveDetectorTool(name, **kwargs) )
     return result
diff --git a/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py b/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py
index 8155a366e6b..2e6e1e4f2b3 100644
--- a/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py
+++ b/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py
@@ -77,7 +77,7 @@ def createSimConfigFlags():
 
     # For ISF
     scf.addFlag("Sim.ISFRun",False)
-    scf.addFlag("Sim.ISF.HITSMergingRequired", True)
+    scf.addFlag("Sim.ISF.HITSMergingRequired", {'ID':True, 'CALO':True, 'MUON':True})
     scf.addFlag("Sim.ISF.Simulator", "ATLFASTII")
     scf.addFlag("Sim.ISF.DoTimeMonitoring", True) # bool: run time monitoring
     scf.addFlag("Sim.ISF.DoMemoryMonitoring", True) # bool: run time monitoring
diff --git a/Simulation/ISF/ISF_Core/ISF_Algorithms/python/collection_merger_helpersNew.py b/Simulation/ISF/ISF_Core/ISF_Algorithms/python/collection_merger_helpersNew.py
index 3756a6a0de3..c9934f5f562 100644
--- a/Simulation/ISF/ISF_Core/ISF_Algorithms/python/collection_merger_helpersNew.py
+++ b/Simulation/ISF/ISF_Core/ISF_Algorithms/python/collection_merger_helpersNew.py
@@ -1,15 +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
 
 from __future__ import print_function
 
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 
-def CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                        mergeable_collection_suffix,
-                                        merger_input_property):
+def CollectionMergerCfg(ConfigFlags,
+                        bare_collection_name,
+                        mergeable_collection_suffix,
+                        merger_input_property,
+                        region):
   """Generates and returns a collection name that is also registered to
      the ISF CollectionMerger algorithm.
- 
+
      :param bare_collection_name: name of the collection if no merging
          is taking place.
      :param mergeable_collection_suffix: suffix to the collection in
@@ -18,18 +20,18 @@ def CollectionMergerCfg(ConfigFlags, bare_collection_name,
          CollectionMerger algorithm to add the mergeable collection to."""
 
   result = ComponentAccumulator()
-  if ConfigFlags.Sim.ISFRun and ConfigFlags.Sim.ISF.HITSMergingRequired: 
+  if ConfigFlags.Sim.ISFRun and ConfigFlags.Sim.ISF.HITSMergingRequired.get(region,True):
       mergeable_collection = '{bare}{suffix}'.format(
              bare=bare_collection_name,
              suffix=mergeable_collection_suffix)
-         
+
       from ISF_Algorithms.CollectionMergerConfig import ISFCollectionMergerCfg
       algo=ISFCollectionMergerCfg(ConfigFlags)
       result.addEventAlgo(algo)
 
       input_attribute_name = 'Input{merger_input_property}'.format(
       merger_input_property=merger_input_property)
-    
+
       merger_input_collections = getattr(algo,input_attribute_name) #empty list always?
       merger_input_collections.append(mergeable_collection)
 
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/python/ISF_FastCaloSimServicesConfigNew.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/python/ISF_FastCaloSimServicesConfigNew.py
index a7b7b92c50d..f4ae1166ab9 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/python/ISF_FastCaloSimServicesConfigNew.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/python/ISF_FastCaloSimServicesConfigNew.py
@@ -111,6 +111,7 @@ def FastHitConvertToolCfg(flags, name="ISF_FastHitConvertTool", **kwargs):
 
     acc = ComponentAccumulator()
     mergeable_collection_suffix = "_FastCaloSim"
+    region = "CALO"
 
     EMB_hits_bare_collection_name = "LArHitEMB"
     EMB_hits_merger_input_property = "LArEMBHits"
@@ -118,7 +119,8 @@ def FastHitConvertToolCfg(flags, name="ISF_FastHitConvertTool", **kwargs):
         flags,
         EMB_hits_bare_collection_name,
         mergeable_collection_suffix,
-        EMB_hits_merger_input_property)
+        EMB_hits_merger_input_property,
+        region)
     acc.merge(acc1)
 
     EMEC_hits_bare_collection_name = "LArHitEMEC"
@@ -127,7 +129,8 @@ def FastHitConvertToolCfg(flags, name="ISF_FastHitConvertTool", **kwargs):
         flags,
         EMEC_hits_bare_collection_name,
         mergeable_collection_suffix,
-        EMEC_hits_merger_input_property)
+        EMEC_hits_merger_input_property,
+        region)
     acc.merge(acc2)
 
     FCAL_hits_bare_collection_name = "LArHitFCAL"
@@ -136,7 +139,8 @@ def FastHitConvertToolCfg(flags, name="ISF_FastHitConvertTool", **kwargs):
         flags,
         FCAL_hits_bare_collection_name,
         mergeable_collection_suffix,
-        FCAL_hits_merger_input_property)
+        FCAL_hits_merger_input_property,
+        region)
     acc.merge(acc3)
 
     HEC_hits_bare_collection_name = "LArHitHEC"
@@ -145,7 +149,8 @@ def FastHitConvertToolCfg(flags, name="ISF_FastHitConvertTool", **kwargs):
         flags,
         HEC_hits_bare_collection_name,
         mergeable_collection_suffix,
-        HEC_hits_merger_input_property)
+        HEC_hits_merger_input_property,
+        region)
     acc.merge(acc4)
 
     tile_hits_bare_collection_name = "TileHitVec"
@@ -154,7 +159,8 @@ def FastHitConvertToolCfg(flags, name="ISF_FastHitConvertTool", **kwargs):
         flags,
         tile_hits_bare_collection_name,
         mergeable_collection_suffix,
-        tile_hits_merger_input_property)
+        tile_hits_merger_input_property,
+        region)
     acc.merge(acc5)
 
     kwargs.setdefault("embHitContainername", EMB_hits_collection_name)
diff --git a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/python/MinBiasScintillatorToolConfig.py b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/python/MinBiasScintillatorToolConfig.py
index eff199174cf..def341b6f0a 100644
--- a/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/python/MinBiasScintillatorToolConfig.py
+++ b/TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator/python/MinBiasScintillatorToolConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from ISF_Algorithms.collection_merger_helpersNew import CollectionMergerCfg
 from AthenaConfiguration.ComponentFactory import CompFactory
@@ -9,10 +9,13 @@ def MinBiasScintillatorSDCfg(ConfigFlags, name="MinBiasScintillatorSD", **kwargs
     bare_collection_name = "MBTSHits"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "MBTSHits"
+    region = "CALO"
 
-    result, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name,
-                                                              mergeable_collection_suffix,
-                                                              merger_input_property)
+    result, hits_collection_name = CollectionMergerCfg(ConfigFlags,
+                                                       bare_collection_name,
+                                                       mergeable_collection_suffix,
+                                                       merger_input_property,
+                                                       region)
     kwargs.setdefault("LogicalVolumeNames", ["LArMgr::MBTS1", "LArMgr::MBTS2"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
@@ -20,6 +23,6 @@ def MinBiasScintillatorSDCfg(ConfigFlags, name="MinBiasScintillatorSD", **kwargs
         kwargs.setdefault("DeltaTHit", [1])
         kwargs.setdefault("DoTOFCorrection", False)
 
-    result.setPrivateTools( MinBiasScintillatorSDTool(name, **kwargs) ) 
+    result.setPrivateTools( MinBiasScintillatorSDTool(name, **kwargs) )
 
     return result
diff --git a/TileCalorimeter/TileG4/TileGeoG4SD/python/TileGeoG4SDToolConfig.py b/TileCalorimeter/TileG4/TileGeoG4SD/python/TileGeoG4SDToolConfig.py
index 95a634d93bf..44a5949671b 100644
--- a/TileCalorimeter/TileG4/TileGeoG4SD/python/TileGeoG4SDToolConfig.py
+++ b/TileCalorimeter/TileG4/TileGeoG4SD/python/TileGeoG4SDToolConfig.py
@@ -10,11 +10,15 @@ def TileGeoG4SDCfg(ConfigFlags, name="TileGeoG4SD", **kwargs):
     bare_collection_name = "TileHitVec"
     mergeable_collection_suffix = "_G4"
     merger_input_property = "TileHits"
+    region = "CALO"
 
-    result, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name, mergeable_collection_suffix, merger_input_property)
+    result, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name, mergeable_collection_suffix, merger_input_property, region)
     kwargs.setdefault("LogicalVolumeNames", ["Tile::Scintillator"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
 
+    result.merge(TileGeoG4SDCalcCfg(ConfigFlags))
+    kwargs.setdefault("TileCalculator", result.getService("TileGeoG4SDCalc") )
+
     result.setPrivateTools( TileGeoG4SDTool(name, **kwargs)  )
     return result
 
@@ -23,7 +27,7 @@ def TileCTBGeoG4SDCfg(ConfigFlags, name="TileCTBGeoG4SD", **kwargs):
     kwargs.setdefault("LogicalVolumeNames", ["Tile::Scintillator"])
     kwargs.setdefault("OutputCollectionNames", ["TileHitVec"])
 
-    result = TileGeoG4SDCalcCfg(ConfigFlags)
+    result = TileCTBGeoG4SDCalcCfg(ConfigFlags)
     kwargs.setdefault("TileCalculator", result.getService("TileCTBGeoG4SDCalc") )
 
     result.setPrivateTools( TileGeoG4SDTool(name, **kwargs) )
-- 
GitLab