diff --git a/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfig.py b/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfig.py index 9cc18e59016c02067574b4af19ff2c8427161109..7705bdcb7a9d6d9d3813e59ab5ea08512369dcb6 100644 --- a/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfig.py +++ b/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfig.py @@ -62,14 +62,10 @@ def G4AtlasAlgCfg(flags, name="G4AtlasAlg", **kwargs): kwargs.setdefault("QuasiStablePatcher", result.getPrimaryAndMerge(ZeroLifetimePositionerCfg(flags)).name ) #sensitive detector master tool - SensitiveDetector = result.popToolsAndMerge(SensitiveDetectorMasterToolCfg(flags)) - result.addPublicTool(SensitiveDetector) - kwargs.setdefault("SenDetMasterTool", result.getPublicTool(SensitiveDetector.name)) + kwargs.setdefault("SenDetMasterTool", result.addPublicTool(result.popToolsAndMerge(SensitiveDetectorMasterToolCfg(flags)))) #fast simulation master tool - FastSimulation = result.popToolsAndMerge(FastSimulationMasterToolCfg(flags)) - result.addPublicTool(FastSimulation) - kwargs.setdefault("FastSimMasterTool", result.getPublicTool(FastSimulation.name)) + kwargs.setdefault("FastSimMasterTool", result.addPublicTool(result.popToolsAndMerge(FastSimulationMasterToolCfg(flags)))) #Write MetaData container and make it available to the job result.merge(writeSimulationParametersMetadata(flags)) diff --git a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasFieldServices.py b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasFieldServices.py index bf2d85a7052778fb425e070f017e88f422005570..4907c274779d27edc3f33b62f110e06a2dad3ce3 100644 --- a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasFieldServices.py +++ b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasFieldServices.py @@ -22,9 +22,7 @@ def ForwardFieldSvcCfg(flags, name="ForwardField", **kwargs): def ForwardRegionFieldSvcCfg(flags, name="ForwardRegionFieldSvc", **kwargs): result = ComponentAccumulator() from ForwardRegionProperties.ForwardRegionPropertiesConfig import ForwardRegionPropertiesCfg - tool = result.popToolsAndMerge(ForwardRegionPropertiesCfg(flags)) - result.addPublicTool(tool) - kwargs.setdefault("ForwardRegionProperties", result.getPublicTool(tool.name)) + kwargs.setdefault("ForwardRegionProperties", result.addPublicTool(result.popToolsAndMerge(ForwardRegionPropertiesCfg(flags)))) result.addService(CompFactory.MagField.ForwardRegionFieldSvc(name, **kwargs), primary=True) return result diff --git a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfig.py b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfig.py index 0a0b961771e29d9415479be82ff8bc75cd201ebd..ee3e5e7b09fff33d85c33ff2921a28b58db2eec9 100644 --- a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfig.py +++ b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.AccumulatorCache import AccumulatorCache @@ -13,10 +13,7 @@ from TRT_TR_Process.TRT_TR_ProcessConfig import TRTPhysicsToolCfg def DetectorGeometrySvcCfg(flags, name="DetectorGeometrySvc", **kwargs): result = ComponentAccumulator() - detConstTool = result.popToolsAndMerge(G4AtlasDetectorConstructionToolCfg(flags)) - result.addPublicTool(detConstTool) - kwargs.setdefault("DetectorConstruction", result.getPublicTool(detConstTool.name)) - + kwargs.setdefault("DetectorConstruction", result.addPublicTool(result.popToolsAndMerge(G4AtlasDetectorConstructionToolCfg(flags)))) result.addService(CompFactory.DetectorGeometrySvc(name, **kwargs), primary = True) return result diff --git a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfig.py b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfig.py index d83ab6a2bb052117499dc8419a13d886959b32a0..4f340d8009c0d390ab8efecd80973ff460d5f0ad 100644 --- a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfig.py +++ b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfig.py @@ -51,8 +51,7 @@ def FullG4TrackProcessorUserActionToolCfg(flags, name="FullG4TrackProcessorUserA tool = result.popToolsAndMerge(EntryLayerToolMTCfg(flags)) else: tool = result.popToolsAndMerge(EntryLayerToolCfg(flags)) - result.addPublicTool(tool) - kwargs.setdefault("EntryLayerTool", result.getPublicTool(tool.name)) + kwargs.setdefault("EntryLayerTool", result.addPublicTool(tool)) kwargs.setdefault("GeoIDSvc", result.getPrimaryAndMerge(GeoIDSvcCfg(flags)).name) if flags.Detector.GeometryCavern: kwargs.setdefault("TruthVolumeLevel", 2) diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py b/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py index 0d92462f7fae3b261c6f7dc26e29ee8d5705905c..b536443520c1b50fde122742cc6fcf34a4373137 100644 --- a/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py +++ b/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py @@ -698,9 +698,8 @@ def G4AtlasDetectorConstructionToolCfg(flags, name="G4AtlasDetectorConstructionT kwargs.setdefault("GeometryConfigurationTools", result.popToolsAndMerge(GeometryConfigurationToolsCfg(flags))) if "SenDetMasterTool" not in kwargs: - tool = result.popToolsAndMerge(SensitiveDetectorMasterToolCfg(flags)) - result.addPublicTool(tool) - kwargs.setdefault("SenDetMasterTool", result.getPublicTool(tool.name)) + kwargs.setdefault("SenDetMasterTool", + result.addPublicTool(result.popToolsAndMerge(SensitiveDetectorMasterToolCfg(flags)))) if flags.Beam.Type is BeamType.TestBeam: # Tile test beam diff --git a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfig.py b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfig.py index f18ca582109a7a03fdbb4390816866be0a84dee6..f266e6914a20f5dca3513bac5493bd8e0ec17828 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfig.py +++ b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfig.py @@ -51,9 +51,7 @@ def LongLivedInputConverterCfg(flags, name="ISF_LongLivedInputConverter", **kwar def ParticleBrokerSvcNoOrderingCfg(flags, name="ISF_ParticleBrokerSvcNoOrdering", **kwargs): result = ComponentAccumulator() if "EntryLayerTool" not in kwargs: - tool = result.popToolsAndMerge(EntryLayerToolCfg(flags)) - result.addPublicTool(tool) - kwargs.setdefault("EntryLayerTool", result.getPublicTool(tool.name)) + kwargs.setdefault("EntryLayerTool", result.addPublicTool(result.popToolsAndMerge(EntryLayerToolCfg(flags)))) kwargs.setdefault("GeoIDSvc", result.getService("ISF_GeoIDSvc").name) # FIXME # assume "GeoIDSvc" has been set alongside "EntryLayerTool" kwargs.setdefault("AlwaysUseGeoIDSvc", False) @@ -77,10 +75,7 @@ def ParticleBrokerSvcCfg(flags, name="ISF_ParticleBrokerSvc", **kwargs): def AFIIParticleBrokerSvcCfg(flags, name="ISF_AFIIParticleBrokerSvc", **kwargs): result = ComponentAccumulator() - tool = result.popToolsAndMerge(AFIIEntryLayerToolCfg(flags)) - result.addPublicTool(tool) - - kwargs.setdefault("EntryLayerTool", result.getPublicTool(tool.name)) + kwargs.setdefault("EntryLayerTool", result.addPublicTool(result.popToolsAndMerge(AFIIEntryLayerToolCfg(flags)))) kwargs.setdefault("GeoIDSvc", result.getService("ISF_AFIIGeoIDSvc").name) # FIXME pbsvc = result.getPrimaryAndMerge(ParticleBrokerSvcCfg(flags, name, **kwargs)) result.addService(pbsvc, primary = True) diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfig.py b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfig.py index ee1a2171daac24fee3cca473b90048788e6e65ed..8b575e6d0deee0e828a1bd049d5be50772f54ae2 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfig.py +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfig.py @@ -12,10 +12,7 @@ from ISF_Tools.ISF_ToolsConfig import EntryLayerFilterCfg def EntryLayerToolCfg(flags, name="ISF_EntryLayerTool", **kwargs): result = ComponentAccumulator() kwargs["GeoIDSvc"] = result.getPrimaryAndMerge(GeoIDSvcCfg(flags)).name - - filt = result.popToolsAndMerge(EntryLayerFilterCfg(flags)) - result.addPublicTool(filt) - kwargs.setdefault("ParticleFilters", [result.getPublicTool(filt.name)]) + kwargs.setdefault("ParticleFilters", [result.addPublicTool(result.popToolsAndMerge(EntryLayerFilterCfg(flags)))]) if flags.GeoModel.Run < LHCPeriod.Run4: kwargs.setdefault("CaloEntryVolumeString", "IDET::IDET") @@ -51,10 +48,7 @@ def EntryLayerToolMTCfg(flags, name="ISF_EntryLayerToolMT", **kwargs): def AFIIEntryLayerToolCfg(flags, name="ISF_AFIIEntryLayerTool", **kwargs): result = ComponentAccumulator() kwargs["GeoIDSvc"] = result.getPrimaryAndMerge(AFIIGeoIDSvcCfg(flags)).name - - filt = result.popToolsAndMerge(EntryLayerFilterCfg(flags)) - result.addPublicTool(filt) - kwargs.setdefault("ParticleFilters", [result.getPublicTool(filt.name)]) + kwargs.setdefault("ParticleFilters", [result.addPublicTool(result.popToolsAndMerge(EntryLayerFilterCfg(flags)))]) if flags.GeoModel.Run < LHCPeriod.Run4: kwargs.setdefault("CaloEntryVolumeString", "IDET::IDET") diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/python/ISF_Geant4ServicesConfig.py b/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/python/ISF_Geant4ServicesConfig.py index 5523603af628920c6d130eb5f460e4204f190a8e..f9716b99a4383f8d7b28af8ca67d18d47eae4782 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/python/ISF_Geant4ServicesConfig.py +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/python/ISF_Geant4ServicesConfig.py @@ -23,9 +23,7 @@ def Geant4SimCfg(flags, name="ISFG4SimSvc", **kwargs): result.addService(G4_DDDBEnvelopeDefSvc) if "SimulatorTool" not in kwargs: - tool = result.popToolsAndMerge(Geant4ToolCfg(flags)) - result.addPublicTool(tool) - kwargs.setdefault("SimulatorTool", result.getPublicTool(tool.name)) + kwargs.setdefault("SimulatorTool", result.addPublicTool(result.popToolsAndMerge(Geant4ToolCfg(flags)))) kwargs.setdefault("Identifier", "Geant4") result.addService(CompFactory.iGeant4.Geant4SimSvc(name, **kwargs), primary = True) return result @@ -34,9 +32,7 @@ def Geant4SimCfg(flags, name="ISFG4SimSvc", **kwargs): def FullGeant4SimCfg(flags, name="ISF_FullGeant4SimSvc", **kwargs): result = ComponentAccumulator() if "SimulatorTool" not in kwargs: - tool = result.popToolsAndMerge(FullGeant4ToolCfg(flags)) - result.addPublicTool(tool) - kwargs.setdefault("SimulatorTool", result.getPublicTool(tool.name)) + kwargs.setdefault("SimulatorTool", result.addPublicTool(result.popToolsAndMerge(FullGeant4ToolCfg(flags)))) svc = result.getPrimaryAndMerge(Geant4SimCfg(flags, name, **kwargs)) result.addService(svc, primary = True) return result @@ -44,9 +40,7 @@ def FullGeant4SimCfg(flags, name="ISF_FullGeant4SimSvc", **kwargs): def LongLivedGeant4SimCfg(flags, name="ISF_LongLivedGeant4SimSvc", **kwargs): result = ComponentAccumulator() - tool = result.popToolsAndMerge(LongLivedGeant4ToolCfg(flags)) - result.addPublicTool(tool) - kwargs.setdefault("SimulatorTool", result.getPublicTool(tool.name)) + kwargs.setdefault("SimulatorTool", result.addPublicTool(result.popToolsAndMerge(LongLivedGeant4ToolCfg(flags)))) svc = result.getPrimaryAndMerge(FullGeant4SimCfg(flags, name, **kwargs)) result.addService(svc, primary = True) return result @@ -55,9 +49,7 @@ def LongLivedGeant4SimCfg(flags, name="ISF_LongLivedGeant4SimSvc", **kwargs): def PassBackGeant4SimCfg(flags, name="ISF_PassBackGeant4SimSvc", **kwargs): result = ComponentAccumulator() if "SimulatorTool" not in kwargs: - tool = result.popToolsAndMerge(PassBackGeant4ToolCfg(flags)) - result.addPublicTool(tool) - kwargs.setdefault("SimulatorTool", result.getPublicTool(tool.name)) + kwargs.setdefault("SimulatorTool", result.addPublicTool(result.popToolsAndMerge(PassBackGeant4ToolCfg(flags)))) svc = result.getPrimaryAndMerge(Geant4SimCfg(flags, name, **kwargs)) result.addService(svc, primary = True) return result @@ -65,9 +57,7 @@ def PassBackGeant4SimCfg(flags, name="ISF_PassBackGeant4SimSvc", **kwargs): def AFIIGeant4SimCfg(flags, name="ISF_AFIIGeant4SimSvc", **kwargs): result = ComponentAccumulator() - tool = result.popToolsAndMerge(AFIIGeant4ToolCfg(flags)) - result.addPublicTool(tool) - kwargs.setdefault("SimulatorTool", result.getPublicTool(tool.name)) + kwargs.setdefault("SimulatorTool", result.addPublicTool(result.popToolsAndMerge(AFIIGeant4ToolCfg(flags)))) svc = result.getPrimaryAndMerge(PassBackGeant4SimCfg(flags, name, **kwargs)) result.addService(svc, primary = True) return result @@ -75,9 +65,7 @@ def AFIIGeant4SimCfg(flags, name="ISF_AFIIGeant4SimSvc", **kwargs): def AFII_QS_Geant4SimCfg(flags, name="ISF_AFII_QS_Geant4SimSvc", **kwargs): result = ComponentAccumulator() - tool = result.popToolsAndMerge(AFII_QS_Geant4ToolCfg(flags)) - result.addPublicTool(tool) - kwargs.setdefault("SimulatorTool", result.getPublicTool(tool.name)) + kwargs.setdefault("SimulatorTool", result.addPublicTool(result.popToolsAndMerge(AFII_QS_Geant4ToolCfg(flags)))) svc = result.getPrimaryAndMerge(PassBackGeant4SimCfg(flags, name, **kwargs)) result.addService(svc, primary = True) return result diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfig.py b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfig.py index 190fb6d7af8fb1367410f16bb21d2425e95dd2f9..88769740ebeb93f0a06c9b751667fec1cff027b8 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfig.py +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfig.py @@ -1,6 +1,6 @@ """Geant4 tools config for ISF with ComponentAccumulator -Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration """ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -46,13 +46,9 @@ def Geant4ToolCfg(flags, name="ISF_Geant4Tool", **kwargs): kwargs.setdefault("G4Commands", flags.Sim.G4Commands) kwargs.setdefault("PrintTimingInfo", flags.Sim.ISF.DoTimeMonitoring) if "SenDetMasterTool" not in kwargs: - tool = acc.popToolsAndMerge(SensitiveDetectorMasterToolCfg(flags)) - acc.addPublicTool(tool) - kwargs.setdefault("SenDetMasterTool", acc.getPublicTool(tool.name)) + kwargs.setdefault("SenDetMasterTool", acc.addPublicTool(acc.popToolsAndMerge(SensitiveDetectorMasterToolCfg(flags)))) if "FastSimMasterTool" not in kwargs: - tool = acc.popToolsAndMerge(FastSimulationMasterToolCfg(flags)) - acc.addPublicTool(tool) - kwargs.setdefault("FastSimMasterTool", acc.getPublicTool(tool.name)) + kwargs.setdefault("FastSimMasterTool", acc.addPublicTool(acc.popToolsAndMerge(FastSimulationMasterToolCfg(flags)))) # PhysicsListSvc kwargs.setdefault("PhysicsListSvc", acc.getPrimaryAndMerge(PhysicsListSvcCfg(flags)).name) @@ -62,9 +58,7 @@ def Geant4ToolCfg(flags, name="ISF_Geant4Tool", **kwargs): if flags.Sim.ISF.Simulator in [SimulationFlavour.FullG4MT, SimulationFlavour.FullG4MT_QS, SimulationFlavour.PassBackG4MT, SimulationFlavour.ATLFAST3MT, SimulationFlavour.ATLFAST3MT_QS]: acc.setPrivateTools(CompFactory.iGeant4.G4TransportTool(name, **kwargs)) else: - tool = acc.popToolsAndMerge(G4RunManagerHelperCfg(flags)) - acc.addPublicTool(tool) - kwargs.setdefault("G4RunManagerHelper", acc.getPublicTool(tool.name)) + kwargs.setdefault("G4RunManagerHelper", acc.addPublicTool(acc.popToolsAndMerge(G4RunManagerHelperCfg(flags)))) acc.setPrivateTools(CompFactory.iGeant4.G4LegacyTransportTool(name, **kwargs)) return acc