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"])
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"],
99 forceCTPasHdw=forceCtp)
102 helper.defineDQAlgorithm(
"L1TopoMismatchRate",
103 hanConfig={
"libname":
"libdqm_summaries.so",
"name":
"Bins_GreaterThan_Threshold",
"BinThreshold":
"0.001",
"PublishBins":
"1"},
104 thresholdConfig={
"NBins":[0,1]},
107 helper.defineDQAlgorithm(
"L1TopoMismatchCountVerticalRange",
108 hanConfig={
"libname":
"libdqm_summaries.so",
"name":
"Bins_GreaterThan_Threshold",
"BinThreshold":
"0.001",
"PublishBins":
"1",
"yMax":
"2"},
109 thresholdConfig={
"NBins":[0,1]},
113 ylabels = [
'#splitline{Sim counts <}{Hdw counts}',
'#splitline{Sim counts >}{Hdw counts}',
'#splitline{Sim counts =}{Hdw counts}']
114 name =
'LBN,MultiplicityAllBoards,L1TopoMultiplicityMissMatchVsLumi;L1TopoMultiplicityMismatchRateVsLumi'
116 for cable
in range(4):
117 topoName =
'Topo1Opt'+
str(cable)
120 AllLabels = [x
for x
in AllLabels
if x]
122 helper.defineHistogram(name,
123 fillGroup=
"L1TopoDQ_mismatches",
124 paths=[
'Expert/Sim'],
125 hanConfig={
"algorithm":
"L1TopoMismatchRate",
"description":
"Agreements and Mismatches between L1Topo Simulation and Hdw perLumi-Block",
"display":
"SetPalette(87),Draw=COLZTEXT"},
127 title=
"L1Topo Multiplicities Sim/Hdw mismatch rate", xbins=32, ybins=len(AllLabels),
129 ymin=0, ymax=len(AllLabels),
131 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
133 for cable
in range(4):
135 topoName =
'Topo1Opt'+
str(cable)
136 name =
'MultiplicityTopo1Opt'+
str(cable)+
',MultiplicityMatchTopo1Opt'+
str(cable)
137 name += f
';{topoName}_mismatch'
138 title = f
'Topo Optical Cable {cable} Miss/Matches Summary'
140 xlabels = [x
for x
in labels
if x]
142 helper.defineHistogram(name,
143 fillGroup=
"L1TopoDQ_mismatches",
144 paths=[
'Expert/Sim/detail/L1Topo/Multiplicities'],
145 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)"},
147 title=title, xbins=len(xlabels), ybins=3,
148 xlabels=xlabels,ylabels=ylabels,
149 xmin=0, xmax=len(xlabels),
150 ymin=0, ymax=len(ylabels),
151 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
154 for cable
in range(2):
155 name =
'CableElec_'+
str(cable+2)
156 name +=
';Topo'+
str(cable+2)+
'El'
157 title = f
'Topo Electric Cable {cable+2}'
159 label_topo_all += labels
163 ylabels = [
'#splitline{Sim counts <}{Hdw counts}',
'#splitline{Sim counts >}{Hdw counts}',
'#splitline{Sim counts =}{Hdw counts}']
164 nameLB =
'LBN,L1TopoAlgorithmAllBoards,L1TopoAlgorithmMissMatchVsLumi;L1TopoAlgoMismatchRateVsLB'
166 helper.defineHistogram(nameLB,
167 fillGroup=
"L1TopoDQ_mismatches",
168 paths=[
'Expert/Sim'],
169 hanConfig={
"algorithm":
"L1TopoMismatchRate",
"description":
"Mismatch Rate between L1Topo Simulation and Hardware vs Lumi-Block (x-axis)",
"display":
"SetPalette(87),Draw=COLZTEXT"},
171 title=
"L1Topo Algorithms Sim/Hdw mismatch rate",xbins=32,ybins=128,
173 ylabels=label_topo_all,
176 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
178 for topo
in [(0,
'2a'),(1,
'2b'),(2,
'3a'),(3,
'3b')]:
179 name = f
'Phase1TopoTrigger_{topo[0]},L1TopoAlgorithmMissMatch_{topo[0]};L1TopoAlgo_{topo[1]}'
180 title = f
'L1Topo_Algo_{topo[1]} Miss/Matches Summary'
181 helper.defineHistogram(name,
182 fillGroup=
"L1TopoDQ_mismatches",
183 paths=[
'Expert/Sim/detail/L1Topo/Algos'],
184 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)"},
186 title=title,xbins=32,ybins=3,
188 xlabels=label_topo_all[topo[0]*32:(topo[0]+1)*32],
191 ymin=0, ymax=len(ylabels),
192 opt=[
'kAddBinsDynamically',
'kCanRebin',
'kAlwaysCreate'],merge=
'merge')
195 #Not Including Overflow plots for now
196 #L1Topo Algorithms Overflow mismatches
197 #ylabelsOF = ['#frac{HdwOFnotSimOF}{HdwOF}','#frac{SimOFnotHdwOF}{SimOF}','#frac{HdwOFandSimOF}{HdwOForSimOF}','#frac{HdwOF}{SimOF}']
198 ylabelsOF = ['#splitline{Sim counts <}{Hdw counts}','#splitline{Sim counts >}{Hdw counts}','#splitline{Sim counts =}{Hdw counts}']
199 for topo in [(0,'2a'),(1,'2b'),(2,'3a'),(3,'3b')]:
200 #name_OF = f'Phase1TopoTrigger_{topo[0]},Phase1TopoMissMatch_{topo[0]};Ph1Topo{topo[1]}_overflows'
201 name_OF = f'Phase1TopoTrigger_{topo[0]},L1TopoAlgorithmOverflowMissMatch_{topo[0]};L1TopoAlgo_OF{topo[1]}'
202 title_OF = f' L1Topo_Algo_{topo[1]} Overflow Miss/Matches Summary'
203 helper.defineHistogram(name_OF,
204 fillGroup="L1TopoDQ_mismatches",
205 paths=['Expert/Sim/detail/L1Topo/Algos/Overflows'],
206 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',
207 title=title_OF,xbins=32,ybins=3,
208 #weight=f'Phase1TopoOFWeight_{topo[0]}',
209 xlabels=label_topo_all[topo[0]*32:(topo[0]+1)*32],
212 ymin=0, ymax=len(ylabelsOF),
213 opt=['kAddBinsDynamically','kCanRebin','kAlwaysCreate'],merge='merge')
216 helper.alg.MonTool = helper.fillGroups[
"L1TopoDQ_mismatches"]
217 return helper.result()
223 for cable
in range(2):
224 name =
'CableElec_'+
str(cable+2)
225 name +=
';Topo'+
str(cable+2)+
'El'
226 title = f
'Topo Electric Cable {cable+2}'
228 label_topo_all += labels
229 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH1I',
230 title=title, xbins=64, xlabels=labels,
233 for cable
in range(4):
234 topoName =
'Topo1Opt'+
str(cable)
235 name =
'CableOpti_'+
str(cable)
236 weight = name+
'_weight'
237 name += f
';{topoName}'
238 title = f
'Topo Optical Cable {cable}'
240 xlabels = [x
for x
in labels
if x]
241 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH1I',
242 title=title, xbins=len(xlabels), xlabels=xlabels,
244 xmin=0, xmax=len(xlabels))
245 for cable
in range(4):
246 topoName =
'Topo1Opt'+
str(cable)
247 name =
'HdwTopo1Opt'+
str(cable)
248 weight = name+
'_weight'
249 name += f
';{topoName}_data'
250 title = f
'Topo Optical Cable {cable} (Data)'
252 xlabels = [x
for x
in labels
if x]
253 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH1I',
254 title=title, xbins=len(xlabels), xlabels=xlabels,
256 xmin=0, xmax=len(xlabels))
258 for cable
in range(4):
259 ylabels = [
'#splitline{Sim counts <}{Hdw counts}',
'#splitline{Sim counts >}{Hdw counts}',
'#splitline{Sim counts =}{Hdw counts}']
260 topoName =
'Topo1Opt'+
str(cable)
261 name =
'MultiplicityTopo1Opt'+
str(cable)+
',MultiplicityMatchTopo1Opt'+
str(cable)
262 name += f
';{topoName}_mismatch'
263 title = f
'Topo Optical Cable {cable} Miss/Matches Summary'
265 xlabels = [x
for x
in labels
if x]
266 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH2F',
267 title=title, xbins=len(xlabels), ybins=3,
268 xlabels=xlabels,ylabels=ylabels,
269 xmin=0, xmax=len(xlabels),
270 ymin=0, ymax=len(ylabels))
272 for cable
in range(4):
273 topoName =
'Topo1Opt'+
str(cable)
275 labels = [x
for x
in labels
if x]
276 for i,label
in enumerate(labels):
277 name = f
'Topo1Opt{cable}_{i}_Sim,Topo1Opt{cable}_{i}_Hdw;Topo1Opt{cable}_{label}'
278 title = f
'Topo1Opt{cable}_{label};Simulation Counts;Hardware Counts'
279 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH2F',
280 title=title,xbins=10,ybins=10,
284 alg.MonTool.defineHistogram(
'TopoSim', path=
'EXPERT', type=
'TH1I',
285 title=
'Simulation Results for L1Topo', xbins=128, xlabels=label_topo_all,
287 alg.MonTool.defineHistogram(
'TopoSim_overflows', path=
'EXPERT', type=
'TH1I',
288 title=
'Overflow Simulation Results for L1Topo', xbins=128, xlabels=label_topo_all,
290 alg.MonTool.defineHistogram(
'TopoSim_ambiguity', path=
'EXPERT', type=
'TH1I',
291 title=
'Ambiguity Results for L1Topo', xbins=128, xlabels=label_topo_all,
295 alg.MonTool.defineHistogram(
'TopoCTP', path=
'EXPERT', type=
'TH1I',
296 title=
'CTP Results for L1Topo', xbins=128, xlabels=label_topo_all,
300 alg.MonTool.defineHistogram(
'SimNotHdwL1TopoResult', path=
'EXPERT', type=
'TH1I',
301 title=
'L1Topo events with simulation accept and hardware fail',
302 xbins=128, xlabels=label_topo_all,
304 alg.MonTool.defineHistogram(
'HdwNotSimL1TopoResult', path=
'EXPERT', type=
'TH1I',
305 title=
'L1Topo events with hardware accept and simulation fail',
306 xbins=128, xlabels=label_topo_all,
308 alg.MonTool.defineHistogram(
'Ambiguity_SimANDHdwDecisions', path=
'EXPERT', type=
'TH1I',
309 title=
'L1Topo ambiguity events with simulation accept and hardware accept',
310 xbins=128, xlabels=label_topo_all,
312 alg.MonTool.defineHistogram(
'Ambiguity_DecisionMismatches', path=
'EXPERT', type=
'TH1I',
313 title=
'L1Topo ambiguity events with mismatches between simulation and hardware',
314 xbins=128, xlabels=label_topo_all,
318 ylabels = [
'#frac{HdwNotSim}{Hdw}',
'#frac{SimNotHdw}{Sim}',
'#frac{HdwAndSim}{HdwOrSim}',
'#frac{Hdw}{Sim}']
319 for topo
in [(0,
'2a'),(1,
'2b'),(2,
'3a'),(3,
'3b')]:
320 name = f
'Phase1TopoTrigger_{topo[0]},Phase1TopoMissMatch_{topo[0]};Ph1Topo{topo[1]}'
321 title = f
'Phase1 Topo{topo[1]} Miss/Matches Summary'
322 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH2F',
323 title=title,xbins=32,ybins=4,
324 weight=f
'Phase1TopoWeight_{topo[0]}',
325 xlabels=label_topo_all[topo[0]*32:(topo[0]+1)*32],
328 ymin=0, ymax=len(ylabels))
329 ylabelsOF = [
'#frac{HdwOFnotSimOF}{HdwOF}',
'#frac{SimOFnotHdwOF}{SimOF}',
'#frac{HdwOFandSimOF}{HdwOForSimOF}',
'#frac{HdwOF}{SimOF}']
330 for topo
in [(0,
'2a'),(1,
'2b'),(2,
'3a'),(3,
'3b')]:
331 name_OF = f
'Phase1TopoTrigger_{topo[0]},Phase1TopoMissMatch_{topo[0]};Ph1Topo{topo[1]}_overflows'
332 title_OF = f
'Phase1 Topo{topo[1]} Overflow Miss/Matches Summary'
333 alg.MonTool.defineHistogram(name_OF, path=
'EXPERT', type=
'TH2F',
334 title=title_OF,xbins=32,ybins=4,
335 weight=f
'Phase1TopoOFWeight_{topo[0]}',
336 xlabels=label_topo_all[topo[0]*32:(topo[0]+1)*32],
339 ymin=0, ymax=len(ylabelsOF))
342 alg.MonTool.defineHistogram(
'HdwResults', path=
'EXPERT', type=
'TH1I',
343 title=
'Hardware Results for L1Topo', xbins=128, xlabels=label_topo_all,
345 alg.MonTool.defineHistogram(
'OverflowResults', path=
'EXPERT', type=
'TH1I',
346 title=
'Overflow Results for L1Topo', xbins=128, xlabels=label_topo_all,
348 rod_errors_labels = [
"CT",
"pc",
"hc",
"pe",
"lm",
"hm",
"pt"]
349 alg.MonTool.defineHistogram(
'ROD_Errors', path=
'EXPERT', type=
'TH1I',
350 title=
'Counts of ROD errors', xbins=len(rod_errors_labels), xlabels=rod_errors_labels,
351 xmin=0, xmax=len(rod_errors_labels))
352 fpga_errors_labels = [
"CT",
"sm",
"pe",
"lm",
"hm",
"pt"]
353 fpga_indexes = [
"topo1fpga1",
"topo1fpga0",
"topo2fpga1",
"topo2fpga0",
"topo3fpga1",
"topo3fpga0"]
354 alg.MonTool.defineHistogram(
'FPGA_Errors, FPGA_Labels; FPGA_Errors', path=
'EXPERT', type=
'TH2I',
355 title=
'Counts of FPGA errors',xbins=len(fpga_errors_labels),ybins=len(fpga_indexes),
356 xlabels=fpga_errors_labels,
357 ylabels=fpga_indexes,
358 xmin=0, xmax=len(fpga_errors_labels),
359 ymin=0, ymax=len(fpga_indexes))
362 mon_failure_labels = [
'doHwMon',
'doSimMon',
'doHwMonCTP',
'doComp',
'doMultComp']
363 alg.MonTool.defineHistogram(
'MonitoringFailures', path=
'EXPERT', type=
'TH1F',
364 title=
'Counts of mon functions returning failure;;Entries',
365 xlabels=mon_failure_labels, xbins=len(mon_failure_labels),
366 xmin=0, xmax=len(mon_failure_labels))