1 """Define methods to construct configured MM Digitization tools and algorithms
3 Copyright (C) 2002-2022 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 DigitizationConfig.PileUpMergeSvcConfig
import PileUpMergeSvcCfg, PileUpXingFolderCfg
9 from DigitizationConfig.PileUpToolsConfig
import PileUpToolsCfg
10 from DigitizationConfig.TruthDigitizationOutputConfig
import TruthDigitizationOutputCfg
11 from MagFieldServices.MagFieldServicesConfig
import AtlasFieldCacheCondAlgCfg
12 from MuonConfig.MuonByteStreamCnvTestConfig
import MM_DigitToRDOCfg
13 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
14 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
27 """Return a PileUpXingFolder tool configured for MM"""
30 kwargs.setdefault(
"CacheRefreshFrequency", 1.0)
31 if flags.Muon.usePhaseIIGeoSetup:
32 kwargs.setdefault(
"ItemList", [
"xAOD::MuonSimHitContainer#xMmSimHits",
33 "xAOD::MuonSimHitAuxContainer#xMmSimHitsAux."])
35 kwargs.setdefault(
"ItemList", [
"MMSimHitCollection#MM_Hits"])
40 """Return ComponentAccumulator with configured MM_DigitizationTool"""
43 from RngComps.RngCompsConfig
import AthRNGSvcCfg
44 kwargs.setdefault(
"RndmSvc", result.getPrimaryAndMerge(
AthRNGSvcCfg(flags)))
46 if flags.Digitization.PileUp:
48 if flags.Digitization.DoXingByXingPileUp:
52 intervals += [result.popToolsAndMerge(
MM_RangeCfg(flags))]
53 kwargs.setdefault(
"PileUpMergeSvc", result.getPrimaryAndMerge(
PileUpMergeSvcCfg(flags, Intervals=intervals)).name)
55 kwargs.setdefault(
"PileUpMergeSvc",
'')
57 kwargs.setdefault(
"OnlyUseContainerName", flags.Digitization.PileUp)
59 kwargs.setdefault(
"OutputObjectName",
"MM_DIGITS")
60 if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
61 kwargs.setdefault(
"OutputSDOName", flags.Overlay.BkgPrefix +
"MM_SDO")
63 kwargs.setdefault(
"OutputSDOName",
"MM_SDO")
66 if not flags.Muon.usePhaseIIGeoSetup:
67 from MuonConfig.MuonCalibrationConfig
import NSWCalibToolCfg, MMCalibSmearingToolCfg
68 kwargs.setdefault(
"CalibrationTool", result.popToolsAndMerge(
NSWCalibToolCfg(flags)))
71 kwargs.setdefault(
"CheckSimHits",
True)
72 the_tool = CompFactory.MM_DigitizationTool(name, **kwargs)
73 elif flags.Muon.doFastMMDigitization:
74 kwargs.setdefault(
"StreamName",
"MmSimForklift")
75 kwargs.setdefault(
"SimHitKey",
"xMmSimHits")
77 from MuonConfig.MuonCondAlgConfig import MmDigitEffiCondAlgCfg
78 result.merge(MmDigitEffiCondAlgCfg(flags,readFromJSON="EffMapMM.json"))
79 kwargs.setdefault("EffiDataKey", "MmDigitEff")
82 kwargs.setdefault(
"EffiDataKey",
"")
84 from MuonConfig.MuonCalibrationConfig
import NswErrorCalibDbAlgCfg
86 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
88 the_tool = CompFactory.MuonR4.MmFastDigiTool(name, **kwargs)
90 from MuonConfig.MuonCalibrationConfig
import NSWCalibToolCfg, MMCalibSmearingToolCfg
91 kwargs.setdefault(
"CalibrationTool", result.popToolsAndMerge(
NSWCalibToolCfg(flags)))
94 kwargs.setdefault(
"CheckSimHits",
True)
96 kwargs.setdefault(
"StreamName",
"MmSimForklift")
97 kwargs.setdefault(
"SimHitKey",
"xMmSimHits")
99 kwargs.setdefault(
"EffiDataKey",
"")
101 from MuonConfig.MuonCalibrationConfig
import NswErrorCalibDbAlgCfg
103 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
105 the_tool = CompFactory.MuonR4.MM_DigitizationTool(name, **kwargs)
108 result.setPrivateTools(the_tool)
113 """Return ComponentAccumulator with MM_DigitizationTool configured for Overlay"""
115 kwargs.setdefault(
"PileUpMergeSvc",
'')
117 kwargs.setdefault(
"OnlyUseContainerName",
False)
118 kwargs.setdefault(
"OutputObjectName", flags.Overlay.SigPrefix +
"MM_DIGITS")
119 kwargs.setdefault(
"OutputSDOName", flags.Overlay.SigPrefix +
"MM_SDO")
121 acc.setPrivateTools(the_tool)
126 """Return ComponentAccumulator with Output for MM. Not standalone."""
128 if flags.Output.doWriteRDO:
129 ItemList = [
"Muon::MM_RawDataContainer#*"]
130 if flags.Digitization.EnableTruth:
131 ItemList += [
"MuonSimDataCollection#*"]
132 ItemList += [
"xAOD::MuonSimHitContainer#*MM_SDO",
133 "xAOD::MuonSimHitAuxContainer#*MM_SDOAux."]
141 """Return ComponentAccumulator for MM digitization"""
143 if "PileUpTools" not in kwargs:
145 kwargs[
"PileUpTools"] = PileUpTools
151 """Return ComponentAccumulator with MM Overlay digitization"""
153 if flags.Common.ProductionStep != ProductionStep.FastChain:
154 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
155 if flags.Muon.usePhaseIIGeoSetup:
157 "xAOD::muonSimHitAuxConatiner#xMmSimHitsAux."]))
163 if flags.Concurrency.NumThreads > 0:
164 kwargs.setdefault(
"Cardinality", flags.Concurrency.NumThreads)
167 kwargs.setdefault(
"ExtraInputs", flags.Overlay.ExtraInputs)
169 acc.addEventAlgo(CompFactory.MuonDigitizer(name=
"MM_OverlayDigitizer", **kwargs))
175 """Return ComponentAccumulator for MM digitization and Output"""
182 """Return ComponentAccumulator with TGC digitization and Digit to TGCRDO"""