CMS 3D CMS Logo

FEDHistograms.cc
Go to the documentation of this file.
4 
5 #include "DQM/SiStripMonitorHardware/interface/FEDHistograms.hh"
6 
7 FEDHistograms::FEDHistograms() {}
8 
9 FEDHistograms::~FEDHistograms() {}
10 
11 void FEDHistograms::initialise(const edm::ParameterSet& iConfig, std::ostringstream* pDebugStream) {
12  getConfigForHistogram(fedEventSize_, "FedEventSize", iConfig, pDebugStream);
13  getConfigForHistogram(fedMaxEventSizevsTime_, "FedMaxEventSizevsTime", iConfig, pDebugStream);
14 
15  getConfigForHistogram(dataPresent_, "DataPresent", iConfig, pDebugStream);
16  getConfigForHistogram(anyFEDErrors_, "AnyFEDErrors", iConfig, pDebugStream);
17  getConfigForHistogram(anyDAQProblems_, "AnyDAQProblems", iConfig, pDebugStream);
18  getConfigForHistogram(anyFEProblems_, "AnyFEProblems", iConfig, pDebugStream);
19  getConfigForHistogram(corruptBuffers_, "CorruptBuffers", iConfig, pDebugStream);
20  getConfigForHistogram(badChannelStatusBits_, "BadChannelStatusBits", iConfig, pDebugStream);
21  getConfigForHistogram(badActiveChannelStatusBits_, "BadActiveChannelStatusBits", iConfig, pDebugStream);
22 
23  getConfigForHistogram(feOverflows_, "FEOverflows", iConfig, pDebugStream);
24  getConfigForHistogram(feMissing_, "FEMissing", iConfig, pDebugStream);
25  getConfigForHistogram(badMajorityAddresses_, "BadMajorityAddresses", iConfig, pDebugStream);
26  getConfigForHistogram(badMajorityInPartition_, "BadMajorityInPartition", iConfig, pDebugStream);
27  getConfigForHistogram(feMajFracTIB_, "FeMajFracTIB", iConfig, pDebugStream);
28  getConfigForHistogram(feMajFracTOB_, "FeMajFracTOB", iConfig, pDebugStream);
29  getConfigForHistogram(feMajFracTECB_, "FeMajFracTECB", iConfig, pDebugStream);
30  getConfigForHistogram(feMajFracTECF_, "FeMajFracTECF", iConfig, pDebugStream);
31 
32  getConfigForHistogram(dataMissing_, "DataMissing", iConfig, pDebugStream);
33  getConfigForHistogram(badIDs_, "BadIDs", iConfig, pDebugStream);
34  getConfigForHistogram(badDAQPacket_, "BadDAQPacket", iConfig, pDebugStream);
35  getConfigForHistogram(invalidBuffers_, "InvalidBuffers", iConfig, pDebugStream);
36  getConfigForHistogram(badDAQCRCs_, "BadDAQCRCs", iConfig, pDebugStream);
37  getConfigForHistogram(badFEDCRCs_, "BadFEDCRCs", iConfig, pDebugStream);
38 
39  getConfigForHistogram(feOverflowDetailed_, "FEOverflowsDetailed", iConfig, pDebugStream);
40  getConfigForHistogram(feMissingDetailed_, "FEMissingDetailed", iConfig, pDebugStream);
41  getConfigForHistogram(badMajorityAddressDetailed_, "BadMajorityAddressesDetailed", iConfig, pDebugStream);
42  getConfigForHistogram(badStatusBitsDetailed_, "BadAPVStatusBitsDetailed", iConfig, pDebugStream);
43  getConfigForHistogram(apvErrorDetailed_, "APVErrorBitsDetailed", iConfig, pDebugStream);
44  getConfigForHistogram(apvAddressErrorDetailed_, "APVAddressErrorBitsDetailed", iConfig, pDebugStream);
45  getConfigForHistogram(unlockedDetailed_, "UnlockedBitsDetailed", iConfig, pDebugStream);
46  getConfigForHistogram(outOfSyncDetailed_, "OOSBitsDetailed", iConfig, pDebugStream);
47 
48  getConfigForHistogram(nFEDErrors_, "nFEDErrors", iConfig, pDebugStream);
49  getConfigForHistogram(nFEDDAQProblems_, "nFEDDAQProblems", iConfig, pDebugStream);
50  getConfigForHistogram(nFEDsWithFEProblems_, "nFEDsWithFEProblems", iConfig, pDebugStream);
51  getConfigForHistogram(nFEDCorruptBuffers_, "nFEDCorruptBuffers", iConfig, pDebugStream);
52  getConfigForHistogram(nBadChannelStatusBits_, "nBadChannelStatusBits", iConfig, pDebugStream);
53  getConfigForHistogram(nBadActiveChannelStatusBits_, "nBadActiveChannelStatusBits", iConfig, pDebugStream);
54  getConfigForHistogram(nFEDsWithFEOverflows_, "nFEDsWithFEOverflows", iConfig, pDebugStream);
55  getConfigForHistogram(nFEDsWithMissingFEs_, "nFEDsWithMissingFEs", iConfig, pDebugStream);
56  getConfigForHistogram(nFEDsWithFEBadMajorityAddresses_, "nFEDsWithFEBadMajorityAddresses", iConfig, pDebugStream);
57 
58  getConfigForHistogram(nFEDErrorsvsTime_, "nFEDErrorsvsTime", iConfig, pDebugStream);
59  getConfigForHistogram(fedErrorsVsIdVsLumi_, "fedErrorsVsIdVsLumi", iConfig, pDebugStream);
60  getConfigForHistogram(nFEDCorruptBuffersvsTime_, "nFEDCorruptBuffersvsTime", iConfig, pDebugStream);
61  getConfigForHistogram(nFEDsWithFEProblemsvsTime_, "nFEDsWithFEProblemsvsTime", iConfig, pDebugStream);
62 
63  getConfigForHistogram(nUnconnectedChannels_, "nUnconnectedChannels", iConfig, pDebugStream);
64 
65  getConfigForHistogram(nTotalBadChannels_, "nTotalBadChannels", iConfig, pDebugStream);
66  getConfigForHistogram(nTotalBadActiveChannels_, "nTotalBadActiveChannels", iConfig, pDebugStream);
67 
68  getConfigForHistogram(nTotalBadChannelsvsTime_, "nTotalBadChannelsvsTime", iConfig, pDebugStream);
69  getConfigForHistogram(nTotalBadActiveChannelsvsTime_, "nTotalBadActiveChannelsvsTime", iConfig, pDebugStream);
70 
71  getConfigForHistogram(nAPVStatusBit_, "nAPVStatusBit", iConfig, pDebugStream);
72  getConfigForHistogram(nAPVError_, "nAPVError", iConfig, pDebugStream);
73  getConfigForHistogram(nAPVAddressError_, "nAPVAddressError", iConfig, pDebugStream);
74  getConfigForHistogram(nUnlocked_, "nUnlocked", iConfig, pDebugStream);
75  getConfigForHistogram(nOutOfSync_, "nOutOfSync", iConfig, pDebugStream);
76 
77  getConfigForHistogram(nAPVStatusBitvsTime_, "nAPVStatusBitvsTime", iConfig, pDebugStream);
78  getConfigForHistogram(nAPVErrorvsTime_, "nAPVErrorvsTime", iConfig, pDebugStream);
79  getConfigForHistogram(nAPVAddressErrorvsTime_, "nAPVAddressErrorvsTime", iConfig, pDebugStream);
80  getConfigForHistogram(nUnlockedvsTime_, "nUnlockedvsTime", iConfig, pDebugStream);
81  getConfigForHistogram(nOutOfSyncvsTime_, "nOutOfSyncvsTime", iConfig, pDebugStream);
82 
83  getConfigForHistogram(tkMapConfig_, "TkHistoMap", iConfig, pDebugStream);
84 
85  getConfigForHistogram(feTimeDiffTIB_, "FETimeDiffTIB", iConfig, pDebugStream);
86  getConfigForHistogram(feTimeDiffTOB_, "FETimeDiffTOB", iConfig, pDebugStream);
87  getConfigForHistogram(feTimeDiffTECB_, "FETimeDiffTECB", iConfig, pDebugStream);
88  getConfigForHistogram(feTimeDiffTECF_, "FETimeDiffTECF", iConfig, pDebugStream);
89 
90  getConfigForHistogram(feTimeDiffvsDBX_, "FETimeDiffvsDBX", iConfig, pDebugStream);
91 
92  getConfigForHistogram(apveAddress_, "ApveAddress", iConfig, pDebugStream);
93  getConfigForHistogram(feMajAddress_, "FeMajAddress", iConfig, pDebugStream);
94 
95  getConfigForHistogram(medianAPV0_, "MedianAPV0", iConfig, pDebugStream);
96  getConfigForHistogram(medianAPV1_, "MedianAPV1", iConfig, pDebugStream);
97 
98  getConfigForHistogram(lumiErrorFraction_, "ErrorFractionByLumiBlock", iConfig, pDebugStream);
99 
100  getConfigForHistogram(fedIdVsApvId_, "FedIdVsApvId", iConfig, pDebugStream);
101 
102  getConfigForHistogram(fedErrorsVsId_, "FedErrorsVsId", iConfig, pDebugStream);
103 }
104 
105 void FEDHistograms::fillCountersHistograms(const FEDErrors::FEDCounters& fedLevelCounters,
106  const FEDErrors::ChannelCounters& chLevelCounters,
107  const unsigned int aMaxSize,
108  const double aTime) {
109  fillHistogram(fedMaxEventSizevsTime_, aTime, aMaxSize);
110 
111  fillHistogram(nFEDErrors_, fedLevelCounters.nFEDErrors);
112  fillHistogram(nFEDDAQProblems_, fedLevelCounters.nDAQProblems);
113  fillHistogram(nFEDsWithFEProblems_, fedLevelCounters.nFEDsWithFEProblems);
114  fillHistogram(nFEDCorruptBuffers_, fedLevelCounters.nCorruptBuffers);
115  fillHistogram(nFEDsWithFEOverflows_, fedLevelCounters.nFEDsWithFEOverflows);
116  fillHistogram(nFEDsWithFEBadMajorityAddresses_, fedLevelCounters.nFEDsWithFEBadMajorityAddresses);
117  fillHistogram(nFEDsWithMissingFEs_, fedLevelCounters.nFEDsWithMissingFEs);
118  fillHistogram(nBadChannelStatusBits_, fedLevelCounters.nBadChannels);
119  fillHistogram(nBadActiveChannelStatusBits_, fedLevelCounters.nBadActiveChannels);
120 
121  fillHistogram(nFEDErrorsvsTime_, aTime, fedLevelCounters.nFEDErrors);
122  fillHistogram(nFEDCorruptBuffersvsTime_, aTime, fedLevelCounters.nCorruptBuffers);
123  fillHistogram(nFEDsWithFEProblemsvsTime_, aTime, fedLevelCounters.nFEDsWithFEProblems);
124 
125  fillHistogram(nUnconnectedChannels_, chLevelCounters.nNotConnected);
126 
127  fillHistogram(nTotalBadChannels_, fedLevelCounters.nTotalBadChannels);
128  fillHistogram(nTotalBadActiveChannels_, fedLevelCounters.nTotalBadActiveChannels);
129 
130  fillHistogram(nTotalBadChannelsvsTime_, aTime, fedLevelCounters.nTotalBadChannels);
131  fillHistogram(nTotalBadActiveChannelsvsTime_, aTime, fedLevelCounters.nTotalBadActiveChannels);
132 
133  fillHistogram(nAPVStatusBit_, chLevelCounters.nAPVStatusBit);
134  fillHistogram(nAPVError_, chLevelCounters.nAPVError);
135  fillHistogram(nAPVAddressError_, chLevelCounters.nAPVAddressError);
136  fillHistogram(nUnlocked_, chLevelCounters.nUnlocked);
137  fillHistogram(nOutOfSync_, chLevelCounters.nOutOfSync);
138 
139  fillHistogram(nAPVStatusBitvsTime_, aTime, chLevelCounters.nAPVStatusBit);
140  fillHistogram(nAPVErrorvsTime_, aTime, chLevelCounters.nAPVError);
141  fillHistogram(nAPVAddressErrorvsTime_, aTime, chLevelCounters.nAPVAddressError);
142  fillHistogram(nUnlockedvsTime_, aTime, chLevelCounters.nUnlocked);
143  fillHistogram(nOutOfSyncvsTime_, aTime, chLevelCounters.nOutOfSync);
144 }
145 
146 void FEDHistograms::fillFEDHistograms(FEDErrors& aFedErr,
147  const unsigned int aEvtSize,
148  bool lFullDebug,
149  const double aLumiSection,
150  unsigned int& NumBadChannels_perFEDID) {
151  const FEDErrors::FEDLevelErrors& lFedLevelErrors = aFedErr.getFEDLevelErrors();
152  const unsigned int lFedId = aFedErr.fedID();
153 
154  fillHistogram(fedEventSize_, lFedId, aEvtSize);
155 
156  if (lFedLevelErrors.DataPresent)
157  fillHistogram(dataPresent_, lFedId);
158 
159  if (lFedLevelErrors.HasCabledChannels && lFedLevelErrors.DataMissing) {
160  fillHistogram(dataMissing_, lFedId);
161  fillHistogram(fedErrorsVsId_, lFedId, 1);
162  }
163 
164  if (lFedLevelErrors.InvalidBuffers) {
165  fillHistogram(invalidBuffers_, lFedId);
166  fillHistogram(fedErrorsVsId_, lFedId, 2);
167  } else if (lFedLevelErrors.CorruptBuffer) {
168  fillHistogram(corruptBuffers_, lFedId);
169  fillHistogram(fedErrorsVsId_, lFedId, 3);
170  } else if (lFedLevelErrors.BadFEDCRCs) {
171  fillHistogram(badFEDCRCs_, lFedId);
172  fillHistogram(fedErrorsVsId_, lFedId, 4);
173  } else if (lFedLevelErrors.BadDAQCRCs) {
174  fillHistogram(badDAQCRCs_, lFedId);
175  fillHistogram(fedErrorsVsId_, lFedId, 5);
176  } else if (lFedLevelErrors.BadIDs) {
177  fillHistogram(badIDs_, lFedId);
178  fillHistogram(fedErrorsVsId_, lFedId, 6);
179  } else if (lFedLevelErrors.BadDAQPacket) {
180  fillHistogram(badDAQPacket_, lFedId);
181  fillHistogram(fedErrorsVsId_, lFedId, 7);
182  }
183 
184  if (aFedErr.anyFEDErrors()) {
185  fillHistogram(anyFEDErrors_, lFedId);
186  fillHistogram(fedErrorsVsId_, lFedId, 8);
187  }
188 
189  if (lFedLevelErrors.HasCabledChannels && aFedErr.anyDAQProblems()) {
190  fillHistogram(anyDAQProblems_, lFedId);
191  fillHistogram(fedErrorsVsId_, lFedId, 9);
192  }
193  if (aFedErr.anyFEProblems()) {
194  fillHistogram(anyFEProblems_, lFedId);
195  fillHistogram(fedErrorsVsId_, lFedId, 10);
196  }
197 
198  if (lFedLevelErrors.FEsOverflow) {
199  fillHistogram(feOverflows_, lFedId);
200  fillHistogram(fedErrorsVsId_, lFedId, 11);
201  }
202  if (lFedLevelErrors.FEsMissing) {
203  fillHistogram(feMissing_, lFedId);
204  fillHistogram(fedErrorsVsId_, lFedId, 12);
205  }
206  if (lFedLevelErrors.FEsBadMajorityAddress) {
207  fillHistogram(badMajorityAddresses_, lFedId);
208  fillHistogram(fedErrorsVsId_, lFedId, 13);
209  }
210 
211  if (lFedLevelErrors.BadChannelStatusBit) {
212  fillHistogram(badChannelStatusBits_, lFedId);
213  fillHistogram(fedErrorsVsId_, lFedId, 14);
214  }
215  if (lFedLevelErrors.BadActiveChannelStatusBit) {
216  fillHistogram(badActiveChannelStatusBits_, lFedId);
217  fillHistogram(fedErrorsVsId_, lFedId, 15);
218  }
219 
220  std::vector<FEDErrors::FELevelErrors>& lFeVec = aFedErr.getFELevelErrors();
221 
222  for (unsigned int iFe(0); iFe < lFeVec.size(); iFe++) {
223  fillFEHistograms(lFedId, lFeVec[iFe], aFedErr.getEventProperties());
224  }
225 
226  std::vector<FEDErrors::ChannelLevelErrors>& lChVec = aFedErr.getChannelLevelErrors();
227  for (unsigned int iCh(0); iCh < lChVec.size(); iCh++) {
228  fillChannelsHistograms(lFedId, lChVec[iCh], lFullDebug);
229  }
230 
231  std::vector<FEDErrors::APVLevelErrors>& lAPVVec = aFedErr.getAPVLevelErrors();
232  for (unsigned int iApv(0); iApv < lAPVVec.size(); iApv++) {
233  fillAPVsHistograms(lFedId, lAPVVec[iApv], lFullDebug);
234  }
235 
236  double numChannelLevelErrors = 0;
237  if (fedErrorsVsIdVsLumi_.globalswitchon) {
238  numChannelLevelErrors = double(lChVec.size());
239  fillHistogram2D(fedErrorsVsIdVsLumi_, aLumiSection, lFedId, numChannelLevelErrors);
240  }
241 }
242 
243 //fill a histogram if the pointer is not NULL (ie if it has been booked)
244 void FEDHistograms::fillFEHistograms(const unsigned int aFedId,
245  const FEDErrors::FELevelErrors& aFeLevelErrors,
246  const FEDErrors::EventProperties& aEventProp) {
247  const unsigned short lFeId = aFeLevelErrors.FeID;
248  /*
249  if ( (feOverflowDetailed_.enabled && aFeLevelErrors.Overflow) ||
250  (badMajorityAddressDetailed_.enabled && aFeLevelErrors.BadMajorityAddress) ||
251  (feMissingDetailed_.enabled && aFeLevelErrors.Missing)
252  )
253  bookFEDHistograms(aFedId);
254  */
255  if (aFeLevelErrors.Overflow)
256  fillHistogram(feOverflowDetailedMap_[aFedId], lFeId);
257  else if (aFeLevelErrors.Missing)
258  fillHistogram(feMissingDetailedMap_[aFedId], lFeId);
259  else if (aFeLevelErrors.BadMajorityAddress)
260  fillHistogram(badMajorityAddressDetailedMap_[aFedId], lFeId);
261 
262  if (aFeLevelErrors.TimeDifference != 0) {
263  if (aFeLevelErrors.SubDetID == 2 || aFeLevelErrors.SubDetID == 3 || aFeLevelErrors.SubDetID == 4)
264  fillHistogram(feTimeDiffTIB_, aFeLevelErrors.TimeDifference);
265  else if (aFeLevelErrors.SubDetID == 5)
266  fillHistogram(feTimeDiffTOB_, aFeLevelErrors.TimeDifference);
267  else if (aFeLevelErrors.SubDetID == 0)
268  fillHistogram(feTimeDiffTECB_, aFeLevelErrors.TimeDifference);
269  else if (aFeLevelErrors.SubDetID == 1)
270  fillHistogram(feTimeDiffTECF_, aFeLevelErrors.TimeDifference);
271  fillHistogram(
272  feTimeDiffvsDBX_,
273  aEventProp.deltaBX,
274  aFeLevelErrors.TimeDifference < 0 ? aFeLevelErrors.TimeDifference + 192 : aFeLevelErrors.TimeDifference);
275  fillHistogram(apveAddress_, aFeLevelErrors.Apve);
276  fillHistogram(feMajAddress_, aFeLevelErrors.FeMaj);
277  }
278 }
279 
280 //fill a histogram if the pointer is not NULL (ie if it has been booked)
281 void FEDHistograms::fillChannelsHistograms(const unsigned int aFedId,
282  const FEDErrors::ChannelLevelErrors& aChErr,
283  bool fullDebug) {
284  unsigned int lChId = aChErr.ChannelID;
285  /*
286  if ( (unlockedDetailed_.enabled && aChErr.Unlocked) ||
287  (outOfSyncDetailed_.enabled && aChErr.OutOfSync)
288  )
289  bookFEDHistograms(aFedId,fullDebug);
290  */
291  if (aChErr.Unlocked) {
292  fillHistogram(unlockedDetailedMap_[aFedId], lChId);
293  }
294  if (aChErr.OutOfSync) {
295  fillHistogram(outOfSyncDetailedMap_[aFedId], lChId);
296  }
297 }
298 
299 void FEDHistograms::fillAPVsHistograms(const unsigned int aFedId,
300  const FEDErrors::APVLevelErrors& aAPVErr,
301  bool fullDebug) {
302  unsigned int lChId = aAPVErr.APVID;
303  /*
304  if ( (badStatusBitsDetailed_.enabled && aAPVErr.APVStatusBit) ||
305  (apvErrorDetailed_.enabled && aAPVErr.APVError) ||
306  (apvAddressErrorDetailed_.enabled && aAPVErr.APVAddressError)
307  ) bookFEDHistograms(aFedId,fullDebug);
308  */
309 
310  if (aAPVErr.APVStatusBit)
311  fillHistogram(badStatusBitsDetailedMap_[aFedId], lChId);
312  if (aAPVErr.APVError)
313  fillHistogram(apvErrorDetailedMap_[aFedId], lChId);
314  if (aAPVErr.APVAddressError)
315  fillHistogram(apvAddressErrorDetailedMap_[aFedId], lChId);
316 }
317 
318 void FEDHistograms::fillMajorityHistograms(const unsigned int aPart,
319  const float aValue,
320  const std::vector<unsigned int>& aFedIdVec) {
321  if (aPart == 0)
322  fillHistogram(feMajFracTIB_, aValue);
323  else if (aPart == 1)
324  fillHistogram(feMajFracTOB_, aValue);
325  else if (aPart == 2)
326  fillHistogram(feMajFracTECB_, aValue);
327  else if (aPart == 3)
328  fillHistogram(feMajFracTECF_, aValue);
329 
330  for (unsigned int iFed(0); iFed < aFedIdVec.size(); ++iFed) {
331  fillHistogram(badMajorityInPartition_, aFedIdVec[iFed]);
332  }
333 }
334 
335 bool FEDHistograms::feMajHistosEnabled() {
336  return (feMajFracTIB_.enabled || feMajFracTOB_.enabled || feMajFracTECB_.enabled || feMajFracTECF_.enabled ||
337  badMajorityInPartition_.enabled);
338 }
339 
340 void FEDHistograms::fillLumiHistograms(const FEDErrors::LumiErrors& aLumErr) {
341  if (lumiErrorFraction_.enabled && lumiErrorFraction_.monitorEle) {
342  lumiErrorFraction_.monitorEle->Reset();
343  for (unsigned int iD(0); iD < aLumErr.nTotal.size(); iD++) {
344  if (aLumErr.nTotal[iD] > 0)
345  fillHistogram(lumiErrorFraction_, iD + 1, static_cast<float>(aLumErr.nErrors[iD]) / aLumErr.nTotal[iD]);
346  }
347  }
348 }
349 
350 bool FEDHistograms::cmHistosEnabled() { return (medianAPV0_.enabled || medianAPV1_.enabled); }
351 
352 FEDHistograms::MonitorElement* FEDHistograms::cmHistPointer(bool aApv1) {
353  if (!aApv1)
354  return medianAPV0_.monitorEle;
355  else
356  return medianAPV1_.monitorEle;
357 }
358 
359 FEDHistograms::MonitorElement* FEDHistograms::getFedvsAPVpointer() { return fedIdVsApvId_.monitorEle; }
360 
361 void FEDHistograms::bookTopLevelHistograms(DQMStore::IBooker& ibooker,
362  const TkDetMap* tkDetMap,
364  //get FED IDs
365  const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
366  const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
367 
368  //book FED level histograms
369  histosBooked_.resize(siStripFedIdMax + 1, false);
370  debugHistosBooked_.resize(siStripFedIdMax + 1, false);
371 
372  //book histos
373  bookProfile(ibooker,
374  fedEventSize_,
375  "FedEventSize",
376  "Average FED buffer Size (B) per Event",
377  siStripFedIdMax - siStripFedIdMin + 1,
378  siStripFedIdMin - 0.5,
379  siStripFedIdMax + 0.5,
380  0,
381  42241, //total number of channels
382  "FED-ID",
383  "<FED buffer Size> (B)");
384 
385  bookHistogram(ibooker,
386  dataPresent_,
387  "DataPresent",
388  "Number of events where the data from a FED is seen",
389  siStripFedIdMax - siStripFedIdMin + 1,
390  siStripFedIdMin - 0.5,
391  siStripFedIdMax + 0.5,
392  "FED-ID");
393 
394  bookHistogram(ibooker,
395  nTotalBadChannels_,
396  "nTotalBadChannels",
397  "Number of channels with any error",
398  "Total # bad enabled channels");
399 
400  bookHistogram(ibooker,
401  nTotalBadActiveChannels_,
402  "nTotalBadActiveChannels",
403  "Number of active channels with any error",
404  "Total # bad active channels");
405 
406  book2DHistogram(ibooker,
407  fedIdVsApvId_,
408  "FedIdVsApvId",
409  "Any error per APV per event",
410  192,
411  0,
412  192,
413  440,
414  50,
415  490,
416  "APV-ID",
417  "FED-ID");
418 
419  book2DHistogram(ibooker,
420  fedErrorsVsId_,
421  "FEDErrorsVsId",
422  "FED Errors vs ID",
423  siStripFedIdMax - siStripFedIdMin + 1,
424  siStripFedIdMin,
425  siStripFedIdMax + 1,
426  15,
427  1,
428  16,
429  "FED ID",
430  "Error Type");
431  fedErrorsVsId_.monitorEle->setBinLabel(1, "Data Missing", 2);
432  fedErrorsVsId_.monitorEle->setBinLabel(2, "Invalid Buffers", 2);
433  fedErrorsVsId_.monitorEle->setBinLabel(3, "Corrupt Buffers", 2);
434  fedErrorsVsId_.monitorEle->setBinLabel(4, "Bad FED CRC", 2);
435  fedErrorsVsId_.monitorEle->setBinLabel(5, "Bad DAQ CRC", 2);
436  fedErrorsVsId_.monitorEle->setBinLabel(6, "Bad IDs", 2);
437  fedErrorsVsId_.monitorEle->setBinLabel(7, "Bad DAQ Packet", 2);
438  fedErrorsVsId_.monitorEle->setBinLabel(8, "Any FED Errors", 2);
439  fedErrorsVsId_.monitorEle->setBinLabel(9, "Any DAQ Problems", 2);
440  fedErrorsVsId_.monitorEle->setBinLabel(10, "Any FE Problems", 2);
441  fedErrorsVsId_.monitorEle->setBinLabel(11, "FE Overflows", 2);
442  fedErrorsVsId_.monitorEle->setBinLabel(12, "FE Missing", 2);
443  fedErrorsVsId_.monitorEle->setBinLabel(13, "FE Bad Maj Addr", 2);
444  fedErrorsVsId_.monitorEle->setBinLabel(14, "Bad Ch Stat Bit", 2);
445  fedErrorsVsId_.monitorEle->setBinLabel(15, "Bad Active Ch Stat Bit", 2);
446 
447  const std::string lBaseDir = ibooker.pwd();
448 
449  ibooker.setCurrentFolder(lBaseDir + "/FED");
450 
451  bookHistogram(
452  ibooker, nFEDErrors_, "nFEDErrors", "Number of FEDs with errors (FED or FE Level) per event", "# FEDErrors");
453 
454  bookHistogram(
455  ibooker, nFEDDAQProblems_, "nFEDDAQProblems", "Number of FEDs with DAQ problems per event", "# FEDDAQProblems");
456 
457  bookHistogram(ibooker,
458  nFEDsWithFEProblems_,
459  "nFEDsWithFEProblems",
460  "Number of FEDs with FE problems per event",
461  "# FEDs with FE problems");
462 
463  bookHistogram(ibooker,
464  nFEDCorruptBuffers_,
465  "nFEDCorruptBuffers",
466  "Number of FEDs with corrupt buffers per event",
467  "# FEDs with corrupt buffer");
468 
469  ibooker.setCurrentFolder(lBaseDir + "/FED/VsId");
470 
471  bookHistogram(ibooker,
472  dataMissing_,
473  "DataMissing",
474  "Number of events where the data from a FED with cabled channels is missing",
475  siStripFedIdMax - siStripFedIdMin + 1,
476  siStripFedIdMin - 0.5,
477  siStripFedIdMax + 0.5,
478  "FED-ID");
479 
480  bookHistogram(
481  ibooker,
482  anyFEDErrors_,
483  "AnyFEDErrors",
484  "Number of buffers with any FED error (excluding bad channel status bits, FE problems except overflows) per FED",
485  siStripFedIdMax - siStripFedIdMin + 1,
486  siStripFedIdMin - 0.5,
487  siStripFedIdMax + 0.5,
488  "FED-ID");
489 
490  bookHistogram(ibooker,
491  corruptBuffers_,
492  "CorruptBuffers",
493  "Number of corrupt FED buffers per FED",
494  siStripFedIdMax - siStripFedIdMin + 1,
495  siStripFedIdMin - 0.5,
496  siStripFedIdMax + 0.5,
497  "FED-ID");
498 
499  bookHistogram(ibooker,
500  invalidBuffers_,
501  "InvalidBuffers",
502  "Number of invalid FED buffers per FED",
503  siStripFedIdMax - siStripFedIdMin + 1,
504  siStripFedIdMin - 0.5,
505  siStripFedIdMax + 0.5,
506  "FED-ID");
507 
508  bookHistogram(ibooker,
509  anyDAQProblems_,
510  "AnyDAQProblems",
511  "Number of buffers with any problems flagged in DAQ header (including CRC)",
512  siStripFedIdMax - siStripFedIdMin + 1,
513  siStripFedIdMin - 0.5,
514  siStripFedIdMax + 0.5,
515  "FED-ID");
516 
517  bookHistogram(ibooker,
518  badIDs_,
519  "BadIDs",
520  "Number of buffers with non-SiStrip source IDs in DAQ header",
521  siStripFedIdMax - siStripFedIdMin + 1,
522  siStripFedIdMin - 0.5,
523  siStripFedIdMax + 0.5,
524  "FED-ID");
525 
526  bookHistogram(ibooker,
527  badDAQCRCs_,
528  "BadDAQCRCs",
529  "Number of buffers with bad CRCs from the DAQ",
530  siStripFedIdMax - siStripFedIdMin + 1,
531  siStripFedIdMin - 0.5,
532  siStripFedIdMax + 0.5,
533  "FED-ID");
534 
535  bookHistogram(ibooker,
536  badFEDCRCs_,
537  "BadFEDCRCs",
538  "Number of buffers with bad CRCs from the FED",
539  siStripFedIdMax - siStripFedIdMin + 1,
540  siStripFedIdMin - 0.5,
541  siStripFedIdMax + 0.5,
542  "FED-ID");
543 
544  bookHistogram(ibooker,
545  badDAQPacket_,
546  "BadDAQPacket",
547  "Number of buffers with (non-CRC) problems flagged in DAQ header/trailer",
548  siStripFedIdMax - siStripFedIdMin + 1,
549  siStripFedIdMin - 0.5,
550  siStripFedIdMax + 0.5,
551  "FED-ID");
552 
553  ibooker.setCurrentFolder(lBaseDir + "/FE");
554 
555  bookHistogram(ibooker,
556  nFEDsWithFEOverflows_,
557  "nFEDsWithFEOverflows",
558  "Number FEDs with FE units which overflowed per event",
559  "# FEDs with FE overflows");
560 
561  bookHistogram(ibooker,
562  nFEDsWithFEBadMajorityAddresses_,
563  "nFEDsWithFEBadMajorityAddresses",
564  "Number of FEDs with FE units with a bad majority address per event",
565  "# FEDs with bad address");
566 
567  bookHistogram(ibooker,
568  nFEDsWithMissingFEs_,
569  "nFEDsWithMissingFEs",
570  "Number of FEDs with missing FE unit payloads per event",
571  "# FEDs with missing FEs");
572 
573  bookHistogram(ibooker,
574  feMajFracTIB_,
575  "FeMajFracTIB",
576  "Fraction of FEs matching majority address in TIB partition",
577  101,
578  0,
579  1.01,
580  "n(majAddrFE)/n(totFE)");
581 
582  bookHistogram(ibooker,
583  feMajFracTOB_,
584  "FeMajFracTOB",
585  "Fraction of FEs matching majority address in TOB partition",
586  101,
587  0,
588  1.01,
589  "n(majAddrFE)/n(totFE)");
590 
591  bookHistogram(ibooker,
592  feMajFracTECB_,
593  "FeMajFracTECB",
594  "Fraction of FEs matching majority address in TECB partition",
595  101,
596  0,
597  1.01,
598  "n(majAddrFE)/n(totFE)");
599 
600  bookHistogram(ibooker,
601  feMajFracTECF_,
602  "FeMajFracTECF",
603  "Fraction of FEs matching majority address in TECF partition",
604  101,
605  0,
606  1.01,
607  "n(majAddrFE)/n(totFE)");
608 
609  ibooker.setCurrentFolder(lBaseDir + "/FE/APVe");
610 
611  bookHistogram(ibooker,
612  feTimeDiffTIB_,
613  "FETimeDiffTIB",
614  "(TimeLoc FE - TimeLoc APVe) for TIB/TID, when different",
615  401,
616  -200,
617  201,
618  "#Delta_{TimeLoc}(FE-APVe)");
619 
620  bookHistogram(ibooker,
621  feTimeDiffTOB_,
622  "FETimeDiffTOB",
623  "(TimeLoc FE - TimeLoc APVe) for TOB, when different",
624  401,
625  -200,
626  201,
627  "#Delta_{TimeLoc}(FE-APVe)");
628 
629  bookHistogram(ibooker,
630  feTimeDiffTECB_,
631  "FETimeDiffTECB",
632  "(TimeLoc FE - TimeLoc APVe) for TECB, when different",
633  401,
634  -200,
635  201,
636  "#Delta_{TimeLoc}(FE-APVe)");
637 
638  bookHistogram(ibooker,
639  feTimeDiffTECF_,
640  "FETimeDiffTECF",
641  "(TimeLoc FE - TimeLoc APVe) for TECF, when different",
642  401,
643  -200,
644  201,
645  "#Delta_{TimeLoc}(FE-APVe)");
646 
647  book2DHistogram(ibooker,
648  feTimeDiffvsDBX_,
649  "FETimeDiffvsDBX",
650  "(TimeLoc FE - TimeLoc APVe) vs DBX, when different",
651  2000,
652  -0.5,
653  1999.5,
654  201,
655  0,
656  201,
657  "DeltaBX",
658  "#Delta_{TimeLoc}(FE-APVe)");
659 
660  bookHistogram(ibooker, apveAddress_, "ApveAddress", "apve Address", 256, 0, 256, "apveAddress");
661 
662  bookHistogram(ibooker, feMajAddress_, "FeMajAddress", "FE Majority Address", 256, 0, 256, "feMajAddress");
663 
664  ibooker.setCurrentFolder(lBaseDir + "/FE/VsId");
665 
666  bookHistogram(ibooker,
667  anyFEProblems_,
668  "AnyFEProblems",
669  "Number of buffers with any FE unit problems",
670  siStripFedIdMax - siStripFedIdMin + 1,
671  siStripFedIdMin - 0.5,
672  siStripFedIdMax + 0.5,
673  "FED-ID");
674 
675  bookHistogram(ibooker,
676  feOverflows_,
677  "FEOverflows",
678  "Number of buffers with one or more FE overflow",
679  siStripFedIdMax - siStripFedIdMin + 1,
680  siStripFedIdMin - 0.5,
681  siStripFedIdMax + 0.5,
682  "FED-ID");
683 
684  bookHistogram(ibooker,
685  badMajorityAddresses_,
686  "BadMajorityAddresses",
687  "Number of buffers with one or more FE with a bad majority APV address",
688  siStripFedIdMax - siStripFedIdMin + 1,
689  siStripFedIdMin - 0.5,
690  siStripFedIdMax + 0.5,
691  "FED-ID");
692 
693  bookHistogram(ibooker,
694  badMajorityInPartition_,
695  "BadMajorityInPartition",
696  "Number of buffers with >=1 FE with FEaddress != majority in partition",
697  siStripFedIdMax - siStripFedIdMin + 1,
698  siStripFedIdMin - 0.5,
699  siStripFedIdMax + 0.5,
700  "FED-ID");
701 
702  bookHistogram(ibooker,
703  feMissing_,
704  "FEMissing",
705  "Number of buffers with one or more FE unit payload missing",
706  siStripFedIdMax - siStripFedIdMin + 1,
707  siStripFedIdMin - 0.5,
708  siStripFedIdMax + 0.5,
709  "FED-ID");
710 
711  ibooker.setCurrentFolder(lBaseDir + "/Fiber");
712 
713  bookHistogram(ibooker,
714  nBadChannelStatusBits_,
715  "nBadChannelStatusBits",
716  "Number of channels with bad status bits per event",
717  "# bad enabled channels");
718 
719  bookHistogram(ibooker,
720  nBadActiveChannelStatusBits_,
721  "nBadActiveChannelStatusBits",
722  "Number of active channels with bad status bits per event",
723  "# bad active channels");
724 
725  bookHistogram(ibooker, nUnlocked_, "nUnlocked", "Number of channels Unlocked per event", "# channels unlocked");
726 
727  bookHistogram(ibooker, nOutOfSync_, "nOutOfSync", "Number of channels OutOfSync per event", "# channels out-of-sync");
728 
729  bookHistogram(ibooker,
730  nUnconnectedChannels_,
731  "nUnconnectedChannels",
732  "Number of channels not connected per event",
733  "# unconnected channels");
734 
735  ibooker.setCurrentFolder(lBaseDir + "/Fiber/VsId");
736 
737  bookHistogram(ibooker,
738  badChannelStatusBits_,
739  "BadChannelStatusBits",
740  "Number of buffers with one or more enabled channel with bad status bits",
741  siStripFedIdMax - siStripFedIdMin + 1,
742  siStripFedIdMin - 0.5,
743  siStripFedIdMax + 0.5,
744  "FED-ID");
745 
746  bookHistogram(ibooker,
747  badActiveChannelStatusBits_,
748  "BadActiveChannelStatusBits",
749  "Number of buffers with one or more active channel with bad status bits",
750  siStripFedIdMax - siStripFedIdMin + 1,
751  siStripFedIdMin - 0.5,
752  siStripFedIdMax + 0.5,
753  "FED-ID");
754 
755  ibooker.setCurrentFolder(lBaseDir + "/APV");
756 
757  bookHistogram(ibooker, medianAPV0_, "MedianAPV0", "Median APV0", "medianAPV0");
758 
759  bookHistogram(ibooker, medianAPV1_, "MedianAPV1", "Median APV1", "MedianAPV1");
760 
761  bookHistogram(ibooker,
762  nAPVStatusBit_,
763  "nAPVStatusBit",
764  "Number of APVs with APVStatusBit error per event",
765  "# APVs with APVStatusBit error");
766 
767  bookHistogram(ibooker, nAPVError_, "nAPVError", "Number of APVs with APVError per event", "#APVs with APVError");
768 
769  bookHistogram(ibooker,
770  nAPVAddressError_,
771  "nAPVAddressError",
772  "Number of APVs with APVAddressError per event",
773  "#APVs with APVAddressError");
774 
775  ibooker.setCurrentFolder(lBaseDir + "/Trends");
776 
777  bookProfile(ibooker,
778  fedMaxEventSizevsTime_,
779  "FedMaxEventSizevsTime",
780  "Max FED buffer Size (B) per Event vs time",
781  0,
782  42241, //total number of channels
783  "Time",
784  "Max FED buffer Size (B)");
785 
786  bookProfile(ibooker,
787  nTotalBadChannelsvsTime_,
788  "nTotalBadChannelsvsTime",
789  "Number of channels with any error vs time",
790  0,
791  42241, //total number of channels
792  "Time",
793  "Total # bad enabled channels");
794 
795  bookProfile(ibooker,
796  nTotalBadActiveChannelsvsTime_,
797  "nTotalBadActiveChannelsvsTime",
798  "Number of active channels with any error vs time",
799  0,
800  42241, //total number of channels
801  "Time",
802  "Total # bad active channels");
803 
804  ibooker.setCurrentFolder(lBaseDir + "/Trends/FED");
805 
806  if (fedErrorsVsIdVsLumi_.globalswitchon) {
807  bookProfile2D(ibooker,
808  fedErrorsVsIdVsLumi_,
809  "fedErrorsVsIdVsLumi",
810  "Total number of errors per FED ID per lumi section",
811  440, //# FED IDS
812  49.5, // Lowest FED ID
813  489.5, // Highest FED ID
814  "Lumi. Section",
815  "FED ID");
816  }
817 
818  bookProfile(ibooker,
819  nFEDErrorsvsTime_,
820  "nFEDErrorsvsTime",
821  "Number of FEDs with any error vs time",
822  0,
823  42241, //total number of channels
824  "Time",
825  "# FEDErrors");
826 
827  bookProfile(ibooker,
828  nFEDCorruptBuffersvsTime_,
829  "nFEDCorruptBuffersvsTime",
830  "Number of FEDs with corrupt buffer vs time",
831  0,
832  42241, //total number of channels
833  "Time",
834  "# FEDCorruptBuffer");
835 
836  ibooker.setCurrentFolder(lBaseDir + "/Trends/FE");
837 
838  bookProfile(ibooker,
839  nFEDsWithFEProblemsvsTime_,
840  "nFEDsWithFEProblemsvsTime",
841  "Number of FEDs with any FE error vs time",
842  0,
843  42241, //total number of channels
844  "Time",
845  "# FEDsWithFEProblems");
846 
847  ibooker.setCurrentFolder(lBaseDir + "/Trends/Fiber");
848 
849  bookProfile(ibooker,
850  nUnlockedvsTime_,
851  "nUnlockedvsTime",
852  "Number of channels Unlocked vs time",
853  0,
854  42241, //total number of channels
855  "Time",
856  "# channels unlocked ");
857 
858  bookProfile(ibooker,
859  nOutOfSyncvsTime_,
860  "nOutOfSyncvsTime",
861  "Number of channels OutOfSync vs time",
862  0,
863  42241, //total number of channels
864  "Time",
865  "# channels out-of-sync");
866 
867  ibooker.setCurrentFolder(lBaseDir + "/Trends/APV");
868 
869  bookProfile(ibooker,
870  nAPVStatusBitvsTime_,
871  "nAPVStatusBitvsTime",
872  "Number of APVs with APVStatusBit error vs time",
873  0,
874  42241, //total number of channels
875  "Time",
876  "# APVs with APVStatusBit error");
877 
878  bookProfile(ibooker,
879  nAPVErrorvsTime_,
880  "nAPVErrorvsTime",
881  "Number of APVs with APVError vs time",
882  0,
883  42241, //total number of channels
884  "Time",
885  "# APVs with APVError");
886 
887  bookProfile(ibooker,
888  nAPVAddressErrorvsTime_,
889  "nAPVAddressErrorvsTime",
890  "Number of APVs with APVAddressError vs time",
891  0,
892  42241, //total number of channels
893  "Time",
894  "# APVs with APVAddressError");
895 
896  ibooker.setCurrentFolder(lBaseDir + "/PerLumiSection");
897 
898  bookHistogram(ibooker,
899  lumiErrorFraction_,
900  "lumiErrorFraction",
901  "Fraction of error per lumi section vs subdetector",
902  6,
903  0.5,
904  6.5,
905  "SubDetId");
906 
907  //Set special property for lumi ME
908  if (lumiErrorFraction_.enabled && lumiErrorFraction_.monitorEle) {
909  lumiErrorFraction_.monitorEle->setLumiFlag();
910  lumiErrorFraction_.monitorEle->setBinLabel(1, "TECB");
911  lumiErrorFraction_.monitorEle->setBinLabel(2, "TECF");
912  lumiErrorFraction_.monitorEle->setBinLabel(3, "TIB");
913  lumiErrorFraction_.monitorEle->setBinLabel(4, "TIDB");
914  lumiErrorFraction_.monitorEle->setBinLabel(5, "TIDF");
915  lumiErrorFraction_.monitorEle->setBinLabel(6, "TOB");
916  }
917 
918  //book map after, as it creates a new folder...
919  if (tkMapConfig_.enabled) {
920  tkmapFED_ = std::make_unique<TkHistoMap>(tkDetMap, topFolderName, "TkHMap_FractionOfBadChannels", 0., true);
921  } else
922  tkmapFED_ = nullptr;
923 }
924 
925 void FEDHistograms::bookFEDHistograms(DQMStore::IBooker& ibooker, unsigned int fedId, bool fullDebugMode) {
926  if (!histosBooked_[fedId]) {
927  //will do that only once
928  SiStripFedKey fedKey(fedId, 0, 0, 0);
929  std::stringstream fedIdStream;
930  fedIdStream << fedId;
931  ibooker.setCurrentFolder(fedKey.path());
932 
933  bookHistogram(ibooker,
934  feOverflowDetailed_,
935  feOverflowDetailedMap_[fedId],
936  "FEOverflowsForFED" + fedIdStream.str(),
937  "FE overflows per FE unit for FED ID " + fedIdStream.str(),
939  0,
941  "FE-Index");
942  bookHistogram(ibooker,
943  badMajorityAddressDetailed_,
944  badMajorityAddressDetailedMap_[fedId],
945  "BadMajorityAddressesForFED" + fedIdStream.str(),
946  "Bad majority APV addresses per FE unit for FED ID " + fedIdStream.str(),
948  0,
950  "FE-Index");
951  bookHistogram(ibooker,
952  feMissingDetailed_,
953  feMissingDetailedMap_[fedId],
954  "FEMissingForFED" + fedIdStream.str(),
955  "Buffers with FE Unit payload missing per FE unit for FED ID " + fedIdStream.str(),
957  0,
959  "FE-Index");
960  bookHistogram(ibooker,
961  badStatusBitsDetailed_,
962  badStatusBitsDetailedMap_[fedId],
963  "BadAPVStatusBitsForFED" + fedIdStream.str(),
964  "Bad apv status bits for FED ID " + fedIdStream.str(),
966  0,
968  "APV-Index");
969  histosBooked_[fedId] = true;
970  }
971  if (fullDebugMode && !debugHistosBooked_[fedId]) {
972  //will do that only once
973  SiStripFedKey fedKey(fedId, 0, 0, 0);
974  std::stringstream fedIdStream;
975  fedIdStream << fedId;
976  ibooker.setCurrentFolder(fedKey.path());
977 
978  bookHistogram(ibooker,
979  apvErrorDetailed_,
980  apvErrorDetailedMap_[fedId],
981  "APVErrorBitsForFED" + fedIdStream.str(),
982  "APV errors for FED ID " + fedIdStream.str(),
984  0,
986  "APV-Index");
987  bookHistogram(ibooker,
988  apvAddressErrorDetailed_,
989  apvAddressErrorDetailedMap_[fedId],
990  "APVAddressErrorBitsForFED" + fedIdStream.str(),
991  "Wrong APV address errors for FED ID " + fedIdStream.str(),
993  0,
995  "APV-Index");
996  bookHistogram(ibooker,
997  unlockedDetailed_,
998  unlockedDetailedMap_[fedId],
999  "UnlockedBitsForFED" + fedIdStream.str(),
1000  "Unlocked channels for FED ID " + fedIdStream.str(),
1002  0,
1004  "Channel-Index");
1005  bookHistogram(ibooker,
1006  outOfSyncDetailed_,
1007  outOfSyncDetailedMap_[fedId],
1008  "OOSBitsForFED" + fedIdStream.str(),
1009  "Out of sync channels for FED ID " + fedIdStream.str(),
1011  0,
1013  "Channel-Index");
1014  debugHistosBooked_[fedId] = true;
1015  }
1016 }
1017 
1018 void FEDHistograms::bookAllFEDHistograms(DQMStore::IBooker& ibooker, bool fullDebugMode) {
1019  //get FED IDs
1020  const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
1021  const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
1022  //book them
1023  for (unsigned int iFed = siStripFedIdMin; iFed <= siStripFedIdMax; iFed++)
1024  bookFEDHistograms(ibooker, iFed, fullDebugMode);
1025 }
1026 
1027 bool FEDHistograms::tkHistoMapEnabled(unsigned int aIndex) { return tkMapConfig_.enabled; }
1028 
1029 TkHistoMap* FEDHistograms::tkHistoMapPointer(unsigned int aIndex) { return tkmapFED_.get(); }
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
static const uint16_t FEUNITS_PER_FED
static const uint16_t APVS_PER_FED
dqm::legacy::MonitorElement MonitorElement
Constants and enumerated types for FED/FEC systems.
static const uint16_t FEDCH_PER_FED