ATLAS Offline Software
Loading...
Searching...
No Matches
TrigT1ResultByteStreamMonitoringConfig.py
Go to the documentation of this file.
2# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3#
4from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
6from libpyeformat_helper import SourceIdentifier, SubDetector
7
8def L1MuonBSConverterMonitoringCfg(flags, name, encoder=False):
9 acc = ComponentAccumulator()
10 tool = GenericMonitoringTool(flags, 'MonTool')
11 tool.HistPath = f'HLTFramework/L1BSConverters/{name}'
12 tool.defineHistogram('NumWordsInROD', path='EXPERT', type='TH1F',
13 title='Size of the MUCTPI ROD payload;N words;N events',
14 xbins=100, xmin=0, xmax=100)
15 tool.defineHistogram('WordType,WordTypeCount;WordTypeCounts', path='EXPERT', type='TH2F',
16 title='Counts of each word type in MUCTPI ROD payload;;Count per event',
17 xbins=6, xmin=0, xmax=6,
18 ybins=150, ymin=0, ymax=150, # max candidate word count per time slice in hardware is 352
19 xlabels=['Undefined', 'Timeslice', 'Multiplicity', 'Candidate', 'Topo', 'Status'])
20 tool.defineHistogram('BCIDOffsetsWrtROB', path='EXPERT', type='TH1F',
21 title='BCID difference between timeslice header and ROB header;BCID difference;N time slices',
22 xbins=201, xmin=-100.5, xmax=100.5)
23 tool.defineHistogram('SubsysID', path='EXPERT', type='TH1F',
24 title='RoI candidate subsys ID;;N RoIs',
25 xbins=4, xmin=0, xmax=4,
26 xlabels=['Undefined','Barrel', 'Forward', 'Endcap'])
27 if flags.Trigger.L1.doMuonTopoInputs:
28 tool.defineHistogram('topoSubsysID', path='EXPERT', type='TH1F',
29 title='Topo TOB subsys ID;;N RoIs',
30 xbins=4, xmin=0, xmax=4,
31 xlabels=['Undefined','Barrel', 'Forward', 'Endcap'])
32
33
34 if not encoder:
35 tool.defineHistogram('BCOffset,NumOutputRoIs;NumOutputRoIs', path='EXPERT', type='TH2F',
36 title='Number of output xAOD::MuonRoI objects in each time slice per event;Time slice;N RoIs',
37 xbins=5, xmin=-2, xmax=3,
38 xlabels=[str(n) for n in range(-2,3)],
39 ybins=100, ymin=0, ymax=100) # max candidate word count per time slice in hardware is 352
40 tool.defineHistogram('DataStatusWordErrors', path='EXPERT', type='TH1F',
41 title='Error bits set in data status word;Bit number;N errors',
42 xbins=16, xmin=0, xmax=16)
43 if flags.Trigger.L1.doMuonTopoInputs:
44 tool.defineHistogram('BCOffset,NumOutputTopoTOBs;NumOutputTopoTOBs', path='EXPERT', type='TH2F',
45 title='Number of output LVL1::MuCTPIL1TopoCandidate objects in each time slice per event;Time slice;N TOBs',
46 xbins=5, xmin=-2, xmax=3,
47 xlabels=[str(n) for n in range(-2,3)],
48 ybins=100, ymin=0, ymax=100)
49 tool.defineHistogram('BCOffset,NumOutputDiffRoITopo;NumOutputDiffRoITopo', path='EXPERT', type='TProfile',
50 title='Average difference between the number of output RoIs and Topo TOBs;Time slice;N RoIs - N TOBs',
51 xbins=5, xmin=-2, xmax=3,
52 xlabels=[str(n) for n in range(-2,3)])
53
54 for subsysName in ['Barrel', 'Forward', 'Endcap']:
55 tool.defineHistogram(f'roiEta_{subsysName}', path='EXPERT', type='TH1F',
56 title=f'Eta of output RoIs in the {subsysName} subsystem;eta;N RoIs',
57 xbins=60, xmin=-3, xmax=3)
58 tool.defineHistogram(f'roiPhi_{subsysName}', path='EXPERT', type='TH1F',
59 title=f'Phi of output RoIs in the {subsysName} subsystem;phi;N RoIs',
60 xbins=64, xmin=-3.2, xmax=3.2)
61 if flags.Trigger.L1.doMuonTopoInputs:
62 tool.defineHistogram(f'topoEta_{subsysName}', path='EXPERT', type='TH1F',
63 title=f'Eta of output Topo TOBs in the {subsysName} subsystem;eta;N TOBs',
64 xbins=60, xmin=-3, xmax=3)
65 tool.defineHistogram(f'topoPhi_{subsysName}', path='EXPERT', type='TH1F',
66 title=f'Phi of output Topo TOBs in the {subsysName} subsystem;phi;N TOBs',
67 xbins=64, xmin=-3.2, xmax=3.2)
68 tool.defineHistogram(f'topoPtThreshold_{subsysName}', path='EXPERT', type='TH1F',
69 title=f'pT threshold [GeV] of output Topo TOBs in the {subsysName} subsystem;pT threshold [GeV];N TOBs',
70 xbins=50, xmin=0, xmax=50)
71
72 acc.setPrivateTools(tool)
73 return acc
74
75def L1TriggerByteStreamDecoderMonitoringCfg(flags, name, decoderTools):
76 acc = ComponentAccumulator()
77
78 if flags.Trigger.doHLT:
79 monTool = GenericMonitoringTool(flags, 'MonTool', HistPath = f'HLTFramework/L1BSConverters/{name}')
80 topDir = 'EXPERT'
81 elif flags.DQ.Steering.doHLTMon: # if used in offline reconstruction respect DQ convention (ATR-26371)
82 from AthenaMonitoring import AthMonitorCfgHelper
83 helper = AthMonitorCfgHelper(flags, 'HLTFramework')
84 monTool = helper.addGroup(None, f'{name}MonTool', f'/HLT/HLTFramework/L1BSConverters/{name}')
85 topDir = None
86 acc.merge(helper.result())
87 else:
88 return acc
89
90 monTool.defineHistogram('TIME_execute', path=topDir, type='TH1F',
91 title='Time of the alg execute() method;Time [ms];N events',
92 xbins=100, xmin=0, xmax=100)
93
94 # In hindsight, it would be better for RoIBResult decoder to have the same property interface as the other tools
95 def getRobIds(decoder):
96 if 'RoIBResult' not in decoder.getName():
97 return decoder.ROBIDs
98 robIds = []
99 robIds += [int(SourceIdentifier(SubDetector.TDAQ_CTP, decoder.CTPModuleId))] if decoder.CTPModuleId!=0xff else []
100 robIds += [int(SourceIdentifier(SubDetector.TDAQ_MUON_CTP_INTERFACE, decoder.MUCTPIModuleId))] if decoder.MUCTPIModuleId!=0xff else []
101 robIds += [int(SourceIdentifier(SubDetector.TDAQ_CALO_CLUSTER_PROC_ROI, modId)) for modId in decoder.EMModuleIds]
102 robIds += [int(SourceIdentifier(SubDetector.TDAQ_CALO_JET_PROC_ROI, modId)) for modId in decoder.JetModuleIds]
103 robIds += [int(SourceIdentifier(SubDetector.TDAQ_CALO_TOPO_PROC, modId)) for modId in decoder.L1TopoModuleIds]
104 return robIds
105
106 allRobIds = []
107 for decoder in decoderTools:
108 decoderName = decoder.getName()
109 allRobIds += getRobIds(decoder)
110 monTool.defineHistogram(f'TIME_prepareROBs_{decoderName}', path=topDir, type='TH1F',
111 title=f'Time of preparing ROB inputs for {decoderName};Time [ms];N events',
112 xbins=100, xmin=0, xmax=100)
113 monTool.defineHistogram(f'TIME_convert_{decoderName}', path=topDir, type='TH1F',
114 title=f'Time of the convertFromBS() method of {decoderName};Time [ms];N events',
115 xbins=100, xmin=0, xmax=100)
116 monTool.defineHistogram(f'LumiBlock,MissingROBFraction_{decoderName};MissingROBFraction_{decoderName}', path=topDir, type='TProfile',
117 title=f'Fraction of missing ROBs requested by {decoderName} vs LBN;LumiBlock;N missing ROBs / N requested ROBs',
118 xbins=100, xmin=0, xmax=100, opt='kCanRebin', merge=None if flags.Trigger.doHLT else 'merge')
119 monTool.defineHistogram(f'LumiBlock,CorruptedROBFraction_{decoderName};CorruptedROBFraction_{decoderName}', path=topDir, type='TProfile',
120 title=f'Fraction of corrupted ROBs requested by {decoderName} vs LBN;LumiBlock;N corrupted ROBs / N retrieved ROBs',
121 xbins=100, xmin=0, xmax=100, opt='kCanRebin', merge=None if flags.Trigger.doHLT else 'merge')
122 monTool.defineHistogram(f'LumiBlock,ErroneousROBFraction_{decoderName};ErroneousROBFraction_{decoderName}', path=topDir, type='TProfile',
123 title=f'Fraction of erroneous ROBs requested by {decoderName} vs LBN;LumiBlock;N erroneous ROBs / N retrieved ROBs',
124 xbins=100, xmin=0, xmax=100, opt='kCanRebin', merge=None if flags.Trigger.doHLT else 'merge')
125
126 robIdLabels = [hex(id) for id in sorted(list(set(allRobIds)))]
127 monTool.defineHistogram('MissingROB', path=topDir, type='TH1F',
128 title='Count of missing obligatory ROBs;ROB ID;N events with ROB missing',
129 xbins=len(robIdLabels), xmin=0, xmax=len(robIdLabels), xlabels=robIdLabels)
130 monTool.defineHistogram('MissingROBAllowed', path=topDir, type='TH1F',
131 title='Count of missing optional ROBs;ROB ID;N events with ROB missing',
132 xbins=len(robIdLabels), xmin=0, xmax=len(robIdLabels), xlabels=robIdLabels)
133 monTool.defineHistogram('CorruptedROB', path=topDir, type='TH1F',
134 title='Count of corrupted obligatory ROBs;ROB ID;N events with ROB errors',
135 xbins=len(robIdLabels), xmin=0, xmax=len(robIdLabels), xlabels=robIdLabels)
136 monTool.defineHistogram('CorruptedROBAllowed', path=topDir, type='TH1F',
137 title='Count of corrupted optional ROBs;ROB ID;N events with ROB errors',
138 xbins=len(robIdLabels), xmin=0, xmax=len(robIdLabels), xlabels=robIdLabels)
139 monTool.defineHistogram('ErroneousROB', path=topDir, type='TH1F',
140 title='Count of erroneous obligatory ROBs;ROB ID;N events with ROB errors',
141 xbins=len(robIdLabels), xmin=0, xmax=len(robIdLabels), xlabels=robIdLabels)
142 monTool.defineHistogram('ErroneousROBAllowed', path=topDir, type='TH1F',
143 title='Count of erroneous optional ROBs;ROB ID;N events with ROB errors',
144 xbins=len(robIdLabels), xmin=0, xmax=len(robIdLabels), xlabels=robIdLabels)
145
146 acc.setPrivateTools(monTool)
147 return acc
STL class.