NanoErrors.cxx
Go to the documentation of this file.
2 #include <iostream>
3 #include "TH2F.h"
4 #include "DAQChannelMap/HardwareDisplay.h"
11 
12 using namespace om;
13 class RawEventSummary;
14 class DataBlockSummary;
15 class MicroSliceSummary;
16 
19  fHwMap(new daqchannelmap::HardwareDisplay)
20 {
22 
23  // initalize the arrays of histograms to zero
24  for(unsigned int i = 0; i < DCM_size_nano; ++i) {
25  for(unsigned int j = 0; j < DCM_size_nano; ++j) {
26  fDPEperDCM[i][j] = 0;
27  fLSEperDCM[i][j] = 0;
28  fDbMperDCM[i][j] = 0;
29  fFIFOperDCM[i][j] = 0;
30  fTECCEnblperDCM[i][j] = 0;
31  fEDAQperDCM[i][j] = 0;
32  fDDEperDCM[i][j] = 0;
33  fTECCErrperDCM[i][j] = 0;
34  fADCEperDCM[i][j] = 0;
35  fCEperDCM[i][j] = 0;
36  } // end for j
37  } // end for i
38 
39  // create the initial Error Plots
41 
42  fDPEbyPixelDCM = h.GetTH2F("DPEbyPixelDCM");
43  fLSEbyPixelDCM = h.GetTH2F("LSEbyPixelDCM");
44  fDbMbyPixelDCM = h.GetTH2F("DbMbyPixelDCM");
45  fFIFObyPixelDCM = h.GetTH2F("FIFObyPixelDCM");
46  fTECCEnblbyPixelDCM = h.GetTH2F("TECCEnblbyPixelDCM");
47  fEDAQbyPixelDCM = h.GetTH2F("EDAQbyPixelDCM");
48  fDDEbyPixelDCM = h.GetTH2F("DDEbyPixelDCM");
49  fTECCErrbyPixelDCM = h.GetTH2F("TECCErrbyPixelDCM");
50  fADCEbyPixelDCM = h.GetTH2F("ADCEbyPixelDCM");
51  fCEbyPixelDCM = h.GetTH2F("CEbyPixelDCM");
52  fAEVsHour = h.GetTH2F("AEVsHour");
53  fAAVsHour = h.GetTH2F("AAVsHour");
54 
55 
56 }
57 
58 //......................................................................
59 
61  if(fHwMap) {delete fHwMap; fHwMap = 0;}
62 }
63 
64 //......................................................................
65 
67  const DataBlockSummary& dbs,
68  const MicroSliceSummary& mss,
69  const NanoSliceSummary& nss)
70 {
72 
73  //
74  // Get the detector coordinates for this nano slice entry
75  //
76  unsigned int X = nss.fHdwX, Y = nss.fHdwY;
77  unsigned int x1, x2, y1, y2;
78  fHwMap->FEBXY(nss.fFEB, &x1, &y1);
79  fHwMap->PixXY(nss.fPix, &x2, &y2);
80 
81  uint32_t FEBstatus = nss.fFEBStatus;
82  float AlertFill = 0.0;
83 
84  // fake an error message (must also add (1<<4) since Enable DAQ is negative logic)
85  /*
86  FEBstatus = (1<<4);
87  if(r.fHour > 14.85 && r.fHour < 14.95 &&
88  nss.fFEB == 33 && mss.fDiblock == 2 && mss.fDCM == 2) FEBstatus = (1<<6)+(1<<4);
89  */
90 
91 
92  //
93  // fill Data Present Error (DPE) histos
94  //
95  if(nss.fDataPresent != 1) {
96 
97  // record error in detailed all errors histo
98  fAEVsHour->Fill(r.fHour, 9);
99  if(r.fHour >= 23.0) fAEVsHour->Fill(r.fHour - 24.0, 9);
100 
101  // fill DCM level histo of DPE reported by pixel
102  fDPEbyPixelDCM->Fill(X,Y);
103 
104  // fill pixel level histo of DPE by specific DCM
105  if(fDPEperDCM[mss.fDiblock][mss.fDCM] == 0) {
106  // create and name the histogram by Diblock and DCM
107  char histoname[64];
108  sprintf(histoname, "DPEperDCM_%.2u_%.2u", mss.fDiblock, mss.fDCM);
109  fDPEperDCM[mss.fDiblock][mss.fDCM] = h.GetTH2F(histoname);
110  }
111 
112  fDPEperDCM[mss.fDiblock][mss.fDCM]->Fill(x1+x2, y1+y2);
113 
114  } // end if fDataPresent != 1
115 
116 
117 
118 
119 
120  //
121  // fill Link Status Error (LSE) histos
122  //
123  if(nss.fLinkStatus != 1) {
124 
125  // record error in detailed all errors histo
126  fAEVsHour->Fill(r.fHour, 8);
127  if(r.fHour >= 23.0) fAEVsHour->Fill(r.fHour - 24.0, 8);
128 
129  // fill DCM level histo of LSE reported by pixel
130  fLSEbyPixelDCM->Fill(X,Y);
131 
132  // fill pixel level histo of LSE by specific DCM
133  if(fLSEperDCM[mss.fDiblock][mss.fDCM] == 0) {
134  // create and name the histogram by Diblock and DCM
135  char histoname[64];
136  sprintf(histoname, "LSEperDCM_%.2u_%.2u", mss.fDiblock, mss.fDCM);
137  fLSEperDCM[mss.fDiblock][mss.fDCM] = h.GetTH2F(histoname);
138  }
139 
140  fLSEperDCM[mss.fDiblock][mss.fDCM]->Fill(x1+x2, y1+y2);
141 
142  } // end if fLinkStatus != 1
143 
144 
145 
146 
147 
148  //
149  // fill Debug Mode (DbM) histos
150  // NOTE: This is an "alert" histo and should only be filled with a status
151  // indicating good (0) or bad (1).
152  // We fill the histo with the OR of the current and previous values
153  // so that once an alert gets set, the histo will continue to display
154  // the set status until the histo is reset.
155  //
156 
157  // record error in detailed all alerts histo
158  fAAVsHour->Fill(r.fHour, 4, nss.fDebugMode);
159  if(r.fHour >= 23.0) fAAVsHour->Fill(r.fHour - 24.0, 4, nss.fDebugMode);
160 
161 
162  // fill DCM level histo of DbM reported by pixel
163  //
164  // NOTE: We add 0.1 to distinguish bins that are empty from bins that have been filled
165  // with zero.
166  if(nss.fDebugMode || fDbMbyPixelDCM->GetBinContent(fDbMbyPixelDCM->FindBin(X,Y)) > 1.0) AlertFill = 1.1;
167  else AlertFill = 0.1;
168  fDbMbyPixelDCM->SetBinContent(fDbMbyPixelDCM->FindBin(X,Y), AlertFill);
169 
170  // fill pixel level histo of DbM by specific DCM
171 
172  // if the histogram already exists, then fill it...
173  if(fDbMperDCM[mss.fDiblock][mss.fDCM] != 0) {
174  if(nss.fDebugMode ||
175  fDbMperDCM[mss.fDiblock][mss.fDCM]
176  ->GetBinContent(fDbMperDCM[mss.fDiblock][mss.fDCM]->FindBin(X,Y)) > 1.0) AlertFill = 1.1;
177  else AlertFill = 0.1;
178  fDbMperDCM[mss.fDiblock][mss.fDCM]
179  ->SetBinContent(fDbMperDCM[mss.fDiblock][mss.fDCM]->FindBin(x1+x2,y1+y2), AlertFill);
180  }
181  // ...otherwise, only book and fill the histogram if the alert status is high
182  else {
183  if(nss.fDebugMode) {
184  // create and name the histogram by Diblock and DCM
185  char histoname[64];
186  sprintf(histoname, "DbMperDCM_%.2u_%.2u", mss.fDiblock, mss.fDCM);
187  fDbMperDCM[mss.fDiblock][mss.fDCM] = h.GetTH2F(histoname);
188  fDbMperDCM[mss.fDiblock][mss.fDCM]
189  ->SetBinContent(fDbMperDCM[mss.fDiblock][mss.fDCM]->FindBin(x1+x2,y1+y2), 1.1);
190  }
191  }
192 
193 
194 
195 
196 
197  //
198  // fill the Event FIFO Full histos
199  // NOTE: This is an "alert" histo and should only be filled with a status
200  // indicating good (0) or bad (1).
201  // We fill the histo with the OR of the current and previous values
202  // so that once an alert gets set, the histo will continue to display
203  // the set status until the histo is reset.
204  //
205  int FIFOfull;
206  if((FEBstatus & (1<<6))) FIFOfull = 1;
207  else FIFOfull = 0;
208 
209  // record error in detailed all alerts histo
210  fAAVsHour->Fill(r.fHour, 3, FIFOfull);
211  if(r.fHour >= 23.0) fAAVsHour->Fill(r.fHour - 24.0, 3, FIFOfull);
212 
213  // fill DCM level histo of FIFOfull reported by pixel
214  //
215  // NOTE: We add 0.1 to distinguish bins that are empty from bins that have been filled
216  // with zero.
217  if(FIFOfull || fFIFObyPixelDCM->GetBinContent(fFIFObyPixelDCM->FindBin(X,Y)) > 1.0) AlertFill = 1.1;
218  else AlertFill = 0.1;
219 
220  fFIFObyPixelDCM->SetBinContent(fFIFObyPixelDCM->FindBin(X,Y), AlertFill);
221 
222  // fill pixel level histo of FIFOfull by specific DCM
223 
224  // if the histogram already exists, then fill it...
225  if(fFIFOperDCM[mss.fDiblock][mss.fDCM] != 0) {
226  if(FIFOfull ||
227  fFIFOperDCM[mss.fDiblock][mss.fDCM]
228  ->GetBinContent(fFIFOperDCM[mss.fDiblock][mss.fDCM]->FindBin(X,Y)) > 1.0) AlertFill = 1.1;
229  else AlertFill = 0.1;
230  fFIFOperDCM[mss.fDiblock][mss.fDCM]
231  ->SetBinContent(fFIFOperDCM[mss.fDiblock][mss.fDCM]->FindBin(x1+x2,y1+y2), AlertFill);
232  }
233  // ...otherwise, only book and fill the histogram if the alert status is high
234  else {
235  if(FIFOfull) {
236  // create and name the histogram by Diblock and DCM
237  char histoname[64];
238  sprintf(histoname, "FIFOperDCM_%.2u_%.2u", mss.fDiblock, mss.fDCM);
239  fFIFOperDCM[mss.fDiblock][mss.fDCM] = h.GetTH2F(histoname);
240  fFIFOperDCM[mss.fDiblock][mss.fDCM]
241  ->SetBinContent(fFIFOperDCM[mss.fDiblock][mss.fDCM]->FindBin(x1+x2,y1+y2), 1.1);
242  }
243  }
244 
245 
246 
247 
248 
249  //
250  // fill the TECC Enable histos
251  // NOTE: This is an "alert" histo and should only be filled with a status
252  // indicating good (0) or bad (1).
253  // We fill the histo with the OR of the current and previous values
254  // so that once an alert gets set, the histo will continue to display
255  // the set status until the histo is reset.
256  //
257 
258  // NOTE: The status flag for TECC Enable is "negative logic" with respect to the alert-status
259  // histogram color scheme (0 = bad, 1 = good.)
260 
261  int TECCEnbl;
262  if((FEBstatus & (1<<5))) TECCEnbl = 0;
263  else TECCEnbl = 1;
264 
265  // record error in detailed all alerts histo
266  fAAVsHour->Fill(r.fHour, 2, TECCEnbl);
267  if(r.fHour >= 23.0) fAAVsHour->Fill(r.fHour - 24.0, 2, TECCEnbl);
268 
269  // fill DCM level histo of TECCEnbl reported by pixel
270  //
271  // NOTE: We add 0.1 to distinguish bins that are empty from bins that have been filled
272  // with zero.
273  if(TECCEnbl || fTECCEnblbyPixelDCM->GetBinContent(fTECCEnblbyPixelDCM->FindBin(X,Y)) > 1.0) AlertFill = 1.1;
274  else AlertFill = 0.1;
275  fTECCEnblbyPixelDCM->SetBinContent(fTECCEnblbyPixelDCM->FindBin(X,Y), AlertFill);
276 
277  // fill pixel level histo of TECCEnbl by specific DCM
278 
279  // if the histogram already exists, then fill it...
280  if(fTECCEnblperDCM[mss.fDiblock][mss.fDCM] != 0) {
281  if(TECCEnbl ||
282  fTECCEnblperDCM[mss.fDiblock][mss.fDCM]
283  ->GetBinContent(fTECCEnblperDCM[mss.fDiblock][mss.fDCM]->FindBin(X,Y)) > 1.0) AlertFill = 1.1;
284  else AlertFill = 0.1;
285  fTECCEnblperDCM[mss.fDiblock][mss.fDCM]
286  ->SetBinContent(fTECCEnblperDCM[mss.fDiblock][mss.fDCM]->FindBin(x1+x2,y1+y2), AlertFill);
287  }
288  // ...otherwise, only book and fill the histogram if the alert status is high
289  else {
290  if(TECCEnbl) {
291  // create and name the histogram by Diblock and DCM
292  char histoname[64];
293  sprintf(histoname, "TECCEnblperDCM_%.2u_%.2u", mss.fDiblock, mss.fDCM);
294  fTECCEnblperDCM[mss.fDiblock][mss.fDCM] = h.GetTH2F(histoname);
295  fTECCEnblperDCM[mss.fDiblock][mss.fDCM]
296  ->SetBinContent(fTECCEnblperDCM[mss.fDiblock][mss.fDCM]->FindBin(x1+x2,y1+y2), 1.1);
297  }
298  }
299 
300 
301 
302 
303 
304  //
305  // fill the Enable DAQ histos
306  // NOTE: This is an "alert" histo and should only be filled with a status
307  // indicating good (0) or bad (1).
308  // We fill the histo with the OR of the current and previous values
309  // so that once an alert gets set, the histo will continue to display
310  // the set status until the histo is reset.
311  //
312 
313  // NOTE: The status flag for Enable DAQ is "negative logic" with respect to the alert-status
314  // histogram color scheme (0 = bad, 1 = good.)
315  int EDAQ;
316  if((FEBstatus & (1<<4))) EDAQ = 0;
317  else EDAQ = 1;
318 
319  // record error in detailed all alerts histo
320  fAAVsHour->Fill(r.fHour, 1, EDAQ);
321  if(r.fHour >= 23.0) fAAVsHour->Fill(r.fHour - 24.0, 1, EDAQ);
322 
323  // fill DCM level histo of EDAQ reported by pixel
324  //
325  // NOTE: We add 0.1 to distinguish bins that are empty from bins that have been filled
326  // with zero.
327  if(EDAQ || fEDAQbyPixelDCM->GetBinContent(fEDAQbyPixelDCM->FindBin(X,Y)) > 1.0) AlertFill = 1.1;
328  else AlertFill = 0.1;
329  fEDAQbyPixelDCM->SetBinContent(fEDAQbyPixelDCM->FindBin(X,Y), AlertFill);
330 
331  // fill pixel level histo of EDAQ by specific DCM
332 
333  // if the histogram already exists, then fill it...
334  if(fEDAQperDCM[mss.fDiblock][mss.fDCM] != 0) {
335  if(EDAQ ||
336  fEDAQperDCM[mss.fDiblock][mss.fDCM]
337  ->GetBinContent(fEDAQperDCM[mss.fDiblock][mss.fDCM]->FindBin(X,Y)) > 1.0) AlertFill = 1.1;
338  else AlertFill = 0.1;
339  fEDAQperDCM[mss.fDiblock][mss.fDCM]
340  ->SetBinContent(fEDAQperDCM[mss.fDiblock][mss.fDCM]->FindBin(x1+x2,y1+y2), AlertFill);
341  }
342  // ...otherwise, only book and fill the histogram if the alert status is high
343  else {
344  if(EDAQ) {
345  // create and name the histogram by Diblock and DCM
346  char histoname[64];
347  sprintf(histoname, "EDAQperDCM_%.2u_%.2u", mss.fDiblock, mss.fDCM);
348  fEDAQperDCM[mss.fDiblock][mss.fDCM] = h.GetTH2F(histoname);
349  fEDAQperDCM[mss.fDiblock][mss.fDCM]
350  ->SetBinContent(fEDAQperDCM[mss.fDiblock][mss.fDCM]->FindBin(x1+x2,y1+y2), 1.1);
351  }
352  }
353 
354 
355 
356 
357 
358  //
359  // fill the Data Drop Error histos
360  //
361  if((FEBstatus & (1<<3))) {
362 
363  // record error in detailed all errors histo
364  fAEVsHour->Fill(r.fHour, 7);
365  if(r.fHour >= 23.0) fAEVsHour->Fill(r.fHour - 24.0, 7);
366 
367  // fill DCM level histo of DDE reported by pixel
368  fDDEbyPixelDCM->Fill(X,Y);
369 
370  // fill pixel level histo of DDE by specific DCM
371  if(fDDEperDCM[mss.fDiblock][mss.fDCM] == 0) {
372  // create and name the histogram by Diblock and DCM
373  char histoname[64];
374  sprintf(histoname, "DDEperDCM_%.2u_%.2u", mss.fDiblock, mss.fDCM);
375  fDDEperDCM[mss.fDiblock][mss.fDCM] = h.GetTH2F(histoname);
376  }
377 
378  fDDEperDCM[mss.fDiblock][mss.fDCM]->Fill(x1+x2, y1+y2);
379 
380  } // end if DDE == true
381 
382 
383 
384 
385 
386  //
387  // fill the TECC Error histos
388  //
389  if((FEBstatus & (1<<2))) {
390 
391  // record error in detailed all errors histo
392  fAEVsHour->Fill(r.fHour, 6);
393  if(r.fHour >= 23.0) fAEVsHour->Fill(r.fHour - 24.0, 6);
394 
395  // fill DCM level histo of TECCErr reported by pixel
396  fTECCErrbyPixelDCM->Fill(X,Y);
397 
398  // fill pixel level histo of TECCErr by specific DCM
399  if(fTECCErrperDCM[mss.fDiblock][mss.fDCM] == 0) {
400  // create and name the histogram by Diblock and DCM
401  char histoname[64];
402  sprintf(histoname, "TECCErrperDCM_%.2u_%.2u", mss.fDiblock, mss.fDCM);
403  fTECCErrperDCM[mss.fDiblock][mss.fDCM] = h.GetTH2F(histoname);
404  }
405 
406  fTECCErrperDCM[mss.fDiblock][mss.fDCM]->Fill(x1+x2, y1+y2);
407 
408  } // end if TECCErr == true
409 
410 
411 
412 
413 
414  //
415  // fill the ADC Error histos
416  //
417  if((FEBstatus & (1<<1))) {
418 
419  // record error in detailed all errors histo
420  fAEVsHour->Fill(r.fHour, 5);
421  if(r.fHour >= 23.0) fAEVsHour->Fill(r.fHour - 24.0, 5);
422 
423  // fill DCM level histo of ADCE reported by pixel
424  fADCEbyPixelDCM->Fill(X,Y);
425 
426  // fill pixel level histo of ADCE by specific DCM
427  if(fADCEperDCM[mss.fDiblock][mss.fDCM] == 0) {
428  // create and name the histogram by Diblock and DCM
429  char histoname[64];
430  sprintf(histoname, "ADCEperDCM_%.2u_%.2u", mss.fDiblock, mss.fDCM);
431  fADCEperDCM[mss.fDiblock][mss.fDCM] = h.GetTH2F(histoname);
432  }
433 
434  fADCEperDCM[mss.fDiblock][mss.fDCM]->Fill(x1+x2, y1+y2);
435 
436  } // end if ADCE == true
437 
438 
439 
440 
441 
442  //
443  // fill the Communication Error histos
444  //
445  if((FEBstatus & (1<<0))) {
446 
447  // record error in detailed all errors histo
448  fAEVsHour->Fill(r.fHour, 4);
449  if(r.fHour >= 23.0) fAEVsHour->Fill(r.fHour - 24.0, 4);
450 
451  // fill DCM level histo of CE reported by pixel
452  fCEbyPixelDCM->Fill(X,Y);
453 
454  // fill pixel level histo of CE by specific DCM
455  if(fCEperDCM[mss.fDiblock][mss.fDCM] == 0) {
456  // create and name the histogram by Diblock and DCM
457  char histoname[64];
458  sprintf(histoname, "CEperDCM_%.2u_%.2u", mss.fDiblock, mss.fDCM);
459  fCEperDCM[mss.fDiblock][mss.fDCM] = h.GetTH2F(histoname);
460  }
461 
462  fCEperDCM[mss.fDiblock][mss.fDCM]->Fill(x1+x2, y1+y2);
463 
464  } // end if CE == true
465 
466 }
467 
468 ////////////////////////////////////////////////////////////////////////
unsigned short fDebugMode
Debug mode status bit.
TH2F * fDDEbyPixelDCM
Definition: NanoErrors.h:53
TH2F * fEDAQbyPixelDCM
Definition: NanoErrors.h:52
unsigned int fDCM
DCM ID.
TH2F * fEDAQperDCM[DCM_size_nano][DCM_size_nano]
Definition: NanoErrors.h:64
virtual void GetNanoSliceSummary(const RawEventSummary &r, const DataBlockSummary &dbs, const MicroSliceSummary &mss, const NanoSliceSummary &nss)
Interface to the nanoslice summary.
Definition: NanoErrors.cxx:66
TH2F * fDbMbyPixelDCM
Definition: NanoErrors.h:49
Float_t y1[n_points_granero]
Definition: compare.C:5
unsigned int fHdwX
location of channel in "hardware display" space
unsigned int fDiblock
Diblock ID.
TH2F * fCEperDCM[DCM_size_nano][DCM_size_nano]
Definition: NanoErrors.h:68
TH2F * fDDEperDCM[DCM_size_nano][DCM_size_nano]
Definition: NanoErrors.h:65
Float_t x1[n_points_granero]
Definition: compare.C:5
TH2F * fAAVsHour
Definition: NanoErrors.h:71
TH2F * fLSEbyPixelDCM
Definition: NanoErrors.h:48
TH2F * fADCEbyPixelDCM
Definition: NanoErrors.h:55
unsigned int fPix
Pixel number on FEB.
TH2F * fFIFOperDCM[DCM_size_nano][DCM_size_nano]
Definition: NanoErrors.h:62
TH2F * fLSEperDCM[DCM_size_nano][DCM_size_nano]
Definition: NanoErrors.h:60
All the interesting event-level data.
unsigned short fLinkStatus
Link status bit.
TH2F * fFIFObyPixelDCM
Definition: NanoErrors.h:50
Float_t Y
Definition: plot.C:38
TH2F * fTECCErrbyPixelDCM
Definition: NanoErrors.h:54
TH2F * fDPEbyPixelDCM
Definition: NanoErrors.h:47
TH2F * GetTH2F(const char *nm)
Definition: HistoSet.cxx:89
float fHour
A fractional hour of the day.
daqchannelmap::HardwareDisplay * fHwMap
Definition: NanoErrors.h:27
TH2F * fTECCEnblperDCM[DCM_size_nano][DCM_size_nano]
Definition: NanoErrors.h:63
const double j
Definition: BetheBloch.cxx:29
unsigned short fDataPresent
Data present status bit.
A simple object that conatins all the global settings.
TH2F * fDbMperDCM[DCM_size_nano][DCM_size_nano]
Definition: NanoErrors.h:61
uint32_t fFEBStatus
Status flags.
TH2F * fADCEperDCM[DCM_size_nano][DCM_size_nano]
Definition: NanoErrors.h:67
TH2F * fTECCErrperDCM[DCM_size_nano][DCM_size_nano]
Definition: NanoErrors.h:66
TH2F * fCEbyPixelDCM
Definition: NanoErrors.h:56
void FEBXY(unsigned int feb, unsigned int *ix, unsigned int *iy)
unsigned int fHdwY
location of channel in "hardware display" space
TH2F * fDPEperDCM[DCM_size_nano][DCM_size_nano]
Definition: NanoErrors.h:59
TRandom3 r(0)
static const unsigned int DCM_size_nano
Definition: NanoErrors.h:8
TH2F * fAEVsHour
Definition: NanoErrors.h:70
unsigned int fFEB
FEB number of nanoslice (aka "hit")
static HistoSet & Instance()
Definition: HistoSet.cxx:24
Float_t X
Definition: plot.C:38
Hold the collection of histograms created by the producer.
All the interesting event-level data.
static Settings & Instance()
Definition: Settings.cxx:12
Online Monitoring package header.
void PixXY(unsigned int pix, unsigned int *ix, unsigned int *iy)
TH2F * fTECCEnblbyPixelDCM
Definition: NanoErrors.h:51
All the interesting event-level data.