3 from AthenaConfiguration.ComponentFactory
import CompFactory
4 from AthenaMonitoringKernel.GenericMonitoringTool
import GenericMonitoringTool
5 from TrigConfigSvc.TriggerConfigAccess
import getL1MenuAccess
9 hypo = CompFactory.L1TopoOnlineMonitorHypo()
13 tool = CompFactory.L1TopoOnlineMonitorHypoTool(
14 chainDict[
'chainName'],
16 ErrorFlagsKey =
'L1TopoErrorFlags',
17 AcceptTrivialFlag =
True)
21 def getL1TopoLabels(flags,connectors = {0:
'LegacyTopo0', 1:
'LegacyTopo1'}, bmax = 128):
22 topo_trigline_labels = [
"" for i
in range(bmax)]
24 for connector_id, connectorKey
in connectors.items():
25 topo_triglines_dict = lvl1access.connector(connectorKey)[
'triggerlines']
26 if not isinstance(topo_triglines_dict, list):
28 topo_fpga = topo_triglines_dict[
'fpga{:d}'.
format(fpga_id)]
29 for clock_id
in [0,1]:
30 topo_clock = topo_fpga[
'clock{:d}'.
format(clock_id)]
31 for topo_trigline
in topo_clock:
32 topo_trigline_name = topo_trigline[
'name']
33 bit_id = topo_trigline[
'startbit']
34 topo_trigline_index = 64*connector_id + 32*fpga_id + 2*bit_id + clock_id
35 topo_trigline_labels[topo_trigline_index] = topo_trigline_name
37 for topo_trigline
in topo_triglines_dict:
38 topo_trigline_name = topo_trigline[
'name']
39 topo_trigline_name= topo_trigline_name.replace(
"TOPO_",
"")
40 bit_id = topo_trigline[
'startbit']
41 fpga_id = topo_trigline[
'fpga']
42 clock_id = topo_trigline[
'clock']
43 topo_trigline_index = 64*connector_id + 32*fpga_id + 2*bit_id + clock_id
44 topo_trigline_labels[topo_trigline_index] = topo_trigline_name
46 for i
in range(len(topo_trigline_labels)):
47 if ( topo_trigline_labels[i] ==
""):
48 topo_trigline_labels[i] =
"-- Unassigned Item --"
50 return topo_trigline_labels
53 topo_trigline_labels = [
"" for i
in range(128)]
55 topo_triglines_dict = lvl1access.connector(topoModule)[
'triggerlines']
57 for topo_trigline
in topo_triglines_dict:
58 topo_trigline_name = topo_trigline[
'name']
59 bit_id = topo_trigline[
'startbit']
60 topo_trigline_labels[bit_id] = topo_trigline_name
61 if ( topo_trigline_labels[bit_id].
find(
"SPARE") >= 0):
62 topo_trigline_labels[bit_id] =
"-- Unassigned Item --"
64 return topo_trigline_labels
67 IsData =
not flags.Input.isMC
70 def getL1TopoPhase1OnlineMonitor(flags, name='L1TopoOnlineMonitor', doSimMon=True, doHwMonCtp=False, doHwMon=False, doComp=False, doMultComp=False, forceCtp=False, logLevel = None, toolName="L1TopoMonitoringTool"):
71 alg = CompFactory.L1TopoOnlineMonitor(toolName,
75 doHwMonCTP = doHwMonCtp,
77 doMultComp = doMultComp,
78 forceCTPasHdw=forceCtp,
79 MultiplicityVetoList=[
"ZeroBiasA",
"ZeroBiasB"],
80 AlgorithmVetoList =[
"jXE40delay",
"TeATIME"])
81 if logLevel : alg.OutputLevel=logLevel
83 alg.MonTool.HistPath = name
88 def getL1TopoPhase1DQMonitor(flags, name='L1TopoDQMonitor', doSimMon=True, doHwMonCtp=False, doHwMon=False, doComp=False, doMultComp=False, forceCtp=False, logLevel = None, toolName="L1TopoMonitoringTool"):
89 from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig
import L1CaloMonitorCfgHelper
90 helper = L1CaloMonitorCfgHelper(flags,CompFactory.L1TopoOnlineMonitor,toolName,
94 doHwMonCTP = doHwMonCtp,
96 doMultComp = doMultComp,
97 MultiplicityVetoList=[
"ZeroBiasA",
"ZeroBiasB"],
98 AlgorithmVetoList =[
"jXE40delay",
"TeATIME"],
99 forceCTPasHdw=forceCtp)
102 helper.defineDQAlgorithm(
"L1TopoAlgMismatchRate",
103 hanConfig={
"libname":
"libdqm_summaries.so",
"name":
"Bins_GreaterThan_Threshold",
"BinThreshold":
"0.002",
"PublishBins":
"1",
"IgnoreBins":
"\"*:125,*:123,*:96,*:94,*:92,*:90,*:37,*:20,*:18\""},
104 thresholdConfig={
"NBins":[0,1]},
107 helper.defineDQAlgorithm(
"L1TopoMultMismatchRate",
108 hanConfig={
"libname":
"libdqm_summaries.so",
"name":
"Bins_GreaterThan_Threshold",
"BinThreshold":
"0.002",
"PublishBins":
"1",
"IgnoreBins":
"\"*:120,*:119,*:115\""},
109 thresholdConfig={
"NBins":[0,1]},
112 helper.defineDQAlgorithm(
"L1TopoMismatchCountVerticalRange",
113 hanConfig={
"libname":
"libdqm_summaries.so",
"name":
"Bins_GreaterThan_Threshold",
"BinThreshold":
"0.001",
"PublishBins":
"1",
"yMax":
"2"},
114 thresholdConfig={
"NBins":[0,1]},
118 ylabels = [
'#splitline{Sim counts <}{Hdw counts}',
'#splitline{Sim counts >}{Hdw counts}',
'#splitline{Sim counts =}{Hdw counts}']
119 name =
'LBN,MultiplicityAllBoards,L1TopoMultiplicityMissMatchVsLumi;L1TopoMultiplicityMismatchRateVsLumi'
121 for cable
in range(4):
122 topoName =
'Topo1Opt'+
str(cable)
125 AllLabels = [x
for x
in AllLabels
if x]
127 helper.defineHistogram(name,
128 fillGroup=
"L1TopoDQ_mismatches",
129 paths=[
'Expert/Sim',
'Shifter/Sim'],
130 hanConfig={
"algorithm":
"L1TopoMultMismatchRate",
"description":
"Drag the y-axis to make the text bigger",
"display":
"SetPalette(87),Draw=COLZ"},
132 title=
"L1Topo Multiplicities Sim/Hdw mismatch rate;LB", xbins=32, ybins=len(AllLabels),
134 ymin=0, ymax=len(AllLabels),
136 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
138 for cable
in range(4):
140 topoName =
'Topo1Opt'+
str(cable)
141 name =
'MultiplicityTopo1Opt'+
str(cable)+
',MultiplicityMatchTopo1Opt'+
str(cable)
142 name += f
';{topoName}_mismatch'
143 title = f
'Topo Optical Cable {cable} Miss/Matches Summary'
145 xlabels = [x
for x
in labels
if x]
147 helper.defineHistogram(name,
148 fillGroup=
"L1TopoDQ_mismatches",
149 paths=[
'Developer/Sim/detail/L1Topo/Multiplicities'],
150 hanConfig={
"algorithm":
"L1TopoMismatchCountVerticalRange",
"description":
"Agreements and Mismatches between L1Topo Simulation and Hdw per L1Topo Item (x-axis). The upper row should be filled (Sim and Hdw agrees), while the lower two rows shouldn't have any entry",
"display":
"SetPalette(55)"},
152 title=title, xbins=len(xlabels), ybins=3,
153 xlabels=xlabels,ylabels=ylabels,
154 xmin=0, xmax=len(xlabels),
155 ymin=0, ymax=len(ylabels),
156 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
159 for cable
in range(2):
160 name =
'CableElec_'+
str(cable+2)
161 name +=
';Topo'+
str(cable+2)+
'El'
162 title = f
'Topo Electric Cable {cable+2}'
164 label_topo_all += labels
168 ylabels = [
'#splitline{Sim counts <}{Hdw counts}',
'#splitline{Sim counts >}{Hdw counts}',
'#splitline{Sim counts =}{Hdw counts}']
169 nameLB =
'LBN,L1TopoAlgorithmAllBoards,L1TopoAlgorithmMissMatchVsLumi;L1TopoAlgoMismatchRateVsLB'
171 helper.defineHistogram(nameLB,
172 fillGroup=
"L1TopoDQ_mismatches",
173 paths=[
'Expert/Sim',
'Shifter/Sim'],
174 hanConfig={
"algorithm":
"L1TopoAlgMismatchRate",
"description":
"Drag the y-axis to make the text bigger",
"display":
"SetPalette(87),Draw=COLZ"},
176 title=
"L1Topo Algorithms Sim/Hdw mismatch rate;LB",xbins=32,ybins=128,
178 ylabels=label_topo_all,
181 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
183 for topo
in [(0,
'2a'),(1,
'2b'),(2,
'3a'),(3,
'3b')]:
184 name = f
'Phase1TopoTrigger_{topo[0]},L1TopoAlgorithmMissMatch_{topo[0]};L1TopoAlgo_{topo[1]}'
185 title = f
'L1Topo_Algo_{topo[1]} Miss/Matches Summary'
186 helper.defineHistogram(name,
187 fillGroup=
"L1TopoDQ_mismatches",
188 paths=[
'Developer/Sim/detail/L1Topo/Algos'],
189 hanConfig={
"algorithm":
"L1TopoMismatchCountVerticalRange",
"description":
"Agreements and Mismatches between L1Topo Simulation and Hardware per L1Topo Item (x-axis). The upper row should be filled (Sim and Hdw agrees), while the lower two rows shouldn't have any entry",
"display":
"SetPalette(55)"},
191 title=title,xbins=32,ybins=3,
193 xlabels=label_topo_all[topo[0]*32:(topo[0]+1)*32],
196 ymin=0, ymax=len(ylabels),
197 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
200 #Not Including Overflow plots for now
201 #L1Topo Algorithms Overflow mismatches
202 #ylabelsOF = ['#frac{HdwOFnotSimOF}{HdwOF}','#frac{SimOFnotHdwOF}{SimOF}','#frac{HdwOFandSimOF}{HdwOForSimOF}','#frac{HdwOF}{SimOF}']
203 ylabelsOF = ['#splitline{Sim counts <}{Hdw counts}','#splitline{Sim counts >}{Hdw counts}','#splitline{Sim counts =}{Hdw counts}']
204 for topo in [(0,'2a'),(1,'2b'),(2,'3a'),(3,'3b')]:
205 #name_OF = f'Phase1TopoTrigger_{topo[0]},Phase1TopoMissMatch_{topo[0]};Ph1Topo{topo[1]}_overflows'
206 name_OF = f'Phase1TopoTrigger_{topo[0]},L1TopoAlgorithmOverflowMissMatch_{topo[0]};L1TopoAlgo_OF{topo[1]}'
207 title_OF = f' L1Topo_Algo_{topo[1]} Overflow Miss/Matches Summary'
208 helper.defineHistogram(name_OF,
209 fillGroup="L1TopoDQ_mismatches",
210 paths=['Expert/Sim/detail/L1Topo/Algos/Overflows'],
211 hanConfig={"description":"Agreements and Mismatches between L1Topo Simulation and Hardware per L1Topo Item (x-axis). The upper row should be filled (Sim and Hdw agrees), while the lower two rows shouldn't have any entry","display":"SetPalette(55)"}, type='TH2F',
212 title=title_OF,xbins=32,ybins=3,
213 #weight=f'Phase1TopoOFWeight_{topo[0]}',
214 xlabels=label_topo_all[topo[0]*32:(topo[0]+1)*32],
217 ymin=0, ymax=len(ylabelsOF),
218 opt=['kAddBinsDynamically','kCanRebin','kAlwaysCreate'],merge='merge')
221 helper.alg.MonTool = helper.fillGroups[
"L1TopoDQ_mismatches"]
222 return helper.result()
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}'
233 label_topo_all += labels
234 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH1I',
235 title=title, xbins=64, xlabels=labels,
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}'
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,
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)'
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,
261 xmin=0, xmax=len(xlabels))
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'
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))
277 for cable
in range(4):
278 topoName =
'Topo1Opt'+
str(cable)
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,
289 alg.MonTool.defineHistogram(
'TopoSim', path=
'EXPERT', type=
'TH1I',
290 title=
'Simulation Results for L1Topo', xbins=128, xlabels=label_topo_all,
292 alg.MonTool.defineHistogram(
'TopoSim_overflows', path=
'EXPERT', type=
'TH1I',
293 title=
'Overflow Simulation Results for L1Topo', xbins=128, xlabels=label_topo_all,
295 alg.MonTool.defineHistogram(
'TopoSim_ambiguity', path=
'EXPERT', type=
'TH1I',
296 title=
'Ambiguity Results for L1Topo', xbins=128, xlabels=label_topo_all,
300 alg.MonTool.defineHistogram(
'TopoCTP', path=
'EXPERT', type=
'TH1I',
301 title=
'CTP Results for L1Topo', xbins=128, xlabels=label_topo_all,
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,
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,
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,
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,
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],
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],
344 ymin=0, ymax=len(ylabelsOF))
347 alg.MonTool.defineHistogram(
'HdwResults', path=
'EXPERT', type=
'TH1I',
348 title=
'Hardware Results for L1Topo', xbins=128, xlabels=label_topo_all,
350 alg.MonTool.defineHistogram(
'OverflowResults', path=
'EXPERT', type=
'TH1I',
351 title=
'Overflow Results for L1Topo', xbins=128, xlabels=label_topo_all,
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))
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))