ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloFEXByteStreamConfig.py
Go to the documentation of this file.
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3#
4from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5from AthenaConfiguration.ComponentFactory import CompFactory
6from libpyeformat_helper import SourceIdentifier, SubDetector
7
8def eFexByteStreamToolCfg(flags, name, *, writeBS=False, TOBs=True, xTOBs=False, multiSlice=False, decodeInputs=False):
9 acc = ComponentAccumulator()
10
11 tool = CompFactory.eFexByteStreamTool(name)
12
13 if writeBS:
14 # write BS == read xAOD
15 # Note: this is currently unsupported!!!
16 tool.eEMContainerReadKey = "L1_eEMxRoI" if xTOBs else "L1_eEMRoI"
17 tool.eTAUContainerReadKey = "L1_eTauxRoI" if xTOBs else "L1_eTauRoI"
18 tool.eEMContainerWriteKey = ""
19 tool.eTAUContainerWriteKey = ""
20 else:
21 # read BS == write xAOD
22 tool.eEMContainerReadKey = ""
23 tool.eTAUContainerReadKey = ""
24 if TOBs or xTOBs or multiSlice:
25 efex_roi_moduleids = [0x1000,0x1100]
26 tool.ROBIDs = [int(SourceIdentifier(SubDetector.TDAQ_CALO_FEAT_EXTRACT_ROI, moduleid)) for moduleid in efex_roi_moduleids]
27 if TOBs:
28 tool.eEMContainerWriteKey = "L1_eEMRoI"
29 tool.eTAUContainerWriteKey = "L1_eTauRoI"
30 if xTOBs:
31 tool.eEMxContainerWriteKey = "L1_eEMxRoI"
32 tool.eTAUxContainerWriteKey = "L1_eTauxRoI"
33 if multiSlice:
34 tool.eEMSliceContainerWriteKey = "L1_eEMxRoIOutOfTime"
35 tool.eTAUSliceContainerWriteKey = "L1_eTauxRoIOutOfTime"
36 if decodeInputs:
37 efex_raw_ids = []
38 inputId = int(SourceIdentifier(SubDetector.TDAQ_CALO_FEAT_EXTRACT_DAQ, 0x1000))
39 for shelf in range(0,2):
40 for module in range(0,12):
41 efex_raw_ids += [inputId + shelf*0x100 + module*0x010 ]
42 tool.ROBIDs += efex_raw_ids
43 tool.eTowerContainerWriteKey = "L1_eFexDataTowers"
44
45 if flags.Output.HISTFileName != '' or flags.Trigger.doHLT:
46 if flags.Trigger.doHLT:
47 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
48 monTool = GenericMonitoringTool(flags,'MonTool',HistPath = f'HLTFramework/L1BSConverters/{name}')
49 topDir = "EXPERT"
50 monTool.defineHistogram('efexDecoderErrorTitle,efexDecoderErrorLocation;errors', path=topDir, type='TH2I',
51 title='Decoder Errors;Title;Location',
52 xbins=1,xmin=0,xmax=1,
53 ybins=1,ymin=0,ymax=1,
54 opt=['kCanRebin'],merge="merge")
55 tool.MonTool = monTool
56 else:
57 # if used in offline reconstruction respect DQ convention (ATR-26371)
58 # use L1Calo's special MonitoringCfgHelper
59 from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig import L1CaloMonitorCfgHelper
60 helper = L1CaloMonitorCfgHelper(flags,None,name)
61
62 # could consider getting rid of this first histogram, since all the info should be accessible in the second
63 # will make decision after gaining experience @ P1
64 helper.defineHistogram('efexDecoderErrorTitle,efexDecoderErrorLocation;h_efex_errors', type='TH2I',
65 path="Developer/ByteStreamDecoders",
66 fillGroup = f'{name}MonTool',
67 title='eFEX Decoder Errors;Title;Location',
68 xbins=1,xmin=0,xmax=1,
69 ybins=1,ymin=0,ymax=1,
70 opt=['kCanRebin','kAlwaysCreate'],merge="merge")
71 helper.defineHistogram('lbn,decoderError;h_efex_errors_vs_lbn', type='TH2I',
72 path="Expert/ByteStreamDecoders",
73 hanConfig={"algorithm":"Histogram_Empty","description":"Should be empty. Please report any errors to eFEX software experts."},
74 fillGroup = f'{name}MonTool',
75 title='eFEX Decoder Errors;LB;Error',
76 xbins=1,xmin=0,xmax=1,
77 ybins=1,ymin=0,ymax=1,
78 opt=['kAddBinsDynamically','kCanRebin','kAlwaysCreate'],merge="merge")
79 tool.MonTool = helper.fillGroups[f'{name}MonTool']
80 acc.merge(helper.result())
81
82
83 acc.setPrivateTools(tool)
84 return acc
85
86
87def jFexRoiByteStreamToolCfg(flags, name, *, writeBS=False, xTOBs=False):
88 acc = ComponentAccumulator()
89 tool = CompFactory.jFexRoiByteStreamTool(name)
90 tool.ConvertExtendedTOBs = xTOBs
91 jfex_roi_moduleids = [0x2000]
92 tool.ROBIDs = [int(SourceIdentifier(SubDetector.TDAQ_CALO_FEAT_EXTRACT_ROI, moduleid)) for moduleid in jfex_roi_moduleids]
93 if writeBS:
94 # write BS == read xAOD
95 tool.jJRoIContainerReadKey = "L1_jFexSRJetxRoI" if xTOBs else "L1_jFexSRJetRoI"
96 tool.jLJRoIContainerReadKey = "L1_jFexLRJetxRoI" if xTOBs else "L1_jFexLRJetRoI"
97 tool.jTauRoIContainerReadKey = "L1_jFexTauxRoI" if xTOBs else "L1_jFexTauRoI"
98 tool.jEMRoIContainerReadKey = "L1_jFexFwdElxRoI" if xTOBs else "L1_jFexFwdElRoI"
99 tool.jTERoIContainerReadKey = "L1_jFexSumETxRoI" if xTOBs else "L1_jFexSumETRoI"
100 tool.jXERoIContainerReadKey = "L1_jFexMETxRoI" if xTOBs else "L1_jFexMETRoI"
101
102 tool.jJRoIContainerWriteKey =""
103 tool.jLJRoIContainerWriteKey =""
104 tool.jTauRoIContainerWriteKey=""
105 tool.jEMRoIContainerWriteKey =""
106 tool.jTERoIContainerWriteKey =""
107 tool.jXERoIContainerWriteKey =""
108 else:
109 # read BS == write xAOD
110 tool.jJRoIContainerReadKey =""
111 tool.jLJRoIContainerReadKey =""
112 tool.jTauRoIContainerReadKey =""
113 tool.jEMRoIContainerReadKey =""
114 tool.jTERoIContainerReadKey =""
115 tool.jXERoIContainerReadKey =""
116
117 tool.jJRoIContainerWriteKey = "L1_jFexSRJetxRoI" if xTOBs else "L1_jFexSRJetRoI"
118 tool.jLJRoIContainerWriteKey = "L1_jFexLRJetxRoI" if xTOBs else "L1_jFexLRJetRoI"
119 tool.jTauRoIContainerWriteKey= "L1_jFexTauxRoI" if xTOBs else "L1_jFexTauRoI"
120 tool.jEMRoIContainerWriteKey = "L1_jFexFwdElxRoI" if xTOBs else "L1_jFexFwdElRoI"
121 tool.jTERoIContainerWriteKey = "L1_jFexSumETxRoI" if xTOBs else "L1_jFexSumETRoI"
122 tool.jXERoIContainerWriteKey = "L1_jFexMETxRoI" if xTOBs else "L1_jFexMETRoI"
123
124 if flags.Output.HISTFileName != '' or flags.Trigger.doHLT:
125 if flags.Trigger.doHLT:
126 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
127 monTool = GenericMonitoringTool(flags,'MonTool',HistPath = f'HLTFramework/L1BSConverters/{name}')
128 topDir = "EXPERT"
129 else:
130 # if used in offline reconstruction respect DQ convention (ATR-26371)
131 from AthenaMonitoring import AthMonitorCfgHelper
132 helper = AthMonitorCfgHelper(flags, 'HLTFramework')
133 monTool = helper.addGroup(None, f'{name}MonTool', f'/HLT/HLTFramework/L1BSConverters/{name}')
134 topDir = None
135 acc.merge(helper.result())
136
137 monTool.defineHistogram('jfexDecoderErrorTitle,jfexDecoderErrorLocation;errors', path=topDir, type='TH2I',
138 title='jFEX TOB Decoder Errors;Type;Location',
139 xlabels=["UNKNOWN"],
140 ylabels=["UNKNOWN"],
141 opt=['kCanRebin'],merge="merge")
142 tool.MonTool = monTool
143
144 acc.setPrivateTools(tool)
145 return acc
146
147
148def gFexByteStreamToolCfg(flags, name, *, writeBS=False):
149 acc = ComponentAccumulator()
150 tool = CompFactory.gFexByteStreamTool(name)
151 gfex_roi_moduleids = [0x3000]
152 tool.ROBIDs = [int(SourceIdentifier(SubDetector.TDAQ_CALO_FEAT_EXTRACT_ROI, moduleid)) for moduleid in gfex_roi_moduleids]
153 if writeBS:
154 # write BS == read xAOD
155 tool.gFexRhoOutputContainerReadKey ="L1_gFexRhoRoI"
156 tool.gFexSRJetOutputContainerReadKey ="L1_gFexSRJetRoI"
157 tool.gFexLRJetOutputContainerReadKey ="L1_gFexLRJetRoI"
158 tool.gScalarEJwojOutputContainerReadKey ="L1_gScalarEJwoj"
159 tool.gEspressoOutputContainerReadKey ="L1_gEspresso"
160 tool.gMETComponentsJwojOutputContainerReadKey ="L1_gMETComponentsJwoj"
161 tool.gMHTComponentsJwojOutputContainerReadKey ="L1_gMHTComponentsJwoj"
162 tool.gMSTComponentsJwojOutputContainerReadKey ="L1_gMSTComponentsJwoj"
163 tool.gMETComponentsNoiseCutOutputContainerReadKey ="L1_gMETComponentsNoiseCut"
164 tool.gMETComponentsRmsOutputContainerReadKey ="L1_gMETComponentsRms"
165 tool.gScalarENoiseCutOutputContainerReadKey ="L1_gScalarENoiseCut"
166 tool.gScalarERmsOutputContainerReadKey ="L1_gScalarERms"
167
168
169 tool.gFexRhoOutputContainerWriteKey =""
170 tool.gFexSRJetOutputContainerWriteKey =""
171 tool.gFexLRJetOutputContainerWriteKey =""
172 tool.gScalarEJwojOutputContainerWriteKey =""
173 tool.gEspressoOutputContainerWriteKey =""
174 tool.gMETComponentsJwojOutputContainerWriteKey =""
175 tool.gMHTComponentsJwojOutputContainerWriteKey =""
176 tool.gMSTComponentsJwojOutputContainerWriteKey =""
177 tool.gMETComponentsNoiseCutOutputContainerWriteKey =""
178 tool.gMETComponentsRmsOutputContainerWriteKey =""
179 tool.gScalarENoiseCutOutputContainerWriteKey =""
180 tool.gScalarERmsOutputContainerWriteKey =""
181 else:
182 # read BS == write xAOD
183 tool.gFexRhoOutputContainerReadKey =""
184 tool.gFexSRJetOutputContainerReadKey =""
185 tool.gFexLRJetOutputContainerReadKey =""
186 tool.gScalarEJwojOutputContainerReadKey =""
187 tool.gEspressoOutputContainerReadKey =""
188 tool.gMETComponentsJwojOutputContainerReadKey =""
189 tool.gMHTComponentsJwojOutputContainerReadKey =""
190 tool.gMSTComponentsJwojOutputContainerReadKey =""
191 tool.gMETComponentsNoiseCutOutputContainerReadKey =""
192 tool.gMETComponentsRmsOutputContainerReadKey =""
193 tool.gScalarENoiseCutOutputContainerReadKey =""
194 tool.gScalarERmsOutputContainerReadKey =""
195
196
197 tool.gFexRhoOutputContainerWriteKey ="L1_gFexRhoRoI"
198 tool.gFexSRJetOutputContainerWriteKey ="L1_gFexSRJetRoI"
199 tool.gFexLRJetOutputContainerWriteKey ="L1_gFexLRJetRoI"
200 tool.gScalarEJwojOutputContainerWriteKey ="L1_gScalarEJwoj"
201 tool.gEspressoOutputContainerWriteKey ="L1_gEspresso"
202 tool.gMETComponentsJwojOutputContainerWriteKey ="L1_gMETComponentsJwoj"
203 tool.gMHTComponentsJwojOutputContainerWriteKey ="L1_gMHTComponentsJwoj"
204 tool.gMSTComponentsJwojOutputContainerWriteKey ="L1_gMSTComponentsJwoj"
205 tool.gMETComponentsNoiseCutOutputContainerWriteKey ="L1_gMETComponentsNoiseCut"
206 tool.gMETComponentsRmsOutputContainerWriteKey ="L1_gMETComponentsRms"
207 tool.gScalarENoiseCutOutputContainerWriteKey ="L1_gScalarENoiseCut"
208 tool.gScalarERmsOutputContainerWriteKey ="L1_gScalarERms"
209
210
211 if flags.Output.HISTFileName != '' or flags.Trigger.doHLT:
212 if flags.Trigger.doHLT:
213 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
214 monTool = GenericMonitoringTool(flags,'MonTool',HistPath = f'HLTFramework/L1BSConverters/{name}')
215 topDir = "EXPERT"
216 else:
217 # if used in offline reconstruction respect DQ convention (ATR-26371)
218 from AthenaMonitoring import AthMonitorCfgHelper
219 helper = AthMonitorCfgHelper(flags, 'HLTFramework')
220 monTool = helper.addGroup(None, f'{name}MonTool', f'/HLT/HLTFramework/L1BSConverters/{name}')
221 topDir = None
222 acc.merge(helper.result())
223
224 monTool.defineHistogram('gfexDecoderErrorTitle,gfexDecoderErrorLocation;errors', path=topDir, type='TH2I',
225 title='gFEX TOB Decoder Errors;Type;Location',
226 xlabels=["UNKNOWN"],
227 ylabels=["UNKNOWN"],
228 opt=['kCanRebin'],merge="merge")
229 tool.MonTool = monTool
230
231
232 acc.setPrivateTools(tool)
233 return acc
234
235
236def jFexInputByteStreamToolCfg(flags, name, *, writeBS=False):
237 acc = ComponentAccumulator()
238 tool = CompFactory.jFexInputByteStreamTool(name)
239 jfex_roi_moduleids = [0x2000,0x2010,0x2020,0x2030,0x2040,0x2050]
240 tool.ROBIDs = [int(SourceIdentifier(SubDetector.TDAQ_CALO_FEAT_EXTRACT_DAQ, moduleid)) for moduleid in jfex_roi_moduleids]
241
242 #will be needed in the future for jTower container, still not coded
243 if writeBS:
244 # write BS == read xAOD
245 tool.jTowersReadKey = "L1_jFexDataTowers"
246
247 tool.jTowersWriteKey =""
248 else:
249 # read BS == write xAOD
250 tool.jTowersReadKey =""
251
252 tool.jTowersWriteKey = "L1_jFexDataTowers"
253
254 if flags.Output.HISTFileName != '' or flags.Trigger.doHLT:
255 if flags.Trigger.doHLT:
256 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
257 monTool = GenericMonitoringTool(flags,'MonTool',HistPath = f'HLTFramework/L1BSConverters/{name}')
258 topDir = "EXPERT"
259 else:
260 # if used in offline reconstruction respect DQ convention (ATR-26371)
261 from AthenaMonitoring import AthMonitorCfgHelper
262 helper = AthMonitorCfgHelper(flags, 'HLTFramework')
263 monTool = helper.addGroup(None, f'{name}MonTool', f'/HLT/HLTFramework/L1BSConverters/{name}')
264 topDir = None
265 acc.merge(helper.result())
266
267 monTool.defineHistogram('jfexDecoderErrorTitle,jfexDecoderErrorLocation;errors', path=topDir, type='TH2I',
268 title='jFEX InputData Decoder Errors;Type;Location',
269 xlabels=["UNKNOWN"],
270 ylabels=["UNKNOWN"],
271 opt=['kCanRebin'],merge="merge")
272 tool.MonTool = monTool
273
274
275 acc.setPrivateTools(tool)
276 return acc
277
278
279def gFexInputByteStreamToolCfg(flags, name, *, writeBS=False):
280 acc = ComponentAccumulator()
281 tool = CompFactory.gFexInputByteStreamTool(name)
282 gfex_roi_moduleids = [0x3000]
283 tool.ROBIDs = [int(SourceIdentifier(SubDetector.TDAQ_CALO_FEAT_EXTRACT_DAQ, moduleid)) for moduleid in gfex_roi_moduleids]
284
285 if writeBS:
286 # write BS == read xAOD
287 tool.gTowersReadKey = "L1_gFexDataTowers"
288
289 tool.gTowersWriteKey =""
290 else:
291 # read BS == write xAOD
292 tool.gTowersReadKey =""
293
294 tool.gTowersWriteKey = "L1_gFexDataTowers"
295
296 if flags.Output.HISTFileName != '' or flags.Trigger.doHLT:
297 if flags.Trigger.doHLT:
298 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
299 monTool = GenericMonitoringTool(flags,'MonTool',HistPath = f'HLTFramework/L1BSConverters/{name}')
300 topDir = "EXPERT"
301 else:
302 # if used in offline reconstruction respect DQ convention (ATR-26371)
303 from AthenaMonitoring import AthMonitorCfgHelper
304 helper = AthMonitorCfgHelper(flags, 'HLTFramework')
305 monTool = helper.addGroup(None, f'{name}MonTool', f'/HLT/HLTFramework/L1BSConverters/{name}')
306 topDir = None
307 acc.merge(helper.result())
308
309 monTool.defineHistogram('gfexDecoderErrorTitle,gfexDecoderErrorLocation;errors', path=topDir, type='TH2I',
310 title='gFEX InputData Decoder Errors;Type;Location',
311 xlabels=["UNKNOWN"],
312 ylabels=["UNKNOWN"],
313 opt=['kCanRebin'],merge="merge")
314 tool.MonTool = monTool
315
316 acc.setPrivateTools(tool)
317 return acc
eFexByteStreamToolCfg(flags, name, *, writeBS=False, TOBs=True, xTOBs=False, multiSlice=False, decodeInputs=False)
jFexRoiByteStreamToolCfg(flags, name, *, writeBS=False, xTOBs=False)
jFexInputByteStreamToolCfg(flags, name, *, writeBS=False)
gFexByteStreamToolCfg(flags, name, *, writeBS=False)
gFexInputByteStreamToolCfg(flags, name, *, writeBS=False)