ATLAS Offline Software
TRTOverlayConfig.py
Go to the documentation of this file.
1 """Define methods to construct configured TRT overlay algorithms
2 
3 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4 """
5 
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 
9 
10 def TRTDataOverlayExtraCfg(flags, **kwargs):
11  """Return a ComponentAccumulator with TRT data overlay specifics"""
12  acc = ComponentAccumulator()
13 
14  # We need to convert BS to RDO for data overlay
15  from TRT_RawDataByteStreamCnv.TRT_RawDataByteStreamCnvConfig import TRTOverlayRawDataProviderAlgCfg
16  acc.merge(TRTOverlayRawDataProviderAlgCfg(flags))
17 
18  return acc
19 
20 
21 def TRTOverlayAlgCfg(flags, name="TRTOverlay", **kwargs):
22  """Return a ComponentAccumulator for TRTOverlay algorithm"""
23  acc = ComponentAccumulator()
24  from TRT_GeoModel.TRT_GeoModelConfig import TRT_ReadoutGeometryCfg
25  acc.merge(TRT_ReadoutGeometryCfg(flags))
26 
27  kwargs.setdefault("SortBkgInput", flags.Overlay.DataOverlay)
28  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}TRT_RDOs")
29  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}TRT_RDOs")
30  kwargs.setdefault("SignalInputSDOKey", f"{flags.Overlay.SigPrefix}TRT_SDO_Map")
31  kwargs.setdefault("OutputKey", "TRT_RDOs")
32 
33  if not flags.Overlay.DataOverlay:
34  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
35  acc.merge(SGInputLoaderCfg(flags, [f'TRT_RDO_Container#{kwargs["BkgInputKey"]}']))
36 
37  # HT hit correction fraction
38  kwargs.setdefault("TRT_HT_OccupancyCorrectionBarrel", 0.110)
39  kwargs.setdefault("TRT_HT_OccupancyCorrectionEndcap", 0.090)
40  kwargs.setdefault("TRT_HT_OccupancyCorrectionBarrelNoE", 0.060)
41  kwargs.setdefault("TRT_HT_OccupancyCorrectionEndcapNoE", 0.050)
42  kwargs.setdefault("TRT_HT_OccupancyCorrectionBarrelAr", 0.100)
43  kwargs.setdefault("TRT_HT_OccupancyCorrectionEndcapAr", 0.101)
44  kwargs.setdefault("TRT_HT_OccupancyCorrectionBarrelArNoE", 0.088)
45  kwargs.setdefault("TRT_HT_OccupancyCorrectionEndcapArNoE", 0.102)
46 
47  from InDetConfig.TRT_ElectronPidToolsConfig import TRT_OverlayLocalOccupancyCfg
48  kwargs.setdefault("TRT_LocalOccupancyTool", acc.popToolsAndMerge(TRT_OverlayLocalOccupancyCfg(flags)))
49 
50  from RngComps.RngCompsConfig import AthRNGSvcCfg
51  kwargs.setdefault("RndmSvc", acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)).name)
52 
53  # Do TRT overlay
54  acc.addEventAlgo(CompFactory.TRTOverlay(name, **kwargs))
55 
56  # Setup output
57  if flags.Output.doWriteRDO:
58  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
59  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
60  "TRT_RDO_Container#TRT_RDOs"
61  ]))
62 
63  if flags.Overlay.DataOverlay:
64  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
65  "TRT_BSErrContainer#TRT_ByteStreamErrs"
66  ]))
67 
68  if flags.Output.doWriteRDO_SGNL:
69  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
70  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
71  f"TRT_RDO_Container#{flags.Overlay.SigPrefix}TRT_RDOs"
72  ]))
73 
74  if flags.Overlay.doTrackOverlay:
75  #for track overlay, write out the signal RDOs because reco tracking will only run on them
76  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
77  f"TRT_RDO_Container#{flags.Overlay.SigPrefix}TRT_RDOs"]))
78 
79  return acc
80 
81 
82 def TRTTruthOverlayCfg(flags, name="TRTSDOOverlay", **kwargs):
83  """Return a ComponentAccumulator for the TRT SDO overlay algorithm"""
84  acc = ComponentAccumulator()
85 
86  # We do not need background TRT SDOs for data overlay
87  if flags.Overlay.DataOverlay:
88  kwargs.setdefault("BkgInputKey", "")
89  else:
90  kwargs.setdefault("BkgInputKey", f"{flags.Overlay.BkgPrefix}TRT_SDO_Map")
91 
92  if kwargs["BkgInputKey"]:
93  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
94  acc.merge(SGInputLoaderCfg(flags, [f'InDetSimDataCollection#{kwargs["BkgInputKey"]}']))
95 
96  kwargs.setdefault("SignalInputKey", f"{flags.Overlay.SigPrefix}TRT_SDO_Map")
97  kwargs.setdefault("OutputKey", "TRT_SDO_Map")
98 
99  # Do TRT truth overlay
100  acc.addEventAlgo(CompFactory.InDetSDOOverlay(name, **kwargs))
101 
102  # Setup output
103  if flags.Output.doWriteRDO:
104  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
105  acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
106  "InDetSimDataCollection#TRT_SDO_Map"
107  ]))
108 
109  if flags.Output.doWriteRDO_SGNL:
110  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
111  acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
112  f"InDetSimDataCollection#{flags.Overlay.SigPrefix}TRT_SDO_Map"
113  ]))
114 
115  return acc
116 
117 
118 def TRTOverlayCfg(flags):
119  """Configure and return a ComponentAccumulator for TRT overlay"""
120  acc = ComponentAccumulator()
121 
122  # Add data overlay specifics
123  if flags.Overlay.DataOverlay:
124  acc.merge(TRTDataOverlayExtraCfg(flags))
125 
126  # Add TRT overlay digitization algorithm
127  from TRT_Digitization.TRT_DigitizationConfig import TRT_OverlayDigitizationBasicCfg
128  acc.merge(TRT_OverlayDigitizationBasicCfg(flags))
129  # Add TRT overlay algorithm
130  acc.merge(TRTOverlayAlgCfg(flags))
131  # Add TRT truth overlay
132  if flags.Digitization.EnableTruth:
133  acc.merge(TRTTruthOverlayCfg(flags))
134 
135  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
TRT_GeoModelConfig.TRT_ReadoutGeometryCfg
def TRT_ReadoutGeometryCfg(flags)
Definition: TRT_GeoModelConfig.py:55
TRTOverlayConfig.TRTTruthOverlayCfg
def TRTTruthOverlayCfg(flags, name="TRTSDOOverlay", **kwargs)
Definition: TRTOverlayConfig.py:82
TRT_DigitizationConfig.TRT_OverlayDigitizationBasicCfg
def TRT_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: TRT_DigitizationConfig.py:211
TRTOverlayConfig.TRTDataOverlayExtraCfg
def TRTDataOverlayExtraCfg(flags, **kwargs)
Definition: TRTOverlayConfig.py:10
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
TRTOverlayConfig.TRTOverlayAlgCfg
def TRTOverlayAlgCfg(flags, name="TRTOverlay", **kwargs)
Definition: TRTOverlayConfig.py:21
python.TRT_ElectronPidToolsConfig.TRT_OverlayLocalOccupancyCfg
def TRT_OverlayLocalOccupancyCfg(flags, name="TRT_OverlayLocalOccupancy", **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:36
TRTOverlayConfig.TRTOverlayCfg
def TRTOverlayCfg(flags)
Definition: TRTOverlayConfig.py:118
python.TRT_RawDataByteStreamCnvConfig.TRTOverlayRawDataProviderAlgCfg
def TRTOverlayRawDataProviderAlgCfg(flags, name="TRTRawDataProvider", **kwargs)
Definition: TRT_RawDataByteStreamCnvConfig.py:56
RngCompsConfig.AthRNGSvcCfg
def AthRNGSvcCfg(flags, name="AthRNGSvc")
Definition: RngCompsConfig.py:51