ATLAS Offline Software
Loading...
Searching...
No Matches
MCTruthBaseConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
6def 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 "SCT_Barrel" 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
37def 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
MCTruthSteppingActionToolCfg(flags, name='G4UA::MCTruthSteppingActionTool', **kwargs)