ATLAS Offline Software
Loading...
Searching...
No Matches
MuonGeometryConfig Namespace Reference

Functions

 TrackingVolumesSvcCfg (flags, name="TrackingVolumesSvc", **kwargs)
 MuonIdHelperSvcCfg (flags)
 MuonGeoModelCfg (flags)
 MuonDetectorToolCfg (flags, name="MuonDetectorTool", **kwargs)
 MuonAlignmentCondAlgCfg (flags, name="MuonAlignmentCondAlg", **kwargs)
 MuonAlignmentErrorDbAlgCfg (flags)
 NswAsBuiltCondAlgCfg (flags, name="NswAsBuiltCondAlg", **kwargs)
 sTGCAsBuiltCondAlgCfg (flags, name="sTGCAsBuiltCondAlg", **kwargs)
 activateMmAsBuilt2PostExec (flags, cfg, **kwargs)
 MdtAsBuiltCondAlgCfg (flags, name="MdtAsBuiltCondAlg", **kwargs)
 CscILineCondAlgCfg (flags, name="CscILinesCondAlg", **kwargs)
 MuonDetectorCondAlgCfg (flags, name="MuonDetectorCondAlg", **kwargs)
 MuonGeoModelToolCfg (flags)
 RegionSelCondAlgCfg (flags, str detector, **kwargs)

Function Documentation

◆ activateMmAsBuilt2PostExec()

activateMmAsBuilt2PostExec ( flags,
cfg,
** kwargs )

Definition at line 179 of file MuonGeometryConfig.py.

179def activateMmAsBuilt2PostExec(flags, cfg, **kwargs):
180
181 name = "MmAsBuilt2CondAlg"
182 if flags.GeoModel.Run != LHCPeriod.Run3:
183 return
184 kwargs.setdefault("readFromJSON","")
185 kwargs.setdefault("WriteKey","MmAsBuilt2")
186 the_alg = CompFactory.Muon.sTGCAsBuiltCondAlg(name,**kwargs)
187 cfg.addCondAlgo(the_alg, primary=True)
188
189 cfg.getCondAlgo("MuonDetectorCondAlg").applyMmAsBuilt2=True
190 cfg.getCondAlgo("MuonDetectorCondAlg").ReadMmAsBuilt2Key = kwargs["WriteKey"]
191
192
193
194

◆ CscILineCondAlgCfg()

CscILineCondAlgCfg ( flags,
name = "CscILinesCondAlg",
** kwargs )

Definition at line 206 of file MuonGeometryConfig.py.

206def CscILineCondAlgCfg(flags, name="CscILinesCondAlg", **kwargs):
207 result = ComponentAccumulator()
208 if not flags.Muon.Align.UseILines:
209 return result
210 from IOVDbSvc.IOVDbSvcConfig import addFolders
211 if (flags.Common.isOnline and not flags.Input.isMC):
212 result.merge(addFolders( flags, ['/MUONALIGN/Onl/CSC/ILINES'], 'MUONALIGN', className='CondAttrListCollection'))
213 else:
214 result.merge(addFolders( flags, ['/MUONALIGN/CSC/ILINES'], 'MUONALIGN_OFL', className='CondAttrListCollection'))
215
216 the_alg = CompFactory.Muon.CscILinesCondAlg(name, **kwargs)
217 result.addCondAlgo(the_alg, primary = True)
218 return result
219
220
221@AccumulatorCache

◆ MdtAsBuiltCondAlgCfg()

MdtAsBuiltCondAlgCfg ( flags,
name = "MdtAsBuiltCondAlg",
** kwargs )

Definition at line 195 of file MuonGeometryConfig.py.

195def MdtAsBuiltCondAlgCfg(flags, name="MdtAsBuiltCondAlg", **kwargs):
196 result = ComponentAccumulator()
197 if not flags.Detector.GeometryMDT:
198 return result
199 from IOVDbSvc.IOVDbSvcConfig import addFolders
200 if "readFromJSON" not in kwargs or not kwargs["readFromJSON"]:
201 result.merge(addFolders( flags, '/MUONALIGN/MDT/ASBUILTPARAMS' , 'MUONALIGN_OFL', className='CondAttrListCollection'))
202 the_alg = CompFactory.Muon.MdtAsBuiltCondAlg(name = name, **kwargs)
203 result.addCondAlgo(the_alg, primary = True)
204 return result
205

