diff --git a/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigNew.py b/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigNew.py index 273a61f286b3dbae1c2022180d15e537672ac79b..7d83f6c0f693d2c6227215bbbee9284a7141b33c 100644 --- a/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigNew.py +++ b/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigNew.py @@ -48,7 +48,9 @@ def G4AtlasAlgCfg(ConfigFlags, name='G4AtlasAlg', **kwargs): acc, DetGeoSvc = DetectorGeometrySvcCfg(ConfigFlags) print "TESTTTTT" #check if it runs! kwargs.setdefault('DetGeoSvc', DetGeoSvc) - result.merge(acc) + result.addService(DetGeoSvc) + tools = result.popToolsAndMerge(acc) + result.setPrivateTools(tools) kwargs.setdefault("InputTruthCollection", "BeamTruthEvent") #tocheck -are these string inputs? kwargs.setdefault("OutputTruthCollection", "TruthEvent") @@ -130,6 +132,7 @@ if __name__ == '__main__': ConfigFlags.Sim.WorldRRange = 15000 ConfigFlags.Sim.WorldZRange = 27000 #change defaults? + ConfigFlags.Detector.SimulateForward = False # Finalize ConfigFlags.lock() @@ -139,7 +142,8 @@ if __name__ == '__main__': #add the algorithm acc, Alg = G4AtlasAlgCfg(ConfigFlags) cfg.addEventAlgo(Alg) - cfg.merge(acc) + tools = cfg.popToolsAndMerge(acc) + cfg.setPrivateTools(tools) # Dump config cfg.getService("StoreGateSvc").Dump = True diff --git a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfigNew.py b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfigNew.py index eb68c283d62fad673270a573351feddb0f963b9f..6f72978197a5de76aedfc471bbac15a3fa6e7970 100644 --- a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfigNew.py +++ b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasServicesConfigNew.py @@ -133,6 +133,7 @@ def getTB_RegionCreatorList(ConfigFlags): ######################################################################### def getATLAS_FieldMgrList(ConfigFlags): + result = ComponentAccumulator() fieldMgrList = [] from G4AtlasApps.SimFlags import simFlags #if not simFlags.TightMuonStepping.statusOn or\ @@ -140,7 +141,10 @@ def getATLAS_FieldMgrList(ConfigFlags): if False: fieldMgrList += [ATLASFieldManagerToolCfg(ConfigFlags)] else: - fieldMgrList += [TightMuonsATLASFieldManagerToolCfg(ConfigFlags)] + acc, tool = TightMuonsATLASFieldManagerToolCfg(ConfigFlags) + #fieldMgrList += [acc.getPublicTool('TightMuonsATLASFieldManager')] # issue with public tools? + fieldMgrList += [tool] + result.merge(acc) from AthenaCommon.DetFlags import DetFlags if ConfigFlags.Detector.SimulateBpipe: @@ -175,7 +179,8 @@ def getATLAS_FieldMgrList(ConfigFlags): Q5HKickFwdFieldManagerToolCfg(ConfigFlags), Q6VKickFwdFieldManagerToolCfg(ConfigFlags), FwdRegionFieldManagerToolCfg(ConfigFlags)] - return fieldMgrList + result.setPrivateTools(fieldMgrList) + return result, fieldMgrList #called? def getCTB_FieldMgrList(ConfigFlags): @@ -220,7 +225,11 @@ def DetectorGeometrySvcCfg(ConfigFlags, name="DetectorGeometrySvc", **kwargs): kwargs.setdefault("RegionCreators", getATLAS_RegionCreatorList(ConfigFlags)) #if hasattr(simFlags, 'MagneticField') and simFlags.MagneticField.statusOn: if True: - kwargs.setdefault("FieldManagers", getATLAS_FieldMgrList(ConfigFlags)) + print "TESTTT" + acc, fieldMgrList = getATLAS_FieldMgrList(ConfigFlags) + kwargs.setdefault("FieldManagers", fieldMgrList ) #causing issues...! + tool = result.popToolsAndMerge(acc) + result.setPrivateTools(tool) return result, DetectorGeometrySvc(name, **kwargs) def G4AtlasSvcCfg(ConfigFlags, name="G4AtlasSvc", **kwargs): @@ -280,14 +289,15 @@ if __name__ == '__main__': #add the algorithm acc1, Svc1 = DetectorGeometrySvcCfg(ConfigFlags) - Svc5 = G4AtlasSvcCfg(ConfigFlags) - Svc6 = G4GeometryNotifierSvcCfg(ConfigFlags) + #Svc5 = G4AtlasSvcCfg(ConfigFlags) + #Svc6 = G4GeometryNotifierSvcCfg(ConfigFlags) cfg.addService(Svc1) - cfg.addService(Svc5) - cfg.addService(Svc6) + #cfg.addService(Svc5) + #cfg.addService(Svc6) - cfg.merge(acc1) + tool = cfg.popToolsAndMerge(acc1) + cfg.setPrivateTools(tool) #cfg.addEventAlgo(Alg) #Event algo? #cfg.merge(acc) diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py b/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py index f69cdd14e925d9fb7b29836b14715c16571314be..d459f864921c890a9f43f6a6455a32f5f1f0ab72 100644 --- a/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py +++ b/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py @@ -1,4 +1,5 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from G4AtlasTools.G4AtlasToolsConf import GlobalFieldManagerTool, DetectorFieldManagerTool #from G4AtlasServices.G4AtlasServicesConfigNew import StandardFieldSvcCfg #either make new file for the StandardFieldSvcCfg etc.. or just import the file @@ -18,16 +19,20 @@ def ATLASFieldManagerToolCfg(ConfigFlags, name='ATLASFieldManager', **kwargs): return GlobalFieldManagerTool(name, **kwargs) def TightMuonsATLASFieldManagerToolCfg(ConfigFlags, name='TightMuonsATLASFieldManager', **kwargs): + result = ComponentAccumulator() from G4AtlasApps.SimFlags import simFlags kwargs.setdefault("IntegratorStepper", simFlags.G4Stepper.get_Value()) acc = StandardFieldSvcCfg(ConfigFlags) kwargs.setdefault("FieldSvc", acc.getService("StandardField")) + result.merge(acc) kwargs.setdefault("UseTightMuonStepping",True) if simFlags.EquationOfMotion.statusOn: kwargs.setdefault("EquationOfMotion", simFlags.EquationOfMotion.get_Value() ) - return GlobalFieldManagerTool(name, **kwargs) + + result.addPublicTool(GlobalFieldManagerTool(name, **kwargs)) + return result, GlobalFieldManagerTool(name, **kwargs) #return tuple for now (add public / private tool later ) def ClassicFieldManagerToolCfg(ConfigFlags, name='ClassicFieldManager', **kwargs): kwargs.setdefault("IntegratorStepper", "ClassicalRK4") @@ -217,7 +222,8 @@ if __name__ == '__main__': #add the algorithm cfg.addPublicTool(ATLASFieldManagerToolCfg(ConfigFlags)) - cfg.addPublicTool(TightMuonsATLASFieldManagerToolCfg (ConfigFlags)) + acc = TightMuonsATLASFieldManagerToolCfg (ConfigFlags) + cfg.merge(acc) #cfg.addPublicTool(ClassicFieldManagerToolCfg(ConfigFlags)) #cfg.addPublicTool(BasicDetectorFieldManagerToolCfg(ConfigFlags)) #cfg.addPublicTool(Q1FwdFieldManagerToolCfg(ConfigFlags))