CMS 3D CMS Logo

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