◆ MuonAlignmentCondAlgCfg()

MuonAlignmentCondAlgCfg ( flags,
name = "MuonAlignmentCondAlg",
** kwargs )

Definition at line 104 of file MuonGeometryConfig.py.

104def MuonAlignmentCondAlgCfg(flags, name="MuonAlignmentCondAlg", **kwargs):
105 acc = ComponentAccumulator()
106
107 # here define if I-lines (CSC internal alignment) are enabled
108 acc.merge(CscILineCondAlgCfg(flags))
109 # here define if As-Built (MDT chamber alignment) are enabled
110 if flags.Muon.Align.UseAsBuilt:
111 acc.merge(MdtAsBuiltCondAlgCfg(flags))
112 acc.merge(NswAsBuiltCondAlgCfg(flags))
113 if(flags.Muon.Align.UsesTGCAsBuilt):
114 acc.merge(sTGCAsBuiltCondAlgCfg(flags))
115
116 if not flags.Muon.Align.UseALines and not flags.Muon.Align.UseBLines:
117 return acc
118 from IOVDbSvc.IOVDbSvcConfig import addFolders
119
120 onl = "/Onl" if ((flags.Common.isOnline or flags.IOVDb.GlobalTag.startswith("CONDBR2-HLTP")) and not flags.Input.isMC) else ""
121 ParlineFolders = [f"/MUONALIGN{onl}/MDT/BARREL",
122 f"/MUONALIGN{onl}/MDT/ENDCAP/SIDEA",
123 f"/MUONALIGN{onl}/MDT/ENDCAP/SIDEC",
124 f"/MUONALIGN{onl}/TGC/SIDEA",
125 f"/MUONALIGN{onl}/TGC/SIDEC"]
126 acc.merge(addFolders( flags, ParlineFolders, 'MUONALIGN' if len(onl) else 'MUONALIGN_OFL', className='CondAttrListCollection'))
127
128 if len(onl):
129 ParlineFolders = [ x[ :x.find(onl)] + x[x.find(onl) + len(onl): ] for x in ParlineFolders]
130
131 kwargs.setdefault("LoadALines", flags.Muon.Align.UseALines)
132 kwargs.setdefault("LoadBLines", flags.Muon.Align.UseBLines)
133
134 kwargs.setdefault("ParlineFolders", ParlineFolders)
135 MuonAlign = CompFactory.Muon.AlignmentCondAlg(name, **kwargs)
136 acc.addCondAlgo(MuonAlign, primary = True)
137 return acc
138
139
if(pathvar)

◆ MuonAlignmentErrorDbAlgCfg()

MuonAlignmentErrorDbAlgCfg ( flags)

Definition at line 140 of file MuonGeometryConfig.py.

140def MuonAlignmentErrorDbAlgCfg(flags):
141 acc = ComponentAccumulator()
142 from IOVDbSvc.IOVDbSvcConfig import addFolders
143 acc.merge(addFolders(flags, "/MUONALIGN/ERRS", "MUONALIGN_OFL", className="CondAttrListCollection"))
144 acc.addCondAlgo(CompFactory.Muon.AlignmentErrorDbAlg("MuonAlignmentErrorDbAlg"))
145 return acc
146

◆ MuonDetectorCondAlgCfg()

MuonDetectorCondAlgCfg ( flags,
name = "MuonDetectorCondAlg",
** kwargs )

Definition at line 222 of file MuonGeometryConfig.py.

222def MuonDetectorCondAlgCfg(flags, name = "MuonDetectorCondAlg", **kwargs):
223 result = ComponentAccumulator()
224
225 kwargs.setdefault("MuonDetectorTool", result.popToolsAndMerge(MuonDetectorToolCfg(flags)))
226 kwargs.setdefault("applyMmPassivation", flags.Muon.applyMMPassivation)
227
228 if kwargs["applyMmPassivation"]:
229 from MuonConfig.MuonCondAlgConfig import NswPassivationDbAlgCfg
230 result.merge(NswPassivationDbAlgCfg(flags))
231 if flags.Muon.enableAlignment:
232 result.merge(MuonAlignmentCondAlgCfg(flags))
233 kwargs.setdefault("applyALines", flags.Muon.Align.UseALines)
234 kwargs.setdefault("applyBLines", flags.Muon.Align.UseBLines)
235 kwargs.setdefault("applyILines", flags.Muon.Align.UseILines)
236 kwargs.setdefault("applyNswAsBuilt", len([alg for alg in result.getCondAlgos() if alg.name == "NswAsBuiltCondAlg"])>0)
237 kwargs.setdefault("applysTGCAsBuilt", len([alg for alg in result.getCondAlgos() if alg.name == "sTGCAsBuiltCondAlg"])>0)
238 kwargs.setdefault("applyMdtAsBuilt", len([alg for alg in result.getCondAlgos() if alg.name == "MdtAsBuiltCondAlg"])>0)
239
240
241
242 MuonDetectorManagerCond = CompFactory.MuonDetectorCondAlg(name, **kwargs)
243
244 result.addCondAlgo(MuonDetectorManagerCond, primary = True)
245 return result
246
247

