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 bit_id = topo_trigline[
'startbit']
40 fpga_id = topo_trigline[
'fpga']
41 clock_id = topo_trigline[
'clock']
42 topo_trigline_index = 64*connector_id + 32*fpga_id + 2*bit_id + clock_id
43 topo_trigline_labels[topo_trigline_index] = topo_trigline_name
45 return topo_trigline_labels
48 topo_trigline_labels = [
"" for i
in range(128)]
50 topo_triglines_dict = lvl1access.connector(topoModule)[
'triggerlines']
52 for topo_trigline
in topo_triglines_dict:
53 topo_trigline_name = topo_trigline[
'name']
54 bit_id = topo_trigline[
'startbit']
55 topo_trigline_labels[bit_id] = topo_trigline_name
57 return topo_trigline_labels
60 def getL1TopoPhase1OnlineMonitor(flags, name='L1TopoOnlineMonitor', doSimMon=True, doHwMonCtp=False, doHwMon=False, doComp=False, doMultComp=False, forceCtp=False, logLevel = None, toolName="L1TopoMonitoringTool"):
63 alg = CompFactory.L1TopoOnlineMonitor(toolName,
67 doHwMonCTP = doHwMonCtp,
69 doMultComp = doMultComp,
70 forceCTPasHdw=forceCtp)
71 if logLevel : alg.OutputLevel=logLevel
73 alg.MonTool.HistPath = name
81 for cable
in range(2):
82 name =
'CableElec_'+
str(cable+2)
83 name +=
';Topo'+
str(cable+2)+
'El'
84 title = f
'Topo Electric Cable {cable+2}'
86 label_topo_all += labels
87 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH1I',
88 title=title, xbins=64, xlabels=labels,
91 for cable
in range(4):
92 topoName =
'Topo1Opt'+
str(cable)
93 name =
'CableOpti_'+
str(cable)
94 weight = name+
'_weight'
95 name += f
';{topoName}'
96 title = f
'Topo Optical Cable {cable}'
98 xlabels = [x
for x
in labels
if x]
99 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH1I',
100 title=title, xbins=len(xlabels), xlabels=xlabels,
102 xmin=0, xmax=len(xlabels))
103 for cable
in range(4):
104 topoName =
'Topo1Opt'+
str(cable)
105 name =
'HdwTopo1Opt'+
str(cable)
106 weight = name+
'_weight'
107 name += f
';{topoName}_data'
108 title = f
'Topo Optical Cable {cable} (Data)'
110 xlabels = [x
for x
in labels
if x]
111 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH1I',
112 title=title, xbins=len(xlabels), xlabels=xlabels,
114 xmin=0, xmax=len(xlabels))
116 for cable
in range(4):
117 ylabels = [
'#splitline{Sim counts <}{Hdw counts}',
'#splitline{Sim counts >}{Hdw counts}',
'#splitline{Sim counts =}{Hdw counts}']
118 topoName =
'Topo1Opt'+
str(cable)
119 name =
'MultiplicityTopo1Opt'+
str(cable)+
',MultiplicityMatchTopo1Opt'+
str(cable)
120 name += f
';{topoName}_mismatch'
121 title = f
'Topo Optical Cable {cable} Miss/Matches Summary'
123 xlabels = [x
for x
in labels
if x]
124 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH2F',
125 title=title, xbins=len(xlabels), ybins=3,
126 xlabels=xlabels,ylabels=ylabels,
127 xmin=0, xmax=len(xlabels),
128 ymin=0, ymax=len(ylabels))
130 for cable
in range(4):
131 topoName =
'Topo1Opt'+
str(cable)
133 labels = [x
for x
in labels
if x]
134 for i,label
in enumerate(labels):
135 name = f
'Topo1Opt{cable}_{i}_Sim,Topo1Opt{cable}_{i}_Hdw;Topo1Opt{cable}_{label}'
136 title = f
'Topo1Opt{cable}_{label};Simulation Counts;Hardware Counts'
137 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH2F',
138 title=title,xbins=10,ybins=10,
142 alg.MonTool.defineHistogram(
'TopoSim', path=
'EXPERT', type=
'TH1I',
143 title=
'Simulation Results for L1Topo', xbins=128, xlabels=label_topo_all,
145 alg.MonTool.defineHistogram(
'TopoSim_overflows', path=
'EXPERT', type=
'TH1I',
146 title=
'Overflow Simulation Results for L1Topo', xbins=128, xlabels=label_topo_all,
148 alg.MonTool.defineHistogram(
'TopoSim_ambiguity', path=
'EXPERT', type=
'TH1I',
149 title=
'Ambiguity Results for L1Topo', xbins=128, xlabels=label_topo_all,
153 alg.MonTool.defineHistogram(
'TopoCTP', path=
'EXPERT', type=
'TH1I',
154 title=
'CTP Results for L1Topo', xbins=128, xlabels=label_topo_all,
158 alg.MonTool.defineHistogram(
'SimNotHdwL1TopoResult', path=
'EXPERT', type=
'TH1I',
159 title=
'L1Topo events with simulation accept and hardware fail',
160 xbins=128, xlabels=label_topo_all,
162 alg.MonTool.defineHistogram(
'HdwNotSimL1TopoResult', path=
'EXPERT', type=
'TH1I',
163 title=
'L1Topo events with hardware accept and simulation fail',
164 xbins=128, xlabels=label_topo_all,
166 alg.MonTool.defineHistogram(
'Ambiguity_SimANDHdwDecisions', path=
'EXPERT', type=
'TH1I',
167 title=
'L1Topo ambiguity events with simulation accept and hardware accept',
168 xbins=128, xlabels=label_topo_all,
170 alg.MonTool.defineHistogram(
'Ambiguity_DecisionMismatches', path=
'EXPERT', type=
'TH1I',
171 title=
'L1Topo ambiguity events with mismatches between simulation and hardware',
172 xbins=128, xlabels=label_topo_all,
176 ylabels = [
'#frac{HdwNotSim}{Hdw}',
'#frac{SimNotHdw}{Sim}',
'#frac{HdwAndSim}{HdwOrSim}',
'#frac{Hdw}{Sim}']
177 for topo
in [(0,
'2a'),(1,
'2b'),(2,
'3a'),(3,
'3b')]:
178 name = f
'Phase1TopoTrigger_{topo[0]},Phase1TopoMissMatch_{topo[0]};Ph1Topo{topo[1]}'
179 title = f
'Phase1 Topo{topo[1]} Miss/Matches Summary'
180 alg.MonTool.defineHistogram(name, path=
'EXPERT', type=
'TH2F',
181 title=title,xbins=32,ybins=4,
182 weight=f
'Phase1TopoWeight_{topo[0]}',
183 xlabels=label_topo_all[topo[0]*32:(topo[0]+1)*32],
186 ymin=0, ymax=len(ylabels))
187 ylabelsOF = [
'#frac{HdwOFnotSimOF}{HdwOF}',
'#frac{SimOFnotHdwOF}{SimOF}',
'#frac{HdwOFandSimOF}{HdwOForSimOF}',
'#frac{HdwOF}{SimOF}']
188 for topo
in [(0,
'2a'),(1,
'2b'),(2,
'3a'),(3,
'3b')]:
189 name_OF = f
'Phase1TopoTrigger_{topo[0]},Phase1TopoMissMatch_{topo[0]};Ph1Topo{topo[1]}_overflows'
190 title_OF = f
'Phase1 Topo{topo[1]} Overflow Miss/Matches Summary'
191 alg.MonTool.defineHistogram(name_OF, path=
'EXPERT', type=
'TH2F',
192 title=title_OF,xbins=32,ybins=4,
193 weight=f
'Phase1TopoOFWeight_{topo[0]}',
194 xlabels=label_topo_all[topo[0]*32:(topo[0]+1)*32],
197 ymin=0, ymax=len(ylabelsOF))
200 alg.MonTool.defineHistogram(
'HdwResults', path=
'EXPERT', type=
'TH1I',
201 title=
'Hardware Results for L1Topo', xbins=128, xlabels=label_topo_all,
203 alg.MonTool.defineHistogram(
'OverflowResults', path=
'EXPERT', type=
'TH1I',
204 title=
'Overflow Results for L1Topo', xbins=128, xlabels=label_topo_all,
206 rod_errors_labels = [
"CT",
"pc",
"hc",
"pe",
"lm",
"hm",
"pt"]
207 alg.MonTool.defineHistogram(
'ROD_Errors', path=
'EXPERT', type=
'TH1I',
208 title=
'Counts of ROD errors', xbins=len(rod_errors_labels), xlabels=rod_errors_labels,
209 xmin=0, xmax=len(rod_errors_labels))
210 fpga_errors_labels = [
"CT",
"sm",
"pe",
"lm",
"hm",
"pt"]
211 fpga_indexes = [
"topo1fpga1",
"topo1fpga0",
"topo2fpga1",
"topo2fpga0",
"topo3fpga1",
"topo3fpga0"]
212 alg.MonTool.defineHistogram(
'FPGA_Errors, FPGA_Labels; FPGA_Errors', path=
'EXPERT', type=
'TH2I',
213 title=
'Counts of FPGA errors',xbins=len(fpga_errors_labels),ybins=len(fpga_indexes),
214 xlabels=fpga_errors_labels,
215 ylabels=fpga_indexes,
216 xmin=0, xmax=len(fpga_errors_labels),
217 ymin=0, ymax=len(fpga_indexes))
220 mon_failure_labels = [
'doHwMon',
'doSimMon',
'doHwMonCTP',
'doComp',
'doMultComp']
221 alg.MonTool.defineHistogram(
'MonitoringFailures', path=
'EXPERT', type=
'TH1F',
222 title=
'Counts of mon functions returning failure;;Entries',
223 xlabels=mon_failure_labels, xbins=len(mon_failure_labels),
224 xmin=0, xmax=len(mon_failure_labels))