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 print("MuonDetectorToolCfg: Adding ChamberAssebmbleTool to MuonDetectorTool")
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 MuonGeoModelCfg(flags):
81 result = ComponentAccumulator()
82 from AtlasGeoModel.GeoModelConfig import GeoModelCfg
83 geoModelSvc = result.getPrimaryAndMerge(GeoModelCfg(flags))
84 geoModelSvc.DetectorTools+=[result.popToolsAndMerge(MuonDetectorToolCfg(flags))]
85 return result
86
88 result = ComponentAccumulator()
89 if not flags.Muon.usePhaseIIGeoSetup: return result
90 from MuonCondAlgR4.ConditionsConfig import ActsMuonAlignCondAlgCfg
91 result.merge(ActsMuonAlignCondAlgCfg(flags))
92 from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsAlignStoreProviderAlgCfg
93
94 from MuonG4TrfCache.MuonTrfCacheConfig import MuonTransformCacheCfg
95 result.merge(MuonTransformCacheCfg(flags))
96
97 setCondDep = flags.Muon.enableAlignment or flags.Sim.ReleaseGeoModel
98 from ROOT.ActsTrk import DetectorType
99 if flags.Detector.GeometryMDT:
100 result.merge(ActsAlignStoreProviderAlgCfg(flags,
101 name="ActsDetAlignmentAlgMdt",
102 CondAlignStore="MdtActsAlignContainer" if setCondDep else "",
103 EventAlignStore="MdtActsAlignContainer",
104 SplitPhysVolCache = False,
105 SplitActsTrfCache = False,
106 FillAlignCache = False,
107 DetectorType=DetectorType.Mdt))
108 if flags.Detector.GeometryRPC:
109 result.merge(ActsAlignStoreProviderAlgCfg(flags,
110 name="ActsDetAlignmentAlgRpc",
111 CondAlignStore="RpcActsAlignContainer" if setCondDep else "",
112 EventAlignStore="RpcActsAlignContainer",
113 SplitPhysVolCache = False,
114 SplitActsTrfCache = False,
115 FillAlignCache = False,
116 DetectorType=DetectorType.Rpc))
117 if flags.Detector.GeometryTGC:
118 result.merge(ActsAlignStoreProviderAlgCfg(flags,
119 name="ActsDetAlignmentAlgTgc",
120 CondAlignStore="TgcActsAlignContainer" if setCondDep else "",
121 EventAlignStore="TgcActsAlignContainer",
122 SplitPhysVolCache = False,
123 SplitActsTrfCache = False,
124 FillAlignCache = False,
125 DetectorType=DetectorType.Tgc))
126 if flags.Detector.GeometrysTGC:
127 result.merge(ActsAlignStoreProviderAlgCfg(flags,
128 name="ActsDetAlignmentAlgSTGC",
129 CondAlignStore="sTgcActsAlignContainer" if setCondDep else "",
130 EventAlignStore="sTgcActsAlignContainer",
131 SplitPhysVolCache = False,
132 SplitActsTrfCache = False,
133 FillAlignCache = False,
134 DetectorType=DetectorType.sTgc))
135
136 if flags.Detector.GeometryMM:
137 result.merge(ActsAlignStoreProviderAlgCfg(flags,
138 name="ActsDetAlignmentAlgMM",
139 CondAlignStore="MmActsAlignContainer" if setCondDep or \
140 flags.Muon.applyMMPassivation else "",
141 EventAlignStore="MmActsAlignContainer",
142 SplitPhysVolCache = False,
143 SplitActsTrfCache = False,
144 FillAlignCache = False,
145 DetectorType=DetectorType.Mm))
146
147
148 return result
149
void print(char *figname, TCanvas *c1)
ChamberAssebmbleToolCfg(flags, name="MuonChamberAssembleTool", **kwargs)
MdtReadoutGeomToolCfg(flags, name="MdtReadoutGeomTool", **kwargs)
MuonGeoUtilityToolCfg(flags, name="MuonGeoUtilityTool", **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)