◆ MuonDetectorToolCfg()

MuonDetectorToolCfg ( flags,
name = "MuonDetectorTool",
** kwargs )

Definition at line 50 of file MuonGeometryConfig.py.

50def MuonDetectorToolCfg(flags, name = "MuonDetectorTool", **kwargs):
51 acc = ComponentAccumulator()
52 kwargs.setdefault("HasCSC", flags.Detector.GeometryCSC)
53 kwargs.setdefault("HasSTgc", flags.Detector.GeometrysTGC)
54 kwargs.setdefault("HasMM", flags.Detector.GeometryMM)
55
56 kwargs.setdefault("UseConditionDb", flags.Muon.enableAlignment)
57 kwargs.setdefault("UseAsciiConditionData", flags.Muon.enableAlignment)
58
59 UseIlinesFromGM = False
60 EnableCscInternalAlignment = False
61
62 if flags.Muon.enableAlignment:
63 if not flags.Input.isMC:
64 kwargs.setdefault("BEENoShift", True)
65 # here define if I-lines (CSC internal alignment) are enabled
66 if flags.Muon.Align.UseILines and flags.Detector.GeometryCSC:
67 if 'HLT' in flags.IOVDb.GlobalTag:
68 #logMuon.info("Reading CSC I-Lines from layout - special configuration for COMP200 in HLT setup.")
69 UseIlinesFromGM = True
70 EnableCscInternalAlignment = False
71 else :
72 #logMuon.info("Reading CSC I-Lines from conditions database.")
73 if (flags.Common.isOnline and not flags.Input.isMC):
74 EnableCscInternalAlignment = True
75 else:
76 UseIlinesFromGM = False
77 EnableCscInternalAlignment = True
78
79 kwargs.setdefault("UseIlinesFromGM", UseIlinesFromGM)
80 kwargs.setdefault("EnableCscInternalAlignment", EnableCscInternalAlignment)
81
82 if not flags.GeoModel.SQLiteDB:
83
84 AGDD2Geo = CompFactory.AGDDtoGeoSvc()
85 muonAGDDTool = CompFactory.MuonAGDDTool("MuonSpectrometer", BuildNSW=False)
86 AGDD2Geo.Builders += [ muonAGDDTool ]
87 if (flags.Detector.GeometrysTGC and flags.Detector.GeometryMM):
88 nswAGDDTool = CompFactory.NSWAGDDTool("NewSmallWheel", Locked=False)
89 nswAGDDTool.Volumes = ["NewSmallWheel"]
90 nswAGDDTool.DefaultDetector = "Muon"
91 AGDD2Geo.Builders += [ nswAGDDTool ]
92
93 #create=True is needed for the service to be initialised in the new style
94 acc.addService(AGDD2Geo, create=True)
95
96
97 acc.merge(MuonIdHelperSvcCfg(flags))
98
99 detTool = CompFactory.MuonDetectorTool(name, **kwargs)
100 acc.setPrivateTools(detTool)
101 return acc
102
103

◆ MuonGeoModelCfg()

MuonGeoModelCfg ( flags)

Definition at line 28 of file MuonGeometryConfig.py.

