ATLAS Offline Software
MCTruthBaseConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
6 def getEnvelopeMap(flags):
7  # Map of volume name to output collection name
8  envelopeMap = dict()
9 
10  # TODO - implement CTB config
11  # if flags.TestBeam.LArFarUpstreamMaterial:
12  # envelopeMap['LARFARUPSTREAMMATERIAL::LARFARUPSTREAMMATERIAL'] = 'LArFarUpstreamMaterialExitLayer'
13  from AthenaConfiguration.Enums import BeamType
14  if flags.Beam.Type is BeamType.Cosmics:
15 
16  if "TRT_Barrel" in flags.Sim.CosmicFilterVolumeNames:
17  envelopeMap['TRT::BarrelOuterSupport'] = 'TRTBarrelEntryLayer'
18  elif "TRT_EC" in flags.Sim.CosmicFilterVolumeNames:
19  envelopeMap['TRT::WheelA'] = 'TRTECAEntryLayer'
20  envelopeMap['TRT::WheelB'] = 'TRTECBEntryLayer'
21  elif "TRT_EC" in flags.Sim.CosmicFilterVolumeNames:
22  envelopeMap['SCT::ThShieldOuterCly'] = 'SCTBarrelEntryLayer'# could be ThShieldInnerCly or Cyl..
23  elif "Pixel" in flags.Sim.CosmicFilterVolumeNames:
24  envelopeMap['Pixel::Pixel'] = 'PixelEntryLayer'
25  if not flags.Sim.ISFRun:
26  if flags.Detector.GeometryID:
27  envelopeMap['IDET::IDET'] = 'CaloEntryLayer'
28  if flags.Detector.GeometryITk:
29  envelopeMap['ITK::ITK'] = 'CaloEntryLayer'
30  if flags.Detector.GeometryCalo:
31  envelopeMap['CALO::CALO'] = 'MuonEntryLayer'
32  if flags.Detector.GeometryMuon: #was geometry in old style, should it be?
33  envelopeMap['MUONQ02::MUONQ02'] = 'MuonExitLayer'
34  return envelopeMap
35 
36 
37 def MCTruthSteppingActionToolCfg(flags, name='G4UA::MCTruthSteppingActionTool', **kwargs):
38  """Retrieve the MCTruthSteppingActionTool"""
39  result = ComponentAccumulator()
40  kwargs.setdefault("VolumeCollectionMap", getEnvelopeMap(flags))
41 
42  result.setPrivateTools( CompFactory.G4UA.MCTruthSteppingActionTool(name, **kwargs) )
43  return result
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
MCTruthBaseConfig.MCTruthSteppingActionToolCfg
def MCTruthSteppingActionToolCfg(flags, name='G4UA::MCTruthSteppingActionTool', **kwargs)
Definition: MCTruthBaseConfig.py:37
MCTruthBaseConfig.getEnvelopeMap
def getEnvelopeMap(flags)
Definition: MCTruthBaseConfig.py:6