1 """Define ComponentAccumulator functions for configuration of muon data conversions
3 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from AthenaConfiguration.Enums
import ProductionStep
8 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
9 from MuonConfig.MuonCablingConfig
import MDTCablingConfigCfg
15 kwargs.setdefault(
"MuonIdHelperSvc", acc.getService(
"MuonIdHelperSvc"))
16 acc.setPrivateTools(CompFactory.Muon.MdtRDO_Decoder(name, **kwargs))
21 """Return ComponentAccumulator with configured MdtRdoToMdtDigit algorithm"""
24 if flags.Common.isOverlay:
25 kwargs.setdefault(
"MdtRdoContainer", f
"{flags.Overlay.BkgPrefix}MDTCSM")
26 kwargs.setdefault(
"MdtDigitContainer", f
"{flags.Overlay.BkgPrefix}MDT_DIGITS")
28 if flags.Overlay.ByteStream:
29 from MuonConfig.MuonBytestreamDecodeConfig
import MdtBytestreamDecodeCfg
32 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
33 acc.merge(
SGInputLoaderCfg(flags, [f
'MdtCsmContainer#{kwargs["MdtRdoContainer"]}']))
35 kwargs.setdefault(
"MdtRdoContainer",
"MDTCSM")
36 kwargs.setdefault(
"MdtDigitContainer",
"MDT_DIGITS")
38 kwargs.setdefault(
"mdtRdoDecoderTool", acc.popToolsAndMerge(
MdtRDO_DecoderCfg(flags)))
40 acc.addEventAlgo(CompFactory.MdtRdoToMdtDigit(name, **kwargs))
45 """Return ComponentAccumulator with configured RpcRdoToRpcDigit algorithm"""
48 if flags.Common.isOverlay:
49 kwargs.setdefault(
"RpcRdoContainer", f
"{flags.Overlay.BkgPrefix}RPCPAD")
50 kwargs.setdefault(
"RpcDigitContainer", f
"{flags.Overlay.BkgPrefix}RPC_DIGITS")
51 kwargs.setdefault(
"NRpcRdoContainer", f
"{flags.Overlay.BkgPrefix}NRPCRDO")
53 kwargs.setdefault(
"RpcRdoContainer",
"RPCPAD")
54 kwargs.setdefault(
"RpcDigitContainer",
"RPC_DIGITS")
55 kwargs.setdefault(
"NRpcRdoContainer",
"NRPCRDO")
57 container = [x
for x
in flags.Input.TypedCollections \
58 if x ==
"RpcPadContainer#{cont_name}".
format(cont_name=kwargs[
"RpcRdoContainer"])
or \
59 x ==
"xAOD::NRPCRDOContainer#{cont_name}".
format(cont_name=kwargs[
"NRpcRdoContainer"])
or \
60 x ==
"xAOD::NRPCRDOAuxContainer#{cont_name}Aux.".
format(cont_name=kwargs[
"NRpcRdoContainer"]) ]
62 if flags.Common.isOverlay:
63 if flags.Overlay.ByteStream:
64 from MuonConfig.MuonBytestreamDecodeConfig
import RpcBytestreamDecodeCfg
67 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
72 kwargs.setdefault(
"DecodeNrpcRDO", len(container) > 1 )
74 kwargs.setdefault(
"DecodeLegacyRDO", len(container) % 2
or \
76 if kwargs[
"DecodeNrpcRDO"]:
77 from MuonConfig.MuonCablingConfig
import NRPCCablingConfigCfg
79 if kwargs[
"DecodeLegacyRDO"]:
80 from MuonConfig.MuonCablingConfig
import RPCLegacyCablingConfigCfg
84 kwargs.setdefault(
"rpcRdoDecoderTool", CompFactory.Muon.RpcRDO_Decoder(
"RpcRDO_Decoder",
85 BCZERO=flags.Trigger.L1MuonSim.RPCNBCZ))
87 acc.addEventAlgo(CompFactory.Muon.RpcRdoToRpcDigit(name, **kwargs))
92 """Return ComponentAccumulator with configured TgcRdoToTgcDigit algorithm"""
95 from MuonConfig.MuonCablingConfig
import TGCCablingConfigCfg
98 if flags.Common.isOverlay:
99 kwargs.setdefault(
"TgcRdoContainer", f
"{flags.Overlay.BkgPrefix}TGCRDO")
100 kwargs.setdefault(
"TgcDigitContainer",f
"{flags.Overlay.BkgPrefix}TGC_DIGITS")
102 if flags.Overlay.ByteStream:
103 from MuonConfig.MuonBytestreamDecodeConfig
import TgcBytestreamDecodeCfg
106 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
107 acc.merge(
SGInputLoaderCfg(flags, [f
'TgcRdoContainer#{kwargs["TgcRdoContainer"]}']))
109 kwargs.setdefault(
"TgcRdoContainer",
"TGCRDO")
110 kwargs.setdefault(
"TgcDigitContainer",
"TGC_DIGITS")
112 acc.addEventAlgo(CompFactory.TgcRdoToTgcDigit(name, **kwargs))
117 """Return ComponentAccumulator with configured STGC_RdoToDigit algorithm"""
120 if flags.Common.isOverlay:
121 kwargs.setdefault(
"sTgcRdoContainer", f
"{flags.Overlay.BkgPrefix}sTGCRDO")
122 kwargs.setdefault(
"sTgcDigitContainer",f
"{flags.Overlay.BkgPrefix}sTGC_DIGITS")
124 if flags.Overlay.ByteStream:
125 from MuonConfig.MuonBytestreamDecodeConfig
import sTgcBytestreamDecodeCfg
128 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
129 acc.merge(
SGInputLoaderCfg(flags, [f
'Muon::STGC_RawDataContainer#{kwargs["sTgcRdoContainer"]}']))
131 kwargs.setdefault(
"sTgcRdoContainer",
"sTGCRDO")
132 kwargs.setdefault(
"sTgcDigitContainer",
"sTGC_DIGITS")
134 kwargs.setdefault(
"sTgcRdoDecoderTool", acc.popToolsAndMerge(
STgcRdoDecoderCfg(flags)))
136 acc.addEventAlgo(CompFactory.STGC_RdoToDigit(name, **kwargs))
141 """Return ComponentAccumulator with configured MM_RdoToDigit algorithm"""
144 if flags.Common.isOverlay:
145 kwargs.setdefault(
"MmRdoContainer", f
"{flags.Overlay.BkgPrefix}MMRDO")
146 kwargs.setdefault(
"MmDigitContainer", f
"{flags.Overlay.BkgPrefix}MM_DIGITS")
148 if flags.Overlay.ByteStream:
149 from MuonConfig.MuonBytestreamDecodeConfig
import MmBytestreamDecodeCfg
152 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
153 acc.merge(
SGInputLoaderCfg(flags, [f
'Muon::MM_RawDataContainer#{kwargs["MmRdoContainer"]}']))
155 kwargs.setdefault(
"MmRdoContainer",
"MMRDO")
156 kwargs.setdefault(
"MmDigitContainer",
"MM_DIGITS")
158 kwargs.setdefault(
"mmRdoDecoderTool", acc.popToolsAndMerge(
MMRdoDecoderCfg(flags)))
160 acc.addEventAlgo(CompFactory.MM_RdoToDigit(name, **kwargs))
165 """Return ComponentAccumulator with configured MdtDigitToMdtRDO algorithm"""
167 kwargs.setdefault(
"MuonIdHelperSvc", acc.getPrimaryAndMerge(
MuonIdHelperSvcCfg(flags)))
168 if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
169 kwargs.setdefault(
"OutputObjectName", f
"{flags.Overlay.BkgPrefix}MDTCSM")
171 kwargs.setdefault(
"OutputObjectName",
"MDTCSM")
173 acc.addEventAlgo(CompFactory.MdtDigitToMdtRDO(name, **kwargs))
178 """Return ComponentAccumulator with configured RpcDigitToRpcRDO algorithm"""
180 from MuonConfig.MuonCondAlgConfig
import RpcCondDbAlgCfg
182 from MuonConfig.MuonCablingConfig
import RPCCablingConfigCfg
184 kwargs.setdefault(
"MuonIdHelperSvc", acc.getPrimaryAndMerge(
MuonIdHelperSvcCfg(flags)))
186 if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
187 kwargs.setdefault(
"OutputObjectName", f
"{flags.Overlay.BkgPrefix}RPCPAD")
189 kwargs.setdefault(
"OutputObjectName",
"RPCPAD")
191 kwargs.setdefault(
"NOBXS", flags.Trigger.L1MuonSim.RPCNBX)
192 kwargs.setdefault(
"BCZERO", flags.Trigger.L1MuonSim.RPCNBCZ)
194 acc.addEventAlgo(CompFactory.RpcDigitToRpcRDO(name, **kwargs))
199 """Return ComponentAccumulator with configured NrpcDigitToNrpcRDO algorithm"""
201 kwargs.setdefault(
"MuonIdHelperSvc", acc.getPrimaryAndMerge(
MuonIdHelperSvcCfg(flags)))
203 from MuonConfig.MuonCablingConfig
import NRPCCablingConfigCfg
206 if flags.Muon.usePhaseIIGeoSetup:
207 kwargs.setdefault(
"ConvertHitsFromStations", [])
209 if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
210 kwargs.setdefault(
"NrpcRdoKey", f
"{flags.Overlay.BkgPrefix}NRPCRDO")
212 kwargs.setdefault(
"NrpcRdoKey",
"NRPCRDO")
214 acc.addEventAlgo(CompFactory.Muon.NrpcDigitToNrpcRDO(name, **kwargs))
219 """Return ComponentAccumulator with configured TgcDigitToTgcRDO algorithm"""
221 kwargs.setdefault(
"MuonIdHelperSvc", acc.getPrimaryAndMerge(
MuonIdHelperSvcCfg(flags)))
223 if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
224 kwargs.setdefault(
"OutputObjectName", f
"{flags.Overlay.BkgPrefix}TGCRDO")
226 kwargs.setdefault(
"OutputObjectName",
"TGCRDO")
228 acc.addEventAlgo(CompFactory.TgcDigitToTgcRDO(name, **kwargs))
233 """Return ComponentAccumulator with configured CscDigitToCscRDOTool"""
236 kwargs.setdefault(
"MuonIdHelperSvc", acc.getPrimaryAndMerge(
MuonIdHelperSvcCfg(flags)))
237 from MuonConfig.MuonCalibrationConfig
import CscCalibToolCfg
238 kwargs.setdefault(
"cscCalibTool", acc.popToolsAndMerge(
CscCalibToolCfg(flags)))
239 kwargs.setdefault(
"NumSamples", 4)
240 kwargs.setdefault(
"Latency", 0)
241 kwargs.setdefault(
"addNoise",
not flags.Common.isOverlay)
243 if flags.Common.isOverlay:
244 kwargs.setdefault(
"InputObjectName", f
"{flags.Overlay.SigPrefix}CSC_DIGITS")
245 kwargs.setdefault(
"OutputObjectName", f
"{flags.Overlay.SigPrefix}CSCRDO")
246 elif flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
247 kwargs.setdefault(
"OutputObjectName", f
"{flags.Overlay.BkgPrefix}CSCRDO")
249 kwargs.setdefault(
"OutputObjectName",
"CSCRDO")
251 from RngComps.RngCompsConfig
import AthRNGSvcCfg
252 kwargs.setdefault(
"RndmSvc", acc.getPrimaryAndMerge(
AthRNGSvcCfg(flags)).name)
253 acc.setPrivateTools(CompFactory.CscDigitToCscRDOTool(
"CscDigitToCscRDOTool", **kwargs))
258 """Return ComponentAccumulator with configured CscDigitToCscRDO algorithm"""
263 if flags.Concurrency.NumThreads > 0:
264 kwargs.setdefault(
"Cardinality", flags.Concurrency.NumThreads)
266 acc.addEventAlgo(CompFactory.CscDigitToCscRDO(name, **kwargs))
271 """Return ComponentAccumulator with configured STGC_DigitToRDO algorithm"""
273 kwargs.setdefault(
"MuonIdHelperSvc", acc.getPrimaryAndMerge(
MuonIdHelperSvcCfg(flags)))
275 if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
276 kwargs.setdefault(
"OutputObjectName", f
"{flags.Overlay.BkgPrefix}sTGCRDO")
278 kwargs.setdefault(
"OutputObjectName",
"sTGCRDO")
280 from MuonConfig.MuonCalibrationConfig
import NSWCalibToolCfg
281 kwargs.setdefault(
"CalibrationTool", acc.popToolsAndMerge(
NSWCalibToolCfg(flags)))
283 acc.addEventAlgo(CompFactory.STGC_DigitToRDO(name, **kwargs))
288 """Return ComponentAccumulator with configured MM_DigitToRDO algorithm"""
290 kwargs.setdefault(
"MuonIdHelperSvc", acc.getPrimaryAndMerge(
MuonIdHelperSvcCfg(flags)))
292 if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
293 kwargs.setdefault(
"OutputObjectName", f
"{flags.Overlay.BkgPrefix}MMRDO")
295 kwargs.setdefault(
"OutputObjectName",
"MMRDO")
297 from MuonConfig.MuonCalibrationConfig
import NSWCalibToolCfg
298 kwargs.setdefault(
"CalibrationTool", acc.popToolsAndMerge(
NSWCalibToolCfg(flags)))
300 acc.addEventAlgo(CompFactory.MM_DigitToRDO(name, **kwargs))
305 """Return ComponentAccumulator with configured MdtDigitToMdtRDO algorithm"""
307 kwargs.setdefault(
"MuonIdHelperSvc", acc.getPrimaryAndMerge(
MuonIdHelperSvcCfg(flags)))
308 kwargs.setdefault(
"InputObjectName", f
"{flags.Overlay.SigPrefix}MDT_DIGITS")
309 kwargs.setdefault(
"OutputObjectName", f
"{flags.Overlay.SigPrefix}MDTCSM")
310 acc.addEventAlgo(CompFactory.MdtDigitToMdtRDO(name, **kwargs))
315 """Return ComponentAccumulator with configured RpcDigitToRpcRDO algorithm"""
317 kwargs.setdefault(
"MuonIdHelperSvc", acc.getPrimaryAndMerge(
MuonIdHelperSvcCfg(flags)))
318 kwargs.setdefault(
"InputObjectName", f
"{flags.Overlay.SigPrefix}RPC_DIGITS")
319 kwargs.setdefault(
"OutputObjectName", f
"{flags.Overlay.SigPrefix}RPCPAD")
320 acc.addEventAlgo(CompFactory.RpcDigitToRpcRDO(name, **kwargs))
325 """Return ComponentAccumulator with configured TgcDigitToTgcRDO algorithm"""
327 kwargs.setdefault(
"MuonIdHelperSvc", acc.getPrimaryAndMerge(
MuonIdHelperSvcCfg(flags)))
328 kwargs.setdefault(
"InputObjectName", f
"{flags.Overlay.SigPrefix}TGC_DIGITS")
329 kwargs.setdefault(
"OutputObjectName", f
"{flags.Overlay.SigPrefix}TGCRDO")
330 acc.addEventAlgo(CompFactory.TgcDigitToTgcRDO(name, **kwargs))
336 from MuonConfig.MuonCalibrationConfig
import NSWCalibToolCfg
337 kwargs.setdefault(
"CalibrationTool", result.popToolsAndMerge(
NSWCalibToolCfg(flags)))
338 result.setPrivateTools(CompFactory.Muon.STGC_RDO_Decoder(name, **kwargs))
344 from MuonConfig.MuonCalibrationConfig
import NSWCalibToolCfg
345 kwargs.setdefault(
"CalibrationTool", result.popToolsAndMerge(
NSWCalibToolCfg(flags)))
346 result.setPrivateTools(CompFactory.Muon.MM_RDO_Decoder(name, **kwargs))
352 from MuonConfig.MuonCablingConfig
import MDTCablingConfigCfg
354 result.setPrivateTools(CompFactory.Muon.MdtRDO_Decoder(name, **kwargs))