ATLAS Offline Software
AtlasTrackingGeometrySvcConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaConfiguration.Enums import ProductionStep
6 
7 def TrackingGeometrySvcCfg(flags , name = 'AtlasTrackingGeometrySvc',
8  doMaterialValidation=False,
9  **kwargs):
10  """
11  Sets up the Tracking Geometry Service
12  """
13  if not (flags.Common.ProductionStep in [ProductionStep.Simulation, ProductionStep.FastChain] or
14  flags.Sim.ISFRun is True):
15  from AthenaCommon.Logging import logging
16  mlog = logging.getLogger("TrackingGeometrySvcCfg")
17  mlog.warning(
18  " TrackingGeometrySvc is to be deprecated in favour of TrackingGeometryCondAlg")
19 
20  result = ComponentAccumulator()
21 
22  from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig import (
23  GeometryBuilderCfg)
24  kwargs.setdefault("GeometryBuilder", result.popToolsAndMerge(
25  GeometryBuilderCfg(flags, useCond=False)))
26 
27  # Now set up processors
28  atlas_geometry_processors=[] # array of private ToolHandles
29 
30  if flags.TrackingGeometry.MaterialSource == 'COOL':
31  CoolDataBaseFolder = '/GLOBAL/TrackingGeo/LayerMaterialV2'
32  if flags.Detector.GeometryITk:
33  CoolDataBaseFolder = '/GLOBAL/TrackingGeo/LayerMaterialITK'
34 
35  from TrackingGeometryCondAlg.TrkDetDescrToolsConfig import (
36  LayerMaterialProviderCfg)
37  atlas_geometry_processors += [ result.popToolsAndMerge(
38  LayerMaterialProviderCfg(flags, name='AtlasMaterialProvider',
39  LayerMaterialMapName = CoolDataBaseFolder,
40  LayerMaterialMapKey = '')) ] # Different from AtlasTrackingGeometryCondAlgConfig
41 
42  # Setup DBs
43  from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig import _setupCondDB
44  result.merge(_setupCondDB(flags, CoolDataBaseFolder))
45 
46  elif flags.TrackingGeometry.MaterialSource == 'Input':
47  from TrackingGeometryCondAlg.TrkDetDescrToolsConfig import (
48  InputLayerMaterialProviderCfg)
49  atlas_geometry_processors += [ result.popToolsAndMerge(
51 
52  if doMaterialValidation:
53  from TrackingGeometryCondAlg.TrkDetDescrToolsConfig import (
54  LayerMaterialInspectorCfg)
55  atlas_geometry_processors += [ result.popToolsAndMerge(
57 
58  from GaudiKernel.GaudiHandles import PrivateToolHandleArray
59  kwargs.setdefault("GeometryProcessors", PrivateToolHandleArray(
60  atlas_geometry_processors))
61  kwargs.setdefault("TrackingGeometryName", 'AtlasTrackingGeometry')
62  kwargs.setdefault("BuildGeometryFromTagInfo", True)
63 
64  result.addService(CompFactory.Trk.TrackingGeometrySvc(name, **kwargs),
65  primary = True)
66 
67  return result
68 
69 if __name__ == '__main__':
70  from AthenaConfiguration.AllConfigFlags import initConfigFlags
71  flags = initConfigFlags()
72 
73  from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
74  flags.Input.Files = defaultTestFiles.RAW_RUN2
75  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
76  flags.lock()
77 
79 
80  f=open('TrackingGeometrySvcCfg.pkl','wb')
81  acc.store(f)
82  f.close()
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.AtlasTrackingGeometrySvcConfig.TrackingGeometrySvcCfg
def TrackingGeometrySvcCfg(flags, name='AtlasTrackingGeometrySvc', doMaterialValidation=False, **kwargs)
Definition: AtlasTrackingGeometrySvcConfig.py:7
AtlasTrackingGeometryCondAlgConfig.GeometryBuilderCfg
def GeometryBuilderCfg(flags, name='AtlasGeometryBuilder', useCond=True, **kwargs)
Definition: AtlasTrackingGeometryCondAlgConfig.py:61
TrkDetDescrToolsConfig.LayerMaterialProviderCfg
def LayerMaterialProviderCfg(flags, name='AtlasMaterialCondProvider', **kwargs)
Definition: TrkDetDescrToolsConfig.py:213
AtlasTrackingGeometryCondAlgConfig._setupCondDB
def _setupCondDB(flags, CoolDataBaseFolder, quiet=True)
Definition: AtlasTrackingGeometryCondAlgConfig.py:8
TrkDetDescrToolsConfig.LayerMaterialInspectorCfg
def LayerMaterialInspectorCfg(flags, name='AtlasLayerMaterialInspector', **kwargs)
Definition: TrkDetDescrToolsConfig.py:226
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
TrkDetDescrToolsConfig.InputLayerMaterialProviderCfg
def InputLayerMaterialProviderCfg(flags, name='AtlasMaterialProvider', **kwargs)
Definition: TrkDetDescrToolsConfig.py:219