24 from LArMonitoring.GlobalVariables
import lArDQGlobals
26 larFEBMonAlg = helper.addAlgorithm(algoinstance,
'larFEBMonAlg')
30 for i
in range(0,len(lArDQGlobals.FEB_Slot)):
31 nslots.append(lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[i]][1])
33 larFEBMonAlg.MonGroup=GroupName
34 larFEBMonAlg.PartitionNames=lArDQGlobals.Partitions
35 larFEBMonAlg.SubDetNames=lArDQGlobals.SubDet
36 larFEBMonAlg.Streams=lArDQGlobals.defaultStreamNames
38 isCOMP200=
"COMP200" in flags.IOVDb.DatabaseInstance
41 dbString=
"<db>COOLONL_LAR/CONDBR2</db>"
42 persClass=
"AthenaAttributeList"
43 fld=
"/LAR/Configuration/DSPThresholdFlat/Thresholds"
45 for c
in helper.resobj.getServices():
46 if c.getName()==
"IOVDbSvc":
48 condLoader=helper.resobj.getCondAlgo(
"CondInputLoader")
53 from IOVDbSvc.IOVDbSvcConfig
import IOVDbSvcCfg
55 condLoader=helper.resobj.getCondAlgo(
"CondInputLoader")
56 iovDbSvc=helper.resobj.getService(
"IOVDbSvc")
58 iovDbSvc.Folders.append(fld+dbString)
59 condLoader.Load.add((persClass,fld))
60 larFEBMonAlg.Run2DSPThresholdsKey = fld
62 fld=
'/LAR/Configuration/DSPThreshold/Thresholds'
64 obj=
'LArDSPThresholdsComplete'
65 from IOVDbSvc.IOVDbSvcConfig
import addFolders
66 helper.resobj.merge(
addFolders(flags,fld,db,obj))
67 larFEBMonAlg.Run1DSPThresholdsKey =
'LArDSPThresholds'
70 Group = helper.addGroup(
78 summary_hist_path=
'Summary/'
81 Group.defineTree(
'timestamp,time_ns,febHwId,febErrorType;LArCorrupted',
82 path=summary_hist_path,
83 title=
'Timestamps of corrupted LAr events',
84 treedef=
'timestamp/i:time_ns/i:febHwId/vector<int>:febErrorType/vector<int>')
86 Group.defineHistogram(
'nbFEB;NbOfReadoutFEBGlobal',
87 title=
'# of readout FEB/DSP header',
89 path=summary_hist_path,
91 xbins=lArDQGlobals.N_FEB+11, xmin=-0.5, xmax=lArDQGlobals.N_FEB+10+0.5)
92 Group.defineHistogram(
'nbFEBpart,part;NbOfEvts2d',
93 title=
'# of readout FEB/DSP header;Num. FEBs;Partition',
95 path=summary_hist_path,
97 xbins=lArDQGlobals.N_FEB_Parttions_Max, xmin=-0.5, xmax=lArDQGlobals.N_FEB_Parttions_Max-0.5,
98 ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions-0.5,
99 ylabels=lArDQGlobals.Partitions
101 Group.defineHistogram(
'febError,part;NbOfLArFEBMonErrors_dE',
102 title=
'# of data corruption errors',
104 path=summary_hist_path,
106 xbins=lArDQGlobals.N_FEBErrors, xmin=0.5, xmax=lArDQGlobals.N_FEBErrors+0.5,
107 ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions-0.5,
108 xlabels=lArDQGlobals.FEBErrors, ylabels=lArDQGlobals.Partitions)
109 Group.defineHistogram(
'dspThrADC;dspThresholdsADC',
110 title=
'DSP thresholds to readout samples;Number of cells;Cell threshold in ADC counts',
112 path=summary_hist_path,
113 xbins=lArDQGlobals.DSPThr_Bins+1, xmin=-0.5, xmax=lArDQGlobals.DSPThr_Bins+0.5,
115 Group.defineHistogram(
'dspThrQT;dspThresholds_qfactortime',
116 title=
'DSP thresholds to readout (qfactor+time);Number of cells;Cell threshold in ADC counts',
118 path=summary_hist_path,
119 xbins=lArDQGlobals.DSPThr_Bins+1, xmin=-0.5, xmax=lArDQGlobals.DSPThr_Bins+0.5,
121 Group.defineHistogram(
'EvtType;Eventtype',
122 title=
'Event type (1st readout FEB)',
124 path=summary_hist_path,
125 xbins=lArDQGlobals.Evt_Bins, xmin=lArDQGlobals.Evt_Min, xmax=lArDQGlobals.Evt_Max,
126 xlabels=lArDQGlobals.Evt_labels)
127 Group.defineHistogram(
'LVL1Trig;TriggerWord',
128 title=
'Number of Events per L1 trigger word (8 bits);L1 trigger word',
130 path=summary_hist_path,
131 xbins=lArDQGlobals.L1Trig_Bins, xmin=lArDQGlobals.L1Trig_Min, xmax=lArDQGlobals.L1Trig_Max)
132 Group.defineHistogram(
'LVL1TrigAllDSP;TriggerWordAllDSP',
133 title=
'Number of L1 trigger word per DSP (8 bits);L1 trigger word',
135 path=summary_hist_path,
136 xbins=lArDQGlobals.L1Trig_Bins, xmin=lArDQGlobals.L1Trig_Min, xmax=lArDQGlobals.L1Trig_Max)
137 Group.defineHistogram(
'EvtRej;EventsRejected',
138 title=
'Nb of events rejected (at least one error)',
140 path=summary_hist_path,
141 xbins=lArDQGlobals.EvtRej_Bins, xmin=lArDQGlobals.EvtRej_Min, xmax=lArDQGlobals.EvtRej_Max,
142 xlabels=lArDQGlobals.EvtRej_labels)
143 Group.defineHistogram(
'LB0,EvtRejYield;RAW_YieldOfRejectedEventsVsLB',
144 title=
'Yield of corrupted events (DATACORRUPTED);Luminosity Block;Yield(%)',
146 path=summary_hist_path,
147 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max)
148 Group.defineHistogram(
'LB0,EvtRejYieldOut;RAW_YieldOfRejectedEventsVsLBout',
149 title=
'Yield of corrupted events (DATACORRUPTED) not vetoed by time window;Luminosity Block;Yield(%)',
151 path=summary_hist_path,
152 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max)
153 Group.defineHistogram(
'LB0,EvtOneErrorYield;RAW_YieldOfOneErrorEventsVsLB',
154 title=
'Yield of events with >=1 FEB in error;Luminosity Block;Yield(%)',
156 path=summary_hist_path,
157 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max)
158 Group.defineHistogram(
'rejBits;rejectionBits',
159 title=
'Errors at the origin of event rejection;Bits;Number of (rejected) events',
161 path=summary_hist_path,
162 xbins=lArDQGlobals.rejBits_Bins, xmin=-0.5, xmax=lArDQGlobals.rejBits_Bins-0.5)
163 Group.defineHistogram(
'LB0;NbOfEventsVsLB',
164 title=
'Nb of events per LB;Luminosity Block',
166 path=summary_hist_path,
167 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max)
168 Group.defineHistogram(
'NbOfSweet2;NbOfSw2',
169 title=
'# of cells with samples readout;Number of cells;Number of events',
171 path=summary_hist_path,
172 xbins=
int(lArDQGlobals.N_Cells/10), xmin=-1000, xmax=lArDQGlobals.N_Cells-1000)
173 Group.defineHistogram(
'LB0,LArEvSize;eventSizeVsLB',
174 title=
'LAr event size (w/o ROS headers);Luminosity Block;Megabytes',
176 path=summary_hist_path,
177 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max)
178 Group.defineHistogram(
'NbOfSamp;NbOfSamples',
179 title=
'# of samples (1st readout FEB);Samples;Number of events',
181 path=summary_hist_path,
182 xbins=lArDQGlobals.Samples_Bins, xmin=lArDQGlobals.Samples_Min, xmax=lArDQGlobals.Samples_Max)
184 isOnline = flags.DQ.Environment==
'online'
187 Group.defineHistogram(
'LBf,EvtRejYield;RAW_EventsRejectedLB',
188 title=
'% of events rejected in current LB (online only)',
190 path=summary_hist_path,
191 xbins=1, xmin=0, xmax=1, xlabels=[
'% of events'])
192 Group.defineHistogram(
'LB,streamBin,LArEvSizePart;eventSizeStreamVsLB',
193 title=
'LAr event size per stream per LB (w/o ROS headers)',
195 path=summary_hist_path,
196 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max,
197 ybins=len(larFEBMonAlg.Streams),ymin=-0.5, ymax= len(larFEBMonAlg.Streams)-0.5,
198 ylabels=
list(larFEBMonAlg.Streams)
202 for subdet
in range(0,lArDQGlobals.N_SubDet):
203 hist_path=
'/LAr/'+GroupName+
'/'+lArDQGlobals.SubDet[subdet]+
'/'
204 slot_low = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet*2]][0] - 0.5
205 slot_up = lArDQGlobals.FEB_Slot[lArDQGlobals.Partitions[subdet*2]][1] + 0.5
206 slot_n =
int(slot_up - slot_low)
207 ft_low = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][0] - 0.5
208 ft_up = lArDQGlobals.FEB_Feedthrough[lArDQGlobals.Partitions[subdet*2]][1] + 0.5
209 ft_n =
int(ft_up - ft_low)
211 darray = helper.addArray([lArDQGlobals.Partitions[2*subdet:2*subdet+2]],larFEBMonAlg,lArDQGlobals.SubDet[subdet],topPath=
'/')
213 darray.defineHistogram(
'slotPar,FTPar;RAW_Parity',
214 title=
'Parity error;Slot;FT',
217 xbins=slot_n,xmin=slot_low,xmax=slot_up,
218 ybins=ft_n, ymin=ft_low, ymax=ft_up)
220 darray.defineHistogram(
'slotBcid,FTBcid;RAW_BCID',
221 title=
'BCID mismatch betw. 2 halves of FEB;Slot;FT',
224 xbins=slot_n,xmin=slot_low,xmax=slot_up,
225 ybins=ft_n, ymin=ft_low, ymax=ft_up)
227 darray.defineHistogram(
'slotRadd,FTRadd;RAW_RADD',
228 title=
'Sample header mismatch betw. 2 halves of FEB;Slot;FT',
231 xbins=slot_n,xmin=slot_low,xmax=slot_up,
232 ybins=ft_n, ymin=ft_low, ymax=ft_up)
234 darray.defineHistogram(
'slotEvtid,FTEvtid;RAW_EVTID',
235 title=
'EVTID mismatch betw. 2 halves of FEB;Slot;FT',
238 xbins=slot_n,xmin=slot_low,xmax=slot_up,
239 ybins=ft_n, ymin=ft_low, ymax=ft_up)
241 darray.defineHistogram(
'slotScac,FTScac;RAW_SCACStatus',
242 title=
'Wrong SCAC status in one half of a FEB;Slot;FT',
245 xbins=slot_n,xmin=slot_low,xmax=slot_up,
246 ybins=ft_n, ymin=ft_low, ymax=ft_up)
248 darray.defineHistogram(
'slotscout,FTscout;RAW_scaOutOfRange',
249 title=
'Sca out of range;Slot;FT',
252 xbins=slot_n,xmin=slot_low,xmax=slot_up,
253 ybins=ft_n, ymin=ft_low, ymax=ft_up)
255 darray.defineHistogram(
'slotgain,FTgain;RAW_gainMismatch',
256 title=
'Gain mismatch within time samples;Slot;FT',
259 xbins=slot_n,xmin=slot_low,xmax=slot_up,
260 ybins=ft_n, ymin=ft_low, ymax=ft_up)
262 darray.defineHistogram(
'slottype,FTtype;RAW_typeMismatch',
263 title=
'Event type mismatch;Slot;FT',
266 xbins=slot_n,xmin=slot_low,xmax=slot_up,
267 ybins=ft_n, ymin=ft_low, ymax=ft_up)
269 darray.defineHistogram(
'slotsmp,FTsmp;RAW_badNbOfSamp',
270 title=
'Non uniform number of samples;Slot;FT',
273 xbins=slot_n,xmin=slot_low,xmax=slot_up,
274 ybins=ft_n, ymin=ft_low, ymax=ft_up)
276 darray.defineHistogram(
'slotzero,FTzero;RAW_zeroSamp',
277 title=
'Empty FEB data blocks;Slot;FT',
280 xbins=slot_n,xmin=slot_low,xmax=slot_up,
281 ybins=ft_n, ymin=ft_low, ymax=ft_up)
283 darray.defineHistogram(
'slotsum,FTsum;RAW_checkSum',
284 title=
'Checksum / DSP block size;Slot;FT',
288 xbins=slot_n,xmin=slot_low,xmax=slot_up,
289 ybins=ft_n, ymin=ft_low, ymax=ft_up)
291 darray.defineHistogram(
'slotmis,FTmis;RAW_missingHeader',
292 title=
'Missing header ;Slot;FT',
295 xbins=slot_n,xmin=slot_low,xmax=slot_up,
296 ybins=ft_n, ymin=ft_low, ymax=ft_up)
298 darray.defineHistogram(
'slotgain,FTgain;RAW_badGain',
299 title=
'Bad gain ;Slot;FT',
302 xbins=slot_n,xmin=slot_low,xmax=slot_up,
303 ybins=ft_n, ymin=ft_low, ymax=ft_up)
305 darray.defineHistogram(
'slotabs,FTabs;RAW_LArFEBMonErrorsAbsolute',
306 title=
'Nb of events with at least one error ;Slot;FT',
310 xbins=slot_n,xmin=slot_low,xmax=slot_up,
311 ybins=ft_n, ymin=ft_low, ymax=ft_up)
313 darray.defineHistogram(
'slotmist,FTmist;RAW_missingTriggerType',
314 title=
'LVL1 trigger type missing or different from event type ;Slot;FT',
318 xbins=slot_n,xmin=slot_low,xmax=slot_up,
319 ybins=ft_n, ymin=ft_low, ymax=ft_up)
321 darray.defineHistogram(
'slotnb,FTnb;RAW_nbOfEvts',
322 title=
'Nb of events (DSP header check only) ;Slot;FT',
326 xbins=slot_n,xmin=slot_low,xmax=slot_up,
327 ybins=ft_n, ymin=ft_low, ymax=ft_up)
329 darray.defineHistogram(
'slotnb,FTnb,weightsweet1;RAW_NbOfSweet1PerFEB',
330 title=
'Average # of cells with (qfactor+time) readout ;Slot;FT',
334 xbins=slot_n,xmin=slot_low,xmax=slot_up,
335 ybins=ft_n, ymin=ft_low, ymax=ft_up)
337 darray.defineHistogram(
'slotnb,FTnb,weightsweet2;RAW_NbOfSweet2PerFEB',
338 title=
'Average # of cells with samples readout ;Slot;FT',
342 xbins=slot_n,xmin=slot_low,xmax=slot_up,
343 ybins=ft_n, ymin=ft_low, ymax=ft_up)
345 darray.defineHistogram(
'nbFEBpart;nbOfFebBlocks',
346 title=
'# of readout FEBs (DSP header check only) ;Slot;FT',
349 xbins=lArDQGlobals.N_FEB_Parttions_Max, xmin=-0.5, xmax=lArDQGlobals.N_FEB_Parttions_Max-0.5)
351 darray.defineHistogram(
'slotMasked,FTMasked;RAW_knownFaultyFEB',
352 title=
'FEB with known errors (1:err. ignored 2:FEB masked);Slot;FT',
355 xbins=slot_n,xmin=slot_low,xmax=slot_up,
356 ybins=ft_n, ymin=ft_low, ymax=ft_up,
359 darray.defineHistogram(
'LB,LArEvSizePart;eventSizeVsLB',
360 title=
'LAr event size per LB (w/o ROS headers);Luminosity Block',
363 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max)
366 darray.defineHistogram(
'LBf,erronl;RAW_EventsRejectedLB',
367 title=
'% of events rejected in current LB (online only)',
371 xbins=1, xmin=0, xmax=1, xlabels=[
'% of events'])
372 darray.defineHistogram(
'LB,streamBin,LArEvSizePart;eventSizeStreamVsLB',
373 title=
'LAr event size per stream per LB (w/o ROS headers)',
376 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max,
377 ybins=len(larFEBMonAlg.Streams),ymin=-0.5, ymax= len(larFEBMonAlg.Streams)-0.5,
378 ylabels=
list(larFEBMonAlg.Streams)