ATLAS Offline Software
TRT_DigitizationConfig.py
Go to the documentation of this file.
1 """Define methods to construct configured TRT 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 BeamType, ProductionStep
8 from TRT_GeoModel.TRT_GeoModelConfig import TRT_ReadoutGeometryCfg
9 from MagFieldServices.MagFieldServicesConfig import AtlasFieldCacheCondAlgCfg
10 from TRT_PAI_Process.TRT_PAI_ProcessConfig import TRT_PAI_Process_XeToolCfg, TRT_PAI_Process_ArToolCfg, TRT_PAI_Process_KrToolCfg
11 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
12 from DigitizationConfig.PileUpToolsConfig import PileUpToolsCfg
13 from DigitizationConfig.PileUpMergeSvcConfig import PileUpMergeSvcCfg, PileUpXingFolderCfg
14 from DigitizationConfig.TruthDigitizationOutputConfig import TruthDigitizationOutputCfg
15 
16 
17 # The earliest and last bunch crossing times for which interactions will be sent
18 # to the TRT Digitization code
20  return -50
21 
22 
24  return 50
25 
26 
27 def TRT_RangeCfg(flags, name="TRTRange", **kwargs):
28  """Return an TRT configured PileUpXingFolder tool"""
29  kwargs.setdefault("FirstXing", TRT_FirstXing())
30  kwargs.setdefault("LastXing", TRT_LastXing())
31  kwargs.setdefault("CacheRefreshFrequency", 1.0) #default 0 no dataproxy reset
32  kwargs.setdefault("ItemList", ["TRTUncompressedHitCollection#TRTUncompressedHits"])
33  return PileUpXingFolderCfg(flags, name, **kwargs)
34 
35 
36 def TRT_DigitizationBasicToolCfg(flags, name="TRT_DigitizationBasicTool", **kwargs):
37  """Return ComponentAccumulator with common TRT digitization tool config"""
38  acc = TRT_ReadoutGeometryCfg(flags)
39  acc.merge(AtlasFieldCacheCondAlgCfg(flags))
40  from AthenaServices.PartPropSvcConfig import PartPropSvcCfg
41  kwargs.setdefault('PartPropSvc', acc.getPrimaryAndMerge(PartPropSvcCfg(flags)).name) # Property from GenBase
42  kwargs.setdefault("DigVersContainerKey", "")
43  # default arguments
44  from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_StrawStatusSummaryToolCfg
45  StrawStatusTool = acc.popToolsAndMerge(TRT_StrawStatusSummaryToolCfg(flags))
46  acc.addPublicTool(StrawStatusTool) # public as it is has many clients to save some memory
47  kwargs.setdefault("InDetTRTStrawStatusSummaryTool", StrawStatusTool)
48  kwargs.setdefault("PAI_Tool_Ar", TRT_PAI_Process_ArToolCfg(flags))
49  kwargs.setdefault("PAI_Tool_Kr", TRT_PAI_Process_KrToolCfg(flags))
50  kwargs.setdefault("PAI_Tool_Xe", TRT_PAI_Process_XeToolCfg(flags))
51  kwargs.setdefault("Override_TrtRangeCutProperty", flags.Sim.TRTRangeCut)
52  kwargs.setdefault("RandomSeedOffset", flags.Digitization.RandomSeedOffset)
53  if not flags.Digitization.DoInnerDetectorNoise:
54  kwargs.setdefault("Override_noiseInSimhits", 0)
55  kwargs.setdefault("Override_noiseInUnhitStraws", 0)
56  if flags.Beam.Type is BeamType.Cosmics:
57  kwargs.setdefault("PrintDigSettings", True)
58  kwargs.setdefault("Override_cosmicFlag", 0)
59  kwargs.setdefault("Override_doCosmicTimingPit", 1)
60  kwargs.setdefault("Override_jitterTimeOffset", 0.)
61  kwargs.setdefault("Override_timeCorrection", 0)
62  if flags.Digitization.DoXingByXingPileUp:
63  kwargs.setdefault("FirstXing", TRT_FirstXing())
64  kwargs.setdefault("LastXing", TRT_LastXing())
65  if flags.BField.configuredSolenoidFieldScale>0 and flags.BField.configuredSolenoidFieldScale<1:
66  from AthenaCommon.SystemOfUnits import tesla
67  kwargs.setdefault("Override_solenoidFieldStrength", flags.BField.configuredSolenoidFieldScale * 2.0 * tesla)
68  from RngComps.RngCompsConfig import AthRNGSvcCfg
69  kwargs.setdefault("RndmSvc", acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)).name)
70  TRTDigitizationTool = CompFactory.TRTDigitizationTool
71  tool = TRTDigitizationTool(name, **kwargs)
72  acc.setPrivateTools(tool)
73  return acc
74 
75 
76 def TRT_DigitizationToolCfg(flags, name="TRTDigitizationTool", **kwargs):
77  """Return ComponentAccumulator with configured TRT digitization tool"""
78  acc = ComponentAccumulator()
79  if flags.Digitization.PileUp:
80  intervals = []
81  if not flags.Digitization.DoXingByXingPileUp:
82  intervals += [acc.popToolsAndMerge(TRT_RangeCfg(flags))]
83  kwargs.setdefault("MergeSvc", acc.getPrimaryAndMerge(PileUpMergeSvcCfg(flags, Intervals=intervals)).name)
84  else:
85  kwargs.setdefault("MergeSvc", '')
86  kwargs.setdefault("OnlyUseContainerName", flags.Digitization.PileUp)
87  if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
88  kwargs.setdefault("OutputObjectName", flags.Overlay.BkgPrefix + "TRT_RDOs")
89  kwargs.setdefault("OutputSDOName", flags.Overlay.BkgPrefix + "TRT_SDO_Map")
90  else:
91  kwargs.setdefault("OutputObjectName", "TRT_RDOs")
92  kwargs.setdefault("OutputSDOName", "TRT_SDO_Map")
93  kwargs.setdefault("HardScatterSplittingMode", 0)
94  if flags.Digitization.TRT.HeavyIonHT:
95  kwargs.setdefault("Override_highThresholdBarShort", 0.00129875)
96  kwargs.setdefault("Override_highThresholdBarLong", 0.00118775)
97  kwargs.setdefault("Override_highThresholdECAwheels", 0.001185591)
98  kwargs.setdefault("Override_highThresholdECBwheels", 0.001145376)
99  kwargs.setdefault("Override_highThresholdBarShortArgon", 0.000468802)
100  kwargs.setdefault("Override_highThresholdBarLongArgon", 0.000456754)
101  kwargs.setdefault("Override_highThresholdECAwheelsArgon", 0.0006035)
102  kwargs.setdefault("Override_highThresholdECBwheelsArgon", 0.00057375)
103  tool = acc.popToolsAndMerge(TRT_DigitizationBasicToolCfg(flags, name, **kwargs))
104  acc.setPrivateTools(tool)
105  return acc
106 
107 
108 def TRT_DigitizationGeantinoTruthToolCfg(flags, name="TRT_GeantinoTruthDigitizationTool", **kwargs):
109  """Return ComponentAccumulator with Geantino configured TRT digitization tool"""
110  acc = ComponentAccumulator()
111  if flags.Digitization.PileUp:
112  intervals = []
113  if not flags.Digitization.DoXingByXingPileUp:
114  intervals += [acc.popToolsAndMerge(TRT_RangeCfg(flags))]
115  kwargs.setdefault("MergeSvc", acc.getPrimaryAndMerge(PileUpMergeSvcCfg(flags, Intervals=intervals)).name)
116  else:
117  kwargs.setdefault("MergeSvc", '')
118  kwargs.setdefault("OnlyUseContainerName", flags.Digitization.PileUp)
119  kwargs.setdefault("VetoPileUpTruthLinks", False)
120  tool = acc.popToolsAndMerge(TRT_DigitizationToolCfg(flags, name, **kwargs))
121  acc.setPrivateTools(tool)
122  return acc
123 
124 
125 def TRT_DigitizationHSToolCfg(flags, name="TRT_DigitizationToolHS", **kwargs):
126  """Return ComponentAccumulator with Hard Scatter configured TRT digitization tool"""
127  acc = ComponentAccumulator()
128  rangetool = acc.popToolsAndMerge(TRT_RangeCfg(flags))
129  kwargs.setdefault("MergeSvc", acc.getPrimaryAndMerge(PileUpMergeSvcCfg(flags, Intervals=rangetool)).name)
130  kwargs.setdefault("OutputObjectName", "TRT_RDOs")
131  kwargs.setdefault("OutputSDOName", "TRT_SDO_Map")
132  kwargs.setdefault("HardScatterSplittingMode", 1)
133  tool = acc.popToolsAndMerge(TRT_DigitizationBasicToolCfg(flags, name, **kwargs))
134  acc.setPrivateTools(tool)
135  return acc
136 
137 
138 def TRT_DigitizationPUToolCfg(flags, name="TRT_DigitizationToolPU", **kwargs):
139  """Return ComponentAccumulator with Pile Up configured TRT digitization tool"""
140  acc = ComponentAccumulator()
141  rangetool = acc.popToolsAndMerge(TRT_RangeCfg(flags))
142  kwargs.setdefault("MergeSvc", acc.getPrimaryAndMerge(PileUpMergeSvcCfg(flags, Intervals=rangetool)).name)
143  kwargs.setdefault("OutputObjectName", "TRT_PU_RDOs")
144  kwargs.setdefault("OutputSDOName", "TRT_PU_SDO_Map")
145  kwargs.setdefault("HardScatterSplittingMode", 2)
146  acc.merge(TRT_DigitizationBasicToolCfg(flags, name, **kwargs))
147  return acc
148 
149 
150 def TRT_DigitizationSplitNoMergePUToolCfg(flags, name="TRT_DigitizationToolSplitNoMergePU", **kwargs):
151  """Return ComponentAccumulator with PileUpTRT_Hits configured TRT digitization tool"""
152  acc = ComponentAccumulator()
153  rangetool = acc.popToolsAndMerge(TRT_RangeCfg(flags))
154  kwargs.setdefault("MergeSvc", acc.getPrimaryAndMerge(PileUpMergeSvcCfg(flags, Intervals=rangetool)).name)
155  kwargs.setdefault("HardScatterSplittingMode", 0)
156  kwargs.setdefault("DataObjectName", "PileupTRTUncompressedHits")
157  kwargs.setdefault("OutputObjectName", "TRT_PU_RDOs")
158  kwargs.setdefault("OutputSDOName", "TRT_PU_SDO_Map")
159  kwargs.setdefault("Override_noiseInSimhits", 0)
160  kwargs.setdefault("Override_noiseInUnhitStraws", 0)
161  tool = acc.popToolsAndMerge(TRT_DigitizationBasicToolCfg(flags, name, **kwargs))
162  acc.setPrivateTools(tool)
163  return acc
164 
165 
166 def TRT_OverlayDigitizationToolCfg(flags, name="TRT_OverlayDigitizationTool", **kwargs):
167  """Return ComponentAccumulator with configured Overlay TRT digitization tool"""
168  acc = ComponentAccumulator()
169  if flags.Overlay.DataOverlay:
170  from IOVDbSvc.IOVDbSvcConfig import addFolders
171  # TODO: remove the hardcode
172  acc.merge(addFolders(flags, "/TRT/Cond/DigVers", "TRT_OFL", tag="TRTCondDigVers-Collisions-01", db="OFLP200", className="AthenaAttributeList"))
173  kwargs.setdefault("DigVersContainerKey", "/TRT/Cond/DigVers")
174 
175  kwargs.setdefault("OnlyUseContainerName", False)
176  kwargs.setdefault("OutputObjectName", flags.Overlay.SigPrefix + "TRT_RDOs")
177  kwargs.setdefault("OutputSDOName", flags.Overlay.SigPrefix + "TRT_SDO_Map")
178  kwargs.setdefault("Override_isOverlay", 1)
179  kwargs.setdefault("HardScatterSplittingMode", 0)
180  kwargs.setdefault("Override_getT0FromData", 0)
181  kwargs.setdefault("Override_noiseInSimhits", 0)
182  kwargs.setdefault("Override_noiseInUnhitStraws", 0)
183  kwargs.setdefault("MergeSvc", '')
184  tool = acc.popToolsAndMerge(TRT_DigitizationBasicToolCfg(flags, name, **kwargs))
185  acc.setPrivateTools(tool)
186  return acc
187 
188 
189 def TRT_OutputCfg(flags):
190  """Return ComponentAccumulator with Output for TRT. Not standalone."""
191  acc = ComponentAccumulator()
192  if flags.Output.doWriteRDO:
193  ItemList = ["TRT_RDO_Container#*"]
194  if flags.Digitization.EnableTruth:
195  ItemList += ["InDetSimDataCollection#*"]
196  acc.merge(TruthDigitizationOutputCfg(flags))
197  acc.merge(OutputStreamCfg(flags, "RDO", ItemList))
198  return acc
199 
200 
201 def TRT_DigitizationBasicCfg(flags, **kwargs):
202  """Return ComponentAccumulator for TRT digitization"""
203  acc = ComponentAccumulator()
204  if "PileUpTools" not in kwargs:
205  PileUpTools = acc.popToolsAndMerge(TRT_DigitizationToolCfg(flags))
206  kwargs["PileUpTools"] = PileUpTools
207  acc.merge(PileUpToolsCfg(flags, **kwargs))
208  return acc
209 
210 
211 def TRT_OverlayDigitizationBasicCfg(flags, **kwargs):
212  """Return ComponentAccumulator with TRT Overlay digitization"""
213  acc = ComponentAccumulator()
214  if flags.Common.ProductionStep != ProductionStep.FastChain:
215  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
216  acc.merge(SGInputLoaderCfg(flags, ["TRTUncompressedHitCollection#TRTUncompressedHits"]))
217 
218  if "DigitizationTool" not in kwargs:
219  tool = acc.popToolsAndMerge(TRT_OverlayDigitizationToolCfg(flags))
220  kwargs["DigitizationTool"] = tool
221 
222  if flags.Concurrency.NumThreads > 0:
223  kwargs.setdefault("Cardinality", flags.Concurrency.NumThreads)
224 
225  # Set common overlay extra inputs
226  kwargs.setdefault("ExtraInputs", flags.Overlay.ExtraInputs)
227 
228  TRTDigitization = CompFactory.TRTDigitization
229  acc.addEventAlgo(TRTDigitization(name="TRT_OverlayDigitization", **kwargs))
230  return acc
231 
232 
233 # with output defaults
234 def TRT_DigitizationCfg(flags, **kwargs):
235  """Return ComponentAccumulator for TRT digitization and Output"""
236  acc = TRT_DigitizationBasicCfg(flags, **kwargs)
237  acc.merge(TRT_OutputCfg(flags))
238  return acc
239 
240 
241 def TRT_OverlayDigitizationCfg(flags, **kwargs):
242  """Return ComponentAccumulator with TRT Overlay digitization and Output"""
243  acc = TRT_OverlayDigitizationBasicCfg(flags, **kwargs)
244  acc.merge(TRT_OutputCfg(flags))
245  return acc
246 
247 
248 # additional specialisations
249 def TRT_DigitizationHSCfg(flags, name="TRT_DigitizationHS", **kwargs):
250  """Return ComponentAccumulator for Hard-Scatter-only TRT digitization and Output"""
251  acc = TRT_DigitizationHSToolCfg(flags)
252  kwargs["PileUpTools"] = acc.popPrivateTools()
253  acc = TRT_DigitizationBasicCfg(flags, name=name, **kwargs)
254  acc.merge(TRT_OutputCfg(flags))
255  return acc
256 
257 
258 def TRT_DigitizationPUCfg(flags, name="TRT_DigitizationPU", **kwargs):
259  """Return ComponentAccumulator with Pile-up-only TRT digitization and Output"""
260  acc = TRT_DigitizationPUToolCfg(flags)
261  kwargs["PileUpTools"] = acc.popPrivateTools()
262  acc = TRT_DigitizationBasicCfg(flags, name=name, **kwargs)
263  acc.merge(TRT_OutputCfg(flags))
264  return acc
SystemOfUnits
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TRT_DigitizationConfig.TRT_DigitizationPUCfg
def TRT_DigitizationPUCfg(flags, name="TRT_DigitizationPU", **kwargs)
Definition: TRT_DigitizationConfig.py:258
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
TRT_DigitizationConfig.TRT_RangeCfg
def TRT_RangeCfg(flags, name="TRTRange", **kwargs)
Definition: TRT_DigitizationConfig.py:27
TRT_DigitizationConfig.TRT_DigitizationHSCfg
def TRT_DigitizationHSCfg(flags, name="TRT_DigitizationHS", **kwargs)
Definition: TRT_DigitizationConfig.py:249
TRT_DigitizationConfig.TRT_DigitizationBasicCfg
def TRT_DigitizationBasicCfg(flags, **kwargs)
Definition: TRT_DigitizationConfig.py:201
python.TruthDigitizationOutputConfig.TruthDigitizationOutputCfg
def TruthDigitizationOutputCfg(flags)
Definition: TruthDigitizationOutputConfig.py:9
TRT_GeoModelConfig.TRT_ReadoutGeometryCfg
def TRT_ReadoutGeometryCfg(flags)
Definition: TRT_GeoModelConfig.py:59
TRT_PAI_ProcessConfig.TRT_PAI_Process_ArToolCfg
def TRT_PAI_Process_ArToolCfg(flags, name="TRT_PAI_Process_Ar", **kwargs)
Definition: TRT_PAI_ProcessConfig.py:14
python.TRT_ConditionsServicesConfig.TRT_StrawStatusSummaryToolCfg
def TRT_StrawStatusSummaryToolCfg(flags, name="TRT_StrawStatusSummaryTool", forceLegacyAccess=False, **kwargs)
Definition: TRT_ConditionsServicesConfig.py:23
TRT_DigitizationConfig.TRT_OverlayDigitizationToolCfg
def TRT_OverlayDigitizationToolCfg(flags, name="TRT_OverlayDigitizationTool", **kwargs)
Definition: TRT_DigitizationConfig.py:166
TRT_DigitizationConfig.TRT_DigitizationGeantinoTruthToolCfg
def TRT_DigitizationGeantinoTruthToolCfg(flags, name="TRT_GeantinoTruthDigitizationTool", **kwargs)
Definition: TRT_DigitizationConfig.py:108
TRT_DigitizationConfig.TRT_OverlayDigitizationBasicCfg
def TRT_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: TRT_DigitizationConfig.py:211
TRT_DigitizationConfig.TRT_DigitizationPUToolCfg
def TRT_DigitizationPUToolCfg(flags, name="TRT_DigitizationToolPU", **kwargs)
Definition: TRT_DigitizationConfig.py:138
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
TRT_DigitizationConfig.TRT_DigitizationBasicToolCfg
def TRT_DigitizationBasicToolCfg(flags, name="TRT_DigitizationBasicTool", **kwargs)
Definition: TRT_DigitizationConfig.py:36
TRTDigitization
Top algorithm class for TRT digitization.
Definition: TRTDigitization.h:13
TRT_DigitizationConfig.TRT_DigitizationSplitNoMergePUToolCfg
def TRT_DigitizationSplitNoMergePUToolCfg(flags, name="TRT_DigitizationToolSplitNoMergePU", **kwargs)
Definition: TRT_DigitizationConfig.py:150
TRT_DigitizationConfig.TRT_DigitizationToolCfg
def TRT_DigitizationToolCfg(flags, name="TRTDigitizationTool", **kwargs)
Definition: TRT_DigitizationConfig.py:76
python.PileUpToolsConfig.PileUpToolsCfg
def PileUpToolsCfg(flags, **kwargs)
Definition: PileUpToolsConfig.py:14
python.PartPropSvcConfig.PartPropSvcCfg
def PartPropSvcCfg(flags, **kwargs)
Definition: PartPropSvcConfig.py:6
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
TRT_DigitizationConfig.TRT_DigitizationHSToolCfg
def TRT_DigitizationHSToolCfg(flags, name="TRT_DigitizationToolHS", **kwargs)
Definition: TRT_DigitizationConfig.py:125
TRT_DigitizationConfig.TRT_OutputCfg
def TRT_OutputCfg(flags)
Definition: TRT_DigitizationConfig.py:189
TRT_DigitizationConfig.TRT_DigitizationCfg
def TRT_DigitizationCfg(flags, **kwargs)
Definition: TRT_DigitizationConfig.py:234
TRTDigitizationTool
Definition: TRTDigitizationTool.h:65
TRT_PAI_ProcessConfig.TRT_PAI_Process_KrToolCfg
def TRT_PAI_Process_KrToolCfg(flags, name="TRT_PAI_Process_Kr", **kwargs)
Definition: TRT_PAI_ProcessConfig.py:19
TRT_PAI_ProcessConfig.TRT_PAI_Process_XeToolCfg
def TRT_PAI_Process_XeToolCfg(flags, name="TRT_PAI_Process_Xe", **kwargs)
Definition: TRT_PAI_ProcessConfig.py:9
TRT_DigitizationConfig.TRT_LastXing
def TRT_LastXing()
Definition: TRT_DigitizationConfig.py:23
python.PileUpMergeSvcConfig.PileUpXingFolderCfg
def PileUpXingFolderCfg(flags, name="PileUpXingFolder", **kwargs)
Definition: PileUpMergeSvcConfig.py:35
TRT_DigitizationConfig.TRT_OverlayDigitizationCfg
def TRT_OverlayDigitizationCfg(flags, **kwargs)
Definition: TRT_DigitizationConfig.py:241
python.MagFieldServicesConfig.AtlasFieldCacheCondAlgCfg
def AtlasFieldCacheCondAlgCfg(flags, **kwargs)
Definition: MagFieldServicesConfig.py:8
TRT_DigitizationConfig.TRT_FirstXing
def TRT_FirstXing()
Definition: TRT_DigitizationConfig.py:19
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