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