From d685a3bcd95bc108c9408a996afe1454c6238311 Mon Sep 17 00:00:00 2001 From: John Derek Chapman <chapman@hep.phy.cam.ac.uk> Date: Tue, 21 Dec 2021 11:52:01 +0100 Subject: [PATCH] Clean-up CA-based configuration of Simulation --- .../python/LArG4BarrelConfigNew.py | 28 +-- .../LArG4/LArG4EC/python/LArG4ECConfigNew.py | 72 +++--- .../LArG4FCAL/python/LArG4FCALConfigNew.py | 8 +- .../LArG4HEC/python/LArG4HECConfigNew.py | 11 +- .../python/LArG4MiniFCALConfigNew.py | 2 +- .../LArG4/LArG4SD/python/LArG4SDToolConfig.py | 213 ++++++---------- .../python/FastCaloSimFactoryNew.py | 2 +- .../G4AtlasAlg/python/G4AtlasAlgConfigNew.py | 27 +- .../python/G4AtlasFieldServices.py | 232 +++++++++++------- .../python/G4AtlasServicesConfigNew.py | 22 +- .../python/G4AtlasUserActionConfigNew.py | 46 ++-- .../G4AtlasTools/python/G4FieldConfigNew.py | 91 ++++--- .../python/G4GeometryToolConfig.py | 65 ++--- .../ISF_Config/python/ISF_MainConfigNew.py | 29 +-- .../python/ISF_ServicesConfigNew.py | 54 ++-- .../python/ISF_ServicesCoreConfigNew.py | 27 +- .../ISF_FastCaloSimServicesConfigNew.py | 36 +-- .../python/ISF_FatrasConfig.py | 39 +-- .../python/ISF_Geant4CommonToolsConfigNew.py | 64 +++-- .../python/ISF_Geant4ToolsConfigNew.py | 37 ++- 20 files changed, 498 insertions(+), 607 deletions(-) diff --git a/LArCalorimeter/LArG4/LArG4Barrel/python/LArG4BarrelConfigNew.py b/LArCalorimeter/LArG4/LArG4Barrel/python/LArG4BarrelConfigNew.py index 7e22a628cf9c..4dfe010f92da 100644 --- a/LArCalorimeter/LArG4/LArG4Barrel/python/LArG4BarrelConfigNew.py +++ b/LArCalorimeter/LArG4/LArG4Barrel/python/LArG4BarrelConfigNew.py @@ -14,62 +14,62 @@ LArG4__BarrelPresampler__Geometry=CompFactory.LArG4.BarrelPresampler.Geometry def BarrelCryostatCalibrationCalculatorCfg(ConfigFlags, name="BarrelCryostatCalibrationCalculator", **kwargs): result = ComponentAccumulator() - result.addService( LArG4__BarrelCryostat__CalibrationCalculator(name, **kwargs) ) + result.addService( LArG4__BarrelCryostat__CalibrationCalculator(name, **kwargs), primary=True ) return result def BarrelCryostatCalibrationLArCalculatorCfg(ConfigFlags, name="BarrelCryostatCalibrationLArCalculator", **kwargs): result = ComponentAccumulator() - result.addService( LArG4__BarrelCryostat__CalibrationLArCalculator(name, **kwargs) ) + result.addService( LArG4__BarrelCryostat__CalibrationLArCalculator(name, **kwargs), primary=True ) return result def BarrelCryostatCalibrationMixedCalculatorCfg(ConfigFlags, name="BarrelCryostatCalibrationMixedCalculator", **kwargs): result = ComponentAccumulator() - result.addService( LArG4__BarrelCryostat__CalibrationMixedCalculator(name, **kwargs) ) + result.addService( LArG4__BarrelCryostat__CalibrationMixedCalculator(name, **kwargs), primary=True ) return result def DMCalibrationCalculatorCfg(ConfigFlags, name="DMCalibrationCalculator", **kwargs): result = ComponentAccumulator() - result.addService( LArG4__DM__CalibrationCalculator(name, **kwargs) ) + result.addService( LArG4__DM__CalibrationCalculator(name, **kwargs), primary=True ) return result def BarrelCalibrationCalculatorCfg(ConfigFlags, name="BarrelCalibrationCalculator", **kwargs): result = ComponentAccumulator() - result.addService( LArG4__Barrel__CalibrationCalculator(name, **kwargs) ) + result.addService( LArG4__Barrel__CalibrationCalculator(name, **kwargs), primary=True ) return result def BarrelPresamplerCalibrationCalculatorCfg(ConfigFlags, name="BarrelPresamplerCalibrationCalculator", **kwargs): result = ComponentAccumulator() - result.addService( LArG4__BarrelPresampler__CalibrationCalculator(name, **kwargs) ) + result.addService( LArG4__BarrelPresampler__CalibrationCalculator(name, **kwargs), primary=True ) return result def EMBCalculatorCfg(ConfigFlags, name="EMBCalculator", **kwargs): - result = LArBarrelGeometryCfg(ConfigFlags) - kwargs.setdefault("GeometryCalculator", result.getService("LArBarrelGeometry")) - result.addService(LArBarrelCalculator(name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("GeometryCalculator", result.getPrimaryAndMerge(LArBarrelGeometryCfg(ConfigFlags)).name) + result.addService(LArBarrelCalculator(name, **kwargs), primary=True) return result def EMBPresamplerCalculatorCfg(ConfigFlags, name="EMBPresamplerCalculator", **kwargs): - result = LArBarrelPresamplerGeometryCfg(ConfigFlags) - kwargs.setdefault("GeometryCalculator", result.getService("LArBarrelPresamplerGeometry")) + result = ComponentAccumulator() + kwargs.setdefault("GeometryCalculator", result.getPrimaryAndMerge(LArBarrelPresamplerGeometryCfg(ConfigFlags)).name) - result.addService(LArBarrelPresamplerCalculator(name, **kwargs)) + result.addService(LArBarrelPresamplerCalculator(name, **kwargs), primary=True) return result def LArBarrelGeometryCfg(ConfigFlags, name="LArBarrelGeometry", **kwargs): result = ComponentAccumulator() - result.addService(LArG4__Barrel__Geometry(name, **kwargs)) + result.addService(LArG4__Barrel__Geometry(name, **kwargs), primary=True) return result def LArBarrelPresamplerGeometryCfg(ConfigFlags, name="LArBarrelPresamplerGeometry", **kwargs): result = ComponentAccumulator() - result.addService(LArG4__BarrelPresampler__Geometry(name, **kwargs)) + result.addService(LArG4__BarrelPresampler__Geometry(name, **kwargs), primary=True) return result diff --git a/LArCalorimeter/LArG4/LArG4EC/python/LArG4ECConfigNew.py b/LArCalorimeter/LArG4/LArG4EC/python/LArG4ECConfigNew.py index 23cada82f094..5fe020737075 100644 --- a/LArCalorimeter/LArG4/LArG4EC/python/LArG4ECConfigNew.py +++ b/LArCalorimeter/LArG4/LArG4EC/python/LArG4ECConfigNew.py @@ -6,91 +6,91 @@ from LArG4EC import LArWheelCalculatorEnum from LArG4SD.LArG4SDToolConfig import CalibrationDefaultCalculatorCfg def CalibrationCalculatorCfg(name="CalibrationCalculator", **kwargs): result = ComponentAccumulator() - result.addService(CompFactory.LArG4.EC.CalibrationCalculator(name, **kwargs)) + result.addService(CompFactory.LArG4.EC.CalibrationCalculator(name, **kwargs), primary=True) return result def EMECPosInnerWheelCalibrationCalculatorCfg(ConfigFlags, name="EMECPosInnerWheelCalibrationCalculator", **kwargs): kwargs.setdefault("WheelType", LArWheelCalculatorEnum.InnerAbsorberWheel) kwargs.setdefault("zSide", 1) - result = EMECPosInnerWheelCorrOffCalculatorCfg(ConfigFlags) - kwargs.setdefault("GeometryCalculator",result.getService("EMECPosInnerWheelCorrOffCalculator")) - result.merge(CalibrationCalculatorCfg(name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("GeometryCalculator",result.getPrimaryAndMerge(EMECPosInnerWheelCorrOffCalculatorCfg(ConfigFlags)).name) + result.addService(CompFactory.LArG4.EC.CalibrationCalculator(name, **kwargs), primary=True) return result def EMECNegInnerWheelCalibrationCalculatorCfg(ConfigFlags, name="EMECNegInnerWheelCalibrationCalculator", **kwargs): kwargs.setdefault("WheelType", LArWheelCalculatorEnum.InnerAbsorberWheel) kwargs.setdefault("zSide", -1) - result = EMECNegInnerWheelCorrOffCalculatorCfg(ConfigFlags) - kwargs.setdefault("GeometryCalculator",result.getService("EMECNegInnerWheelCorrOffCalculator")) - result.merge(CalibrationCalculatorCfg(name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("GeometryCalculator",result.getPrimaryAndMerge(EMECNegInnerWheelCorrOffCalculatorCfg(ConfigFlags)).name) + result.addService(CompFactory.LArG4.EC.CalibrationCalculator(name, **kwargs), primary=True) return result def EMECPosOuterWheelCalibrationCalculatorCfg(ConfigFlags, name="EMECPosOuterWheelCalibrationCalculator", **kwargs): kwargs.setdefault("WheelType", LArWheelCalculatorEnum.OuterAbsorberWheel) kwargs.setdefault("zSide", 1) - result = EMECPosOuterWheelCorrOffCalculatorCfg(ConfigFlags) - kwargs.setdefault("GeometryCalculator",result.getService("EMECPosOuterWheelCorrOffCalculator")) - result.merge(CalibrationCalculatorCfg(name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("GeometryCalculator",result.getPrimaryAndMerge(EMECPosOuterWheelCorrOffCalculatorCfg(ConfigFlags)).name) + result.addService(CompFactory.LArG4.EC.CalibrationCalculator(name, **kwargs), primary=True) return result def EMECNegOuterWheelCalibrationCalculatorCfg(ConfigFlags, name="EMECNegOuterWheelCalibrationCalculator", **kwargs): kwargs.setdefault("WheelType", LArWheelCalculatorEnum.OuterAbsorberWheel) kwargs.setdefault("zSide", -1) - result = EMECNegOuterWheelCorrOffCalculatorCfg(ConfigFlags) - kwargs.setdefault("GeometryCalculator",result.getService("EMECNegOuterWheelCorrOffCalculator")) - result.merge(CalibrationCalculatorCfg(name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("GeometryCalculator",result.getPrimaryAndMerge(EMECNegOuterWheelCorrOffCalculatorCfg(ConfigFlags)).name) + result.addService(CompFactory.LArG4.EC.CalibrationCalculator(name, **kwargs), primary=True) return result def EMECPosBackOuterBarretteCalibrationCalculatorCfg(ConfigFlags, name="EMECPosBackOuterBarretteCalibrationCalculator", **kwargs): kwargs.setdefault("WheelType", LArWheelCalculatorEnum.BackOuterBarretteWheelCalib) kwargs.setdefault("zSide", 1) - result = EMECPosBackOuterBarretteCorrOffCalculatorCfg(ConfigFlags) - kwargs.setdefault("GeometryCalculator",result.getService("EMECPosBackOuterBarretteCorrOffCalculator")) - result.merge(CalibrationCalculatorCfg(name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("GeometryCalculator",result.getPrimaryAndMerge(EMECPosBackOuterBarretteCorrOffCalculatorCfg(ConfigFlags)).name) + result.addService(CompFactory.LArG4.EC.CalibrationCalculator(name, **kwargs), primary=True) return result def EMECNegBackOuterBarretteCalibrationCalculatorCfg(ConfigFlags, name="EMECNegBackOuterBarretteCalibrationCalculator", **kwargs): kwargs.setdefault("WheelType", LArWheelCalculatorEnum.BackOuterBarretteWheelCalib) kwargs.setdefault("zSide", -1) - result = EMECNegBackOuterBarretteCorrOffCalculatorCfg(ConfigFlags) - kwargs.setdefault("GeometryCalculator",result.getService("EMECNegBackOuterBarretteCorrOffCalculator")) - result.merge(CalibrationCalculatorCfg(name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("GeometryCalculator",result.getPrimaryAndMerge(EMECNegBackOuterBarretteCorrOffCalculatorCfg(ConfigFlags)).name) + result.addService(CompFactory.LArG4.EC.CalibrationCalculator(name, **kwargs), primary=True) return result def EMECPresamplerCalibrationCalculatorCfg(ConfigFlags, name="EMECPresamplerCalibrationCalculator", **kwargs): result = ComponentAccumulator() - result.addService(CompFactory.LArG4.EC.PresamplerCalibrationCalculator(name, **kwargs)) + result.addService(CompFactory.LArG4.EC.PresamplerCalibrationCalculator(name, **kwargs), primary=True) return result def EndcapCryostatCalibrationCalculatorCfg(ConfigFlags, name="EndcapCryostatCalibrationCalculator", **kwargs): result = ComponentAccumulator() - result.addService( CompFactory.LArG4.EndcapCryostat.CalibrationCalculator(name, **kwargs) ) + result.addService( CompFactory.LArG4.EndcapCryostat.CalibrationCalculator(name, **kwargs), primary=True) return result def EndcapCryostatCalibrationLArCalculatorCfg(ConfigFlags, name="EndcapCryostatCalibrationLArCalculator", **kwargs): - result = CalibrationDefaultCalculatorCfg(ConfigFlags) - kwargs.setdefault("CalibrationDefaultCalculator", result.getService("CalibrationDefaultCalculator")) - result.addService( CompFactory.LArG4.EndcapCryostat.CalibrationLArCalculator(name, **kwargs) ) + result = ComponentAccumulator() + kwargs.setdefault("CalibrationDefaultCalculator", result.getPrimaryAndMerge(CalibrationDefaultCalculatorCfg(ConfigFlags)).name) + result.addService( CompFactory.LArG4.EndcapCryostat.CalibrationLArCalculator(name, **kwargs), primary=True) return result def EndcapCryostatCalibrationMixedCalculatorCfg(ConfigFlags, name="EndcapCryostatCalibrationMixedCalculator", **kwargs): result = ComponentAccumulator() - result.addService( CompFactory.LArG4.EndcapCryostat.CalibrationMixedCalculator(name, **kwargs) ) + result.addService( CompFactory.LArG4.EndcapCryostat.CalibrationMixedCalculator(name, **kwargs), primary=True) return result def EMECSupportCalibrationCalculatorCfg(ConfigFlags, name="EMECSupportCalibrationCalculator", **kwargs): - result = EndcapCryostatCalibrationLArCalculatorCfg(ConfigFlags) - kwargs.setdefault("BackupCalculator", result.getService("EndcapCryostatCalibrationLArCalculator")) - result.addService( CompFactory.LArG4.EMECSupportCalibrationCalculator(name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("BackupCalculator", result.getPrimaryAndMerge(EndcapCryostatCalibrationLArCalculatorCfg(ConfigFlags)).name) + result.addService( CompFactory.LArG4.EMECSupportCalibrationCalculator(name, **kwargs), primary=True) return result def EnergyCalculatorCfg(ConfigFlags, name="EnergyCalculator", **kwargs): - result = EMECSupportCalibrationCalculatorCfg(ConfigFlags) - kwargs.setdefault("SupportCalculator", result.getService("EMECSupportCalibrationCalculator")) + result = ComponentAccumulator() + kwargs.setdefault("SupportCalculator", result.getPrimaryAndMerge(EMECSupportCalibrationCalculatorCfg(ConfigFlags)).name) from AthenaCommon.SystemOfUnits import ns kwargs.setdefault("OOTcut", 300.0*ns) - result.addService(CompFactory.LArG4.EC.EnergyCalculator(name, **kwargs)) + result.addService(CompFactory.LArG4.EC.EnergyCalculator(name, **kwargs), primary=True) return result def EMECPosInnerWheelCalculatorCfg(ConfigFlags, name="EMECPosInnerWheelCalculator", **kwargs): @@ -154,11 +154,11 @@ def EMECNegBackOuterBarretteCorrOffCalculatorCfg(ConfigFlags, name="EMECNegBackO def EMECPresamplerCalculatorCfg(ConfigFlags, name="EMECPresamplerCalculator", **kwargs): result = ComponentAccumulator() - - result.addService(EMECPresamplerGeometryCfg(ConfigFlags)) - kwargs.setdefault("GeometryCalculator",result.getService("EMECPresamplerGeometry")) - result.addService(CompFactory.LArEndcapPresamplerCalculator(name, **kwargs)) + kwargs.setdefault("GeometryCalculator",result.getPrimaryAndMerge(EMECPresamplerGeometryCfg(ConfigFlags)).name) + result.addService(CompFactory.LArEndcapPresamplerCalculator(name, **kwargs), primary=True) return result def EMECPresamplerGeometryCfg(ConfigFlags, name="EMECPresamplerGeometry", **kwargs): - return CompFactory.LArG4.EC.PresamplerGeometry(name, **kwargs) + result = ComponentAccumulator() + result.addService(CompFactory.LArG4.EC.PresamplerGeometry(name, **kwargs), primary = True) + return result diff --git a/LArCalorimeter/LArG4/LArG4FCAL/python/LArG4FCALConfigNew.py b/LArCalorimeter/LArG4/LArG4FCAL/python/LArG4FCALConfigNew.py index 90f1447cf909..f91af23df6da 100644 --- a/LArCalorimeter/LArG4/LArG4FCAL/python/LArG4FCALConfigNew.py +++ b/LArCalorimeter/LArG4/LArG4FCAL/python/LArG4FCALConfigNew.py @@ -10,7 +10,7 @@ import math def FCALCalculatorBaseCfg(name="FCALCalculatorBase", **kwargs): result = ComponentAccumulator() kwargs.setdefault("OOTcut",2.5*ns) - result.addService(LArFCALCalculatorBase(name, **kwargs)) + result.addService(LArFCALCalculatorBase(name, **kwargs), primary = True) return result @@ -34,7 +34,7 @@ def FCAL1CalibCalculatorCfg(ConfigFlags, name="FCAL1CalibCalculator", **kwargs): kwargs.setdefault("FCALdeltaX",7.5*mm) kwargs.setdefault("FCALdeltaY",7.5*mm*math.sin(60*deg)) kwargs.setdefault("FCALSampling",1) - result.addService(LArG4__FCAL__LArFCALCalibCalculatorBase(name, **kwargs)) + result.addService(LArG4__FCAL__LArFCALCalibCalculatorBase(name, **kwargs), primary = True) return result @@ -43,7 +43,7 @@ def FCAL2CalibCalculatorCfg(ConfigFlags, name="FCAL2CalibCalculator", **kwargs): kwargs.setdefault("FCALdeltaX",8.179*mm) kwargs.setdefault("FCALdeltaY",8.179*mm*math.sin(60*deg)) kwargs.setdefault("FCALSampling",2) - result.addService(LArG4__FCAL__LArFCALCalibCalculatorBase(name, **kwargs)) + result.addService(LArG4__FCAL__LArFCALCalibCalculatorBase(name, **kwargs), primary = True) return result @@ -52,5 +52,5 @@ def FCAL3CalibCalculatorCfg(ConfigFlags, name="FCAL3CalibCalculator", **kwargs): kwargs.setdefault("FCALdeltaX",9.0*mm) kwargs.setdefault("FCALdeltaY",9.0*mm*math.sin(60*deg)) kwargs.setdefault("FCALSampling",3) - result.addService(LArG4__FCAL__LArFCALCalibCalculatorBase(name, **kwargs)) + result.addService(LArG4__FCAL__LArFCALCalibCalculatorBase(name, **kwargs), primary = True) return result diff --git a/LArCalorimeter/LArG4/LArG4HEC/python/LArG4HECConfigNew.py b/LArCalorimeter/LArG4/LArG4HEC/python/LArG4HECConfigNew.py index 3f1d1413ab36..a9d0b285191e 100644 --- a/LArCalorimeter/LArG4/LArG4HEC/python/LArG4HECConfigNew.py +++ b/LArCalorimeter/LArG4/LArG4HEC/python/LArG4HECConfigNew.py @@ -10,6 +10,7 @@ LArHECWheelCalculator=CompFactory.LArHECWheelCalculator LArG4__HEC__HECGeometry=CompFactory.LArG4.HEC.HECGeometry from LArG4HEC import HECGeometryType +# Not used??? def LArHECLocalCalculatorCfg(ConfigFlags, name="LArHECLocalCalculator", **kwargs): return LArHECLocalCalculator(name, **kwargs) @@ -23,15 +24,15 @@ def LocalHECGeometry(name="LocalHECGeometry", **kwargs): def HECWheelCalculatorCfg(ConfigFlags, name="HECWheelCalculator", **kwargs): - result = HECGeometryCfg(ConfigFlags) - kwargs.setdefault("GeometryCalculator", result.getService("HECGeometry")) - result.addService(LArHECWheelCalculator(name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("GeometryCalculator", result.getPrimaryAndMerge(HECGeometryCfg(ConfigFlags)).name) + result.addService(LArHECWheelCalculator(name, **kwargs), primary = True) return result def LArHECCalibrationWheelCalculatorCfg(ConfigFlags, name="LArHECCalibrationWheelCalculator", **kwargs): result = ComponentAccumulator() - result.addService( LArG4__HEC__LArHECCalibrationWheelCalculator(name, **kwargs) ) + result.addService( LArG4__HEC__LArHECCalibrationWheelCalculator(name, **kwargs), primary = True ) return result @@ -52,5 +53,5 @@ def HECCalibrationWheelDeadCalculatorCfg(ConfigFlags, name="HECCalibrationWheelD def HECGeometryCfg(ConfigFlags, name="HECGeometry", **kwargs): result = ComponentAccumulator() - result.addService(LArG4__HEC__HECGeometry(name, **kwargs)) + result.addService(LArG4__HEC__HECGeometry(name, **kwargs), primary = True) return result diff --git a/LArCalorimeter/LArG4/LArG4MiniFCAL/python/LArG4MiniFCALConfigNew.py b/LArCalorimeter/LArG4/LArG4MiniFCAL/python/LArG4MiniFCALConfigNew.py index 61f9a05b58b6..55b89ae38f9f 100644 --- a/LArCalorimeter/LArG4/LArG4MiniFCAL/python/LArG4MiniFCALConfigNew.py +++ b/LArCalorimeter/LArG4/LArG4MiniFCAL/python/LArG4MiniFCALConfigNew.py @@ -7,7 +7,7 @@ LArG4__MiniFCAL__MiniFCALCalibrationCalculator=CompFactory.LArG4.MiniFCAL.MiniFC def MiniFCALCalibrationCalculatorCfg(ConfigFlags, name="MiniFCALCalibrationCalculator", **kwargs): result = ComponentAccumulator() - result.addService(LArG4__MiniFCAL__MiniFCALCalibrationCalculator(name, **kwargs)) + result.addService(LArG4__MiniFCAL__MiniFCALCalibrationCalculator(name, **kwargs), primary = True) return result def MiniFCALActiveCalibrationCalculatorCfg(ConfigFlags, name="MiniFCALActiveCalibrationCalculator", **kwargs): diff --git a/LArCalorimeter/LArG4/LArG4SD/python/LArG4SDToolConfig.py b/LArCalorimeter/LArG4/LArG4SD/python/LArG4SDToolConfig.py index a3b269b6f06d..6b5e98550256 100644 --- a/LArCalorimeter/LArG4/LArG4SD/python/LArG4SDToolConfig.py +++ b/LArCalorimeter/LArG4/LArG4SD/python/LArG4SDToolConfig.py @@ -43,57 +43,47 @@ def LArActiveSensitiveDetectorToolCfg(ConfigFlags, name="LArActiveSensitiveDetec kwargs.setdefault("OutputCollectionNames", ["LArCalibrationHitActive"]) from LArG4Barrel.LArG4BarrelConfigNew import BarrelCalibrationCalculatorCfg, BarrelPresamplerCalibrationCalculatorCfg - - result.merge( BarrelPresamplerCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMBPSCalibrationCalculator", result.getService("BarrelPresamplerCalibrationCalculator")) - result.merge( BarrelCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMBCalibrationCalculator", result.getService("BarrelCalibrationCalculator")) + kwargs.setdefault("EMBPSCalibrationCalculator", + result.getPrimaryAndMerge(BarrelPresamplerCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMBCalibrationCalculator", + result.getPrimaryAndMerge(BarrelCalibrationCalculatorCfg(ConfigFlags)).name) from LArG4EC.LArG4ECConfigNew import EMECPosInnerWheelCalibrationCalculatorCfg, EMECNegInnerWheelCalibrationCalculatorCfg, EMECPosOuterWheelCalibrationCalculatorCfg, EMECNegOuterWheelCalibrationCalculatorCfg, EMECPosBackOuterBarretteCalibrationCalculatorCfg, EMECNegBackOuterBarretteCalibrationCalculatorCfg, EMECPresamplerCalibrationCalculatorCfg - - result.merge( EMECPosInnerWheelCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECPosIWCalibrationCalculator",result.getService("EMECPosInnerWheelCalibrationCalculator")) - - result.merge( EMECNegInnerWheelCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECNegIWCalibrationCalculator",result.getService("EMECNegInnerWheelCalibrationCalculator")) - - result.merge( EMECPosOuterWheelCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECPosOWCalibrationCalculator",result.getService("EMECPosOuterWheelCalibrationCalculator")) - - result.merge( EMECNegOuterWheelCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECNegOWCalibrationCalculator",result.getService("EMECNegOuterWheelCalibrationCalculator")) - - result.merge (EMECPresamplerCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECPSCalibrationCalculator",result.getService("EMECPresamplerCalibrationCalculator")) - - result.merge( EMECPosBackOuterBarretteCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECPosBOBCalibrationCalculator",result.getService("EMECPosBackOuterBarretteCalibrationCalculator")) - result.merge( EMECNegBackOuterBarretteCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECNegBOBCalibrationCalculator",result.getService("EMECNegBackOuterBarretteCalibrationCalculator")) + kwargs.setdefault("EMECPosIWCalibrationCalculator", + result.getPrimaryAndMerge(EMECPosInnerWheelCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECNegIWCalibrationCalculator", + result.getPrimaryAndMerge(EMECNegInnerWheelCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECPosOWCalibrationCalculator", + result.getPrimaryAndMerge(EMECPosOuterWheelCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECNegOWCalibrationCalculator", + result.getPrimaryAndMerge(EMECNegOuterWheelCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECPSCalibrationCalculator", + result.getPrimaryAndMerge(EMECPresamplerCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECPosBOBCalibrationCalculator", + result.getPrimaryAndMerge(EMECPosBackOuterBarretteCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECNegBOBCalibrationCalculator", + result.getPrimaryAndMerge(EMECNegBackOuterBarretteCalibrationCalculatorCfg(ConfigFlags)).name) from LArG4HEC.LArG4HECConfigNew import HECCalibrationWheelActiveCalculatorCfg - result.merge( HECCalibrationWheelActiveCalculatorCfg(ConfigFlags)) - kwargs.setdefault("HECWActiveCalculator",result.getService("HECCalibrationWheelActiveCalculator")) + kwargs.setdefault("HECWActiveCalculator", + result.getPrimaryAndMerge(HECCalibrationWheelActiveCalculatorCfg(ConfigFlags)).name) from LArG4FCAL.LArG4FCALConfigNew import FCAL1CalibCalculatorCfg, FCAL2CalibCalculatorCfg, FCAL3CalibCalculatorCfg - - result.merge(FCAL1CalibCalculatorCfg(ConfigFlags)) - kwargs.setdefault("FCAL1CalibCalculator", result.getService("FCAL1CalibCalculator") ) - - result.merge(FCAL2CalibCalculatorCfg(ConfigFlags)) - kwargs.setdefault("FCAL2CalibCalculator", result.getService("FCAL2CalibCalculator") ) - - result.merge(FCAL3CalibCalculatorCfg(ConfigFlags)) - kwargs.setdefault("FCAL3CalibCalculator", result.getService("FCAL3CalibCalculator") ) - + kwargs.setdefault("FCAL1CalibCalculator", + result.getPrimaryAndMerge(FCAL1CalibCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("FCAL2CalibCalculator", + result.getPrimaryAndMerge(FCAL2CalibCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("FCAL3CalibCalculator", + result.getPrimaryAndMerge(FCAL3CalibCalculatorCfg(ConfigFlags)).name) from LArG4MiniFCAL.LArG4MiniFCALConfigNew import MiniFCALActiveCalibrationCalculatorCfg - result.merge ( MiniFCALActiveCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("MiniFCALActiveCalibrationCalculator", result.getService("MiniFCALActiveCalibrationCalculator")) + kwargs.setdefault("MiniFCALActiveCalibrationCalculator", + result.getPrimaryAndMerge (MiniFCALActiveCalibrationCalculatorCfg(ConfigFlags)).name) result.setPrivateTools( LArG4__ActiveSDTool(name, **kwargs)) return result + def LArDeadSensitiveDetectorToolCfg(ConfigFlags, name="LArDeadSensitiveDetector", **kwargs): ## Main configuration kwargs.setdefault("BarrelCryVolumes", ["LArMgr::LAr::Barrel::Cryostat::InnerWall::Vis", @@ -183,44 +173,30 @@ def LArDeadSensitiveDetectorToolCfg(ConfigFlags, name="LArDeadSensitiveDetector" outputCollectionName = "LArCalibrationHitDeadMaterial_DEAD" kwargs.setdefault("HitCollectionName", outputCollectionName) + result = ComponentAccumulator() + from LArG4Barrel.LArG4BarrelConfigNew import BarrelCryostatCalibrationCalculatorCfg, BarrelCryostatCalibrationLArCalculatorCfg, BarrelCryostatCalibrationMixedCalculatorCfg, DMCalibrationCalculatorCfg, BarrelCalibrationCalculatorCfg, BarrelPresamplerCalibrationCalculatorCfg + kwargs.setdefault("EMBCryoCalibrationCalculator", result.getPrimaryAndMerge(BarrelCryostatCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMBCryoLArCalibrationCalculator", result.getPrimaryAndMerge(BarrelCryostatCalibrationLArCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("DefaultCalibrationCalculator", result.getPrimaryAndMerge(CalibrationDefaultCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMBCryoMixCalibrationCalculator", result.getPrimaryAndMerge(BarrelCryostatCalibrationMixedCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("DMCalibrationCalculator", result.getPrimaryAndMerge(DMCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMBPSCalibrationCalculator", result.getPrimaryAndMerge(BarrelPresamplerCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMBCalibrationCalculator", result.getPrimaryAndMerge(BarrelCalibrationCalculatorCfg(ConfigFlags)).name) from LArG4EC.LArG4ECConfigNew import EndcapCryostatCalibrationCalculatorCfg, EndcapCryostatCalibrationLArCalculatorCfg, EndcapCryostatCalibrationMixedCalculatorCfg, EMECSupportCalibrationCalculatorCfg + kwargs.setdefault("ECCryoCalibrationCalculator", result.getPrimaryAndMerge(EndcapCryostatCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("ECCryoLArCalibrationCalculator", result.getPrimaryAndMerge(EndcapCryostatCalibrationLArCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("ECCryoMixCalibrationCalculator", result.getPrimaryAndMerge(EndcapCryostatCalibrationMixedCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECSuppCalibrationCalculator", result.getPrimaryAndMerge(EMECSupportCalibrationCalculatorCfg(ConfigFlags)).name) from LArG4HEC.LArG4HECConfigNew import HECCalibrationWheelDeadCalculatorCfg - - result = ComponentAccumulator() - - result.merge( BarrelCryostatCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMBCryoCalibrationCalculator", result.getService("BarrelCryostatCalibrationCalculator")) - result.merge( BarrelCryostatCalibrationLArCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMBCryoLArCalibrationCalculator", result.getService("BarrelCryostatCalibrationLArCalculator")) - result.merge( CalibrationDefaultCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("DefaultCalibrationCalculator", result.getService("CalibrationDefaultCalculator")) - result.merge( BarrelCryostatCalibrationMixedCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMBCryoMixCalibrationCalculator", result.getService("BarrelCryostatCalibrationMixedCalculator")) - result.merge( DMCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("DMCalibrationCalculator", result.getService("DMCalibrationCalculator")) - result.merge( BarrelPresamplerCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMBPSCalibrationCalculator", result.getService("BarrelPresamplerCalibrationCalculator")) - result.merge( BarrelCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMBCalibrationCalculator", result.getService("BarrelCalibrationCalculator")) - - result.merge( EndcapCryostatCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("ECCryoCalibrationCalculator", result.getService("EndcapCryostatCalibrationCalculator")) - result.merge( EndcapCryostatCalibrationLArCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("ECCryoLArCalibrationCalculator", result.getService("EndcapCryostatCalibrationLArCalculator")) - result.merge( EndcapCryostatCalibrationMixedCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("ECCryoMixCalibrationCalculator", result.getService("EndcapCryostatCalibrationMixedCalculator")) - result.merge( EMECSupportCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECSuppCalibrationCalculator", result.getService("EMECSupportCalibrationCalculator")) - - result.merge( HECCalibrationWheelDeadCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("HECWheelDeadCalculator", result.getService("HECCalibrationWheelDeadCalculator")) + kwargs.setdefault("HECWheelDeadCalculator", result.getPrimaryAndMerge(HECCalibrationWheelDeadCalculatorCfg(ConfigFlags)).name) result.setPrivateTools(LArG4__DeadSDTool(name, **kwargs)) return result + def LArEMBSensitiveDetectorCfg(ConfigFlags,name="LArEMBSensitiveDetector", **kwargs): result = ComponentAccumulator() bare_collection_name = "LArHitEMB" @@ -243,15 +219,13 @@ def LArEMBSensitiveDetectorCfg(ConfigFlags,name="LArEMBSensitiveDetector", **kwa kwargs.setdefault("UseFrozenShowers", ConfigFlags.Sim.LArParameterization > 0) from LArG4Barrel.LArG4BarrelConfigNew import EMBPresamplerCalculatorCfg, EMBCalculatorCfg - result.merge(EMBPresamplerCalculatorCfg(ConfigFlags)) - kwargs.setdefault("EMBPSCalculator", result.getService("EMBPresamplerCalculator") ) - - result.merge(EMBCalculatorCfg(ConfigFlags)) - kwargs.setdefault("EMBCalculator", result.getService("EMBCalculator")) + kwargs.setdefault("EMBPSCalculator", result.getPrimaryAndMerge(EMBPresamplerCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMBCalculator", result.getPrimaryAndMerge(EMBCalculatorCfg(ConfigFlags)).name) result.setPrivateTools( LArG4__EMBSDTool(name, **kwargs) ) return result + def LArEMECSensitiveDetectorCfg(ConfigFlags, name="LArEMECSensitiveDetector", **kwargs): result = ComponentAccumulator() bare_collection_name = "LArHitEMEC" @@ -280,31 +254,18 @@ def LArEMECSensitiveDetectorCfg(ConfigFlags, name="LArEMECSensitiveDetector", ** kwargs.setdefault("UseFrozenShowers", ConfigFlags.Sim.LArParameterization > 0) from LArG4EC.LArG4ECConfigNew import EMECPosInnerWheelCalculatorCfg, EMECNegInnerWheelCalculatorCfg, EMECPosOuterWheelCalculatorCfg, EMECNegOuterWheelCalculatorCfg, EMECPresamplerCalculatorCfg, EMECPosBackOuterBarretteCalculatorCfg, EMECNegBackOuterBarretteCalculatorCfg - - result.merge(EMECPosInnerWheelCalculatorCfg(ConfigFlags)) - kwargs.setdefault("EMECPosIWCalculator",result.getService("EMECPosInnerWheelCalculator") ) - - result.merge(EMECNegInnerWheelCalculatorCfg(ConfigFlags)) - kwargs.setdefault("EMECNegIWCalculator",result.getService("EMECNegInnerWheelCalculator") ) - - result.merge(EMECPosOuterWheelCalculatorCfg(ConfigFlags)) - kwargs.setdefault("EMECPosOWCalculator",result.getService("EMECPosOuterWheelCalculator") ) - - result.merge(EMECNegOuterWheelCalculatorCfg(ConfigFlags)) - kwargs.setdefault("EMECNegOWCalculator",result.getService("EMECNegOuterWheelCalculator") ) - - result.merge(EMECPresamplerCalculatorCfg(ConfigFlags)) - kwargs.setdefault("EMECPSCalculator",result.getService("EMECPresamplerCalculator") ) - - result.merge(EMECPosBackOuterBarretteCalculatorCfg(ConfigFlags)) - kwargs.setdefault("EMECPosBOBCalculator",result.getService("EMECPosBackOuterBarretteCalculator") ) - - result.merge(EMECNegBackOuterBarretteCalculatorCfg(ConfigFlags)) - kwargs.setdefault("EMECNegBOBCalculator",result.getService("EMECNegBackOuterBarretteCalculator") ) + kwargs.setdefault("EMECPosIWCalculator", result.getPrimaryAndMerge(EMECPosInnerWheelCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECNegIWCalculator", result.getPrimaryAndMerge(EMECNegInnerWheelCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECPosOWCalculator", result.getPrimaryAndMerge(EMECPosOuterWheelCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECNegOWCalculator", result.getPrimaryAndMerge(EMECNegOuterWheelCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECPSCalculator", result.getPrimaryAndMerge(EMECPresamplerCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECPosBOBCalculator", result.getPrimaryAndMerge(EMECPosBackOuterBarretteCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECNegBOBCalculator", result.getPrimaryAndMerge(EMECNegBackOuterBarretteCalculatorCfg(ConfigFlags)).name) result.setPrivateTools( LArG4__EMECSDTool(name, **kwargs) ) return result + def LArFCALSensitiveDetectorCfg(ConfigFlags, name="LArFCALSensitiveDetector", **kwargs): result = ComponentAccumulator() bare_collection_name = "LArHitFCAL" @@ -328,19 +289,14 @@ def LArFCALSensitiveDetectorCfg(ConfigFlags, name="LArFCALSensitiveDetector", ** kwargs.setdefault("UseFrozenShowers", ConfigFlags.Sim.LArParameterization > 0) from LArG4FCAL.LArG4FCALConfigNew import FCAL1CalculatorCfg, FCAL2CalculatorCfg, FCAL3CalculatorCfg - - result.merge(FCAL1CalculatorCfg(ConfigFlags)) - kwargs.setdefault("FCAL1Calculator", result.getService("FCAL1Calculator") ) - - result.merge(FCAL2CalculatorCfg(ConfigFlags)) - kwargs.setdefault("FCAL2Calculator", result.getService("FCAL2Calculator") ) - - result.merge(FCAL3CalculatorCfg(ConfigFlags)) - kwargs.setdefault("FCAL3Calculator", result.getService("FCAL3Calculator") ) + kwargs.setdefault("FCAL1Calculator", result.getPrimaryAndMerge(FCAL1CalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("FCAL2Calculator", result.getPrimaryAndMerge(FCAL2CalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("FCAL3Calculator", result.getPrimaryAndMerge(FCAL3CalculatorCfg(ConfigFlags)).name) result.setPrivateTools( LArG4__FCALSDTool(name, **kwargs) ) return result + def LArHECSensitiveDetectorCfg(ConfigFlags, name="LArHECSensitiveDetector", **kwargs): result = ComponentAccumulator() bare_collection_name = "LArHitHEC" @@ -362,12 +318,12 @@ def LArHECSensitiveDetectorCfg(ConfigFlags, name="LArHECSensitiveDetector", **kw kwargs.setdefault("OutputCollectionNames", [hits_collection_name]) from LArG4HEC.LArG4HECConfigNew import HECWheelCalculatorCfg - result.merge(HECWheelCalculatorCfg(ConfigFlags)) - kwargs.setdefault("HECWheelCalculator", result.getService("HECWheelCalculator")) + kwargs.setdefault("HECWheelCalculator", result.getPrimaryAndMerge(HECWheelCalculatorCfg(ConfigFlags)).name) result.setPrivateTools( LArG4__HECSDTool(name, **kwargs) ) return result + def LArInactiveSensitiveDetectorToolCfg(ConfigFlags, name="LArInactiveSensitiveDetector", **kwargs): result = ComponentAccumulator() ## Main configuration @@ -460,51 +416,30 @@ def LArInactiveSensitiveDetectorToolCfg(ConfigFlags, name="LArInactiveSensitiveD kwargs.setdefault("OutputCollectionNames", ["LArCalibrationHitInactive"]) from LArG4Barrel.LArG4BarrelConfigNew import BarrelCalibrationCalculatorCfg, BarrelPresamplerCalibrationCalculatorCfg - - result.merge( BarrelPresamplerCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMBPSCalibrationCalculator", result.getService("BarrelPresamplerCalibrationCalculator")) - result.merge( BarrelCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMBCalibrationCalculator", result.getService("BarrelCalibrationCalculator")) + kwargs.setdefault("EMBPSCalibrationCalculator", result.getPrimaryAndMerge(BarrelPresamplerCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMBCalibrationCalculator", result.getPrimaryAndMerge(BarrelCalibrationCalculatorCfg(ConfigFlags)).name) from LArG4EC.LArG4ECConfigNew import EMECPosInnerWheelCalibrationCalculatorCfg, EMECNegInnerWheelCalibrationCalculatorCfg, EMECPosOuterWheelCalibrationCalculatorCfg, EMECNegOuterWheelCalibrationCalculatorCfg - - result.merge( EMECPosInnerWheelCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECPosIWCalibrationCalculator",result.getService("EMECPosInnerWheelCalibrationCalculator")) - - result.merge( EMECNegInnerWheelCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECNegIWCalibrationCalculator",result.getService("EMECNegInnerWheelCalibrationCalculator")) - - result.merge( EMECPosOuterWheelCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECPosOWCalibrationCalculator",result.getService("EMECPosOuterWheelCalibrationCalculator")) - - result.merge( EMECNegOuterWheelCalibrationCalculatorCfg(ConfigFlags) ) - kwargs.setdefault("EMECNegOWCalibrationCalculator",result.getService("EMECNegOuterWheelCalibrationCalculator")) - + kwargs.setdefault("EMECPosIWCalibrationCalculator", result.getPrimaryAndMerge(EMECPosInnerWheelCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECNegIWCalibrationCalculator", result.getPrimaryAndMerge(EMECNegInnerWheelCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECPosOWCalibrationCalculator", result.getPrimaryAndMerge(EMECPosOuterWheelCalibrationCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("EMECNegOWCalibrationCalculator", result.getPrimaryAndMerge(EMECNegOuterWheelCalibrationCalculatorCfg(ConfigFlags)).name) from LArG4HEC.LArG4HECConfigNew import HECCalibrationWheelInactiveCalculatorCfg - result.merge( HECCalibrationWheelInactiveCalculatorCfg(ConfigFlags)) - kwargs.setdefault("HECWheelInactiveCalculator",result.getService("HECCalibrationWheelInactiveCalculator")) + kwargs.setdefault("HECWheelInactiveCalculator", result.getPrimaryAndMerge(HECCalibrationWheelInactiveCalculatorCfg(ConfigFlags)).name) from LArG4FCAL.LArG4FCALConfigNew import FCAL1CalibCalculatorCfg, FCAL2CalibCalculatorCfg, FCAL3CalibCalculatorCfg - - result.merge(FCAL1CalibCalculatorCfg(ConfigFlags)) - kwargs.setdefault("FCAL1CalibCalculator", result.getService("FCAL1CalibCalculator") ) - - result.merge(FCAL2CalibCalculatorCfg(ConfigFlags)) - kwargs.setdefault("FCAL2CalibCalculator", result.getService("FCAL2CalibCalculator") ) - - result.merge(FCAL3CalibCalculatorCfg(ConfigFlags)) - kwargs.setdefault("FCAL3CalibCalculator", result.getService("FCAL3CalibCalculator") ) + kwargs.setdefault("FCAL1CalibCalculator", result.getPrimaryAndMerge(FCAL1CalibCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("FCAL2CalibCalculator", result.getPrimaryAndMerge(FCAL2CalibCalculatorCfg(ConfigFlags)).name) + kwargs.setdefault("FCAL3CalibCalculator", result.getPrimaryAndMerge(FCAL3CalibCalculatorCfg(ConfigFlags)).name) from LArG4MiniFCAL.LArG4MiniFCALConfigNew import MiniFCALInactiveCalibrationCalculatorCfg - result.merge(MiniFCALInactiveCalibrationCalculatorCfg(ConfigFlags)) - kwargs.setdefault("MiniFCALInactiveCalibrationCalculator", result.getService("MiniFCALInactiveCalibrationCalculator")) - - + kwargs.setdefault("MiniFCALInactiveCalibrationCalculator", result.getPrimaryAndMerge(MiniFCALInactiveCalibrationCalculatorCfg(ConfigFlags)).name) result.setPrivateTools( LArG4__InactiveSDTool(name, **kwargs) ) return result + def LArMiniFCALSensitiveDetectorToolCfg(ConfigFlags, name="LArMiniFCALSensitiveDetector", **kwargs): result = ComponentAccumulator() kwargs.setdefault("MiniVolumes",["LArMgr::MiniFCAL::Wafer"]) @@ -517,7 +452,7 @@ def LArMiniFCALSensitiveDetectorToolCfg(ConfigFlags, name="LArMiniFCALSensitiveD def CalibrationDefaultCalculatorCfg(ConfigFlags, name="CalibrationDefaultCalculator", **kwargs): result = ComponentAccumulator() - result.addService( LArG4__CalibrationDefaultCalculator(name, **kwargs) ) + result.addService( LArG4__CalibrationDefaultCalculator(name, **kwargs), primary = True) return result #todo -> migrate this diff --git a/Simulation/FastShower/FastCaloSim/python/FastCaloSimFactoryNew.py b/Simulation/FastShower/FastCaloSim/python/FastCaloSimFactoryNew.py index 22271bdf891c..eb39e8da378f 100644 --- a/Simulation/FastShower/FastCaloSim/python/FastCaloSimFactoryNew.py +++ b/Simulation/FastShower/FastCaloSim/python/FastCaloSimFactoryNew.py @@ -47,7 +47,7 @@ def AtlasNavigatorCfg(flags, name="AtlasNavigator", **kwargs): if 'TrackingGeometrySvc' not in kwargs: from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg acc = TrackingGeometrySvcCfg(flags) - kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary()) + kwargs.setdefault("TrackingGeometrySvc", acc.getPrimary().name) kwargs.setdefault("TrackingGeometryKey", '') result.merge(acc) else: diff --git a/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigNew.py b/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigNew.py index 00443eabba8e..4d620cf8a2aa 100644 --- a/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigNew.py +++ b/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigNew.py @@ -6,14 +6,15 @@ from G4AtlasTools.G4AtlasToolsConfigNew import SensitiveDetectorMasterToolCfg, F from G4AtlasServices.G4AtlasUserActionConfigNew import UserActionSvcCfg from G4AtlasApps.G4Atlas_MetadataNew import writeSimulationParametersMetadata from AthenaConfiguration.ComponentFactory import CompFactory +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg def G4AtlasAlgBasicCfg(ConfigFlags, name="G4AtlasAlg", **kwargs): """Return ComponentAccumulator configured for Atlas G4 simulation, without output""" # wihout output - result = DetectorGeometrySvcCfg(ConfigFlags) - kwargs.setdefault("DetGeoSvc", result.getService("DetectorGeometrySvc")) + result = ComponentAccumulator() + kwargs.setdefault("DetGeoSvc", result.getPrimaryAndMerge(DetectorGeometrySvcCfg(ConfigFlags)).name) kwargs.setdefault("InputTruthCollection", "BeamTruthEvent") #tocheck -are these string inputs? kwargs.setdefault("OutputTruthCollection", "TruthEvent") @@ -46,21 +47,11 @@ def G4AtlasAlgBasicCfg(ConfigFlags, name="G4AtlasAlg", **kwargs): is_hive = ConfigFlags.Concurrency.NumThreads > 0 kwargs.setdefault("MultiThreading", is_hive) - - accMCTruth = TruthServiceCfg(ConfigFlags) - truthSvcName = accMCTruth.getPrimary().getName() - result.merge(accMCTruth) - kwargs.setdefault("TruthRecordService", result.getService(truthSvcName)) - #kwargs.setdefault("TruthRecordService", ConfigFlags.Sim.TruthStrategy) # TODO need to have manual override (simFlags.TruthStrategy.TruthServiceName()) - - accGeoID = GeoIDSvcCfg(ConfigFlags) - result.merge(accGeoID) - kwargs.setdefault("GeoIDSvc", result.getService("ISF_GeoIDSvc")) + kwargs.setdefault("TruthRecordService", result.getPrimaryAndMerge(TruthServiceCfg(ConfigFlags)).name) + kwargs.setdefault("GeoIDSvc", result.getPrimaryAndMerge(GeoIDSvcCfg(ConfigFlags)).name) #input converter - accInputConverter = InputConverterCfg(ConfigFlags) - result.merge(accInputConverter) - kwargs.setdefault("InputConverter", result.getService("ISF_InputConverter")) + kwargs.setdefault("InputConverter", result.getPrimaryAndMerge(InputConverterCfg(ConfigFlags)).name) #sensitive detector master tool SensitiveDetector = result.popToolsAndMerge(SensitiveDetectorMasterToolCfg(ConfigFlags)) @@ -76,12 +67,10 @@ def G4AtlasAlgBasicCfg(ConfigFlags, name="G4AtlasAlg", **kwargs): result.merge(writeSimulationParametersMetadata(ConfigFlags)) #User action services (Slow...) - result.merge( UserActionSvcCfg(ConfigFlags) ) - kwargs.setdefault("UserActionSvc", result.getService( "G4UA::UserActionSvc") ) + kwargs.setdefault("UserActionSvc", result.getPrimaryAndMerge(UserActionSvcCfg(ConfigFlags)).name) #PhysicsListSvc - result.merge( PhysicsListSvcCfg(ConfigFlags) ) - kwargs.setdefault("PhysicsListSvc", result.getService( "PhysicsListSvc") ) + kwargs.setdefault("PhysicsListSvc", result.getPrimaryAndMerge(PhysicsListSvcCfg(ConfigFlags)).name) ## G4AtlasAlg verbosities (available domains = Navigator, Propagator, Tracking, Stepping, Stacking, Event) ## Set stepper verbose = 1 if the Athena logging level is <= DEBUG diff --git a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasFieldServices.py b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasFieldServices.py index b091f349ad9d..9b6ee85712f5 100644 --- a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasFieldServices.py +++ b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasFieldServices.py @@ -8,187 +8,243 @@ import os if "AthSimulation_DIR" not in os.environ: MagField__ForwardRegionFieldSvc=CompFactory.MagField.ForwardRegionFieldSvc + def StandardFieldSvcCfg(ConfigFlags,name="StandardField", **kwargs): result = ComponentAccumulator() - - result.addService(StandardFieldSvc(name, **kwargs)) + result.addService(StandardFieldSvc(name, **kwargs), primary = True) return result + def ForwardFieldSvcCfg(ConfigFlags, name="ForwardField", **kwargs): result = ComponentAccumulator() - # #FIXME Once it exists this version should use the new MagField Service defined in ForwardRegionMgField # kwargs.setdefault("MagneticFieldSvc", result.getService("AtlasFieldSvc")) # #kwargs.setdefault("FieldOn", True) kwargs.setdefault("UseMagFieldSvc", True) - result.addService(StandardFieldSvc(name, **kwargs)) + result.addService(StandardFieldSvc(name, **kwargs), primary = True) return result + def Q1FwdG4FieldSvcCfg(ConfigFlags, name='Q1FwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - - result.addService( MagField__ForwardRegionFieldSvc("Q1", + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q1", Magnet = 0, # FIXME find a better way to do this. - MQXA_DataFile = "MQXA_NOMINAL.dat")) + MQXA_DataFile = "MQXA_NOMINAL.dat"), primary = True) - kwargs.setdefault("MagneticFieldSvc", result.getService("Q1")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q2FwdG4FieldSvcCfg(ConfigFlags, name='Q2FwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - - result.addService( MagField__ForwardRegionFieldSvc("Q2", + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q2", Magnet = 1, # FIXME find a better way to do this. - MQXA_DataFile = "MQXA_NOMINAL.dat")) - kwargs.setdefault("MagneticFieldSvc", result.getService("Q2")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + MQXA_DataFile = "MQXA_NOMINAL.dat"), primary = True) + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q3FwdG4FieldSvcCfg(ConfigFlags, name='Q3FwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - - result.addService( MagField__ForwardRegionFieldSvc("Q3", + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q3", Magnet = 2, # FIXME find a better way to do this. - MQXA_DataFile = "MQXA_NOMINAL.dat")) - kwargs.setdefault("MagneticFieldSvc", result.getService("Q3")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + MQXA_DataFile = "MQXA_NOMINAL.dat"), primary = True) + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def D1FwdG4FieldSvcCfg(ConfigFlags, name='D1FwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("D1", - Magnet = 3))# FIXME find a better way to do this. + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("D1", + Magnet = 3), primary = True)# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("D1")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def D2FwdG4FieldSvcCfg(ConfigFlags, name='D2FwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - - result.addService( MagField__ForwardRegionFieldSvc("D2", - Magnet = 4))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("D2")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("D2", + Magnet = 4), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q4FwdG4FieldSvcCfg(ConfigFlags, name='Q4FwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q4", - Magnet = 5))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q4")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q4", + Magnet = 5), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q5FwdG4FieldSvcCfg(ConfigFlags, name='Q5FwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q5", - Magnet = 6))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q5")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q5", + Magnet = 6), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q6FwdG4FieldSvcCfg(ConfigFlags, name='Q6FwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q6", - Magnet = 7))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q6")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q6", + Magnet = 7), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q7FwdG4FieldSvcCfg(ConfigFlags, name='Q7FwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q7", - Magnet = 8))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q7")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q7", + Magnet = 8), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q1HKickFwdG4FieldSvcCfg(ConfigFlags, name='Q1HKickFwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q1HKick", - Magnet = 9))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q1HKick")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q1HKick", + Magnet = 9), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q1VKickFwdG4FieldSvcCfg(ConfigFlags, name='Q1VKickFwdG4FieldSvc', **kwargs): #note is lower case "v" in ForwardRegionMgFieldConfig.py result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q1VKick", - Magnet = 10))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q1VKick")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q1VKick", + Magnet = 10), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q2HKickFwdG4FieldSvcCfg(ConfigFlags, name='Q2HKickFwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q2HKick", - Magnet = 11))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q2HKick")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q2HKick", + Magnet = 11), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q2VKickFwdG4FieldSvcCfg(ConfigFlags, name='Q2VKickFwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q2VKick", - Magnet = 12))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q2VKick")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q2VKick", + Magnet = 12), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q3HKickFwdG4FieldSvcCfg(ConfigFlags, name='Q3HKickFwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q3HKick", - Magnet = 13))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q3HKick")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q3HKick", + Magnet = 13), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q3VKickFwdG4FieldSvcCfg(ConfigFlags, name='Q3VKickFwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q3VKick", - Magnet = 14))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q3VKick")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q3VKick", + Magnet = 14), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q4VKickAFwdG4FieldSvcCfg(ConfigFlags, name='Q4VKickAFwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q4VKickA", - Magnet = 15))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q4VKickA")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q4VKickA", + Magnet = 15), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q4HKickFwdG4FieldSvcCfg(ConfigFlags, name='Q4HKickFwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q4HKick", - Magnet = 16))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q4HKick")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q4HKick", + Magnet = 16), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q4VKickBFwdG4FieldSvcCfg(ConfigFlags, name='Q4VKickBFwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q4VKickB", - Magnet = 17))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q4VKickB")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q4VKickB", + Magnet = 17), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q5HKickFwdG4FieldSvcCfg(ConfigFlags, name='Q5HKickFwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q5HKick", - Magnet = 18))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q5HKick")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q5HKick", + Magnet = 18), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result + def Q6VKickFwdG4FieldSvcCfg(ConfigFlags, name='Q6VKickFwdG4FieldSvc', **kwargs): result = ComponentAccumulator() - result.addService( MagField__ForwardRegionFieldSvc("Q6VKick", - Magnet = 19))# FIXME find a better way to do this. - kwargs.setdefault("MagneticFieldSvc", result.getService("Q6VKick")) - result.merge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + fieldAcc = ComponentAccumulator() + fieldAcc.addService(MagField__ForwardRegionFieldSvc("Q6VKick", + Magnet = 19), primary = True)# FIXME find a better way to do this. + kwargs.setdefault("MagneticFieldSvc", result.getPrimaryAndMerge(fieldAcc).name) + fieldSvc = result.getPrimaryAndMerge(ForwardFieldSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(fieldSvc, primary = True) return result diff --git a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfigNew.py b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfigNew.py index 1afb52cade10..295747ddc04d 100644 --- a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfigNew.py +++ b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfigNew.py @@ -1,9 +1,7 @@ # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration -from __future__ import print_function from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -DetectorGeometrySvc, G4AtlasSvc, G4GeometryNotifierSvc, PhysicsListSvc=CompFactory.getComps("DetectorGeometrySvc","G4AtlasSvc","G4GeometryNotifierSvc","PhysicsListSvc",) from G4AtlasTools.G4GeometryToolConfig import G4AtlasDetectorConstructionToolCfg from G4StepLimitation.G4StepLimitationConfigNew import G4StepLimitationToolCfg from ExtraParticles.ExtraParticlesConfigNew import ExtraParticlesPhysicsToolCfg @@ -16,26 +14,10 @@ def DetectorGeometrySvcCfg(ConfigFlags, name="DetectorGeometrySvc", **kwargs): result.addPublicTool(detConstTool) kwargs.setdefault("DetectorConstruction", result.getPublicTool(detConstTool.name)) - result.addService(DetectorGeometrySvc(name, **kwargs)) + result.addService(CompFactory.DetectorGeometrySvc(name, **kwargs), primary = True) return result -def G4AtlasSvcCfg(ConfigFlags, name="G4AtlasSvc", **kwargs): - if ConfigFlags.Concurrency.NumThreads > 0: - is_hive = True - else: - is_hive = False - kwargs.setdefault("isMT", is_hive) - kwargs.setdefault("DetectorGeometrySvc", 'DetectorGeometrySvc') - return G4AtlasSvc(name, **kwargs) - - -def G4GeometryNotifierSvcCfg(ConfigFlags, name="G4GeometryNotifierSvc", **kwargs): - kwargs.setdefault("ActivateLVNotifier", True) - kwargs.setdefault("ActivatePVNotifier", False) - return G4GeometryNotifierSvc(name, **kwargs) - - def PhysicsListSvcCfg(ConfigFlags, name="PhysicsListSvc", **kwargs): result = ComponentAccumulator() PhysOptionList = [ result.popToolsAndMerge(G4StepLimitationToolCfg(ConfigFlags)) ] @@ -71,5 +53,5 @@ def PhysicsListSvcCfg(ConfigFlags, name="PhysicsListSvc", **kwargs): """ ## kwargs.setdefault("EMDEDXBinning" , 77) ## kwargs.setdefault("EMLambdaBinning" , 77) - result.addService(PhysicsListSvc(name, **kwargs)) + result.addService(CompFactory.PhysicsListSvc(name, **kwargs), primary = True) return result diff --git a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfigNew.py b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfigNew.py index 2936cc8c8d95..1d8753513642 100644 --- a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfigNew.py +++ b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfigNew.py @@ -50,8 +50,7 @@ def FullG4TrackProcessorUserActionToolCfg(flags, name="FullG4TrackProcessorUserA tool = result.popToolsAndMerge(EntryLayerToolCfg(flags)) result.addPublicTool(tool) kwargs.setdefault("EntryLayerTool", result.getPublicTool(tool.name)) - result.merge(GeoIDSvcCfg(flags)) - kwargs.setdefault("GeoIDSvc", result.getService("ISF_GeoIDSvc")) + kwargs.setdefault("GeoIDSvc", result.getPrimaryAndMerge(GeoIDSvcCfg(flags)).name) if flags.Detector.GeometryCavern: kwargs.setdefault("TruthVolumeLevel", 2) kwargs.setdefault("IsITkGeometry", flags.GeoModel.Run not in ['RUN1', 'RUN2', 'RUN3']) @@ -67,9 +66,7 @@ def PhysicsValidationUserActionToolCfg(flags, name="ISFG4PhysicsValidationUserAc def MCTruthUserActionToolCfg(flags, name="ISFMCTruthUserActionTool", **kwargs): result = ComponentAccumulator() - truthacc = TruthServiceCfg(flags) - kwargs.setdefault("TruthRecordSvc", truthacc.getPrimary()) - result.merge(truthacc) + kwargs.setdefault("TruthRecordSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name) result.setPrivateTools(CompFactory.G4UA.iGeant4.MCTruthUserActionTool(name, **kwargs)) return result @@ -77,10 +74,8 @@ def MCTruthUserActionToolCfg(flags, name="ISFMCTruthUserActionTool", **kwargs): def TrackProcessorUserActionToolCfg(flags, name="ISFG4TrackProcessorUserActionTool", **kwargs): result = ComponentAccumulator() if "ParticleBroker" not in kwargs: - result.merge(ParticleBrokerSvcCfg(flags)) - kwargs.setdefault("ParticleBroker", result.getService("ISF_ParticleBrokerSvc")) - result.merge(GeoIDSvcCfg(flags)) - kwargs.setdefault("GeoIDSvc", result.getService("ISF_GeoIDSvc")) + kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(ParticleBrokerSvcCfg(flags)).name) + kwargs.setdefault("GeoIDSvc", result.getPrimaryAndMerge(GeoIDSvcCfg(flags)).name) result.setPrivateTools(CompFactory.G4UA.iGeant4.TrackProcessorUserActionPassBackTool(name, **kwargs)) return result @@ -96,10 +91,8 @@ def AFII_G4TrackProcessorUserActionToolCfg(flags, name="AFII_G4TrackProcessorUse if flags.Sim.ISF.Simulator in ["PassBackG4MT", "ATLFASTIIMT", "ATLFAST3MT", "ATLFAST3MT_QS"]: kwargs.setdefault("ParticleBroker", "") if flags.Sim.ISF.Simulator in ["ATLFASTIIF_G4MS"]: - result.merge(AFIIParticleBrokerSvcCfg(flags)) - kwargs.setdefault("ParticleBroker", result.getService("ISF_AFIIParticleBrokerSvc")) - result.merge(AFIIGeoIDSvcCfg(flags)) - kwargs.setdefault("GeoIDSvc", result.getService("ISF_AFIIGeoIDSvc")) + kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(AFIIParticleBrokerSvcCfg(flags)).name) + kwargs.setdefault("GeoIDSvc", result.getPrimaryAndMerge(AFIIGeoIDSvcCfg(flags)).name) kwargs.setdefault("PassBackEkinThreshold", 0.05*MeV) kwargs.setdefault("KillBoundaryParticlesBelowThreshold", True) tool = result.popToolsAndMerge(PassBackG4TrackProcessorUserActionToolCfg(flags, name, **kwargs)) @@ -160,7 +153,7 @@ def UserActionSvcCfg(ConfigFlags, name="G4UA::UserActionSvc", **kwargs): kwargs.setdefault("UserActionTools", result.popToolsAndMerge(getDefaultActions(ConfigFlags))) # placeholder for more advanced config, if needed - result.addService(CompFactory.G4UA.UserActionSvc(name, **kwargs)) + result.addService(CompFactory.G4UA.UserActionSvc(name, **kwargs), primary = True) return result @@ -185,7 +178,7 @@ def CTBUserActionSvcCfg(ConfigFlags, name="G4UA::CTBUserActionSvc", **kwargs): kwargs.setdefault("UserActionTools", generalActions) # placeholder for more advanced config, if needed - result.addService(CompFactory.G4UA.UserActionSvc(name, **kwargs)) + result.addService(CompFactory.G4UA.UserActionSvc(name, **kwargs), primary = True) return result @@ -207,34 +200,37 @@ def ISFUserActionSvcCfg(ConfigFlags, name="G4UA::ISFUserActionSvc", **kwargs): # New user action tools kwargs.setdefault("UserActionTools", generalActions) - result.addService(CompFactory.G4UA.UserActionSvc(name, **kwargs)) + result.addService(CompFactory.G4UA.UserActionSvc(name, **kwargs), primary = True) return result def ISFFullUserActionSvcCfg(ConfigFlags, name="G4UA::ISFFullUserActionSvc", **kwargs): # this configuration needs ISFMCTruthUserAction # and FullG4TrackProcessorUserAction - result = FullG4TrackProcessorUserActionToolCfg(ConfigFlags) - kwargs.setdefault("TrackProcessorUserAction", [result.popPrivateTools()]) - result.merge(ISFUserActionSvcCfg(ConfigFlags, name, **kwargs)) + tpAcc = FullG4TrackProcessorUserActionToolCfg(ConfigFlags) + kwargs.setdefault("TrackProcessorUserAction", [tpAcc.popPrivateTools()]) + result = ISFUserActionSvcCfg(ConfigFlags, name, **kwargs) + result.merge(tpAcc) return result def ISFPassBackUserActionSvcCfg(ConfigFlags, name="G4UA::ISFPassBackUserActionSvc", **kwargs): # this configuration needs ISFMCTruthUserAction and # PassBackG4TrackProcessorUserAction - result = ComponentAccumulator() + tpAcc = ComponentAccumulator() kwargs.setdefault("TrackProcessorUserAction", - [result.popToolsAndMerge(PassBackG4TrackProcessorUserActionToolCfg(ConfigFlags))]) - result.merge(ISFUserActionSvcCfg(ConfigFlags, name, **kwargs)) + [tpAcc.popToolsAndMerge(PassBackG4TrackProcessorUserActionToolCfg(ConfigFlags))]) + result = ISFUserActionSvcCfg(ConfigFlags, name, **kwargs) + result.merge(tpAcc) return result def ISF_AFIIUserActionSvcCfg(ConfigFlags, name="G4UA::ISF_AFIIUserActionSvc", **kwargs): # this configuration needs ISFMCTruthUserAction and # AFII_G4TrackProcessorUserAction - result = ComponentAccumulator() + tpAcc = ComponentAccumulator() kwargs.setdefault("TrackProcessorUserAction", - [result.popToolsAndMerge(AFII_G4TrackProcessorUserActionToolCfg(ConfigFlags))]) - result.merge(ISFUserActionSvcCfg(ConfigFlags, name, **kwargs)) + [tpAcc.popToolsAndMerge(AFII_G4TrackProcessorUserActionToolCfg(ConfigFlags))]) + result = ISFUserActionSvcCfg(ConfigFlags, name, **kwargs) + result.merge(tpAcc) return result diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py b/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py index 21e99c68bd77..40a0310fb9e5 100644 --- a/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py +++ b/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py @@ -8,9 +8,9 @@ from G4AtlasServices.G4AtlasFieldServices import StandardFieldSvcCfg, Q1FwdG4Fie # Field Managers def ATLASFieldManagerToolCfg(ConfigFlags, name='ATLASFieldManager', **kwargs): - result = StandardFieldSvcCfg(ConfigFlags) + result = ComponentAccumulator() kwargs.setdefault("IntegratorStepper", ConfigFlags.Sim.G4Stepper) - kwargs.setdefault("FieldSvc", result.getService("StandardField")) + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(StandardFieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("UseTightMuonStepping", False) if len(ConfigFlags.Sim.G4EquationOfMotion)>0: kwargs.setdefault("EquationOfMotion", ConfigFlags.Sim.G4EquationOfMotion ) @@ -18,9 +18,9 @@ def ATLASFieldManagerToolCfg(ConfigFlags, name='ATLASFieldManager', **kwargs): return result def TightMuonsATLASFieldManagerToolCfg(ConfigFlags, name='TightMuonsATLASFieldManager', **kwargs): - result = StandardFieldSvcCfg(ConfigFlags) + result = ComponentAccumulator() kwargs.setdefault("IntegratorStepper", ConfigFlags.Sim.G4Stepper) - kwargs.setdefault("FieldSvc", result.getService("StandardField")) + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(StandardFieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("UseTightMuonStepping",True) if len(ConfigFlags.Sim.G4EquationOfMotion)>0: kwargs.setdefault("EquationOfMotion", ConfigFlags.Sim.G4EquationOfMotion ) @@ -35,8 +35,7 @@ def ClassicFieldManagerToolCfg(ConfigFlags, name='ClassicFieldManager', **kwargs def BasicDetectorFieldManagerToolCfg(ConfigFlags, name='BasicDetectorFieldManager', **kwargs): result = ComponentAccumulator() if 'FieldSvc' not in kwargs: # don't create the StandardFieldSvc if it is not required by this tool. - result.merge(StandardFieldSvcCfg(ConfigFlags)) - kwargs.setdefault("FieldSvc", result.getService("StandardField")) + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(StandardFieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("IntegratorStepper", ConfigFlags.Sim.G4Stepper) kwargs.setdefault('MuonOnlyField', False) if len(ConfigFlags.Sim.G4EquationOfMotion)>0: @@ -105,32 +104,32 @@ def BasicFwdFieldManagerToolCfg(ConfigFlags, name='FwdFieldManagerTool', **kwarg return BasicDetectorFieldManagerToolCfg(ConfigFlags, name, **kwargs) def Q1FwdFieldManagerToolCfg(ConfigFlags, name='Q1FwdFieldManager', **kwargs): - result = Q1FwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q1FwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q1FwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQXAA.1R1MagQ1']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q2FwdFieldManagerToolCfg(ConfigFlags, name='Q2FwdFieldManager', **kwargs): - result=Q2FwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q2FwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q2FwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQXBA.2R1MagQ2a', 'FwdRegion::LQXBA.2R1MagQ2b']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q3FwdFieldManagerToolCfg(ConfigFlags, name='Q3FwdFieldManager', **kwargs): - result=Q3FwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q3FwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q3FwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQXAG.3R1MagQ3']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def D1FwdFieldManagerToolCfg(ConfigFlags, name='D1FwdFieldManager', **kwargs): - result=D1FwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('D1FwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(D1FwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::MBXW.A4R1MagD1a', 'FwdRegion::MBXW.B4R1MagD1b', 'FwdRegion::MBXW.C4R1MagD1c', 'FwdRegion::MBXW.D4R1MagD1d', 'FwdRegion::MBXW.E4R1MagD1e', 'FwdRegion::MBXW.F4R1MagD1f']) @@ -139,128 +138,128 @@ def D1FwdFieldManagerToolCfg(ConfigFlags, name='D1FwdFieldManager', **kwargs): result.setPrivateTools(tool) return result def D2FwdFieldManagerToolCfg(ConfigFlags, name='D2FwdFieldManager', **kwargs): - result=D2FwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('D2FwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(D2FwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LBRCD.4R1MagD2']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q4FwdFieldManagerToolCfg(ConfigFlags, name='Q4FwdFieldManager', **kwargs): - result=Q4FwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q4FwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q4FwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQYCH.4R1MagQ4']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q5FwdFieldManagerToolCfg(ConfigFlags, name='Q5FwdFieldManager', **kwargs): - result=Q5FwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q5FwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q5FwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQNDC.5R1MagQ5']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q6FwdFieldManagerToolCfg(ConfigFlags, name='Q6FwdFieldManager', **kwargs): - result=Q6FwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q6FwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q6FwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQNDD.6R1MagQ6']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q7FwdFieldManagerToolCfg(ConfigFlags, name='Q7FwdFieldManager', **kwargs): - result=Q7FwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q7FwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q7FwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQNFD.7R1MagQ7a', 'FwdRegion::LQNFD.7R1MagQ7b']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q1HKickFwdFieldManagerToolCfg(ConfigFlags, name='Q1HKickFwdFieldManager', **kwargs): - result=Q1HKickFwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q1HKickFwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q1HKickFwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQXAA.1R1MagQ1HKick']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q1VKickFwdFieldManagerToolCfg(ConfigFlags, name='Q1VKickFwdFieldManager', **kwargs): - result=Q1VKickFwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q1VKickFwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q1VKickFwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQXAA.1R1MagQ1VKick']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q2HKickFwdFieldManagerToolCfg(ConfigFlags, name='Q2HKickFwdFieldManager', **kwargs): - result=Q2HKickFwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q2HKickFwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q2HKickFwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQXBA.2R1MagQ2HKick']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q2VKickFwdFieldManagerToolCfg(ConfigFlags, name='Q2VKickFwdFieldManager', **kwargs): - result=Q2VKickFwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q2VKickFwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q2VKickFwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQXBA.2R1MagQ2VKick']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q3HKickFwdFieldManagerToolCfg(ConfigFlags, name='Q3HKickFwdFieldManager', **kwargs): - result=Q3HKickFwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q3HKickFwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q3HKickFwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQXAG.3R1MagQ3HKick']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q3VKickFwdFieldManagerToolCfg(ConfigFlags, name='Q3VKickFwdFieldManager', **kwargs): - result=Q3VKickFwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q3VKickFwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q3VKickFwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQXAG.3R1MagQ3VKick']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q4VKickAFwdFieldManagerToolCfg(ConfigFlags, name='Q4VKickAFwdFieldManager', **kwargs): - result=Q4VKickAFwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q4VKickAFwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q4VKickAFwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQYCH.4R1MagQ4VKickA']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q4HKickFwdFieldManagerToolCfg(ConfigFlags, name='Q4HKickFwdFieldManager', **kwargs): - result=Q4HKickFwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q4HKickFwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q4HKickFwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQYCH.4R1MagQ4HKick']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q4VKickBFwdFieldManagerToolCfg(ConfigFlags, name='Q4VKickBFwdFieldManager', **kwargs): - result=Q4VKickBFwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q4VKickBFwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q4VKickBFwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQYCH.4R1MagQ4VKickB']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q5HKickFwdFieldManagerToolCfg(ConfigFlags, name='Q5HKickFwdFieldManager', **kwargs): - result=Q5HKickFwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q5HKickFwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q5HKickFwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQNDC.5R1MagQ5HKick']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) result.setPrivateTools(tool) return result def Q6VKickFwdFieldManagerToolCfg(ConfigFlags, name='Q6VKickFwdFieldManager', **kwargs): - result=Q6VKickFwdG4FieldSvcCfg(ConfigFlags) - kwargs.setdefault("FieldSvc", result.getService('Q6VKickFwdG4FieldSvc')) + result = ComponentAccumulator() + kwargs.setdefault("FieldSvc", result.getPrimaryAndMerge(Q6VKickFwdG4FieldSvcCfg(ConfigFlags)).name) kwargs.setdefault("LogicalVolumes", ['FwdRegion::LQNDD.6R1MagQ6VKick']) acc=BasicFwdFieldManagerToolCfg(ConfigFlags, name, **kwargs) tool = result.popToolsAndMerge(acc) diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py b/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py index 20ba3cd6fae2..886f111f9d18 100644 --- a/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py +++ b/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py @@ -25,11 +25,12 @@ from AthenaCommon.SystemOfUnits import mm, cm, m #put it here to avoid circular import? -G4GeometryNotifierSvc=CompFactory.G4GeometryNotifierSvc def G4GeometryNotifierSvcCfg(ConfigFlags, name="G4GeometryNotifierSvc", **kwargs): + result = ComponentAccumulator() kwargs.setdefault("ActivateLVNotifier", True) kwargs.setdefault("ActivatePVNotifier", False) - return G4GeometryNotifierSvc(name, **kwargs) + result.addService(CompFactory.G4GeometryNotifierSvc(name, **kwargs), primary = True) + return result def BeamPipeGeoDetectorToolCfg(ConfigFlags, name='BeamPipe', **kwargs): @@ -38,8 +39,7 @@ def BeamPipeGeoDetectorToolCfg(ConfigFlags, name='BeamPipe', **kwargs): result = BeamPipeGeometryCfg(ConfigFlags) kwargs.setdefault("DetectorName", "BeamPipe") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -50,8 +50,7 @@ def PixelGeoDetectorToolCfg(ConfigFlags, name='Pixel', **kwargs): result = PixelSimulationGeometryCfg(ConfigFlags) kwargs.setdefault("DetectorName", "Pixel") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -62,8 +61,7 @@ def SCTGeoDetectorToolCfg(ConfigFlags, name='SCT', **kwargs): result = SCT_SimulationGeometryCfg(ConfigFlags) kwargs.setdefault("DetectorName", "SCT") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -73,8 +71,7 @@ def PLRGeoDetectorToolCfg(ConfigFlags, name='PLR', **kwargs): result = PLRGeometryCfg(ConfigFlags) kwargs.setdefault("DetectorName", "PLR") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -84,8 +81,7 @@ def ITkPixelGeoDetectorToolCfg(ConfigFlags, name='ITkPixel', **kwargs): result = ITkPixelSimulationGeometryCfg(ConfigFlags) kwargs.setdefault("DetectorName", "ITkPixel") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -96,8 +92,7 @@ def ITkStripGeoDetectorToolCfg(ConfigFlags, name='ITkStrip', **kwargs): result = ITkStripSimulationGeometryCfg(ConfigFlags) kwargs.setdefault("DetectorName", "ITkStrip") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -108,8 +103,7 @@ def HGTDGeoDetectorToolCfg(ConfigFlags, name='HGTD', **kwargs): result = HGTD_SimulationGeometryCfg(ConfigFlags) kwargs.setdefault("DetectorName", "HGTD") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -120,8 +114,7 @@ def TRTGeoDetectorToolCfg(ConfigFlags, name='TRT', **kwargs): result = TRT_SimulationGeometryCfg(ConfigFlags) kwargs.setdefault("DetectorName", "TRT") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -132,8 +125,7 @@ def IDetServicesMatGeoDetectorToolCfg(ConfigFlags, name='IDetServicesMat', **kwa result = InDetServiceMaterialCfg(ConfigFlags) kwargs.setdefault("DetectorName", "InDetServMat") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -144,8 +136,7 @@ def LArMgrGeoDetectorToolCfg(ConfigFlags, name='LArMgr', **kwargs): result = LArGMCfg(ConfigFlags) kwargs.setdefault("DetectorName", "LArMgr") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -156,8 +147,7 @@ def TileGeoDetectorToolCfg(ConfigFlags, name='Tile', **kwargs): result = TileGMCfg(ConfigFlags) kwargs.setdefault("DetectorName", "Tile") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -168,8 +158,7 @@ def LucidGeoDetectorToolCfg(ConfigFlags, name='Lucid', **kwargs): result=ForDetGeometryCfg(ConfigFlags) kwargs.setdefault("DetectorName", "LUCID") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -180,8 +169,7 @@ def ALFAGeoDetectorToolCfg(ConfigFlags, name='ALFA', **kwargs): result = ForDetGeometryCfg(ConfigFlags) kwargs.setdefault("DetectorName", "ALFA") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -192,8 +180,7 @@ def ZDCGeoDetectorToolCfg(ConfigFlags, name='ZDC', **kwargs): result = ForDetGeometryCfg(ConfigFlags) kwargs.setdefault("DetectorName", "ZDC") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -205,8 +192,7 @@ def AFPGeoDetectorToolCfg(ConfigFlags, name='AFP', **kwargs): kwargs.setdefault("DetectorName", "AFP") kwargs.setdefault("GeoDetectorName", "AFP_GeoModel") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -218,8 +204,7 @@ def FwdRegionGeoDetectorToolCfg(ConfigFlags, name='FwdRegion', **kwargs): kwargs.setdefault("DetectorName", "FwdRegion") kwargs.setdefault("GeoDetectorName", "ForwardRegionGeoModel") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -230,8 +215,7 @@ def MuonGeoDetectorToolCfg(ConfigFlags, name='Muon', **kwargs): result = MuonGeoModelCfg(ConfigFlags) kwargs.setdefault("DetectorName", "Muon") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -241,8 +225,7 @@ def getCavernInfraGeoDetectorTool(ConfigFlags, name='CavernInfra', **kwargs): result = ComponentAccumulator() #needs geometry setting up! kwargs.setdefault("DetectorName", "CavernInfra") #add the GeometryNotifierSvc - result.addService(G4GeometryNotifierSvcCfg(ConfigFlags)) - kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc")) + kwargs.setdefault("GeometryNotifierSvc", result.getPrimaryAndMerge(G4GeometryNotifierSvcCfg(ConfigFlags)).name) result.setPrivateTools(GeoDetectorTool(name, **kwargs)) return result @@ -818,8 +801,8 @@ def CavernWorldCfg(ConfigFlags, name="Cavern", **kwargs): # Subtraction Solid - has to be a better way to do this!! kwargs.setdefault("NumberOfHoles", 1) kwargs.setdefault("HoleNames", ['BelowCavern']) - kwargs.setdefault("Hole_dX", [bedrockDX]) - kwargs.setdefault("Hole_dY", [41000]) + kwargs.setdefault("Hole_dX", [bedrockDX]) + kwargs.setdefault("Hole_dY", [41000]) kwargs.setdefault("Hole_dZ", [bedrockDZ]) kwargs.setdefault("HolePosX", [0]) @@ -829,7 +812,7 @@ def CavernWorldCfg(ConfigFlags, name="Cavern", **kwargs): SubDetectorList = [] SubDetectorList += [ result.popToolsAndMerge(CavernInfraGeoDetectorToolCfg(ConfigFlags))] SubDetectorList += [ result.popToolsAndMerge(ATLASEnvelopeCfg(ConfigFlags))] - + kwargs.setdefault("SubDetectors", SubDetectorList) result.setPrivateTools(BoxEnvelope(name, **kwargs)) return result diff --git a/Simulation/ISF/ISF_Config/python/ISF_MainConfigNew.py b/Simulation/ISF/ISF_Config/python/ISF_MainConfigNew.py index a3638f03f672..299c80c08827 100644 --- a/Simulation/ISF/ISF_Config/python/ISF_MainConfigNew.py +++ b/Simulation/ISF/ISF_Config/python/ISF_MainConfigNew.py @@ -67,17 +67,13 @@ def Kernel_GenericSimulatorMTCfg(flags, name="ISF_Kernel_GenericSimulatorMT", ** kwargs.setdefault("ParticleKillerTool", pubTool) # public toolHandle if "GeoIDSvc" not in kwargs: - acc.merge(GeoIDSvcCfg(flags)) - kwargs.setdefault("GeoIDSvc", acc.getService("ISF_GeoIDSvc")) + kwargs.setdefault("GeoIDSvc", acc.getPrimaryAndMerge(GeoIDSvcCfg(flags)).name) if "InputConverter" not in kwargs: - acc.merge(InputConverterCfg(flags)) - kwargs.setdefault("InputConverter", acc.getService("ISF_InputConverter")) + kwargs.setdefault("InputConverter", acc.getPrimaryAndMerge(InputConverterCfg(flags)).name) if "TruthRecordService" not in kwargs: - truthacc = TruthServiceCfg(flags) - kwargs.setdefault("TruthRecordService", truthacc.getPrimary()) - acc.merge(truthacc) + kwargs.setdefault("TruthRecordService", acc.getPrimaryAndMerge(TruthServiceCfg(flags)).name) if "EntryLayerTool" not in kwargs: entryLayerTool = acc.popToolsAndMerge(EntryLayerToolMTCfg(flags)) @@ -148,8 +144,7 @@ def Kernel_FullG4MT_QSCfg(flags, name="ISF_Kernel_FullG4MT_QS", **kwargs): acc.popToolsAndMerge(LongLivedGeant4ToolCfg(flags)) ]) - acc.merge(LongLivedInputConverterCfg(flags)) - kwargs.setdefault("InputConverter", acc.getService("ISF_LongLivedInputConverter")) + kwargs.setdefault("InputConverter", acc.getPrimaryAndMerge(LongLivedInputConverterCfg(flags)).name) acc.merge(Kernel_GenericG4OnlyMTCfg(flags, name, **kwargs)) return acc @@ -190,8 +185,7 @@ def Kernel_PassBackG4MTCfg(flags, name="ISF_Kernel_PassBackG4MT", **kwargs): def Kernel_ATLFASTIIMTCfg(flags, name="ISF_Kernel_ATLFASTIIMT", **kwargs): acc = ComponentAccumulator() - acc.merge(AFIIGeoIDSvcCfg(flags)) - kwargs.setdefault("GeoIDSvc", acc.getService("ISF_AFIIGeoIDSvc")) + kwargs.setdefault("GeoIDSvc", acc.getPrimaryAndMerge(AFIIGeoIDSvcCfg(flags)).name) eltool = acc.popToolsAndMerge(AFIIEntryLayerToolMTCfg(flags)) acc.addPublicTool(eltool) kwargs.setdefault("EntryLayerTool" , acc.getPublicTool(eltool.name)) # public ToolHandle @@ -296,8 +290,7 @@ def Kernel_ATLFAST3MTCfg(flags, name="ISF_Kernel_ATLFAST3MT", **kwargs): def Kernel_ATLFAST3MT_QSCfg(flags, name="ISF_Kernel_ATLFAST3MT_QS", **kwargs): acc = ComponentAccumulator() - acc.merge(LongLivedInputConverterCfg(flags)) - kwargs.setdefault("InputConverter", acc.getService("ISF_LongLivedInputConverter")) + kwargs.setdefault("InputConverter", acc.getPrimaryAndMerge(LongLivedInputConverterCfg(flags)).name) kwargs.setdefault("ParticleOrderingTool" , acc.popToolsAndMerge(ParticleOrderingToolCfg(flags))) tool = acc.popToolsAndMerge(AFIIEntryLayerToolMTCfg(flags)) @@ -345,9 +338,7 @@ def Kernel_GenericSimulatorCfg(flags, name="ISF_Kernel_GenericSimulator", **kwar acc = ComponentAccumulator() if "TruthRecordService" not in kwargs: - truthacc = TruthServiceCfg(flags) - kwargs.setdefault("TruthRecordService", truthacc.getPrimary()) - acc.merge(truthacc) + kwargs.setdefault("TruthRecordService", acc.getPrimaryAndMerge(TruthServiceCfg(flags)).name) if "MemoryMonitoringTool" not in kwargs: tool = acc.popToolsAndMerge(MemoryMonitorToolCfg(flags)) @@ -356,12 +347,10 @@ def Kernel_GenericSimulatorCfg(flags, name="ISF_Kernel_GenericSimulator", **kwar kwargs.setdefault("MemoryMonitoringTool", pubTool) if "ParticleBroker" not in kwargs: - acc.merge(AFIIParticleBrokerSvcCfg(flags)) - kwargs.setdefault("ParticleBroker", acc.getService("ISF_AFIIParticleBrokerSvc")) + kwargs.setdefault("ParticleBroker", acc.getPrimaryAndMerge(AFIIParticleBrokerSvcCfg(flags)).name) if "InputConverter" not in kwargs: - acc.merge(InputConverterCfg(flags)) - kwargs.setdefault("InputConverter", acc.getService("ISF_InputConverter")) + kwargs.setdefault("InputConverter", acc.getPrimaryAndMerge(InputConverterCfg(flags)).name) kwargs.setdefault("InputHardScatterCollection", "BeamTruthEvent") kwargs.setdefault("OutputHardScatterTruthCollection", "TruthEvent") diff --git a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfigNew.py b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfigNew.py index c6a30415c10d..203bec88060e 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfigNew.py +++ b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfigNew.py @@ -53,13 +53,13 @@ def GenParticleFiltersToolCfg(ConfigFlags): def InputConverterCfg(ConfigFlags, name="ISF_InputConverter", **kwargs): - result = BarcodeSvcCfg(ConfigFlags) - kwargs.setdefault("BarcodeSvc", result.getPrimary()) + result = ComponentAccumulator() + kwargs.setdefault("BarcodeSvc", result.getPrimaryAndMerge(BarcodeSvcCfg(ConfigFlags)).name) kwargs.setdefault("UseGeneratedParticleMass", False) if "GenParticleFilters" not in kwargs: acc_GenParticleFiltersList = GenParticleFiltersToolCfg(ConfigFlags) kwargs.setdefault("GenParticleFilters", result.popToolsAndMerge(acc_GenParticleFiltersList) ) - result.addService(CompFactory.ISF.InputConverter(name, **kwargs)) + result.addService(CompFactory.ISF.InputConverter(name, **kwargs), primary = True) return result @@ -73,7 +73,9 @@ def LongLivedInputConverterCfg(ConfigFlags, name="ISF_LongLivedInputConverter", ] kwargs.setdefault("GenParticleFilters", gpfilt) kwargs.setdefault("QuasiStableParticlesIncluded", True) - return InputConverterCfg(ConfigFlags, name, **kwargs) + inptCnv = result.getPrimaryAndMerge(InputConverterCfg(ConfigFlags, name, **kwargs)) + result.addService(inptCnv, primary = True) + return result def ParticleBrokerSvcNoOrderingCfg(ConfigFlags, name="ISF_ParticleBrokerSvcNoOrdering", **kwargs): @@ -82,27 +84,26 @@ def ParticleBrokerSvcNoOrderingCfg(ConfigFlags, name="ISF_ParticleBrokerSvcNoOrd tool = result.popToolsAndMerge(EntryLayerToolCfg(ConfigFlags)) result.addPublicTool(tool) kwargs.setdefault("EntryLayerTool", result.getPublicTool(tool.name)) - kwargs.setdefault("GeoIDSvc", result.getService("ISF_GeoIDSvc")) + kwargs.setdefault("GeoIDSvc", result.getService("ISF_GeoIDSvc").name) # FIXME # assume "GeoIDSvc" has been set alongside "EntryLayerTool" kwargs.setdefault("AlwaysUseGeoIDSvc", False) kwargs.setdefault("ValidateGeoIDs", ConfigFlags.Sim.ISF.ValidationMode) kwargs.setdefault("ValidationOutput", ConfigFlags.Sim.ISF.ValidationMode) kwargs.setdefault("ValidationStreamName", "ParticleBroker") - baracc = BarcodeSvcCfg(ConfigFlags) - kwargs.setdefault("BarcodeService", baracc.getPrimary()) - result.merge(baracc) + kwargs.setdefault("BarcodeService", result.getPrimaryAndMerge(BarcodeSvcCfg(ConfigFlags)).name) - result.addService(CompFactory.ISF.ParticleBrokerDynamicOnReadIn(name, **kwargs)) + result.addService(CompFactory.ISF.ParticleBrokerDynamicOnReadIn(name, **kwargs), primary = True) return result def ParticleBrokerSvcCfg(ConfigFlags, name="ISF_ParticleBrokerSvc", **kwargs): # comment copied from old config #kwargs.setdefault("ParticleOrderingTool", "ISF_InToOutSubDetOrderingTool") - result = ParticleOrderingToolCfg(ConfigFlags) - kwargs.setdefault("ParticleOrderingTool", result.popPrivateTools()) - result.merge(ParticleBrokerSvcNoOrderingCfg(ConfigFlags, name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("ParticleOrderingTool", result.popToolsAndMerge(ParticleOrderingToolCfg(ConfigFlags))) + pbsvc = result.getPrimaryAndMerge(ParticleBrokerSvcNoOrderingCfg(ConfigFlags, name, **kwargs)) + result.addService(pbsvc, primary = True) return result @@ -112,8 +113,9 @@ def AFIIParticleBrokerSvcCfg(ConfigFlags, name="ISF_AFIIParticleBrokerSvc", **kw result.addPublicTool(tool) kwargs.setdefault("EntryLayerTool", result.getPublicTool(tool.name)) - kwargs.setdefault("GeoIDSvc", result.getService("ISF_AFIIGeoIDSvc")) - result.merge(ParticleBrokerSvcCfg(ConfigFlags, name, **kwargs)) + kwargs.setdefault("GeoIDSvc", result.getService("ISF_AFIIGeoIDSvc").name) # FIXME + pbsvc = result.getPrimaryAndMerge(ParticleBrokerSvcCfg(ConfigFlags, name, **kwargs)) + result.addService(pbsvc, primary = True) return result @@ -141,9 +143,7 @@ def TruthServiceCfg(ConfigFlags, **kwargs): def GenericTruthServiceCfg(ConfigFlags, name="ISF_TruthService", **kwargs): result = ComponentAccumulator() - tmpAcc = BarcodeSvcCfg(ConfigFlags) - kwargs.setdefault("BarcodeSvc", tmpAcc.getPrimary()) - result.merge(tmpAcc) + kwargs.setdefault("BarcodeSvc", result.getPrimaryAndMerge(BarcodeSvcCfg(ConfigFlags)).name) kwargs.setdefault("SkipIfNoChildren", True) kwargs.setdefault("SkipIfNoParentBarcode", True) @@ -197,9 +197,8 @@ def MC12TruthServiceCfg(ConfigFlags, name="ISF_MC12TruthService", **kwargs): kwargs.setdefault("TruthStrategies", truthStrats) kwargs.setdefault("IgnoreUndefinedBarcodes", False) kwargs.setdefault("PassWholeVertices", True) - truthService = GenericTruthServiceCfg(ConfigFlags, name, **kwargs) - result.addService(truthService.getPrimary(), primary=True) - result.merge(truthService) + truthService = result.getPrimaryAndMerge(GenericTruthServiceCfg(ConfigFlags, name, **kwargs)) + result.addService(truthService, primary=True) return result @@ -220,7 +219,8 @@ def MC12LLPTruthServiceCfg(ConfigFlags, name="ISF_MC12TruthLLPService", **kwargs ] truthStrats = [result.popToolsAndMerge(cfg(ConfigFlags)) for cfg in truthCfgs] kwargs.setdefault("TruthStrategies", truthStrats) - result.merge(MC12TruthServiceCfg(ConfigFlags, name, **kwargs)) + truthService = result.getPrimaryAndMerge(MC12TruthServiceCfg(ConfigFlags, name, **kwargs)) + result.addService(truthService, primary = True) return result @@ -262,9 +262,8 @@ def MC15TruthServiceCfg(ConfigFlags, name="ISF_MC15TruthService", **kwargs): kwargs.setdefault("IgnoreUndefinedBarcodes", False) kwargs.setdefault("PassWholeVertices", False) # new for MC15 - can write out partial vertices. kwargs.setdefault("ForceEndVtxInRegions", [AtlasRegion.fAtlasID]) - truthService = GenericTruthServiceCfg(ConfigFlags, name, **kwargs) - result.addService(truthService.getPrimary(), primary=True) - result.merge(truthService) + truthService = result.getPrimaryAndMerge(GenericTruthServiceCfg(ConfigFlags, name, **kwargs)) + result.addService(truthService, primary=True) return result @@ -277,8 +276,7 @@ def MC15aPlusTruthServiceCfg(ConfigFlags, name="ISF_MC15aPlusTruthService", **kw AtlasRegion = ROOT.AtlasDetDescr.AtlasRegion kwargs.setdefault("ForceEndVtxInRegions", [AtlasRegion.fAtlasID]) - result = MC15TruthServiceCfg(ConfigFlags, name, **kwargs) - return result + return MC15TruthServiceCfg(ConfigFlags, name, **kwargs) def MC15aPlusLLPTruthServiceCfg(ConfigFlags, name="ISF_MC15aPlusLLPTruthService", **kwargs): @@ -294,7 +292,9 @@ def MC15aPlusLLPTruthServiceCfg(ConfigFlags, name="ISF_MC15aPlusLLPTruthService" ] truthStrats = [result.popToolsAndMerge(cfg(ConfigFlags)) for cfg in truthCfgs] kwargs.setdefault("TruthStrategies", truthStrats) - return MC15aPlusTruthServiceCfg(ConfigFlags, name, **kwargs) + truthService = result.getPrimaryAndMerge(MC15aPlusTruthServiceCfg(ConfigFlags, name, **kwargs)) + result.addService(truthService, primary = True) + return result # MC16 Truth Service Configurations diff --git a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesCoreConfigNew.py b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesCoreConfigNew.py index 127d5cf70bba..bc08f8155fd3 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesCoreConfigNew.py +++ b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesCoreConfigNew.py @@ -12,34 +12,34 @@ from ISF_Tools.ISF_ToolsConfigNew import ParticleKillerToolCfg def ISFEnvelopeDefSvcCfg(ConfigFlags, name="ISF_ISFEnvelopeDefSvc", **kwargs): - result = EnvelopeDefSvcCfg(ConfigFlags) # ATLAS common envlope definitions - kwargs.setdefault("ATLASEnvelopeDefSvc", result.getService("AtlasGeometry_EnvelopeDefSvc")) - result.addService(CompFactory.ISF.ISFEnvelopeDefSvc(name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("ATLASEnvelopeDefSvc", result.getPrimaryAndMerge(EnvelopeDefSvcCfg(ConfigFlags)).name) + result.addService(CompFactory.ISF.ISFEnvelopeDefSvc(name, **kwargs), primary = True) return result def GeoIDSvcCfg(ConfigFlags, name="ISF_GeoIDSvc", **kwargs): - result = ISFEnvelopeDefSvcCfg(ConfigFlags) + result = ComponentAccumulator() # with ISF volume definitions - kwargs.setdefault("EnvelopeDefSvc", result.getService("ISF_ISFEnvelopeDefSvc")) - result.addService(CompFactory.ISF.GeoIDSvc(name, **kwargs)) + kwargs.setdefault("EnvelopeDefSvc", result.getPrimaryAndMerge(ISFEnvelopeDefSvcCfg(ConfigFlags)).name) + result.addService(CompFactory.ISF.GeoIDSvc(name, **kwargs), primary = True) return result def AFIIEnvelopeDefSvcCfg(ConfigFlags, name="ISF_AFIIEnvelopeDefSvc", **kwargs): - result = ISFEnvelopeDefSvcCfg(ConfigFlags) + result = ComponentAccumulator() # ATLAS common envlope definitions - kwargs.setdefault("ISFEnvelopeDefSvc", result.getService("ISF_ISFEnvelopeDefSvc")) + kwargs.setdefault("ISFEnvelopeDefSvc", result.getPrimaryAndMerge(ISFEnvelopeDefSvcCfg(ConfigFlags)).name) kwargs.setdefault("InDetMaxExtentZ", 3549.5*mm) - result.addService(CompFactory.ISF.AFIIEnvelopeDefSvc(name, **kwargs)) + result.addService(CompFactory.ISF.AFIIEnvelopeDefSvc(name, **kwargs), primary = True) return result def AFIIGeoIDSvcCfg(ConfigFlags, name="ISF_AFIIGeoIDSvc", **kwargs): - result = AFIIEnvelopeDefSvcCfg(ConfigFlags) - kwargs.setdefault("EnvelopeDefSvc", result.getService("ISF_AFIIEnvelopeDefSvc")) - result.addService(CompFactory.ISF.GeoIDSvc(name, **kwargs)) + result = ComponentAccumulator() + kwargs.setdefault("EnvelopeDefSvc", result.getPrimaryAndMerge(AFIIEnvelopeDefSvcCfg(ConfigFlags)).name) + result.addService(CompFactory.ISF.GeoIDSvc(name, **kwargs), primary = True) return result @@ -49,6 +49,5 @@ def ParticleKillerSvcCfg(ConfigFlags, name="ISF_ParticleKillerSvc", **kwargs): kwargs.setdefault("Identifier", "ParticleKiller") tool = result.popToolsAndMerge(ParticleKillerToolCfg(ConfigFlags)) kwargs.setdefault("SimulatorTool", tool) - svc = CompFactory.ISF.LegacySimSvc(name, **kwargs) - result.addService(svc) + result.addService(CompFactory.ISF.LegacySimSvc(name, **kwargs), primary = True) return result 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 d8c6ff272e88..5a8a41fd0742 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/python/ISF_FastCaloSimServicesConfigNew.py +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/python/ISF_FastCaloSimServicesConfigNew.py @@ -31,11 +31,8 @@ def PunchThroughToolCfg(flags, name="ISF_PunchThroughTool", **kwargs): kwargs.setdefault("MinEnergy" , [ 938.3, 135.6, 50., 50., 105.7]) kwargs.setdefault("MaxNumParticles" , [ -1, -1, -1, -1, -1]) kwargs.setdefault("EnergyFactor" , [ 1., 1., 1., 1., 1.]) - acc_bar = BarcodeSvcCfg(flags) - kwargs.setdefault("BarcodeSvc", acc_bar.getPrimary()) - acc.merge(acc_bar) - acc.merge(EnvelopeDefSvcCfg(flags)) - kwargs.setdefault("EnvelopeDefSvc", acc.getService("AtlasGeometry_EnvelopeDefSvc")) + kwargs.setdefault("BarcodeSvc", acc.getPrimaryAndMerge(BarcodeSvcCfg(flags)).name) + kwargs.setdefault("EnvelopeDefSvc", acc.getPrimaryAndMerge(EnvelopeDefSvcCfg(flags)).name) kwargs.setdefault("BeamPipeRadius", 500.) acc.setPrivateTools(CompFactory.ISF.PunchThroughTool(name, **kwargs)) return acc @@ -229,9 +226,7 @@ def FastCaloToolBaseCfg(flags, name="ISF_FastCaloTool", **kwargs): acc.addPublicTool(Extrapolator) kwargs.setdefault("Extrapolator", acc.getPublicTool(Extrapolator.name)) if "ParticleTruthSvc" not in kwargs: - truthacc = TruthServiceCfg(flags) - kwargs.setdefault("ParticleTruthSvc", truthacc.getPrimary()) - acc.merge(truthacc) + kwargs.setdefault("ParticleTruthSvc", acc.getPrimaryAndMerge(TruthServiceCfg(flags)).name) acc.setPrivateTools(CompFactory.ISF.FastCaloTool(name, **kwargs)) return acc @@ -268,23 +263,20 @@ def FastCaloSimV2ToolCfg(flags, name="ISF_FastCaloSimV2Tool", **kwargs): acc.addPublicTool(CaloCellContainer) Extrapolator = acc.popToolsAndMerge(FastCaloSimCaloExtrapolationCfg(flags)) acc.addPublicTool(Extrapolator) - acc.merge(FastCaloSimV2ParamSvcCfg(flags)) kwargs.setdefault("CaloCellsOutputName", flags.Sim.FastCalo.CaloCellsName) kwargs.setdefault("CaloCellMakerTools_setup", [acc.getPublicTool(EmptyCellBuilder.name)]) kwargs.setdefault("CaloCellMakerTools_release", [acc.getPublicTool(CaloCellContainer.name), acc.getPublicTool(FastHit.name)]) kwargs.setdefault("FastCaloSimCaloExtrapolation", acc.getPublicTool(Extrapolator.name)) - kwargs.setdefault("ParamSvc", acc.getService("ISF_FastCaloSimV2ParamSvc")) + kwargs.setdefault("ParamSvc", acc.getPrimaryAndMerge(FastCaloSimV2ParamSvcCfg(flags)).name) acc.merge(RNG(flags.Random.Engine)) - kwargs.setdefault("RandomSvc", acc.getService("AthRNGSvc")) + kwargs.setdefault("RandomSvc", acc.getService("AthRNGSvc").name) #FIXME kwargs.setdefault("RandomStream", "FastCaloSimRnd") PT_tool = acc.popToolsAndMerge(PunchThroughToolCfg(flags)) kwargs.setdefault("PunchThroughTool", PT_tool) if "ParticleTruthSvc" not in kwargs: - truthacc = TruthServiceCfg(flags) - kwargs.setdefault("ParticleTruthSvc", truthacc.getPrimary()) - acc.merge(truthacc) + kwargs.setdefault("ParticleTruthSvc", acc.getPrimaryAndMerge(TruthServiceCfg(flags)).name) acc.setPrivateTools(CompFactory.ISF.FastCaloSimV2Tool(name, **kwargs)) return acc @@ -301,7 +293,7 @@ def FastCaloSimSvcCfg(flags, name="ISF_FastCaloSimSvc", **kwargs): acc.addPublicTool(tool) kwargs.setdefault("SimulatorTool", acc.getPublicTool(tool.name)) kwargs.setdefault("Identifier", "FastCaloSim") - acc.addService(CompFactory.ISF.LegacySimSvc(name, **kwargs)) + acc.addService(CompFactory.ISF.LegacySimSvc(name, **kwargs), primary = True) return acc @@ -365,10 +357,8 @@ def FastCaloSimPileupOTSvcCfg(flags, name="ISF_FastCaloSimPileupOTSvc", **kwargs acc.getPublicTool(FastHit.name)]) kwargs.setdefault("Extrapolator", acc.getPublicTool(Extrapolator.name)) if "ParticleTruthSvc" not in kwargs: - truthacc = TruthServiceCfg(flags) - kwargs.setdefault("ParticleTruthSvc", truthacc.getPrimary()) - acc.merge(truthacc) - acc.addService(CompFactory.ISF.FastCaloSimSvcPU(name, **kwargs)) + kwargs.setdefault("ParticleTruthSvc", acc.getPrimaryAndMerge(TruthServiceCfg(flags)).name) + acc.addService(CompFactory.ISF.FastCaloSimSvcPU(name, **kwargs), primary = True) return acc @@ -376,7 +366,7 @@ def FastCaloSimV2ParamSvcCfg(flags, name="ISF_FastCaloSimV2ParamSvc", **kwargs): acc = ComponentAccumulator() kwargs.setdefault("ParamsInputFilename", flags.Sim.FastCalo.ParamsInputFilename) kwargs.setdefault("ParamsInputObject", "SelPDGID") - acc.addService(CompFactory.ISF.FastCaloSimV2ParamSvc(name, **kwargs)) + acc.addService(CompFactory.ISF.FastCaloSimV2ParamSvc(name, **kwargs), primary = True) return acc @@ -386,7 +376,7 @@ def FastCaloSimV2SvcCfg(flags, name="ISF_FastCaloSimSvcV2", **kwargs): acc.addPublicTool(tool) kwargs.setdefault("SimulatorTool", acc.getPublicTools(tool)) kwargs.setdefault("Identifier", "FastCaloSim") - acc.addService(CompFactory.ISF.LegacySimSvc(name, **kwargs)) + acc.addService(CompFactory.ISF.LegacySimSvc(name, **kwargs), primary = True) return acc @@ -410,6 +400,6 @@ def DNNCaloSimSvcCfg(flags, name="ISF_DNNCaloSimSvc", **kwargs): kwargs.setdefault("FastCaloSimCaloExtrapolation", acc.getPublicTool(Extrapolator.name)) kwargs.setdefault("RandomStream", "FastCaloSimRnd") acc.merge(RNG(flags.Random.Engine)) - kwargs.setdefault("RandomSvc", acc.getService("AthRNGSvc")) - acc.addService(CompFactory.ISF.DNNCaloSimSvc(name, **kwargs)) + kwargs.setdefault("RandomSvc", acc.getService("AthRNGSvc").name) + acc.addService(CompFactory.ISF.DNNCaloSimSvc(name, **kwargs), primary = True) return acc diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasServices/python/ISF_FatrasConfig.py b/Simulation/ISF/ISF_Fatras/ISF_FatrasServices/python/ISF_FatrasConfig.py index 047a4a5fe92d..ab5450849284 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasServices/python/ISF_FatrasConfig.py +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasServices/python/ISF_FatrasConfig.py @@ -288,13 +288,10 @@ def fatrasParticleDecayHelperCfg(flags, name="ISF_FatrasParticleDecayHelper", ** kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode) if "ParticleBroker" not in kwargs: - result.merge(AFIIParticleBrokerSvcCfg(flags)) - kwargs.setdefault("ParticleBroker", result.getService("ISF_AFIIParticleBrokerSvc")) + kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(AFIIParticleBrokerSvcCfg(flags)).name) if "TruthRecordSvc" not in kwargs: - acc = TruthServiceCfg(flags) - kwargs.setdefault("ParticleTruthSvc", acc.getPrimary()) - result.merge(acc) + kwargs.setdefault("ParticleTruthSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name) pdg_g4part_cfg = result.popToolsAndMerge(fatrasPdgG4ParticleCfg(flags)) result.addPublicTool(pdg_g4part_cfg) @@ -392,13 +389,10 @@ def fatrasMaterialUpdatorCfg(flags, name="ISF_FatrasMaterialUpdator", **kwargs): kwargs.setdefault("RandomNumberService", result.getService("AtDSFMTGenSvc")) kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName) if "ParticleBroker" not in kwargs: - result.merge(AFIIParticleBrokerSvcCfg(flags)) - kwargs.setdefault("ParticleBroker", result.getService("ISF_AFIIParticleBrokerSvc")) + kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(AFIIParticleBrokerSvcCfg(flags)).name) if "TruthRecordSvc" not in kwargs: - acc = TruthServiceCfg(flags) - kwargs.setdefault("TruthRecordSvc", acc.getPrimary()) - result.merge(acc) + kwargs.setdefault("TruthRecordSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name) # @TODO retire once migration to TrackingGeometry conditions data is complete if flags.Sim.ISF.UseTrackingGeometryCond: @@ -555,13 +549,10 @@ def fatrasConversionCreatorCfg(flags, name="ISF_FatrasConversionCreator", **kwar kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName) if "ParticleBroker" not in kwargs: - result.merge(AFIIParticleBrokerSvcCfg(flags)) - kwargs.setdefault("ParticleBroker", result.getService("ISF_AFIIParticleBrokerSvc")) + kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(AFIIParticleBrokerSvcCfg(flags)).name) if "TruthRecordSvc" not in kwargs: - acc = TruthServiceCfg(flags) - kwargs.setdefault("TruthRecordSvc", acc.getPrimary()) - result.merge(acc) + kwargs.setdefault("TruthRecordSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name) phys_val_cfg = result.popToolsAndMerge(fatrasPhysicsValidationToolCfg(flags)) result.addPublicTool(phys_val_cfg) @@ -587,13 +578,10 @@ def fatrasG4HadIntProcessorCfg(flags, name="ISF_FatrasG4HadIntProcessor", **kwar kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName) if "ParticleBroker" not in kwargs: - result.merge(AFIIParticleBrokerSvcCfg(flags)) - kwargs.setdefault("ParticleBroker", result.getService("ISF_AFIIParticleBrokerSvc")) + kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(AFIIParticleBrokerSvcCfg(flags)).name) if "TruthRecordSvc" not in kwargs: - acc = TruthServiceCfg(flags) - kwargs.setdefault("TruthRecordSvc", acc.getPrimary()) - result.merge(acc) + kwargs.setdefault("TruthRecordSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name) phys_val_cfg = result.popToolsAndMerge(fatrasPhysicsValidationToolCfg(flags)) result.addPublicTool(phys_val_cfg) @@ -624,13 +612,10 @@ def fatrasParametricHadIntProcessorCfg(flags, name="ISF_FatrasParametricHadIntPr kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName) if "ParticleBroker" not in kwargs: - result.merge(AFIIParticleBrokerSvcCfg(flags)) - kwargs.setdefault("ParticleBroker", result.getService("ISF_AFIIParticleBrokerSvc")) + kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(AFIIParticleBrokerSvcCfg(flags)).name) if "TruthRecordSvc" not in kwargs: - acc = TruthServiceCfg(flags) - kwargs.setdefault("TruthRecordSvc", acc.getPrimary()) - result.merge(acc) + kwargs.setdefault("TruthRecordSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name) kwargs.setdefault("HadronicInteractionScaleFactor", flags.Sim.Fatras.HadronIntProb) kwargs.setdefault("MinimumHadronicInitialEnergy", flags.Sim.Fatras.MomCutOffSec) @@ -660,9 +645,7 @@ def fatrasProcessSamplingToolCfg(flags, name="ISF_FatrasProcessSamplingTool", ** # truth record if "TruthRecordSvc" not in kwargs: - acc = TruthServiceCfg(flags) - kwargs.setdefault("TruthRecordSvc", acc.getPrimary()) - result.merge(acc) + kwargs.setdefault("TruthRecordSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name) # decays pd_helper_cfg = result.popToolsAndMerge(fatrasParticleDecayHelperCfg(flags)) diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py index 930cf06cec80..296df90be154 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py @@ -9,12 +9,10 @@ from ISF_Tools.ISF_ToolsConfigNew import EntryLayerFilterCfg def EntryLayerToolCfg(flags, name="ISF_EntryLayerTool", **kwargs): - acc = ComponentAccumulator() + result = ComponentAccumulator() + kwargs["GeoIDSvc"] = result.getPrimaryAndMerge(GeoIDSvcCfg(flags)).name - acc.merge(GeoIDSvcCfg(flags)) - kwargs["GeoIDSvc"] = acc.getService("ISF_GeoIDSvc") - - filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags)) + filt = result.popToolsAndMerge(EntryLayerFilterCfg(flags)) kwargs.setdefault("ParticleFilters", [filt]) if flags.GeoModel.Run in ['RUN1', 'RUN2', 'RUN3']: @@ -24,20 +22,18 @@ def EntryLayerToolCfg(flags, name="ISF_EntryLayerTool", **kwargs): if flags.Sim.DoFullChain: OEsvc = CompFactory.StoreGateSvc("OriginalEvent_SG") - acc.addService(OEsvc) - kwargs.setdefault("EvtStore", OEsvc) # For Fast Chain + result.addService(OEsvc) + kwargs.setdefault("EvtStore", OEsvc.name) # For Fast Chain - acc.setPrivateTools(CompFactory.ISF.EntryLayerTool(name, **kwargs)) - return acc + result.setPrivateTools(CompFactory.ISF.EntryLayerTool(name, **kwargs)) + return result def EntryLayerToolMTCfg(flags, name="ISF_EntryLayerToolMT", **kwargs): - acc = ComponentAccumulator() - - acc.merge(GeoIDSvcCfg(flags)) - kwargs["GeoIDSvc"] = acc.getService("ISF_GeoIDSvc") + result = ComponentAccumulator() + kwargs["GeoIDSvc"] = result.getPrimaryAndMerge(GeoIDSvcCfg(flags)).name - filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags)) + filt = result.popToolsAndMerge(EntryLayerFilterCfg(flags)) kwargs.setdefault("ParticleFilters", [filt]) if flags.GeoModel.Run in ['RUN1', 'RUN2', 'RUN3']: @@ -47,20 +43,18 @@ def EntryLayerToolMTCfg(flags, name="ISF_EntryLayerToolMT", **kwargs): if flags.Sim.DoFullChain: OEsvc = CompFactory.StoreGateSvc("OriginalEvent_SG") - acc.addService(OEsvc) - kwargs.setdefault("EvtStore", OEsvc) # For Fast Chain + result.addService(OEsvc) + kwargs.setdefault("EvtStore", OEsvc.name) # For Fast Chain - acc.setPrivateTools(CompFactory.ISF.EntryLayerToolMT(name, **kwargs)) - return acc + result.setPrivateTools(CompFactory.ISF.EntryLayerToolMT(name, **kwargs)) + return result def AFIIEntryLayerToolCfg(flags, name="ISF_AFIIEntryLayerTool", **kwargs): - acc = ComponentAccumulator() + result = ComponentAccumulator() + kwargs["GeoIDSvc"] = result.getPrimaryAndMerge(AFIIGeoIDSvcCfg(flags)).name - acc.merge(AFIIGeoIDSvcCfg(flags)) - kwargs["GeoIDSvc"] = acc.getService("ISF_AFIIGeoIDSvc") - - filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags)) + filt = result.popToolsAndMerge(EntryLayerFilterCfg(flags)) kwargs.setdefault("ParticleFilters", [filt]) if flags.GeoModel.Run in ['RUN1', 'RUN2', 'RUN3']: @@ -70,20 +64,18 @@ def AFIIEntryLayerToolCfg(flags, name="ISF_AFIIEntryLayerTool", **kwargs): if flags.Sim.DoFullChain: OEsvc = CompFactory.StoreGateSvc("OriginalEvent_SG") - acc.addService(OEsvc) - kwargs.setdefault("EvtStore", OEsvc) # For Fast Chain + result.addService(OEsvc) + kwargs.setdefault("EvtStore", OEsvc.name) # For Fast Chain - acc.setPrivateTools(CompFactory.ISF.EntryLayerTool(name, **kwargs)) - return acc + result.setPrivateTools(CompFactory.ISF.EntryLayerTool(name, **kwargs)) + return result def AFIIEntryLayerToolMTCfg(flags, name="ISF_AFIIEntryLayerToolMT", **kwargs): - acc = ComponentAccumulator() - - acc.merge(AFIIGeoIDSvcCfg(flags)) - kwargs["GeoIDSvc"] = acc.getService("ISF_AFIIGeoIDSvc") + result = ComponentAccumulator() + kwargs["GeoIDSvc"] = result.getPrimaryAndMerge(AFIIGeoIDSvcCfg(flags)).name - filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags)) + filt = result.popToolsAndMerge(EntryLayerFilterCfg(flags)) kwargs.setdefault("ParticleFilters", [filt]) if flags.GeoModel.Run in ['RUN1', 'RUN2', 'RUN3']: @@ -93,8 +85,8 @@ def AFIIEntryLayerToolMTCfg(flags, name="ISF_AFIIEntryLayerToolMT", **kwargs): if flags.Sim.DoFullChain: OEsvc = CompFactory.StoreGateSvc("OriginalEvent_SG") - acc.addService(OEsvc) - kwargs.setdefault("EvtStore", OEsvc) # For Fast Chain + result.addService(OEsvc) + kwargs.setdefault("EvtStore", OEsvc.name) # For Fast Chain - acc.setPrivateTools(CompFactory.ISF.EntryLayerToolMT(name, **kwargs)) - return acc + result.setPrivateTools(CompFactory.ISF.EntryLayerToolMT(name, **kwargs)) + return result diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py index dde2b168e63c..89f5834c6967 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py @@ -27,20 +27,18 @@ def G4RunManagerHelperCfg(flags, name="G4RunManagerHelper", **kwargs): def Geant4ToolCfg(flags, name="ISF_Geant4Tool", **kwargs): - acc = RNG(flags.Random.Engine, name="AthRNGSvc") - kwargs.setdefault("RandomNumberService", acc.getService("AthRNGSvc")) + acc = ComponentAccumulator() + kwargs.setdefault("DetGeoSvc", acc.getPrimaryAndMerge(DetectorGeometrySvcCfg(flags)).name) - acc.merge(DetectorGeometrySvcCfg(flags)) - kwargs.setdefault("DetGeoSvc", acc.getService("DetectorGeometrySvc")) + acc.merge(RNG(flags.Random.Engine, name="AthRNGSvc")) + kwargs.setdefault("RandomNumberService", acc.getService("AthRNGSvc").name) # FIXME # Only add it if it's not added already if "InputConverter" not in kwargs.keys(): - acc.merge(InputConverterCfg(flags)) - kwargs.setdefault("InputConverter", acc.getService("ISF_InputConverter")) + kwargs.setdefault("InputConverter", acc.getPrimaryAndMerge(InputConverterCfg(flags)).name) if "UserActionSvc" not in kwargs.keys(): - acc.merge(ISFUserActionSvcCfg(flags)) - kwargs.setdefault("UserActionSvc", acc.getService("G4UA::ISFUserActionSvc")) + kwargs.setdefault("UserActionSvc", acc.getPrimaryAndMerge(ISFUserActionSvcCfg(flags)).name) kwargs.setdefault("RecordFlux", flags.Sim.RecordFlux) @@ -58,8 +56,7 @@ def Geant4ToolCfg(flags, name="ISF_Geant4Tool", **kwargs): kwargs.setdefault("FastSimMasterTool", acc.getPublicTool(tool.name)) # PhysicsListSvc - acc.merge(PhysicsListSvcCfg(flags)) - kwargs.setdefault("PhysicsListSvc", acc.getService("PhysicsListSvc")) + kwargs.setdefault("PhysicsListSvc", acc.getPrimaryAndMerge(PhysicsListSvcCfg(flags)).name) # Workaround to keep other simulation flavours working while we migrate everything to be AthenaMT-compatible. if flags.Sim.ISF.Simulator in ["FullG4MT", "FullG4MT_QS", "PassBackG4MT", "ATLFAST3MT", "ATLFAST3MT_QS"]: @@ -73,40 +70,40 @@ def Geant4ToolCfg(flags, name="ISF_Geant4Tool", **kwargs): def FullGeant4ToolCfg(flags, name="ISF_FullGeant4Tool", **kwargs): - acc = ISFFullUserActionSvcCfg(flags) - kwargs.setdefault("UserActionSvc", acc.getService("G4UA::ISFFullUserActionSvc")) + acc = ComponentAccumulator() + kwargs.setdefault("UserActionSvc", acc.getPrimaryAndMerge(ISFFullUserActionSvcCfg(flags)).name) FullGeant4Tool = acc.popToolsAndMerge(Geant4ToolCfg(flags, name, **kwargs)) acc.setPrivateTools(FullGeant4Tool) return acc def PassBackGeant4ToolCfg(flags, name="ISF_PassBackGeant4Tool", **kwargs): - acc = ISFPassBackUserActionSvcCfg(flags) - kwargs.setdefault("UserActionSvc", acc.getService("G4UA::ISFPassBackUserActionSvc")) + acc = ComponentAccumulator() + kwargs.setdefault("UserActionSvc", acc.getPrimaryAndMerge(ISFPassBackUserActionSvcCfg(flags)).name) PassBackGeant4Tool = acc.popToolsAndMerge(Geant4ToolCfg(flags, name, **kwargs)) acc.setPrivateTools(PassBackGeant4Tool) return acc def AFIIGeant4ToolCfg(flags, name="ISF_AFIIGeant4Tool", **kwargs): - acc = ISF_AFIIUserActionSvcCfg(flags) - kwargs.setdefault("UserActionSvc", acc.getService("G4UA::ISF_AFIIUserActionSvc")) + acc = ComponentAccumulator() + kwargs.setdefault("UserActionSvc", acc.getPrimaryAndMerge(ISF_AFIIUserActionSvcCfg(flags)).name) PassBackGeant4Tool = acc.popToolsAndMerge(Geant4ToolCfg(flags, name, **kwargs)) acc.setPrivateTools(PassBackGeant4Tool) return acc def LongLivedGeant4ToolCfg(flags, name="ISF_LongLivedGeant4Tool", **kwargs): - acc = LongLivedInputConverterCfg(flags) - kwargs.setdefault("InputConverter", acc.getService("ISF_LongLivedInputConverter")) + acc = ComponentAccumulator() + kwargs.setdefault("InputConverter", acc.getPrimaryAndMerge(LongLivedInputConverterCfg(flags)).name) FullGeant4Tool = acc.popToolsAndMerge(FullGeant4ToolCfg(flags, name, **kwargs)) acc.setPrivateTools(FullGeant4Tool) return acc def AFII_QS_Geant4ToolCfg(flags, name="AFII_QS_Geant4Tool", **kwargs): - acc = LongLivedInputConverterCfg(flags) - kwargs.setdefault("InputConverter", acc.getService("ISF_LongLivedInputConverter")) + acc = ComponentAccumulator() + kwargs.setdefault("InputConverter", acc.getPrimaryAndMerge(LongLivedInputConverterCfg(flags)).name) AFIIGeant4Tool = acc.popToolsAndMerge(AFIIGeant4ToolCfg(flags, name, **kwargs)) acc.setPrivateTools(AFIIGeant4Tool) return acc -- GitLab