28def MuonGeoModelCfg(flags):
29 result = ComponentAccumulator()
30 result.merge(MuonIdHelperSvcCfg(flags))
31 if flags.Muon.usePhaseIIGeoSetup:
32 from MuonGeoModelR4.MuonGeoModelConfig import MuonGeoModelCfg as MuonGeoModelCfgR4
33 result.merge(MuonGeoModelCfgR4(flags))
34 from MuonGeoModelR4.MuonGeoModelConfig import MuonAlignStoreCfg
35 result.merge(MuonAlignStoreCfg(flags))
36 if flags.Common.ProductionStep != ProductionStep.Simulation:
37 from MuonGeometryCnv.MuonReadoutGeomCnvCfg import MuonReadoutGeometryCnvAlgCfg
38 # For the moment this converter is still needed for some last clients to run in the phase II setup.
39 # The conversion is throwing some warnings but is successfully converting the relevant parts of the geometry.
40 # Since this converter is only needed temporarily and a significant amount of work would be needed to adress the warnings the output level is set to ERROR to avoid spamming the log file with warnings.
41 from AthenaCommon.Constants import ERROR
42 result.merge(MuonReadoutGeometryCnvAlgCfg(flags, OutputLevel=ERROR))
43 return result
44
45 result.merge(MuonGeoModelToolCfg(flags))
46 result.merge(MuonDetectorCondAlgCfg(flags))
47 return result
48
49

◆ MuonGeoModelToolCfg()

MuonGeoModelToolCfg ( flags)

Definition at line 248 of file MuonGeometryConfig.py.

248def MuonGeoModelToolCfg(flags):
249 result = ComponentAccumulator()
250 geoModelSvc = result.getPrimaryAndMerge(GeoModelCfg(flags))
251 geoModelSvc.DetectorTools+= [result.popToolsAndMerge(MuonDetectorToolCfg(flags))]
252 return result
253

◆ MuonIdHelperSvcCfg()

MuonIdHelperSvcCfg ( flags)

Definition at line 15 of file MuonGeometryConfig.py.

15def MuonIdHelperSvcCfg(flags):
16 acc = ComponentAccumulator()
17 acc.merge(GeoModelCfg(flags))
18 acc.addService( CompFactory.Muon.MuonIdHelperSvc("MuonIdHelperSvc",
19 HasCSC=flags.Detector.GeometryCSC,
20 HasSTGC=flags.Detector.GeometrysTGC,
21 HasMM=flags.Detector.GeometryMM,
22 HasMDT=flags.Detector.GeometryMDT,
23 HasRPC=flags.Detector.GeometryRPC,
24 HasTGC=flags.Detector.GeometryTGC), primary=True )
25 return acc
26
27@AccumulatorCache

◆ NswAsBuiltCondAlgCfg()

NswAsBuiltCondAlgCfg ( flags,
name = "NswAsBuiltCondAlg",
** kwargs )

Definition at line 147 of file MuonGeometryConfig.py.

147def NswAsBuiltCondAlgCfg(flags, name = "NswAsBuiltCondAlg", **kwargs):
148 result = ComponentAccumulator()
149
150 if flags.GeoModel.Run < LHCPeriod.Run3:
151 return result
152 kwargs.setdefault("MicroMegaJSON","")
153
154 kwargs.setdefault("ReadMmAsBuiltParamsKey","/MUONALIGN/ASBUILTPARAMS/MM")
155
156
157 from IOVDbSvc.IOVDbSvcConfig import addFolders
158 if(not (kwargs["MicroMegaJSON"] or not kwargs["ReadMmAsBuiltParamsKey"]) ) : # no need to add the folder if we are reading a json file anyhow
159 result.merge(addFolders( flags, kwargs["ReadMmAsBuiltParamsKey"] , 'MUONALIGN_OFL', className='CondAttrListCollection'))
160 the_alg = CompFactory.Muon.NswAsBuiltCondAlg(name, **kwargs)
161 result.addCondAlgo(the_alg, primary = True)
162 return result
163

◆ RegionSelCondAlgCfg()

RegionSelCondAlgCfg ( flags,
str detector,
** kwargs )

Definition at line 254 of file MuonGeometryConfig.py.

