ATLAS Offline Software
Loading...
Searching...
No Matches
MuonGeoModelConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
3from AthenaConfiguration.ComponentFactory import CompFactory
4
5def MuonGeoUtilityToolCfg(flags, name = "MuonGeoUtilityTool", **kwargs):
6 result = ComponentAccumulator()
7 the_tool = CompFactory.MuonGMR4.MuonGeoUtilityTool(name, **kwargs)
8 result.addPublicTool(the_tool, primary = True)
9 return result
10def MdtReadoutGeomToolCfg(flags, name="MdtReadoutGeomTool", **kwargs):
11 result = ComponentAccumulator()
12 kwargs.setdefault("GeoUtilTool", result.getPrimaryAndMerge(MuonGeoUtilityToolCfg(flags)))
13 the_tool = CompFactory.MuonGMR4.MdtReadoutGeomTool(name, **kwargs)
14 result.setPrivateTools(the_tool)
15 return result
16
17def RpcReadoutGeomToolCfg(flags, name="RpcReadoutGeomTool", **kwargs):
18 result = ComponentAccumulator()
19 kwargs.setdefault("GeoUtilTool", result.getPrimaryAndMerge(MuonGeoUtilityToolCfg(flags)))
20 the_tool = CompFactory.MuonGMR4.RpcReadoutGeomTool(name, **kwargs)
21 result.setPrivateTools(the_tool)
22 return result
23
24def TgcReadoutGeomToolCfg(flags, name="TgcReadoutGeomTool", **kwargs):
25 result = ComponentAccumulator()
26 kwargs.setdefault("GeoUtilTool", result.getPrimaryAndMerge(MuonGeoUtilityToolCfg(flags)))
27 the_tool = CompFactory.MuonGMR4.TgcReadoutGeomTool(name, **kwargs)
28 result.setPrivateTools(the_tool)
29 return result
30
31def sTgcReadoutGeomToolCfg(flags, name="sTgcReadoutGeomTool", **kwargs):
32 result = ComponentAccumulator()
33 kwargs.setdefault("GeoUtilTool", result.getPrimaryAndMerge(MuonGeoUtilityToolCfg(flags)))
34 the_tool = CompFactory.MuonGMR4.sTgcReadoutGeomTool(name, **kwargs)
35 result.setPrivateTools(the_tool)
36 return result
37
38def MmReadoutGeomToolCfg(flags, name="MmReadoutGeomTool", **kwargs):
39 result = ComponentAccumulator()
40 kwargs.setdefault("GeoUtilTool", result.getPrimaryAndMerge(MuonGeoUtilityToolCfg(flags)))
41 the_tool = CompFactory.MuonGMR4.MmReadoutGeomTool(name, **kwargs)
42 result.setPrivateTools(the_tool)
43 return result
44
45def ChamberAssebmbleToolCfg(flags,name="MuonChamberAssembleTool", **kwargs):
46 result = ComponentAccumulator()
47 from AthenaConfiguration.Enums import LHCPeriod
48 kwargs.setdefault("run4Layout", flags.GeoModel.Run >= LHCPeriod.Run4)
49 the_tool = CompFactory.MuonGMR4.ChamberAssembleTool(name, **kwargs)
50 result.setPrivateTools(the_tool)
51 return result
52
53def MuonDetectorToolCfg(flags, name="MuonDetectorToolR4", **kwargs):
54 result = ComponentAccumulator()
55 sub_detTools = []
56 if flags.Detector.GeometryMDT:
57 sub_detTools.append(result.popToolsAndMerge(MdtReadoutGeomToolCfg(flags)))
58
59 if flags.Detector.GeometryRPC:
60 sub_detTools.append(result.popToolsAndMerge(RpcReadoutGeomToolCfg(flags)))
61
62 if flags.Detector.GeometryTGC:
63 sub_detTools.append(result.popToolsAndMerge(TgcReadoutGeomToolCfg(flags)))
64
65 if flags.Detector.GeometrysTGC:
66 sub_detTools.append(result.popToolsAndMerge(sTgcReadoutGeomToolCfg(flags)))
67
68 if flags.Detector.GeometryMM:
69 sub_detTools.append(result.popToolsAndMerge(MmReadoutGeomToolCfg(flags)))
70
71 from AthenaConfiguration.Enums import ProductionStep
72 if flags.Common.ProductionStep is not ProductionStep.Simulation:
73 sub_detTools.append(result.popToolsAndMerge(ChamberAssebmbleToolCfg(flags)))
74
75 kwargs.setdefault("ReadoutEleBuilders", sub_detTools)
76 the_tool = CompFactory.MuonGMR4.MuonDetectorTool(name = name, **kwargs)
77 result.setPrivateTools(the_tool)
78 return result
79
80def ToroidGeoModelToolCfg(flags, **kwargs):
81 result = ComponentAccumulator()
82 if not flags.Detector.SpecialGeometryToroid:
83 return result
84 from AtlasGeoModel.GeoModelConfig import GeoModelCfg
85 geoModelSvc = result.getPrimaryAndMerge(GeoModelCfg(flags))
86
87 kwargs.setdefault("TreeTops", ["Toroid"])
88 the_tool = CompFactory.MuonGMR4.ToroidDetectorTool(name="ToroidDetectorTool", **kwargs)
89 geoModelSvc.DetectorTools+=[the_tool]
90 return result
91
92def MuonGeoModelCfg(flags):
93 result = ComponentAccumulator()
94 from AtlasGeoModel.GeoModelConfig import GeoModelCfg
95 geoModelSvc = result.getPrimaryAndMerge(GeoModelCfg(flags))
96 geoModelSvc.DetectorTools+=[result.popToolsAndMerge(MuonDetectorToolCfg(flags))]
97 return result
98
100 result = ComponentAccumulator()
101 if not flags.Muon.usePhaseIIGeoSetup:
102 return result
103 from AthenaConfiguration.Enums import ProductionStep
104 if flags.Common.ProductionStep == ProductionStep.Simulation:
105 from MuonG4TrfCache.MuonTrfCacheConfig import MuonTransformCacheCfg
106 result.merge(MuonTransformCacheCfg(flags))
107 return result
108
109 from MuonCondAlgR4.ConditionsConfig import MuonGeoAlignCondAlgCfg
110 result.merge(MuonGeoAlignCondAlgCfg(flags))
111 from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsAlignStoreProviderAlgCfg
112
113
114
115 setCondDep = flags.Muon.enableAlignment or flags.Sim.ReleaseGeoModel
116 from MuonConfig.MuonConfigFlags import GeoTrfCacheMode
117 from ROOT.ActsTrk import DetectorType
118 if flags.Detector.GeometryMDT:
119 result.merge(ActsAlignStoreProviderAlgCfg(flags,
120 name="MuonAlignStoreProviderMdt",
121 CondAlignStore="MdtActsAlignContainer" if setCondDep else "",
122 EventAlignStore="MdtActsAlignContainer",
123 SplitPhysVolCache = flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SplitCache or
124 flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SlopyCache,
125 SplitActsTrfCache = flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SplitCache or
126 flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.ActsSplitALineCond,
127 FillAlignCache = False,
128 DetectorType=DetectorType.Mdt))
129 if flags.Detector.GeometryRPC:
130 result.merge(ActsAlignStoreProviderAlgCfg(flags,
131 name="MuonAlignStoreProviderRpc",
132 CondAlignStore="RpcActsAlignContainer" if setCondDep else "",
133 EventAlignStore="RpcActsAlignContainer",
134 SplitPhysVolCache = flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SplitCache or
135 flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SlopyCache,
136 SplitActsTrfCache = flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SplitCache or
137 flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.ActsSplitALineCond,
138 FillAlignCache = False,
139 DetectorType=DetectorType.Rpc))
140 if flags.Detector.GeometryTGC:
141 result.merge(ActsAlignStoreProviderAlgCfg(flags,
142 name="MuonAlignStoreProviderTgc",
143 CondAlignStore="TgcActsAlignContainer" if setCondDep else "",
144 EventAlignStore="TgcActsAlignContainer",
145 SplitPhysVolCache = flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SplitCache or
146 flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SlopyCache,
147 SplitActsTrfCache = flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SplitCache or
148 flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.ActsSplitALineCond,
149 FillAlignCache = False,
150 DetectorType=DetectorType.Tgc))
151 if flags.Detector.GeometrysTGC:
152 result.merge(ActsAlignStoreProviderAlgCfg(flags,
153 name="MuonAlignStoreProviderSTGC",
154 CondAlignStore="sTgcActsAlignContainer" if setCondDep else "",
155 EventAlignStore="sTgcActsAlignContainer",
156 SplitPhysVolCache = flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SplitCache or
157 flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SlopyCache,
158 SplitActsTrfCache = flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SplitCache or
159 flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.ActsSplitALineCond,
160 FillAlignCache = False,
161 DetectorType=DetectorType.sTgc))
162
163 if flags.Detector.GeometryMM:
164 result.merge(ActsAlignStoreProviderAlgCfg(flags,
165 name="MuonAlignStoreProviderMM",
166 CondAlignStore="MmActsAlignContainer" if setCondDep or \
167 flags.Muon.applyMMPassivation else "",
168 EventAlignStore="MmActsAlignContainer",
169 SplitPhysVolCache = flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SplitCache or
170 flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SlopyCache,
171 SplitActsTrfCache = flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SplitCache or
172 flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.ActsSplitALineCond,
173 FillAlignCache = False,
174 DetectorType=DetectorType.Mm))
175
176
177 return result
178
ChamberAssebmbleToolCfg(flags, name="MuonChamberAssembleTool", **kwargs)
MdtReadoutGeomToolCfg(flags, name="MdtReadoutGeomTool", **kwargs)
MuonGeoUtilityToolCfg(flags, name="MuonGeoUtilityTool", **kwargs)
ToroidGeoModelToolCfg(flags, **kwargs)
MmReadoutGeomToolCfg(flags, name="MmReadoutGeomTool", **kwargs)
TgcReadoutGeomToolCfg(flags, name="TgcReadoutGeomTool", **kwargs)
RpcReadoutGeomToolCfg(flags, name="RpcReadoutGeomTool", **kwargs)
MuonDetectorToolCfg(flags, name="MuonDetectorToolR4", **kwargs)
sTgcReadoutGeomToolCfg(flags, name="sTgcReadoutGeomTool", **kwargs)