ATLAS Offline Software
sTGC_DigitizationConfig.py
Go to the documentation of this file.
1 """Define methods to construct configured STGC Digitization tools and algorithms
2 
3 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4 """
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.Enums import ProductionStep
8 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
9 from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
10 from MuonConfig.MuonByteStreamCnvTestConfig import STGC_DigitToRDOCfg
11 from DigitizationConfig.TruthDigitizationOutputConfig import TruthDigitizationOutputCfg
12 from DigitizationConfig.PileUpToolsConfig import PileUpToolsCfg
13 from DigitizationConfig.PileUpMergeSvcConfig import PileUpMergeSvcCfg, PileUpXingFolderCfg
14 
15 
16 # The earliest and last bunch crossing times for which interactions will be sent
17 # to the sTgcDigitizationTool.
19  return -100
20 
21 
23  return 100
24 
25 
26 def sTGC_RangeCfg(flags, name="sTgcRange", **kwargs):
27  """Return a PileUpXingFolder tool configured for sTGC"""
28  kwargs.setdefault("FirstXing", sTGC_FirstXing())
29  kwargs.setdefault("LastXing", sTGC_LastXing())
30  kwargs.setdefault("CacheRefreshFrequency", 1.0)
31  if flags.Muon.usePhaseIIGeoSetup:
32  kwargs.setdefault("ItemList", ["xAOD::MuonSimHitContainer#xStgcSimHits",
33  "xAOD::MuonSimHitAuxContainer#xStgcSimHitsAux."])
34  else:
35  kwargs.setdefault("ItemList", ["sTGCSimHitCollection#sTGC_Hits"])
36  return PileUpXingFolderCfg(flags, name, **kwargs)
37 
38 def sTGC_DigitizationToolCfg(flags, name="sTgcDigitizationTool", **kwargs):
39  result = ComponentAccumulator()
40 
41  from RngComps.RngCompsConfig import AthRNGSvcCfg
42  kwargs.setdefault("RndmSvc", result.getPrimaryAndMerge(AthRNGSvcCfg(flags)))
43 
44 
45  if flags.Digitization.PileUp:
46  intervals = []
47  if flags.Digitization.DoXingByXingPileUp:
48  kwargs.setdefault("FirstXing", sTGC_FirstXing())
49  kwargs.setdefault("LastXing", sTGC_LastXing())
50  else:
51  intervals += [result.popToolsAndMerge(sTGC_RangeCfg(flags))]
52  kwargs.setdefault("PileUpMergeSvc", result.getPrimaryAndMerge(PileUpMergeSvcCfg(flags, Intervals=intervals)))
53  else:
54  kwargs.setdefault("PileUpMergeSvc", '')
55  kwargs.setdefault("OnlyUseContainerName", flags.Digitization.PileUp)
56 
57  if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
58  kwargs.setdefault("OutputSDOName", flags.Overlay.BkgPrefix + "sTGC_SDO")
59  else:
60  kwargs.setdefault("OutputSDOName", "sTGC_SDO")
61  kwargs.setdefault("OutputObjectName", "sTGC_DIGITS")
62 
63  the_tool = None
64  if not flags.Muon.usePhaseIIGeoSetup:
65  from MuonConfig.MuonCalibrationConfig import NSWCalibToolCfg, STgcCalibSmearingToolCfg
66  kwargs.setdefault("CalibrationTool", result.popToolsAndMerge(NSWCalibToolCfg(flags)))
67  kwargs.setdefault("SmearingTool", result.popToolsAndMerge(STgcCalibSmearingToolCfg(flags)))
68  # sTGC VMM configurables
69  kwargs.setdefault("doToFCorrection", True)
70  kwargs.setdefault("InputObjectName", "sTGC_Hits")
71  the_tool = CompFactory.sTgcDigitizationTool(name, **kwargs)
72  else:
73  from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsGeometryContextAlgCfg
74  result.merge(ActsGeometryContextAlgCfg(flags))
75  kwargs.setdefault("StreamName", "sTgcSimForklift")
76  kwargs.setdefault("SimHitKey", "xStgcSimHits")
77  kwargs.setdefault("EffiDataKey", "")
78  """
79  from MuonConfig.MuonCondAlgConfig import sTgcDigitEffiCondAlgCfg
80  result.merge(sTgcDigitEffiCondAlgCfg(flags,readFromJSON="EffMapsTGC.json"))
81  kwargs.setdefault("EffiDataKey", "sTgcDigitEff")
82  """
83  from MuonConfig.MuonCalibrationConfig import NswErrorCalibDbAlgCfg
84  result.merge(NswErrorCalibDbAlgCfg(flags))
85  the_tool = CompFactory.MuonR4.sTgcFastDigiTool(name, **kwargs)
86 
87  result.setPrivateTools(the_tool)
88  return result
89 
90 def sTGC_OverlayDigitizationToolCfg(flags, name="STGC_OverlayDigitizationTool", **kwargs):
91  """Return ComponentAccumulator with TgcDigitizationTool configured for Overlay"""
92  acc = ComponentAccumulator()
93  kwargs.setdefault("PileUpMergeSvc", '')
94  kwargs.setdefault("OnlyUseContainerName", False)
95  kwargs.setdefault("OutputObjectName", flags.Overlay.SigPrefix + "sTGC_DIGITS")
96  kwargs.setdefault("OutputSDOName", flags.Overlay.SigPrefix + "sTGC_SDO")
97  the_tool = acc.popToolsAndMerge(sTGC_DigitizationToolCfg(flags, name=name, **kwargs))
98  acc.setPrivateTools(the_tool)
99  return acc
100 
101 
102 def sTGC_OutputCfg(flags):
103  """Return ComponentAccumulator with Output for sTGC. Not standalone."""
104  acc = ComponentAccumulator()
105  if flags.Output.doWriteRDO:
106  ItemList = ["Muon::STGC_RawDataContainer#*"]
107  if flags.Digitization.EnableTruth:
108  ItemList += ["MuonSimDataCollection#*"]
109  ItemList += ["xAOD::MuonSimHitContainer#*STGC_SDO",
110  "xAOD::MuonSimHitAuxContainer#*STGC_SDOAux."]
111 
112  acc.merge(TruthDigitizationOutputCfg(flags))
113  acc.merge(OutputStreamCfg(flags, "RDO", ItemList))
114  return acc
115 
116 
117 def sTGC_DigitizationBasicCfg(flags, **kwargs):
118  """Return ComponentAccumulator for sTGC digitization"""
119  acc = MuonGeoModelCfg(flags)
120  if "PileUpTools" not in kwargs:
121  PileUpTools = acc.popToolsAndMerge(sTGC_DigitizationToolCfg(flags))
122  kwargs["PileUpTools"] = PileUpTools
123  acc.merge(PileUpToolsCfg(flags, **kwargs))
124  return acc
125 
126 
127 def sTGC_OverlayDigitizationBasicCfg(flags, **kwargs):
128  """Return ComponentAccumulator with sTGC Overlay digitization"""
129  acc = MuonGeoModelCfg(flags)
130  if flags.Common.ProductionStep != ProductionStep.FastChain:
131  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
132  if flags.Muon.usePhaseIIGeoSetup:
133  acc.merge(SGInputLoaderCfg(flags, ["xAOD::MuonSimHitContainer#xStgcSimHits",
134  "xAOD::MuonSimHitAuxContainer#xStgcSimHitsAux."]))
135  else:
136  acc.merge(SGInputLoaderCfg(flags, ["sTGCSimHitCollection#sTGC_Hits"]))
137  kwargs.setdefault("DigitizationTool", acc.popToolsAndMerge(sTGC_OverlayDigitizationToolCfg(flags)))
138 
139  if flags.Concurrency.NumThreads > 0:
140  kwargs.setdefault("Cardinality", flags.Concurrency.NumThreads)
141 
142  # Set common overlay extra inputs
143  kwargs.setdefault("ExtraInputs", flags.Overlay.ExtraInputs)
144 
145  the_alg = CompFactory.MuonDigitizer(name="STGC_OverlayDigitizer", **kwargs)
146  acc.addEventAlgo(the_alg)
147  return acc
148 
149 
150 # with output defaults
151 def sTGC_DigitizationCfg(flags, **kwargs):
152  """Return ComponentAccumulator for sTGC digitization and Output"""
153  acc = sTGC_DigitizationBasicCfg(flags, **kwargs)
154  acc.merge(sTGC_OutputCfg(flags))
155  return acc
156 
157 
159  """Return ComponentAccumulator with sTGC digitization and Digit to TGCRDO"""
160  acc = sTGC_DigitizationCfg(flags)
161  acc.merge(STGC_DigitToRDOCfg(flags))
162  return acc
python.sTGC_DigitizationConfig.sTGC_OverlayDigitizationBasicCfg
def sTGC_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: sTGC_DigitizationConfig.py:127
python.sTGC_DigitizationConfig.sTGC_FirstXing
def sTGC_FirstXing()
Definition: sTGC_DigitizationConfig.py:18
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.sTGC_DigitizationConfig.sTGC_DigitizationToolCfg
def sTGC_DigitizationToolCfg(flags, name="sTgcDigitizationTool", **kwargs)
Definition: sTGC_DigitizationConfig.py:38
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
python.TruthDigitizationOutputConfig.TruthDigitizationOutputCfg
def TruthDigitizationOutputCfg(flags)
Definition: TruthDigitizationOutputConfig.py:9
python.MuonCalibrationConfig.NswErrorCalibDbAlgCfg
def NswErrorCalibDbAlgCfg(flags, name="NswErrorCalibDbAlg", **kwargs)
Definition: MuonCalibrationConfig.py:175
python.sTGC_DigitizationConfig.sTGC_RangeCfg
def sTGC_RangeCfg(flags, name="sTgcRange", **kwargs)
Definition: sTGC_DigitizationConfig.py:26
python.sTGC_DigitizationConfig.sTGC_LastXing
def sTGC_LastXing()
Definition: sTGC_DigitizationConfig.py:22
python.sTGC_DigitizationConfig.sTGC_DigitizationDigitToRDOCfg
def sTGC_DigitizationDigitToRDOCfg(flags)
Definition: sTGC_DigitizationConfig.py:158
python.sTGC_DigitizationConfig.sTGC_DigitizationBasicCfg
def sTGC_DigitizationBasicCfg(flags, **kwargs)
Definition: sTGC_DigitizationConfig.py:117
python.sTGC_DigitizationConfig.sTGC_OverlayDigitizationToolCfg
def sTGC_OverlayDigitizationToolCfg(flags, name="STGC_OverlayDigitizationTool", **kwargs)
Definition: sTGC_DigitizationConfig.py:90
python.sTGC_DigitizationConfig.sTGC_DigitizationCfg
def sTGC_DigitizationCfg(flags, **kwargs)
Definition: sTGC_DigitizationConfig.py:151
python.MuonCalibrationConfig.NSWCalibToolCfg
def NSWCalibToolCfg(flags, name="NSWCalibTool", **kwargs)
Definition: MuonCalibrationConfig.py:143
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
python.MuonByteStreamCnvTestConfig.STGC_DigitToRDOCfg
def STGC_DigitToRDOCfg(flags, name="STGC_DigitToRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:270
AlignmentAlgsConfig.ActsGeometryContextAlgCfg
def ActsGeometryContextAlgCfg(flags, name="GeometryContextAlg", **kwargs)
Setup the Geometry context algorithm.
Definition: AlignmentAlgsConfig.py:125
python.PileUpToolsConfig.PileUpToolsCfg
def PileUpToolsCfg(flags, **kwargs)
Definition: PileUpToolsConfig.py:14
python.MuonGeometryConfig.MuonGeoModelCfg
def MuonGeoModelCfg(flags)
Definition: MuonGeometryConfig.py:28
python.sTGC_DigitizationConfig.sTGC_OutputCfg
def sTGC_OutputCfg(flags)
Definition: sTGC_DigitizationConfig.py:102
python.PileUpMergeSvcConfig.PileUpXingFolderCfg
def PileUpXingFolderCfg(flags, name="PileUpXingFolder", **kwargs)
Definition: PileUpMergeSvcConfig.py:35
python.PileUpMergeSvcConfig.PileUpMergeSvcCfg
def PileUpMergeSvcCfg(flags, name="PileUpMergeSvc", Intervals=[], **kwargs)
Definition: PileUpMergeSvcConfig.py:10
python.MuonCalibrationConfig.STgcCalibSmearingToolCfg
def STgcCalibSmearingToolCfg(flags, name="STgcCalibSmearingTool", **kwargs)
Definition: MuonCalibrationConfig.py:167
RngCompsConfig.AthRNGSvcCfg
def AthRNGSvcCfg(flags, name="AthRNGSvc")
Definition: RngCompsConfig.py:51