ATLAS Offline Software
G4DebuggingToolsConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaCommon.Logging import logging
6 
7 #Based on G4UserActionsConfig.py
8 
9 def VerboseSelectorToolCfg(flags, name="G4UA::VerboseSelectorTool", **kwargs):
10  result = ComponentAccumulator()
11  # example custom configuration - not enabled in this initial version
12  #if name in flags.Sim.UserActionConfig.keys():
13  # for prop,value in flags.Sim.UserActionConfig[name].items():
14  # kwargs.setdefault(prop,value)
15  result.setPrivateTools(CompFactory.G4UA.VerboseSelectorTool(name, **kwargs))
16  return result
17 
18 
19 def VolumeDebuggerToolCfg(flags, name='G4UA::VolumeDebuggerTool', **kwargs):
20  result = ComponentAccumulator()
21  result.setPrivateTools(CompFactory.G4UA.VolumeDebuggerTool(name,**kwargs))
22  return result
23 
24 
25 def VolumeDebugger(configFlags, name="G4UA::ISFFullUserActionSvc", **kwargs):
26 
27  kwargs.setdefault("RunGeoTest",True)
28  kwargs.setdefault("Verbose",False)
29 
30  result = ComponentAccumulator()
31  #Setting up the CA for the LengthIntegrator
32  from G4DebuggingTools.G4DebuggingToolsConfig import VolumeDebuggerToolCfg
33  actionAcc = ComponentAccumulator()
34  actions = []
35  actions += [actionAcc.popToolsAndMerge(VolumeDebuggerToolCfg(configFlags,**kwargs))]
36  actionAcc.setPrivateTools(actions)
37  volumeDebuggerAction = result.popToolsAndMerge(actionAcc)
38 
39  actionList = volumeDebuggerAction
40  #We clear it here because UserActionsTools also wants kwargs, different
41  #from the tool above - probably this can be improved...
42  kwargs_UATools = {}
43  kwargs_UATools.setdefault("UserActionTools",actionList)
44  result.addService(CompFactory.G4UA.UserActionSvc(name,**kwargs_UATools))
45 
46  return result
47 
48 def StepHistogramToolCfg(flags, name="G4UA::StepHistogramTool", **kwargs):
49  """
50  flags.Sim.OptionalUserActionList += ['G4DebuggingTools.G4DebuggingToolsConfig.StepHistogramToolCfg']
51  """
52  result = ComponentAccumulator()
53  if flags.Concurrency.NumThreads > 1:
54  msg = 'Attempt to run '+name+' with more than one thread, which is not supported'
55  log = logging.getLogger(name)
56  log.fatal(msg)
57  raise TypeError(msg)
58  output = './StepHistograms_opts_temp.root'
59  result.addService(CompFactory.THistSvc(Output = ["stepHisto DATAFILE='"+output+"' OPT='RECREATE'"]))
60  result.setPrivateTools(CompFactory.G4UA.StepHistogramTool(name, **kwargs))
61  return result
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.G4DebuggingToolsConfig.VerboseSelectorToolCfg
def VerboseSelectorToolCfg(flags, name="G4UA::VerboseSelectorTool", **kwargs)
Definition: G4DebuggingToolsConfig.py:9
python.G4DebuggingToolsConfig.VolumeDebugger
def VolumeDebugger(configFlags, name="G4UA::ISFFullUserActionSvc", **kwargs)
Definition: G4DebuggingToolsConfig.py:25
python.G4DebuggingToolsConfig.StepHistogramToolCfg
def StepHistogramToolCfg(flags, name="G4UA::StepHistogramTool", **kwargs)
Definition: G4DebuggingToolsConfig.py:48
python.G4DebuggingToolsConfig.VolumeDebuggerToolCfg
def VolumeDebuggerToolCfg(flags, name='G4UA::VolumeDebuggerTool', **kwargs)
Definition: G4DebuggingToolsConfig.py:19