254def RegionSelCondAlgCfg(flags, detector: str, **kwargs):
255 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
256 from AthenaConfiguration.ComponentFactory import CompFactory
257 from MuonConfig.MuonCablingConfig import RPCCablingConfigCfg, MDTCablingConfigCfg, TGCCablingConfigCfg
258 from MuonConfig.MuonCondAlgConfig import MdtCondDbAlgCfg
259 result = ComponentAccumulator()
260 kwargs.setdefault("name", f"RegSelCondAlg_{detector}")
261 kwargs.setdefault("RegSelLUT", f"RegSelLUTCondData_{detector}")
262 kwargs.setdefault("PrintTable", flags.hasFlag("PrintLUT") and flags.PrintLUT)
263
264 result.merge(MuonGeoModelCfg(flags))
265 result.merge(RPCCablingConfigCfg(flags))
266 result.merge(MDTCablingConfigCfg(flags))
267 result.merge(TGCCablingConfigCfg(flags))
268
269
270 result.merge(MdtCondDbAlgCfg(flags))
271
272 the_alg = None
273 if (flags.Muon.usePhaseIIGeoSetup and flags.Trigger.Muon.useNewRegionSelector ):
274 if not flags.Detector.GeometryMDT:
275 kwargs.setdefault("MdtCablingKey", "")
276 if not flags.Detector.GeometryRPC:
277 kwargs.setdefault("RpcCablingKey", "")
278 if not flags.Detector.GeometryTGC:
279 kwargs.setdefault("TgcCablingKey", "")
280 alignDet = ""
281 if detector == "MDT": alignDet = "Mdt"
282 elif detector == "RPC": alignDet = "Rpc"
283 elif detector == "TGC": alignDet = "Tgc"
284 elif detector == "sTGC": alignDet = "sTgc"
285 elif detector == "MM": alignDet = "Mm"
286
287 kwargs.setdefault("AlignKey", f"{alignDet}ActsAlignContainer")
288 from MuonConfig.MuonConfigFlags import GeoTrfCacheMode
289 kwargs.setdefault("splitTrfCache", flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SplitCache or
290 flags.Muon.AlignedGeoTrfCacheMode == GeoTrfCacheMode.SlopyCache)
291 the_alg = CompFactory.MuonR4.RegionSelectorCondAlg(**kwargs)
292
293 elif detector == "MDT":
294 if not flags.Muon.useMdtDcsData:
295 kwargs.setdefault("Conditions", "")
296 the_alg = CompFactory.MDT_RegSelCondAlg(**kwargs)
297 elif detector == "RPC":
298 the_alg = CompFactory.RPC_RegSelCondAlg(**kwargs)
299 elif detector == "TGC":
300 the_alg = CompFactory.TGC_RegSelCondAlg(**kwargs)
301 elif detector == "sTGC":
302 the_alg = CompFactory.sTGC_RegSelCondAlg(**kwargs)
303 elif detector == "MM":
304 the_alg = CompFactory.MM_RegSelCondAlg(**kwargs)
305 else:
306 raise ValueError(f"The {detector} is an unknown detector flag")
307 result.addCondAlgo(the_alg, primary = True)
308 return result

◆ sTGCAsBuiltCondAlgCfg()

sTGCAsBuiltCondAlgCfg ( flags,
name = "sTGCAsBuiltCondAlg",
** kwargs )

Definition at line 164 of file MuonGeometryConfig.py.

164def sTGCAsBuiltCondAlgCfg(flags, name = "sTGCAsBuiltCondAlg", **kwargs):
165 result = ComponentAccumulator()
166
167 if flags.GeoModel.Run < LHCPeriod.Run3 or not flags.Muon.Align.UsesTGCAsBuilt:
168 return result
169 kwargs.setdefault("readFromJSON","")
170 if not kwargs["readFromJSON"]:
171 kwargs.setdefault("ReadKey","/MUONALIGN/ASBUILTPARAMS/STGC")
172 from IOVDbSvc.IOVDbSvcConfig import addFolders
173 result.merge(addFolders( flags, kwargs["ReadKey"], 'MUONALIGN_OFL', className='CondAttrListCollection'))
174 the_alg = CompFactory.Muon.sTGCAsBuiltCondAlg(name,**kwargs)
175 result.addCondAlgo(the_alg, primary=True)
176 return result
177
178# since the MM as built 2 corrections are not supossed to run in standart reco job just a fragment to activate them in a postExex is provided

◆ TrackingVolumesSvcCfg()

TrackingVolumesSvcCfg ( flags,
name = "TrackingVolumesSvc",
** kwargs )

Definition at line 10 of file MuonGeometryConfig.py.

10def TrackingVolumesSvcCfg(flags, name="TrackingVolumesSvc", **kwargs):
11 result = ComponentAccumulator()
12 trackingVolSvc = CompFactory.Trk.TrackingVolumesSvc(name=name, **kwargs)
13 result.addService(trackingVolSvc, primary=True)
14 return result