1 """Define methods to construct configured MDT Digitization tools and algorithms
3 Copyright (C) 2002-2023 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 BeamType, ProductionStep
8 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
9 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
10 from MuonConfig.MuonByteStreamCnvTestConfig
import MdtDigitToMdtRDOCfg
11 from MuonConfig.MuonCablingConfig
import MDTCablingConfigCfg
12 from DigitizationConfig.TruthDigitizationOutputConfig
import TruthDigitizationOutputCfg
13 from DigitizationConfig.PileUpToolsConfig
import PileUpToolsCfg
14 from DigitizationConfig.PileUpMergeSvcConfig
import PileUpMergeSvcCfg, PileUpXingFolderCfg
29 """Return a PileUpXingFolder tool configured for MDT"""
32 kwargs.setdefault(
"CacheRefreshFrequency", 1.0)
33 if flags.Muon.usePhaseIIGeoSetup:
34 kwargs.setdefault(
"ItemList", [
"xAOD::MuonSimHitContainer#xMdtSimHits",
35 "xAOD::MuonSimHitAuxContainer#xMdtSimHitsAux."])
37 kwargs.setdefault(
"ItemList", [
"MDTSimHitCollection#MDT_Hits"])
42 """Return an RT_Relation_DB_DigiTool"""
44 acc.setPrivateTools(CompFactory.RT_Relation_DB_DigiTool(name, **kwargs))
49 """Return a configured MDT_Response_DigiTool"""
51 kwargs.setdefault(
"DoQballGamma", (flags.Input.SpecialConfiguration.get(
"MDT_QballConfig",
"False") ==
"True"))
52 MDT_Response_DigiTool = CompFactory.MDT_Response_DigiTool
58 """Return ComponentAccumulator with common MdtDigitizationTool config"""
59 from MuonConfig.MuonCondAlgConfig
import MdtCondDbAlgCfg
60 from MuonConfig.MuonCalibrationConfig
import MdtCalibDbAlgCfg
67 if not flags.Muon.usePhaseIIGeoSetup:
68 kwargs.setdefault(
"DiscardEarlyHits",
True)
69 kwargs.setdefault(
"UseTof", flags.Beam.Type
is not BeamType.Cosmics)
70 kwargs.setdefault(
"DoQballCharge", (flags.Input.SpecialConfiguration.get(
"MDT_QballConfig",
"False") ==
"True"))
74 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
76 kwargs.setdefault(
"useTwinTubes",
True)
77 if kwargs[
"useTwinTubes"]:
78 from MuonConfig.MuonCablingConfig
import MdtTwinTubeMapCondAlgCfg
81 kwargs.setdefault(
"SimHitKey",
"xMdtSimHits")
82 kwargs.setdefault(
"StreamName",
"MdtDigitForklifting")
84 if flags.Digitization.DoXingByXingPileUp:
87 from RngComps.RngCompsConfig
import AthRNGSvcCfg
88 kwargs.setdefault(
"RndmSvc", acc.getPrimaryAndMerge(
AthRNGSvcCfg(flags)))
89 if not flags.Muon.usePhaseIIGeoSetup:
90 acc.setPrivateTools(CompFactory.MdtDigitizationTool(name, **kwargs))
92 acc.setPrivateTools(CompFactory.MuonR4.MdtDigitizationTool(name, **kwargs))
97 """Return ComponentAccumulator with configured MdtDigitizationTool"""
99 if flags.Digitization.PileUp:
101 if not flags.Digitization.DoXingByXingPileUp:
102 intervals += [acc.popToolsAndMerge(
MDT_RangeCfg(flags))]
103 kwargs.setdefault(
"PileUpMergeSvc", acc.getPrimaryAndMerge(
PileUpMergeSvcCfg(flags, Intervals=intervals)).name)
105 kwargs.setdefault(
"PileUpMergeSvc",
'')
106 kwargs.setdefault(
"OnlyUseContainerName", flags.Digitization.PileUp)
107 kwargs.setdefault(
"OutputObjectName",
"MDT_DIGITS")
108 if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
109 kwargs.setdefault(
"OutputSDOName", flags.Overlay.BkgPrefix +
"MDT_SDO")
111 kwargs.setdefault(
"OutputSDOName",
"MDT_SDO")
113 acc.setPrivateTools(tool)
118 """Return ComponentAccumulator with MdtDigitizationTool configured for Overlay"""
119 kwargs.setdefault(
"OnlyUseContainerName",
False)
120 kwargs.setdefault(
"OutputObjectName", flags.Overlay.SigPrefix +
"MDT_DIGITS")
121 kwargs.setdefault(
"OutputSDOName", flags.Overlay.SigPrefix +
"MDT_SDO")
122 kwargs.setdefault(
"PileUpMergeSvc",
'')
127 """Return ComponentAccumulator with Output for MDT. Not standalone."""
129 if flags.Output.doWriteRDO:
130 ItemList = [
"MdtCsmContainer#*"]
131 if flags.Digitization.EnableTruth:
132 for pref
in [flags.Overlay.SigPrefix, flags.Overlay.BkgPrefix,
""]:
134 ItemList += [f
"MuonSimDataCollection#{pref}MDT_SDO"]
136 ItemList += [f
"xAOD::MuonSimHitContainer#{pref}MDT_SDO", f
"xAOD::MuonSimHitAuxContainer#{pref}MDT_SDOAux."]
143 """Return ComponentAccumulator for MDT digitization"""
145 if "PileUpTools" not in kwargs:
147 kwargs[
"PileUpTools"] = PileUpTools
153 """Return ComponentAccumulator with MDT Overlay digitization"""
155 from MuonConfig.MuonCalibrationConfig
import MdtCalibDbAlgCfg
158 if flags.Common.ProductionStep != ProductionStep.FastChain:
159 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
160 if flags.Muon.usePhaseIIGeoSetup:
162 "xAOD::MuonSimHitAuxContainer#xMdtSimHitsAux."]))
168 if flags.Concurrency.NumThreads > 0:
169 kwargs.setdefault(
"Cardinality", flags.Concurrency.NumThreads)
172 kwargs.setdefault(
"ExtraInputs", flags.Overlay.ExtraInputs)
174 acc.addEventAlgo(CompFactory.MuonDigitizer(name=
"MDT_OverlayDigitizer", **kwargs))
180 """Return ComponentAccumulator for MDT digitization and Output"""
187 """Return ComponentAccumulator with MDT digitization and Digit to MDTCSM RDO"""