ATLAS Offline Software
TGC_DigitizationConfig.py
Go to the documentation of this file.
1 """Define methods to construct configured TGC Digitization tools and algorithms
2 
3 Copyright (C) 2002-2022 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 TgcDigitToTgcRDOCfg
11 from MuonConfig.MuonCablingConfig import TGCCablingConfigCfg
12 from DigitizationConfig.TruthDigitizationOutputConfig import TruthDigitizationOutputCfg
13 from DigitizationConfig.PileUpToolsConfig import PileUpToolsCfg
14 from DigitizationConfig.PileUpMergeSvcConfig import PileUpMergeSvcCfg, PileUpXingFolderCfg
15 
16 
17 # The earliest and last bunch crossing times for which interactions will be sent
18 # to the TgcDigitizationTool.
20  return -50
21 
22 
24  return 75
25 
26 
27 def TGC_RangeCfg(flags, name="TGC_Range", **kwargs):
28  """Return a PileUpXingFolder tool configured for TGC"""
29  kwargs.setdefault("FirstXing", TGC_FirstXing())
30  kwargs.setdefault("LastXing", TGC_LastXing())
31  kwargs.setdefault("CacheRefreshFrequency", 1.0)
32  if flags.Muon.usePhaseIIGeoSetup:
33  kwargs.setdefault("ItemList", ["xAOD::MuonSimHitContainer#xTgcSimHits",
34  "xAOD::MuonSimHitAuxContainer#xTgcSimHitsAux."])
35  else:
36  kwargs.setdefault("ItemList", ["TGCSimHitCollection#TGC_Hits"])
37  return PileUpXingFolderCfg(flags, name, **kwargs)
38 
39 
40 def TGC_DigitizationToolCfg(flags, name="TgcDigitizationTool", **kwargs):
41  """Return ComponentAccumulator with configured TgcDigitizationTool"""
42  acc = ComponentAccumulator()
43  if flags.Digitization.PileUp:
44  intervals = []
45  if not flags.Digitization.DoXingByXingPileUp:
46  intervals += [acc.popToolsAndMerge(TGC_RangeCfg(flags))]
47  kwargs.setdefault("PileUpMergeSvc", acc.getPrimaryAndMerge(PileUpMergeSvcCfg(flags, Intervals=intervals)))
48  else:
49  kwargs.setdefault("PileUpMergeSvc", '')
50  kwargs.setdefault("OnlyUseContainerName", flags.Digitization.PileUp)
51 
52  if flags.Digitization.DoXingByXingPileUp:
53  kwargs.setdefault("FirstXing", TGC_FirstXing())
54  kwargs.setdefault("LastXing", TGC_LastXing())
55 
56  if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
57  kwargs.setdefault("OutputSDOName", flags.Overlay.BkgPrefix + "TGC_SDO")
58  else:
59  kwargs.setdefault("OutputSDOName", "TGC_SDO")
60  kwargs.setdefault("OutputObjectName", "TGC_DIGITS")
61 
62  from RngComps.RngCompsConfig import AthRNGSvcCfg
63  kwargs.setdefault("RndmSvc", acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)))
64 
65  the_tool = None
66  if not flags.Muon.usePhaseIIGeoSetup:
67  from MuonConfig.MuonCondAlgConfig import TgcDigitCondAlgCfg
68  acc.merge(TgcDigitCondAlgCfg(flags))
69  kwargs.setdefault("TGCDigitASDposKey", "TGCDigitASDposData")
70  kwargs.setdefault("TGCDigitTimeOffsetKey", "TGCDigitTimeOffsetData")
71  kwargs.setdefault("TGCDigitCrosstalkKey", "TGCDigitCrosstalkData")
72 
73  from AthenaConfiguration.Enums import LHCPeriod
74  kwargs.setdefault("FourBunchDigitization", flags.GeoModel.Run >= LHCPeriod.Run3)
75  the_tool = CompFactory.TgcDigitizationTool(name, **kwargs)
76  else:
77  from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsGeometryContextAlgCfg
78  acc.merge(ActsGeometryContextAlgCfg(flags))
79  kwargs.setdefault("StreamName", "TgcSimForklift")
80  kwargs.setdefault("SimHitKey", "xTgcSimHits")
81  kwargs.setdefault("EffiDataKey", "")
82  the_tool = CompFactory.MuonR4.TgcFastDigiTool(name, **kwargs)
83 
84  acc.setPrivateTools(the_tool)
85  return acc
86 
87 
88 def TGC_OverlayDigitizationToolCfg(flags, name="Tgc_OverlayDigitizationTool", **kwargs):
89  """Return ComponentAccumulator with TgcDigitizationTool configured for Overlay"""
90  acc = ComponentAccumulator()
91  kwargs.setdefault("OnlyUseContainerName", False)
92  kwargs.setdefault("OutputObjectName", flags.Overlay.SigPrefix + "TGC_DIGITS")
93  kwargs.setdefault("OutputSDOName", flags.Overlay.SigPrefix + "TGC_SDO")
94  the_tool = acc.popToolsAndMerge(TGC_DigitizationToolCfg(flags,name=name, **kwargs))
95  acc.setPrivateTools(the_tool)
96  return acc
97 
98 
99 def TGC_OutputCfg(flags):
100  """Return ComponentAccumulator with Output for TGC. Not standalone."""
101  acc = ComponentAccumulator()
102  if flags.Output.doWriteRDO:
103  ItemList = ["TgcRdoContainer#*"]
104  if flags.Digitization.EnableTruth:
105  ItemList += ["MuonSimDataCollection#*"]
106  ItemList += ["xAOD::MuonSimHitContainer#*TGC_SDO",
107  "xAOD::MuonSimHitAuxContainer#*TGC_SDOAux."]
108 
109  acc.merge(TruthDigitizationOutputCfg(flags))
110  acc.merge(OutputStreamCfg(flags, "RDO", ItemList))
111  return acc
112 
113 
114 def TGC_DigitizationBasicCfg(flags, **kwargs):
115  """Return ComponentAccumulator for TGC digitization"""
116  acc = MuonGeoModelCfg(flags)
117  if "PileUpTools" not in kwargs:
118  PileUpTools = acc.popToolsAndMerge(TGC_DigitizationToolCfg(flags))
119  kwargs["PileUpTools"] = PileUpTools
120  acc.merge(PileUpToolsCfg(flags, **kwargs))
121  return acc
122 
123 
124 def TGC_OverlayDigitizationBasicCfg(flags, **kwargs):
125  """Return ComponentAccumulator with TGC Overlay digitization"""
126  acc = MuonGeoModelCfg(flags)
127  if flags.Common.ProductionStep != ProductionStep.FastChain:
128  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
129  if flags.Muon.usePhaseIIGeoSetup:
130  acc.merge(SGInputLoaderCfg(flags,["xAOD::MuonSimHitContainer#xTgcSimHits",
131  "xAOD::MuonSimHitAuxContainer#xTgcSimHitsAux."]))
132  else:
133  acc.merge(SGInputLoaderCfg(flags, ["TGCSimHitCollection#TGC_Hits"]))
134 
135  kwargs.setdefault("DigitizationTool", acc.popToolsAndMerge(TGC_OverlayDigitizationToolCfg(flags)))
136 
137  if flags.Concurrency.NumThreads > 0:
138  kwargs.setdefault("Cardinality", flags.Concurrency.NumThreads)
139 
140  # Set common overlay extra inputs
141  kwargs.setdefault("ExtraInputs", flags.Overlay.ExtraInputs)
142 
143  the_alg = CompFactory.MuonDigitizer(name="TGC_OverlayDigitizer", **kwargs)
144  acc.addEventAlgo(the_alg)
145  return acc
146 
147 
148 # with output defaults
149 def TGC_DigitizationCfg(flags, **kwargs):
150  """Return ComponentAccumulator for TGC digitization and Output"""
151  acc = TGC_DigitizationBasicCfg(flags, **kwargs)
152  acc.merge(TGC_OutputCfg(flags))
153  return acc
154 
155 
157  """Return ComponentAccumulator with TGC digitization and Digit to TGCRDO"""
158  acc = TGC_DigitizationCfg(flags)
159  acc.merge(TGCCablingConfigCfg(flags))
160  acc.merge(TgcDigitToTgcRDOCfg(flags))
161  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
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.TGC_DigitizationConfig.TGC_OverlayDigitizationToolCfg
def TGC_OverlayDigitizationToolCfg(flags, name="Tgc_OverlayDigitizationTool", **kwargs)
Definition: TGC_DigitizationConfig.py:88
python.MuonCablingConfig.TGCCablingConfigCfg
def TGCCablingConfigCfg(flags)
Definition: MuonCablingConfig.py:86
python.MuonCondAlgConfig.TgcDigitCondAlgCfg
def TgcDigitCondAlgCfg(flags)
Definition: MuonCondAlgConfig.py:168
python.TGC_DigitizationConfig.TGC_FirstXing
def TGC_FirstXing()
Definition: TGC_DigitizationConfig.py:19
python.TGC_DigitizationConfig.TGC_DigitizationToolCfg
def TGC_DigitizationToolCfg(flags, name="TgcDigitizationTool", **kwargs)
Definition: TGC_DigitizationConfig.py:40
python.TGC_DigitizationConfig.TGC_DigitizationBasicCfg
def TGC_DigitizationBasicCfg(flags, **kwargs)
Definition: TGC_DigitizationConfig.py:114
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
python.TGC_DigitizationConfig.TGC_RangeCfg
def TGC_RangeCfg(flags, name="TGC_Range", **kwargs)
Definition: TGC_DigitizationConfig.py:27
AlignmentAlgsConfig.ActsGeometryContextAlgCfg
def ActsGeometryContextAlgCfg(flags, name="GeometryContextAlg", **kwargs)
Setup the Geometry context algorithm.
Definition: AlignmentAlgsConfig.py:125
python.TGC_DigitizationConfig.TGC_LastXing
def TGC_LastXing()
Definition: TGC_DigitizationConfig.py:23
python.PileUpToolsConfig.PileUpToolsCfg
def PileUpToolsCfg(flags, **kwargs)
Definition: PileUpToolsConfig.py:14
python.TGC_DigitizationConfig.TGC_OutputCfg
def TGC_OutputCfg(flags)
Definition: TGC_DigitizationConfig.py:99
python.TGC_DigitizationConfig.TGC_OverlayDigitizationBasicCfg
def TGC_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: TGC_DigitizationConfig.py:124
python.TGC_DigitizationConfig.TGC_DigitizationCfg
def TGC_DigitizationCfg(flags, **kwargs)
Definition: TGC_DigitizationConfig.py:149
python.TGC_DigitizationConfig.TGC_DigitizationDigitToRDOCfg
def TGC_DigitizationDigitToRDOCfg(flags)
Definition: TGC_DigitizationConfig.py:156
python.MuonGeometryConfig.MuonGeoModelCfg
def MuonGeoModelCfg(flags)
Definition: MuonGeometryConfig.py:28
python.MuonByteStreamCnvTestConfig.TgcDigitToTgcRDOCfg
def TgcDigitToTgcRDOCfg(flags, name="TgcDigitToTgcRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:197
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
RngCompsConfig.AthRNGSvcCfg
def AthRNGSvcCfg(flags, name="AthRNGSvc")
Definition: RngCompsConfig.py:51