225def configureHistograms(alg, flags, doHwMonCtp, doHwMon, doComp, doMultComp):
226
227 label_topo_all = []
228 for cable in range(2):
229 name = 'CableElec_'+str(cable+2)
230 name += ';Topo'+str(cable+2)+'El'
231 title = f'Topo Electric Cable {cable+2}'
232 labels = getL1TopoLabels(flags,{0: f'Topo{cable+2}El'},64)
233 label_topo_all += labels
234 alg.MonTool.defineHistogram(name, path='EXPERT', type='TH1I',
235 title=title, xbins=64, xlabels=labels,
236 xmin=0, xmax=64)
237
238 for cable in range(4):
239 topoName = 'Topo1Opt'+str(cable)
240 name = 'CableOpti_'+str(cable)
241 weight = name+'_weight'
242 name += f';{topoName}'
243 title = f'Topo Optical Cable {cable}'
244 labels = getMultiplicityLabels(flags=flags,topoModule=topoName)
245 xlabels = [x for x in labels if x]
246 alg.MonTool.defineHistogram(name, path='EXPERT', type='TH1I',
247 title=title, xbins=len(xlabels), xlabels=xlabels,
248 weight=weight,
249 xmin=0, xmax=len(xlabels))
250 for cable in range(4):
251 topoName = 'Topo1Opt'+str(cable)
252 name = 'HdwTopo1Opt'+str(cable)
253 weight = name+'_weight'
254 name += f';{topoName}_data'
255 title = f'Topo Optical Cable {cable} (Data)'
256 labels = getMultiplicityLabels(flags=flags,topoModule=topoName)
257 xlabels = [x for x in labels if x]
258 alg.MonTool.defineHistogram(name, path='EXPERT', type='TH1I',
259 title=title, xbins=len(xlabels), xlabels=xlabels,
260 weight=weight,
261 xmin=0, xmax=len(xlabels))
262
263 for cable in range(4):
264 ylabels = ['#splitline{Sim counts <}{Hdw counts}','#splitline{Sim counts >}{Hdw counts}','#splitline{Sim counts =}{Hdw counts}']
265 topoName = 'Topo1Opt'+str(cable)
266 name = 'MultiplicityTopo1Opt'+str(cable)+',MultiplicityMatchTopo1Opt'+str(cable)
267 name += f';{topoName}_mismatch'
268 title = f'Topo Optical Cable {cable} Miss/Matches Summary'
269 labels = getMultiplicityLabels(flags=flags,topoModule=topoName)
270 xlabels = [x for x in labels if x]
271 alg.MonTool.defineHistogram(name, path='EXPERT', type='TH2F',
272 title=title, xbins=len(xlabels), ybins=3,
273 xlabels=xlabels,ylabels=ylabels,
274 xmin=0, xmax=len(xlabels),
275 ymin=0, ymax=len(ylabels))
276
277 for cable in range(4):
278 topoName = 'Topo1Opt'+str(cable)
279 labels = getMultiplicityLabels(flags=flags,topoModule=topoName)
280 labels = [x for x in labels if x]
281 for i,label in enumerate(labels):
282 name = f'Topo1Opt{cable}_{i}_Sim,Topo1Opt{cable}_{i}_Hdw;Topo1Opt{cable}_{label}'
283 title = f'Topo1Opt{cable}_{label};Simulation Counts;Hardware Counts'
284 alg.MonTool.defineHistogram(name, path='EXPERT', type='TH2F',
285 title=title,xbins=10,ybins=10,
286 xmin=0, xmax=10,
287 ymin=0, ymax=10)
288
289 alg.MonTool.defineHistogram('TopoSim', path='EXPERT', type='TH1I',
290 title='Simulation Results for L1Topo', xbins=128, xlabels=label_topo_all,
291 xmin=0, xmax=128)
292 alg.MonTool.defineHistogram('TopoSim_overflows', path='EXPERT', type='TH1I',
293 title='Overflow Simulation Results for L1Topo', xbins=128, xlabels=label_topo_all,
294 xmin=0, xmax=128)
295 alg.MonTool.defineHistogram('TopoSim_ambiguity', path='EXPERT', type='TH1I',
296 title='Ambiguity Results for L1Topo', xbins=128, xlabels=label_topo_all,
297 xmin=0, xmax=128)
298
299 if doHwMonCtp:
300 alg.MonTool.defineHistogram('TopoCTP', path='EXPERT', type='TH1I',
301 title='CTP Results for L1Topo', xbins=128, xlabels=label_topo_all,
302 xmin=0, xmax=128)
303
304 if doComp:
305 alg.MonTool.defineHistogram('SimNotHdwL1TopoResult', path='EXPERT', type='TH1I',
306 title='L1Topo events with simulation accept and hardware fail',
307 xbins=128, xlabels=label_topo_all,
308 xmin=0, xmax=128)
309 alg.MonTool.defineHistogram('HdwNotSimL1TopoResult', path='EXPERT', type='TH1I',
310 title='L1Topo events with hardware accept and simulation fail',
311 xbins=128, xlabels=label_topo_all,
312 xmin=0, xmax=128)
313 alg.MonTool.defineHistogram('Ambiguity_SimANDHdwDecisions', path='EXPERT', type='TH1I',
314 title='L1Topo ambiguity events with simulation accept and hardware accept',
315 xbins=128, xlabels=label_topo_all,
316 xmin=0, xmax=128)
317 alg.MonTool.defineHistogram('Ambiguity_DecisionMismatches', path='EXPERT', type='TH1I',
318 title='L1Topo ambiguity events with mismatches between simulation and hardware',
319 xbins=128, xlabels=label_topo_all,
320 xmin=0, xmax=128)
321
322 if doMultComp:
323 ylabels = ['#frac{HdwNotSim}{Hdw}','#frac{SimNotHdw}{Sim}','#frac{HdwAndSim}{HdwOrSim}','#frac{Hdw}{Sim}']
324 for topo in [(0,'2a'),(1,'2b'),(2,'3a'),(3,'3b')]:
325 name = f'Phase1TopoTrigger_{topo[0]},Phase1TopoMissMatch_{topo[0]};Ph1Topo{topo[1]}'
326 title = f'Phase1 Topo{topo[1]} Miss/Matches Summary'
327 alg.MonTool.defineHistogram(name, path='EXPERT', type='TH2F',
328 title=title,xbins=32,ybins=4,
329 weight=f'Phase1TopoWeight_{topo[0]}',
330 xlabels=label_topo_all[topo[0]*32:(topo[0]+1)*32],
331 ylabels=ylabels,
332 xmin=0, xmax=32,
333 ymin=0, ymax=len(ylabels))
334 ylabelsOF = ['#frac{HdwOFnotSimOF}{HdwOF}','#frac{SimOFnotHdwOF}{SimOF}','#frac{HdwOFandSimOF}{HdwOForSimOF}','#frac{HdwOF}{SimOF}']
335 for topo in [(0,'2a'),(1,'2b'),(2,'3a'),(3,'3b')]:
336 name_OF = f'Phase1TopoTrigger_{topo[0]},Phase1TopoMissMatch_{topo[0]};Ph1Topo{topo[1]}_overflows'
337 title_OF = f'Phase1 Topo{topo[1]} Overflow Miss/Matches Summary'
338 alg.MonTool.defineHistogram(name_OF, path='EXPERT', type='TH2F',
339 title=title_OF,xbins=32,ybins=4,
340 weight=f'Phase1TopoOFWeight_{topo[0]}',
341 xlabels=label_topo_all[topo[0]*32:(topo[0]+1)*32],
342 ylabels=ylabelsOF,
343 xmin=0, xmax=32,
344 ymin=0, ymax=len(ylabelsOF))
345
346 if doHwMon:
347 alg.MonTool.defineHistogram('HdwResults', path='EXPERT', type='TH1I',
348 title='Hardware Results for L1Topo', xbins=128, xlabels=label_topo_all,
349 xmin=0, xmax=128)
350 alg.MonTool.defineHistogram('OverflowResults', path='EXPERT', type='TH1I',
351 title='Overflow Results for L1Topo', xbins=128, xlabels=label_topo_all,
352 xmin=0, xmax=128)
353 rod_errors_labels = ["CT", "pc", "hc", "pe", "lm", "hm", "pt"]
354 alg.MonTool.defineHistogram('ROD_Errors', path='EXPERT', type='TH1I',
355 title='Counts of ROD errors', xbins=len(rod_errors_labels), xlabels=rod_errors_labels,
356 xmin=0, xmax=len(rod_errors_labels))
357 fpga_errors_labels = ["CT", "sm", "pe", "lm", "hm", "pt"]
358 fpga_indexes = ["topo1fpga1", "topo1fpga0", "topo2fpga1", "topo2fpga0", "topo3fpga1", "topo3fpga0"]
359 alg.MonTool.defineHistogram('FPGA_Errors, FPGA_Labels; FPGA_Errors', path='EXPERT', type='TH2I',
360 title='Counts of FPGA errors',xbins=len(fpga_errors_labels),ybins=len(fpga_indexes),
361 xlabels=fpga_errors_labels,
362 ylabels=fpga_indexes,
363 xmin=0, xmax=len(fpga_errors_labels),
364 ymin=0, ymax=len(fpga_indexes))
365
366
367 mon_failure_labels = ['doHwMon', 'doSimMon', 'doHwMonCTP', 'doComp', 'doMultComp']
368 alg.MonTool.defineHistogram('MonitoringFailures', path='EXPERT', type='TH1F',
369 title='Counts of mon functions returning failure;;Entries',
370 xlabels=mon_failure_labels, xbins=len(mon_failure_labels),
371 xmin=0, xmax=len(mon_failure_labels))