ATLAS Offline Software
Loading...
Searching...
No Matches
G4AtlasServicesConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2from AthenaConfiguration.ComponentFactory import CompFactory
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.AccumulatorCache import AccumulatorCache
5
6from G4AtlasTools.G4AtlasToolsConfig import FastSimulationConstructorToolCfg
7from ExtraParticles.ExtraParticlesConfig import ExtraParticlesPhysicsToolCfg
8from SimulationConfig.SimEnums import CavernBackground
9from G4ExtraProcesses.G4ExtraProcessesConfig import G4EMProcessesPhysicsToolCfg
10from G4StepLimitation.G4StepLimitationConfig import G4StepLimitationToolCfg
11from TRT_TR_Process.TRT_TR_ProcessConfig import TRTPhysicsToolCfg
12
13
14@AccumulatorCache
15def PhysicsListSvcCfg(flags, name="PhysicsListSvc", **kwargs):
16 result = ComponentAccumulator()
17 PhysOptionList = [ result.popToolsAndMerge(G4StepLimitationToolCfg(flags)) ]
18 if flags.Sim.ISF.Simulator.isQuasiStable():
19 #Quasi stable particle simulation
20 PhysOptionList += [ result.popToolsAndMerge(ExtraParticlesPhysicsToolCfg(flags)) ] # FIXME more configuration required in this method
21 PhysOptionList += [ result.popToolsAndMerge(G4EMProcessesPhysicsToolCfg(flags)) ]
22 #PhysOptionList += flags.Sim.PhysicsOptions # FIXME Missing functionality
23 if flags.Detector.GeometryTRT:
24 PhysOptionList +=[ result.popToolsAndMerge(TRTPhysicsToolCfg(flags)) ]
25 if flags.Detector.GeometryLucid or flags.Detector.GeometryAFP or flags.Detector.GeometryZDC:
26 from LUCID_OpProcess.LUCID_OpProcessConfig import LucidPhysicsToolCfg
27 PhysOptionList +=[result.popToolsAndMerge(LucidPhysicsToolCfg(flags))]
28 kwargs.setdefault("PhysOption", PhysOptionList)
29 PhysDecaysList = []
30 kwargs.setdefault("PhysicsDecay", PhysDecaysList)
31 kwargs.setdefault("PhysicsList", flags.Sim.PhysicsList)
32 if 'PhysicsList' in kwargs:
33 if kwargs['PhysicsList'].endswith('_EMV') or kwargs['PhysicsList'].endswith('_EMX'):
34 raise RuntimeError( 'PhysicsList not allowed: '+kwargs['PhysicsList'] )
35
36 kwargs.setdefault("GeneralCut", 1.)
37 if flags.Sim.CavernBackground not in [CavernBackground.Read, CavernBackground.Write]:
38 kwargs.setdefault("NeutronTimeCut", flags.Sim.NeutronTimeCut)
39 kwargs.setdefault("NeutronEnergyCut", flags.Sim.NeutronEnergyCut)
40 kwargs.setdefault("ApplyEMCuts", flags.Sim.ApplyEMCuts)
41 kwargs.setdefault("QuietMode", flags.Exec.QuietMode)
42
43 #fast simulation constructor tool
44 kwargs.setdefault("FastSimConstructor", result.popToolsAndMerge(FastSimulationConstructorToolCfg(flags)))
45
46
49 """ --- ATLASSIM-3967 ---
50 these two options are replaced by SetNumberOfBinsPerDecade
51 which now controls both values.
52 """
53
55 if flags.Sim.ISF.Simulator.usesFatras():
56 kwargs.setdefault("UnstableAntiNeutrons", True) # Fix for ATLASSIM-6634 - consider fixing for FullG4 also
57 result.addService(CompFactory.PhysicsListSvc(name, **kwargs), primary = True)
58 return result
59
60
61def UserLimitsSvcCfg(flags, name="UserLimitsSvc", **kwargs):
62 result = ComponentAccumulator()
63 result.addService(CompFactory.UserLimitsSvc(name, **kwargs), primary = True)
64 return result
PhysicsListSvcCfg(flags, name="PhysicsListSvc", **kwargs)
UserLimitsSvcCfg(flags, name="UserLimitsSvc", **kwargs)