ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloL1TopoMonitorAlgorithm.py
Go to the documentation of this file.
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3#
5 '''Function to configure LVL1 L1CaloL1Topo algorithm in the monitoring system.'''
6
7 import math
8 # get the component factory - used for getting the algorithms
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11 result = ComponentAccumulator()
12
13 # make the athena monitoring helper
14 from AthenaMonitoring import AthMonitorCfgHelper
15 helper = AthMonitorCfgHelper(inputFlags,'L1CaloL1TopoMonitoringCfg')
16
17 # get any algorithms
18 L1CaloL1TopoMonAlg = helper.addAlgorithm(CompFactory.L1CaloL1TopoMonitorAlgorithm,'L1CaloL1TopoMonAlg')
19
20 # add any steering
21 groupName = 'L1CaloL1TopoMonitor' # the monitoring group name is also used for the package name
22 L1CaloL1TopoMonAlg.PackageName = groupName
23
24 mainDir = 'LVL1_Interfaces'
25 trigPath = 'L1Topo/'
26
27 MAXTOBS=20
28 # phi bins (auto)
29 phibins = 32
30 phimin = 0.
31 phimax = 2.*math.pi
32
33 # eta bin edges taken from TrigT1CaloLWHistogramTool
34 etabins = [-4.9,-3.2,-2.9,-2.7,-2.4,-2.2,-2.0,-1.8,
35 -1.6,-1.4,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,
36 0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,
37 2.0,2.2,2.4,2.7,2.9,3.2,4.9]
38
39 # add monitoring algorithm to group, with group name and main directory
40 myGroup = helper.addGroup(L1CaloL1TopoMonAlg, groupName , mainDir)
41
42 # run number plot
43 myGroup.defineHistogram(
44 'run',title='Run Number;run;Events',
45 path=trigPath,xbins=1000000,xmin=-0.5,xmax=999999.5)
46
47 # Error summary plot for the entire algorithm
48 error_labels = ['Calo conv','No CMX','DAQ conv','No DAQ','ROI conv',
49 'Fibre CRC','Payload CRC','CMX-Topo match']
50 myGroup.defineHistogram(
51 'sumErrors;l1topo_1d_Errors',
52 path=trigPath, type='TH1F',
53 title='Counts of errors;;Entries',
54 opt='kAlwaysCreate',
55 xlabels=error_labels, xbins=len(error_labels),
56 xmin=0, xmax=len(error_labels))
57
58 # Errors ordered by lumiblock
59 myGroup.defineHistogram(
60 'lbErrors;l1topo_1d_ErrorsByLumiblock',
61 path=trigPath,type='TH1F',
62 opt='kAlwaysCreate',
63 title='Events with Errors by Lumiblock;Lumi Block;Number of Events',
64 xbins=2500,xmin=0,xmax=2500)
65
66 # TOB plots
67 myGroup.defineHistogram(
68 'jetTobsEnergyL;l1topo_1d_JetTobs_EnergyLg', weight='wFPGA',
69 title='L1Topo-Jet TOB Energy Large Window Size;Energy;Events',
70 path=trigPath,xbins=256,xmin=0,xmax=1024)
71
72 myGroup.defineHistogram(
73 'nJetTobs;l1topo_1d_DAQJetTobs',
74 title='Number of L1Topo DAQ Jet TOBs;Tobs;Events',
75 path=trigPath,xbins=MAXTOBS,xmin=0,xmax=MAXTOBS)
76
77 myGroup.defineHistogram(
78 'nTauTobs;l1topo_1d_DAQTauTobs',
79 title='Number of L1Topo DAQ Tau TOBs;Tobs;Events',
80 path=trigPath,xbins=MAXTOBS,xmin=0,xmax=MAXTOBS)
81
82 myGroup.defineHistogram(
83 'nEMTobs;l1topo_1d_DAQEMTobs',
84 title='Number of L1Topo DAQ EM TOBs;Tobs;Events',
85 path=trigPath,xbins=MAXTOBS,xmin=0,xmax=MAXTOBS)
86
87 myGroup.defineHistogram(
88 'nMuonTobs;l1topo_1d_DAQMuonTobs',
89 title='Number of L1Topo DAQ Muon TOBs;Tobs;Events',
90 path=trigPath,xbins=MAXTOBS,xmin=0,xmax=MAXTOBS)
91
92 # 2D hitmaps matched eta-phi
93 myGroup.defineHistogram('etaJetSTobs_match,phiJetSTobs_match;l1topo_2d_JetSTobs_etaPhi_match',
94 title='CMX-L1Topo matched small jet TOBs hit map;#eta;#phi', type='TH2F',
95 path=trigPath,opt='kAlwaysCreate',
96 xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax)
97
98 myGroup.defineHistogram('etaJetLTobs_match,phiJetLTobs_match;l1topo_2d_JetLTobs_etaPhi_match',
99 title='CMX-L1Topo matched large jet TOBs hit map;#eta;#phi', type='TH2F',
100 path=trigPath,opt='kAlwaysCreate',
101 xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax)
102
103 myGroup.defineHistogram('etaTauTobs_match,phiTauTobs_match;l1topo_2d_TauTobs_etaPhi_match',
104 title='CMX-L1Topo matched tau TOBs hit map;#eta;#phi', type='TH2F',
105 path=trigPath,opt='kAlwaysCreate',
106 xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax)
107
108 myGroup.defineHistogram('etaEMTobs_match,phiEMTobs_match;l1topo_2d_EMTobs_etaPhi_match',
109 title='CMX-L1Topo matched EM TOBs hit map;#eta;#phi', type='TH2F',
110 path=trigPath,opt='kAlwaysCreate',
111 xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax)
112
113 # 2D hitmaps mismatched eta-phi
114 myGroup.defineHistogram('etaJetSTobs_mismatch,phiJetSTobs_mismatch;l1topo_2d_JetSTobs_etaPhi_mismatch',
115 title='CMX-L1Topo mismatched small jet TOBs hit map;#eta;#phi', type='TH2F',
116 path=trigPath,opt='kAlwaysCreate',
117 xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax)
118
119 myGroup.defineHistogram('etaJetLTobs_mismatch,phiJetLTobs_mismatch;l1topo_2d_JetLTobs_etaPhi_mismatch',
120 title='CMX-L1Topo mismatched large jet TOBs hit map;#eta;#phi', type='TH2F',
121 path=trigPath,opt='kAlwaysCreate',
122 xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax)
123
124 myGroup.defineHistogram('etaTauTobs_mismatch,phiTauTobs_mismatch;l1topo_2d_TauTobs_etaPhi_mismatch',
125 title='CMX-L1Topo mismatched tau TOBs hit map;#eta;#phi', type='TH2F',
126 path=trigPath,opt='kAlwaysCreate',
127 xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax)
128
129 myGroup.defineHistogram('etaEMTobs_mismatch,phiEMTobs_mismatch;l1topo_2d_EMTobs_etaPhi_mismatch',
130 title='CMX-L1Topo mismatched EM TOBs hit map;#eta;#phi', type='TH2F',
131 path=trigPath,opt='kAlwaysCreate',
132 xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax)
133
134 # 2D hitmaps matched hardware coordinates
135 myGroup.defineHistogram('xJetSTobs_match,yJetSTobs_match;l1topo_2d_JetSTobs_Hitmap_match',
136 title='CMX-L1Topo matched small jet TOBs hit map;Crate*Module;Frame*Local',
137 type='TH2F',path=trigPath,opt='kAlwaysCreate',
138 xbins=32,xmin=0.,xmax=32,ybins=32,ymin=0,ymax=32.)
139
140 myGroup.defineHistogram('xJetLTobs_match,yJetLTobs_match;l1topo_2d_JetLTobs_Hitmap_match',
141 title='CMX-L1Topo matched large jet TOBs hit map;Crate*Module;Frame*Local',
142 type='TH2F',path=trigPath,opt='kAlwaysCreate',
143 xbins=32,xmin=0.,xmax=32,ybins=32,ymin=0,ymax=32.)
144
145 myGroup.defineHistogram('xTauTobs_match,yTauTobs_match;l1topo_2d_TauTobs_Hitmap_match',
146 title='CMX-L1Topo matched tau TOBs hit map;Crate*Module;Chip*Local',
147 type='TH2F',path=trigPath,opt='kAlwaysCreate',
148 xbins=56,xmin=0.,xmax=56,ybins=64,ymin=0,ymax=64.)
149
150 myGroup.defineHistogram('xEMTobs_match,yEMTobs_match;l1topo_2d_EMTobs_Hitmap_match',
151 title='CMX-L1Topo matched EM TOBs hit map;Crate*Module;Chip*Local',
152 type='TH2F',path=trigPath,opt='kAlwaysCreate',
153 xbins=56,xmin=0.,xmax=56.0,ybins=64,ymin=0.,ymax=64.)
154
155 # 2D hitmaps mismatched hardware coordinates
156 myGroup.defineHistogram('xJetSTobs_mismatch,yJetSTobs_mismatch;l1topo_2d_JetSTobs_Hitmap_mismatch',
157 title='CMX-L1Topo mismatched small jet TOBs hit map;Crate*Module;Frame*Local',
158 type='TH2F',path=trigPath,opt='kAlwaysCreate',
159 xbins=32,xmin=0.,xmax=32,ybins=32,ymin=0,ymax=32.)
160
161 myGroup.defineHistogram('xJetLTobs_mismatch,yJetLTobs_mismatch;l1topo_2d_JetLTobs_Hitmap_mismatch',
162 title='CMX-L1Topo mismatched large jet TOBs hit map;Crate*Module;Frame*Local',
163 type='TH2F',path=trigPath,opt='kAlwaysCreate',
164 xbins=32,xmin=0.,xmax=32,ybins=32,ymin=0,ymax=32.)
165
166 myGroup.defineHistogram('xTauTobs_mismatch,yTauTobs_mismatch;l1topo_2d_TauTobs_Hitmap_mismatch',
167 title='CMX-L1Topo mismatched tau TOBs hit map;Crate*Module;Chip*Local',
168 type='TH2F',path=trigPath,opt='kAlwaysCreate',
169 xbins=56,xmin=0.,xmax=56,ybins=64,ymin=0,ymax=64.)
170
171 myGroup.defineHistogram('xEMTobs_mismatch,yEMTobs_mismatch;l1topo_2d_EMTobs_Hitmap_mismatch',
172 title='CMX-L1Topo mismatched EM TOBs hit map;Crate*Module;Chip*Local',
173 type='TH2F',path=trigPath,opt='kAlwaysCreate',
174 xbins=56,xmin=0.,xmax=56.0,ybins=64,ymin=0.,ymax=64.)
175
176 # Timing Topo items vs BC
177 myGroup.defineHistogram('item0,bc0;l1topo_2d_ItemsBC0',
178 title='BC Timing vs Algorithm Number L1Topo_00_U1',
179 type='TH2F',path=trigPath,opt='kAlwaysCreate',
180 xbins=32,xmin=0*32,xmax=(0+1)*32,ybins=5,ymin=-2.5,ymax=2.5)
181 myGroup.defineHistogram('item1,bc1;l1topo_2d_ItemsBC1',
182 title='BC Timing vs Algorithm Number L1Topo_00_U2',
183 type='TH2F',path=trigPath,opt='kAlwaysCreate',
184 xbins=32,xmin=1*32,xmax=(1+1)*32,ybins=5,ymin=-2.5,ymax=2.5)
185 myGroup.defineHistogram('item2,bc2;l1topo_2d_ItemsBC2',
186 title='BC Timing vs Algorithm Number L1Topo_01_U1',
187 type='TH2F',path=trigPath,opt='kAlwaysCreate',
188 xbins=32,xmin=2*32,xmax=(2+1)*32,ybins=5,ymin=-2.5,ymax=2.5)
189 myGroup.defineHistogram('item3,bc3;l1topo_2d_ItemsBC3',
190 title='BC Timing vs Algorithm Number L1Topo_01_U2',
191 type='TH2F',path=trigPath,opt='kAlwaysCreate',
192 xbins=32,xmin=3*32,xmax=(3+1)*32,ybins=5,ymin=-2.5,ymax=2.5)
193
194 acc = helper.result()
195 result.merge(acc)
196 return result
197
198
199if __name__=='__main__':
200 # set input file and config options
201 from AthenaConfiguration.AllConfigFlags import initConfigFlags
202 import glob
203
204 inputs = glob.glob('/eos/atlas/atlascerngroupdisk/data-art/build-output/master/Athena/x86_64-centos7-gcc8-opt/2020-04-06T2139/TrigP1Test/test_trigP1_v1PhysP1_T0Mon_build/ESD.pool.root')
205
206 flags = initConfigFlags()
207 flags.Input.Files = inputs
208 flags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1.root'
209
210 flags.lock()
211 flags.dump() # print all the configs
212
213 from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg
214 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
215 cfg = MainServicesSerialCfg()
216 cfg.merge(PoolReadCfg(flags))
217
218 L1CaloL1TopoMonitorCfg = L1CaloL1TopoMonitoringConfig(flags)
219 cfg.merge(L1CaloL1TopoMonitorCfg)
220
221 # message level for algorithm
222 L1CaloL1TopoMonitorCfg.getEventAlgo('L1CaloL1TopoMonAlg').OutputLevel = 2 # 1/2 INFO/DEBUG
223 # options - print all details of algorithms, very short summary
224 cfg.printConfig(withDetails=False, summariseProps = True)
225
226 nevents=-1
227 cfg.run(nevents)