CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FEDErrors.cc
Go to the documentation of this file.
3 
8 
10 
11 #include "DQM/SiStripMonitorHardware/interface/HistogramBase.hh"
12 #include "DQM/SiStripMonitorHardware/interface/FEDErrors.hh"
14 
15 
16 FEDErrors::FEDErrors()
17 {
18  //initialiseLumiBlock();
19  initialiseEvent();
20 }
21 
22 FEDErrors::~FEDErrors()
23 {
24 
25 }
26 
27 void FEDErrors::initialiseLumiBlock() {
28  lumiErr_.nTotal.clear();
29  lumiErr_.nErrors.clear();
30  //6 subdetectors:
31  //TECB,TECF,TIB,TIDB,TIDF,TOB
32  lumiErr_.nTotal.resize(6,0);
33  lumiErr_.nErrors.resize(6,0);
34 }
35 
36 void FEDErrors::initialiseEvent() {
37  fedID_ = 0;
38  failUnpackerFEDCheck_ = false;
39 
40  connected_.clear();
41  detid_.clear();
42  nChInModule_.clear();
43 
44  subDetId_.clear();
45 
46  FEDCounters & lFedCounter = FEDErrors::getFEDErrorsCounters();
47  lFedCounter.nFEDErrors = 0;
48  lFedCounter.nDAQProblems = 0;
49  lFedCounter.nFEDsWithFEProblems = 0;
50  lFedCounter.nCorruptBuffers = 0;
51  lFedCounter.nBadChannels = 0;
52  lFedCounter.nBadActiveChannels = 0;
53  lFedCounter.nFEDsWithFEOverflows = 0;
54  lFedCounter.nFEDsWithFEBadMajorityAddresses = 0;
55  lFedCounter.nFEDsWithMissingFEs = 0;
56  lFedCounter.nTotalBadChannels = 0;
57  lFedCounter.nTotalBadActiveChannels = 0;
58 
59  ChannelCounters & lChCounter = FEDErrors::getChannelErrorsCounters();
60  lChCounter.nNotConnected = 0;
61  lChCounter.nUnlocked = 0;
62  lChCounter.nOutOfSync = 0;
63  lChCounter.nAPVStatusBit = 0;
64  lChCounter.nAPVError = 0;
65  lChCounter.nAPVAddressError = 0;
66 
67  feCounter_.nFEOverflows = 0;
68  feCounter_.nFEBadMajorityAddresses = 0;
69  feCounter_.nFEMissing = 0;
70 
71  fedErrors_.HasCabledChannels = false;
72  fedErrors_.DataPresent = false;
73  fedErrors_.DataMissing = false;
74  fedErrors_.InvalidBuffers = false;
75  fedErrors_.BadFEDCRCs = false;
76  fedErrors_.BadDAQCRCs = false;
77  fedErrors_.BadIDs = false;
78  fedErrors_.BadDAQPacket = false;
79  fedErrors_.CorruptBuffer = false;
80  fedErrors_.FEsOverflow = false;
81  fedErrors_.FEsMissing = false;
82  fedErrors_.FEsBadMajorityAddress = false;
83  fedErrors_.BadChannelStatusBit = false;
84  fedErrors_.BadActiveChannelStatusBit = false;
85 
86  feErrors_.clear();
87 
88  chErrorsDetailed_.clear();
89 
90  apvErrors_.clear();
91 
92  chErrors_.clear();
93 
94  eventProp_.deltaBX=0;
95 }
96 
97 
98 
99 void FEDErrors::initialiseFED(const unsigned int aFedID,
100  const SiStripFedCabling* aCabling,
101  const bool initVars)
102 {
103  fedID_ = aFedID;
104  failUnpackerFEDCheck_ = false;
105 
106  //initialise first. if no channel connected in one FE, subdetid =
107  //0. in the loop on channels, if at least one channel is connected
108  //and has a valid ID, the subdet value will be changed to the right
109  //one.
110  if (initVars) {
111 
112  subDetId_.resize(sistrip::FEUNITS_PER_FED,0);
113 
114  connected_.resize(sistrip::FEDCH_PER_FED,false);
115  detid_.resize(sistrip::FEDCH_PER_FED,0);
116  nChInModule_.resize(sistrip::FEDCH_PER_FED,0);
117 
118  for (unsigned int iCh = 0;
119  iCh < sistrip::FEDCH_PER_FED;
120  iCh++) {
121 
122  const FedChannelConnection & lConnection = aCabling->connection(fedID_,iCh);
123  connected_[iCh] = lConnection.isConnected();
124  detid_[iCh] = lConnection.detId();
125  nChInModule_[iCh] = lConnection.nApvPairs();
126 
127  unsigned short lFeNumber = static_cast<unsigned int>(iCh/sistrip::FEDCH_PER_FEUNIT);
128  unsigned int lDetid = detid_[iCh];
129 
130  if (lDetid && lDetid != sistrip::invalid32_ && connected_[iCh]) {
131  unsigned int lSubid = 6;
132  // 3=TIB, 4=TID, 5=TOB, 6=TEC (TECB here)
133  switch(DetId(lDetid).subdetId()) {
134  case 3:
135  lSubid = 2; //TIB
136  break;
137 
138  case 4:
139  {
140  TIDDetId lTidId(lDetid);
141  if (lTidId.side() == 2) lSubid = 4; //TIDF
142  else lSubid = 3; //TIDB
143  break;
144  }
145 
146  case 5:
147  lSubid = 5; //TOB
148  break;
149 
150  case 6:
151  {
152  TECDetId lTecId(lDetid);
153  if (lTecId.side() == 2) lSubid = 1; //TECF
154  else lSubid = 0; //TECB
155  break;
156  }
157 
158  default:
159  lSubid = 6;
160  break;
161 
162  }
163  subDetId_[lFeNumber] = lSubid;
164  //if (iCh%12==0) std::cout << fedID_ << " " << lFeNumber << " " << subDetId_[lFeNumber] << std::endl;
165 
166  }
167  }
168 
169 
170  feCounter_.nFEOverflows = 0;
171  feCounter_.nFEBadMajorityAddresses = 0;
172  feCounter_.nFEMissing = 0;
173 
174  fedErrors_.HasCabledChannels = false;
175  fedErrors_.DataPresent = false;
176  fedErrors_.DataMissing = false;
177  fedErrors_.InvalidBuffers = false;
178  fedErrors_.BadFEDCRCs = false;
179  fedErrors_.BadDAQCRCs = false;
180  fedErrors_.BadIDs = false;
181  fedErrors_.BadDAQPacket = false;
182  fedErrors_.CorruptBuffer = false;
183  fedErrors_.FEsOverflow = false;
184  fedErrors_.FEsMissing = false;
185  fedErrors_.FEsBadMajorityAddress = false;
186  fedErrors_.BadChannelStatusBit = false;
187  fedErrors_.BadActiveChannelStatusBit = false;
188 
189  feErrors_.clear();
190 
191  chErrorsDetailed_.clear();
192 
193  apvErrors_.clear();
194 
195  chErrors_.clear();
196  }
197 }
198 
199 bool FEDErrors::checkDataPresent(const FEDRawData& aFedData)
200 {
201 
202  if (!aFedData.size() || !aFedData.data()) {
203  for (unsigned int iCh = 0;
204  iCh < sistrip::FEDCH_PER_FED;
205  iCh++) {
206  if (connected_[iCh]){
207  fedErrors_.HasCabledChannels = true;
208  fedErrors_.DataMissing = true;
209  return false;
210  }
211  }
212  fedErrors_.DataMissing = true;
213  fedErrors_.HasCabledChannels = false;
214  return false;
215  } else {
216  fedErrors_.DataPresent = true;
217  for (unsigned int iCh = 0;
218  iCh < sistrip::FEDCH_PER_FED;
219  iCh++) {
220  if (connected_[iCh]){
221  fedErrors_.HasCabledChannels = true;
222  break;
223  }
224  }
225  return true;
226  }
227 
228 }
229 
230 bool FEDErrors::failUnpackerFEDCheck()
231 {
232  return failUnpackerFEDCheck_;
233 }
234 
235 
236 bool FEDErrors::fillFatalFEDErrors(const FEDRawData& aFedData,
237  const unsigned int aPrintDebug)
238 {
239 
240  std::auto_ptr<const sistrip::FEDBufferBase> bufferBase;
241  try {
242  bufferBase.reset(new sistrip::FEDBufferBase(aFedData.data(),aFedData.size()));
243  } catch (const cms::Exception& e) {
244  fedErrors_.InvalidBuffers = true;
245  failUnpackerFEDCheck_ = true;
246  //don't check anything else if the buffer is invalid
247  return false;
248  }
249 
250  //CRC checks
251  //if CRC fails then don't continue as if the buffer has been corrupted in DAQ then anything else could be invalid
252  if (!bufferBase->checkNoSlinkCRCError()) {
253  fedErrors_.BadFEDCRCs = true;
254  return false;
255  } else if (!bufferBase->checkCRC()) {
256  failUnpackerFEDCheck_ = true;
257  fedErrors_.BadDAQCRCs = true;
258  return false;
259  }
260  //next check that it is a SiStrip buffer
261  //if not then stop checks
262  if (!bufferBase->checkSourceIDs() || !bufferBase->checkNoUnexpectedSourceID()) {
263  fedErrors_.BadIDs = true;
264  return false;
265  }
266  //if so then do DAQ header/trailer checks
267  //if these fail then buffer may be incomplete and checking contents doesn't make sense
268  else if (!bufferBase->doDAQHeaderAndTrailerChecks()) {
269  failUnpackerFEDCheck_ = true;
270  fedErrors_.BadDAQPacket = true;
271  return false;
272  }
273 
274  //now do checks on header
275  //check that tracker special header is consistent
276  if ( !(bufferBase->checkBufferFormat() &&
277  bufferBase->checkHeaderType() &&
278  bufferBase->checkReadoutMode()) ) {
279  failUnpackerFEDCheck_ = true;
280  fedErrors_.InvalidBuffers = true;
281  //do not return false if debug printout of the buffer done below...
282  if (!printDebug() || aPrintDebug<3 ) return false;
283  }
284 
285  //FE unit overflows
286  if (!bufferBase->checkNoFEOverflows()) {
287  failUnpackerFEDCheck_ = true;
288  fedErrors_.FEsOverflow = true;
289  //do not return false if debug printout of the buffer done below...
290  if (!printDebug() || aPrintDebug<3 ) return false;
291  }
292 
293  return true;
294 
295 }
296 
297 bool FEDErrors::fillCorruptBuffer(const sistrip::FEDBuffer* aBuffer)
298 {
299  //corrupt buffer checks
300  if (!(aBuffer->checkChannelLengthsMatchBufferLength() &&
301  aBuffer->checkChannelPacketCodes() &&
302  aBuffer->checkFEUnitLengths())) {
303  fedErrors_.CorruptBuffer = true;
304 
305  return false;
306  }
307 
308  return true;
309 
310 }
311 
312 float FEDErrors::fillNonFatalFEDErrors(const sistrip::FEDBuffer* aBuffer,
313  const SiStripFedCabling* aCabling)
314 {
315  unsigned int lBadChans = 0;
316  unsigned int lTotChans = 0;
317  for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) {//loop on channels
318  bool lIsConnected = false;
319  if (aCabling) {
320  const FedChannelConnection & lConnection = aCabling->connection(fedID_,iCh);
321  lIsConnected = lConnection.isConnected();
322  }
323  else lIsConnected = connected_[iCh];
324 
325  if (!lIsConnected) continue;
326  lTotChans++;
327  if (!aBuffer->channelGood(iCh)) lBadChans++;
328  }
329 
330  return static_cast<float>(lBadChans*1.0/lTotChans);
331 }
332 
333 
334 bool FEDErrors::fillFEDErrors(const FEDRawData& aFedData,
335  bool & aFullDebug,
336  const unsigned int aPrintDebug,
337  unsigned int & aCounterMonitoring,
338  unsigned int & aCounterUnpacker,
339  const bool aDoMeds,
340  MonitorElement *aMedianHist0,
341  MonitorElement *aMedianHist1,
342  const bool aDoFEMaj,
343  std::vector<std::vector<std::pair<unsigned int,unsigned int> > > & aFeMajFrac
344  )
345 {
346  //try to construct the basic buffer object (do not check payload)
347  //if this fails then count it as an invalid buffer and stop checks since we can't understand things like buffer ordering
348 
349  if (!fillFatalFEDErrors(aFedData,aPrintDebug)) return false;
350 
351  //need to construct full object to go any further
352  std::auto_ptr<const sistrip::FEDBuffer> buffer;
353  buffer.reset(new sistrip::FEDBuffer(aFedData.data(),aFedData.size(),true));
354 
355  //fill remaining unpackerFEDcheck
356  if (!buffer->checkChannelLengths()) failUnpackerFEDCheck_= true;
357 
358  //payload checks, only if none of the above error occured
359  if (!this->anyFEDErrors()) {
360 
361  bool lCorruptCheck = fillCorruptBuffer(buffer.get());
362  if (aPrintDebug>1 && !lCorruptCheck) {
363  edm::LogWarning("SiStripMonitorHardware")
364  << "CorruptBuffer check failed for FED " << fedID_
365  << std::endl
366  << " -- buffer->checkChannelLengthsMatchBufferLength() = " << buffer->checkChannelLengthsMatchBufferLength()
367  << std::endl
368  << " -- buffer->checkChannelPacketCodes() = " << buffer->checkChannelPacketCodes()
369  << std::endl
370  << " -- buffer->checkFEUnitLengths() = " << buffer->checkFEUnitLengths()
371  << std::endl;
372  }
373 
374  //corruptBuffer concerns the payload: header info should still be reliable...
375  //so analyze FE and channels to fill histograms.
376 
377  //fe check...
378  fillFEErrors(buffer.get(),aDoFEMaj,aFeMajFrac);
379 
380  //channel checks
381  fillChannelErrors(buffer.get(),
382  aFullDebug,
383  aPrintDebug,
384  aCounterMonitoring,
385  aCounterUnpacker,
386  aDoMeds,
387  aMedianHist0,
388  aMedianHist1
389  );
390 
391  }
392 
393 
394  if (printDebug() && aPrintDebug>2) {
395  const sistrip::FEDBufferBase* debugBuffer = NULL;
396 
397  if (buffer.get()) debugBuffer = buffer.get();
398  //else if (bufferBase.get()) debugBuffer = bufferBase.get();
399  if (debugBuffer) {
400  std::vector<FEDErrors::APVLevelErrors> & lChVec = getAPVLevelErrors();
401  std::ostringstream debugStream;
402  if (lChVec.size()) {
403  std::sort(lChVec.begin(),lChVec.end());
404  debugStream << "[FEDErrors] Cabled channels which had errors: ";
405 
406  for (unsigned int iBadCh(0); iBadCh < lChVec.size(); iBadCh++) {
407  print(lChVec[iBadCh],debugStream);
408  }
409  debugStream << std::endl;
410  debugStream << "[FEDErrors] Active (have been locked in at least one event) cabled channels which had errors: ";
411  for (unsigned int iBadCh(0); iBadCh < lChVec.size(); iBadCh++) {
412  if ((lChVec[iBadCh]).IsActive) print(lChVec[iBadCh],debugStream);
413  }
414 
415  }
416  debugStream << (*debugBuffer) << std::endl;
417  debugBuffer->dump(debugStream);
418  debugStream << std::endl;
419  edm::LogInfo("SiStripMonitorHardware") << "[FEDErrors] Errors found in FED " << fedID_;
420  edm::LogVerbatim("SiStripMonitorHardware") << debugStream.str();
421  }
422  }
423 
424  return !(anyFEDErrors());
425 }
426 
427 bool FEDErrors::fillFEErrors(const sistrip::FEDBuffer* aBuffer,
428  const bool aDoFEMaj,
429  std::vector<std::vector<std::pair<unsigned int,unsigned int> > > & aFeMajFrac)
430 {
431  bool foundOverflow = false;
432  bool foundBadMajority = false;
433  bool foundMissing = false;
434  for (unsigned int iFE = 0; iFE < sistrip::FEUNITS_PER_FED; iFE++) {
435 
436  FEDErrors::FELevelErrors lFeErr;
437  lFeErr.FeID = iFE;
438  lFeErr.SubDetID = subDetId_[iFE];
439  lFeErr.Overflow = false;
440  lFeErr.Missing = false;
441  lFeErr.BadMajorityAddress = false;
442  lFeErr.TimeDifference = 0;
443  lFeErr.Apve = 0;
444  lFeErr.FeMaj = 0;
445  //check for cabled channels
446  bool hasCabledChannels = false;
447  for (unsigned int feUnitCh = 0; feUnitCh < sistrip::FEDCH_PER_FEUNIT; feUnitCh++) {
448  if (connected_[iFE*sistrip::FEDCH_PER_FEUNIT+feUnitCh]) {
449  hasCabledChannels = true;
450  break;
451  }
452  }
453 
454  if (!hasCabledChannels) continue;
455 
456  if (aBuffer->feOverflow(iFE)) {
457  lFeErr.Overflow = true;
458  foundOverflow = true;
459  addBadFE(lFeErr);
460  //if FE overflowed then address isn't valid
461  continue;
462  }
463  if (!aBuffer->feEnabled(iFE)) continue;
464 
465  //check for missing data
466  if (!aBuffer->fePresent(iFE)) {
467  //if (hasCabledChannels) {
468  lFeErr.Missing = true;
469  foundMissing = true;
470  addBadFE(lFeErr);
471  //}
472  continue;
473  }
474  //two independent checks for the majority address of a FE:
475  //first is done inside the FED,
476  //second is comparing explicitely the FE majAddress with the APVe address.
478  //want to do it only for this FE... do it directly with the time difference.
479  if (aBuffer->majorityAddressErrorForFEUnit(iFE)){
480  lFeErr.BadMajorityAddress = true;
481  foundBadMajority = true;
482  //no continue to fill the timeDifference.
483  }
484 
485  //need fullDebugHeader to fill histo with time difference between APVe and FEmajAddress
486  const sistrip::FEDFEHeader* header = aBuffer->feHeader();
487  const sistrip::FEDFullDebugHeader* debugHeader = dynamic_cast<const sistrip::FEDFullDebugHeader*>(header);
488  // if (debugHeader) {
489  // unsigned int apveTime = static_cast<unsigned int>(sistrip::FEDAddressConversion::timeLocation(aBuffer->apveAddress()));
490  // unsigned int feTime = static_cast<unsigned int>(sistrip::FEDAddressConversion::timeLocation(debugHeader->feUnitMajorityAddress(iFE)));
491  // if ((apveTime == 200 && aBuffer->apveAddress()) || feTime == 200) {
492  // std::cout << "FED " << fedID_ << ", iFE = " << iFE << std::endl
493  // << " -- aBuffer->apveAddress() = " << static_cast<unsigned int>(aBuffer->apveAddress())
494  // // << ", debugHeader = " << debugHeader
495  // // << ", header->feGood(iFE) = " << aBuffer->feGood(iFE)
496  // << ", debugHeader->feUnitMajorityAddress(iFE) " << static_cast<unsigned int>(debugHeader->feUnitMajorityAddress(iFE))
497  // << std::endl
498  // << " -- timeLoc(feUnitMajAddr) = "
499  // << static_cast<unsigned int>(sistrip::FEDAddressConversion::timeLocation(debugHeader->feUnitMajorityAddress(iFE)))
500  // << ", timeLoc(apveAddr) = "
501  // << static_cast<unsigned int>(sistrip::FEDAddressConversion::timeLocation(aBuffer->apveAddress()))
502  // // << ", aBuffer->checkFEUnitAPVAddresses() = "
503  // // << aBuffer->checkFEUnitAPVAddresses()
504  // << std::endl;
505  // std::cout << "My checks = "
506  // << ", feOverflows = " << lFeErr.Overflow << " " << foundOverflow
507  // << ", feMissing = " << lFeErr.Missing << " " << foundMissing
508  // << ", feBadMajAddr = " << lFeErr.BadMajorityAddress << " " << foundBadMajority
509  // << std::endl;
510 
511  // std::cout << "TimeDiff = " << feTime-apveTime << std::endl;
512 
513  // // std::cout << "aBuffer->checkFEUnitAPVAddresses() = " << aBuffer->checkFEUnitAPVAddresses() << std::endl;
514  // }
515  // }
516 
517  lFeErr.Apve = aBuffer->apveAddress();
518 
519  if (debugHeader){
520 
521  lFeErr.FeMaj = debugHeader->feUnitMajorityAddress(iFE);
522 
523  if (aDoFEMaj){
524  if (lFeErr.SubDetID == 2 || lFeErr.SubDetID == 3 || lFeErr.SubDetID == 4)
525  aFeMajFrac[0].push_back(std::pair<unsigned int, unsigned int>(fedID_,lFeErr.FeMaj));
526  else if (lFeErr.SubDetID == 5)
527  aFeMajFrac[1].push_back(std::pair<unsigned int, unsigned int>(fedID_,lFeErr.FeMaj));
528  else if (lFeErr.SubDetID == 0)
529  aFeMajFrac[2].push_back(std::pair<unsigned int, unsigned int>(fedID_,lFeErr.FeMaj));
530  else if (lFeErr.SubDetID == 1)
531  aFeMajFrac[3].push_back(std::pair<unsigned int, unsigned int>(fedID_,lFeErr.FeMaj));
532  }
533 
534 
535  if (aBuffer->apveAddress()){
536  lFeErr.TimeDifference = //0;
537  static_cast<unsigned int>(sistrip::FEDAddressConversion::timeLocation(debugHeader->feUnitMajorityAddress(iFE)))-static_cast<unsigned int>(sistrip::FEDAddressConversion::timeLocation(aBuffer->apveAddress()));
538  //aBuffer->apveAddress(), debugHeader->feUnitMajorityAddress(iFE)
539  //FEDAddressConversion::timeLocation(const uint8_t aPipelineAddress)
540  }
541  }
542 
543  if (foundBadMajority || lFeErr.TimeDifference != 0){
544  addBadFE(lFeErr);
545 
546 
547  // LogDebug("SiStripMonitorHardware") << " -- Problem found with FE maj address :" << std::endl
548 // << " --- FED = " << fedID_
549 // << ", iFE = " << iFE << std::endl
550 // << " --- aBuffer->apveAddress() = " << static_cast<unsigned int>(aBuffer->apveAddress())
551 // << std::endl
552 // << " --- debugHeader->feUnitMajorityAddress(iFE) " << static_cast<unsigned int>(debugHeader->feUnitMajorityAddress(iFE))<< std::endl
553 // << " --- timeLoc(feUnitMajAddr) = "
554 // << static_cast<unsigned int>(sistrip::FEDAddressConversion::timeLocation(debugHeader->feUnitMajorityAddress(iFE)))<< std::endl
555 // << " --- timeLoc(apveAddr) = "
556 // << static_cast<unsigned int>(sistrip::FEDAddressConversion::timeLocation(aBuffer->apveAddress())) << std::endl
557 // << " --- aBuffer->checkFEUnitAPVAddresses() = "
558 // << aBuffer->checkFEUnitAPVAddresses()
559 // << std::endl;
560 
561 
562  }
563 
564  }
565 
566  return !(foundOverflow || foundMissing || foundBadMajority);
567 }
568 
569 bool FEDErrors::fillChannelErrors(const sistrip::FEDBuffer* aBuffer,
570  bool & aFullDebug,
571  const unsigned int aPrintDebug,
572  unsigned int & aCounterMonitoring,
573  unsigned int & aCounterUnpacker,
574  const bool aDoMeds,
575  MonitorElement *aMedianHist0,
576  MonitorElement *aMedianHist1
577  )
578 {
579  bool foundError = false;
580 
581  const sistrip::FEDFEHeader* header = aBuffer->feHeader();
582  const sistrip::FEDFullDebugHeader* debugHeader = dynamic_cast<const sistrip::FEDFullDebugHeader*>(header);
583 
584  aFullDebug = debugHeader;
585 
586  bool lMedValid = aBuffer->readoutMode() == sistrip::READOUT_MODE_ZERO_SUPPRESSED;
587 
588  //this method is not called if there was anyFEDerrors(),
589  //so only corruptBuffer+FE check are useful.
590  bool lPassedMonitoringFEDcheck = !fedErrors_.CorruptBuffer;
591 
592  for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) {//loop on channels
593 
594  bool lFailUnpackerChannelCheck = (!aBuffer->channelGood(iCh) && connected_[iCh]) || failUnpackerFEDCheck_;
595  bool lFailMonitoringChannelCheck = !lPassedMonitoringFEDcheck && connected_[iCh];
596 
597 
598  FEDErrors::ChannelLevelErrors lChErr;
599  lChErr.ChannelID = iCh;
600  lChErr.Connected = connected_[iCh];
601  lChErr.IsActive = false;
602  lChErr.Unlocked = false;
603  lChErr.OutOfSync = false;
604 
605  if (!connected_[iCh]) {
606  //to fill histo with unconnected channels
607  addBadChannel(lChErr);
608  foundError = true;
609  }
610  else {//if channel connected
611  if (!aBuffer->feGood(static_cast<unsigned int>(iCh/sistrip::FEDCH_PER_FEUNIT))) {
612  lFailMonitoringChannelCheck = true;
613  foundError = true;
614  }
615  else {//if FE good
616 
617  bool apvBad[2] = {false,false};
619  //CHANNEL_STATUS_NO_PROBLEMS
620  //CHANNEL_STATUS_LOCKED
621  //CHANNEL_STATUS_IN_SYNC
622  //CHANNEL_STATUS_APV1_ADDRESS_GOOD
623  //CHANNEL_STATUS_APV1_NO_ERROR_BIT
624  //CHANNEL_STATUS_APV0_ADDRESS_GOOD
625  //CHANNEL_STATUS_APV0_NO_ERROR_BIT
626 
627  if (debugHeader) {
628  lStatus = debugHeader->getChannelStatus(iCh);
629  apvBad[0] =
630  !(lStatus & sistrip::CHANNEL_STATUS_LOCKED) ||
631  !(lStatus & sistrip::CHANNEL_STATUS_IN_SYNC) ||
634  apvBad[1] =
635  !(lStatus & sistrip::CHANNEL_STATUS_LOCKED) ||
636  !(lStatus & sistrip::CHANNEL_STATUS_IN_SYNC) ||
639  //if (!debugHeader->unlocked(iCh)) {
640  if (lStatus & sistrip::CHANNEL_STATUS_LOCKED) {
641  lChErr.IsActive = true;
642  if (lStatus == sistrip::CHANNEL_STATUS_NO_PROBLEMS) continue;
643  //if (debugHeader->outOfSyncFromBit(iCh)) {
644  if (!(lStatus & sistrip::CHANNEL_STATUS_IN_SYNC)) {
645  lChErr.OutOfSync = true;
646  }
647  }
648  else {
649  lChErr.Unlocked = true;
650  }
651  } else {
652  //if (header->checkChannelStatusBits(iCh)) activeChannel = true;
653  apvBad[0] = !header->checkStatusBits(iCh,0);
654  apvBad[1] = !header->checkStatusBits(iCh,1);
655  if (!apvBad[0] && !apvBad[1]) {
656  lChErr.IsActive = true;
657  continue;
658  }
659  }
660 
661  if (lChErr.Unlocked || lChErr.OutOfSync) addBadChannel(lChErr);
662 
663  //std::ostringstream lMode;
664  //lMode << aBuffer->readoutMode();
665 
666  bool lFirst = true;
667 
668  for (unsigned int iAPV = 0; iAPV < 2; iAPV++) {//loop on APVs
669 
670  FEDErrors::APVLevelErrors lAPVErr;
671  lAPVErr.APVID = 2*iCh+iAPV;
672  lAPVErr.ChannelID = iCh;
673  lAPVErr.Connected = connected_[iCh];
674  lAPVErr.IsActive = lChErr.IsActive;
675  lAPVErr.APVStatusBit = false;
676  lAPVErr.APVError = false;
677  lAPVErr.APVAddressError = false;
678 
679  //if (!header->checkStatusBits(iCh,iAPV)){
680  if (apvBad[iAPV]) {
681  lFailMonitoringChannelCheck = true;
682  lAPVErr.APVStatusBit = true;
683  foundError = true;
684  }
685 
686  if (debugHeader && !lChErr.Unlocked && !lChErr.OutOfSync) {
687  //if (debugHeader->apvErrorFromBit(iCh,iAPV)) {
688  if ( (iAPV==0 && !(lStatus & sistrip::CHANNEL_STATUS_APV0_NO_ERROR_BIT)) ||
689  (iAPV==1 && !(lStatus & sistrip::CHANNEL_STATUS_APV1_NO_ERROR_BIT))) {
690  lAPVErr.APVError = true;
691  }
692  //if (debugHeader->apvAddressErrorFromBit(iCh,iAPV)) {
693  if ((iAPV==0 && !(lStatus & sistrip::CHANNEL_STATUS_APV0_ADDRESS_GOOD)) ||
694  (iAPV==1 && !(lStatus & sistrip::CHANNEL_STATUS_APV1_ADDRESS_GOOD))) {
695  lAPVErr.APVAddressError = true;
696  }
697  }
698 
699  if ( lAPVErr.APVStatusBit ||
700  lAPVErr.APVError ||
701  lAPVErr.APVAddressError
702  ) addBadAPV(lAPVErr, lFirst);
703  }//loop on APVs
704 
705  }//if FE good
706  }//if connected
707 
708 
709  if (lFailUnpackerChannelCheck != lFailMonitoringChannelCheck && connected_[iCh]){
710  if (aPrintDebug>1) {
711  std::ostringstream debugStream;
712  debugStream << "[FEDErrors] ------ WARNING: FED " << fedID_ << ", channel " << iCh
713  << ", isConnected = " << connected_[iCh] << std::endl
714  << "[FEDErrors] --------- Monitoring Channel check " ;
715  if (lFailMonitoringChannelCheck) debugStream << "failed." << std::endl;
716  else debugStream << "passed." << std::endl ;
717  debugStream << "[FEDErrors] --------- Unpacker Channel check " ;
718  if (lFailUnpackerChannelCheck) debugStream << "failed." << std::endl;
719  else debugStream << "passed." << std::endl;
720  debugStream << "[FEDErrors] --------- fegood = "
721  << aBuffer->feGood(static_cast<unsigned int>(iCh/sistrip::FEDCH_PER_FEUNIT))
722  << std::endl
723  << "[FEDErrors] --------- unpacker FED check = " << failUnpackerFEDCheck_ << std::endl;
724  edm::LogError("SiStripMonitorHardware") << debugStream.str();
725  }
726 
727  if (lFailMonitoringChannelCheck) aCounterMonitoring++;
728  if (lFailUnpackerChannelCheck) aCounterUnpacker++;
729  }
730 
731  if (lMedValid && !foundError && lPassedMonitoringFEDcheck && aDoMeds) {
732  //get CM values
733  const sistrip::FEDChannel & lChannel = aBuffer->channel(iCh);
734 
735  HistogramBase::fillHistogram(aMedianHist0,
736  lChannel.cmMedian(0));
737  HistogramBase::fillHistogram(aMedianHist1,
738  lChannel.cmMedian(1));
739 
740  }
741 
742  }//loop on channels
743 
744  return !foundError;
745 }
746 
747 void FEDErrors::fillBadChannelList(const bool doTkHistoMap,
748  TkHistoMap *aTkMapPointer,
749  MonitorElement *aFedIdVsApvId,
750  unsigned int & aNBadChannels,
751  unsigned int & aNBadActiveChannels)
752 {
753 
754  uint32_t lPrevId = 0;
755  uint16_t nBad = 0;
756  uint16_t lPrevTot = 0;
757  bool hasBeenProcessed = false;
758  bool lFailFED = failMonitoringFEDCheck();
759 
760  for (unsigned int iCh = 0;
761  iCh < sistrip::FEDCH_PER_FED;
762  iCh++) {//loop on channels
763 
764  if (!connected_[iCh]) continue;
765  if (!detid_[iCh] || detid_[iCh] == sistrip::invalid32_) continue;
766 
767  if (lPrevId==0) {
768  lPrevId = detid_[iCh];
769  lPrevTot = nChInModule_[iCh];
770  }
771 
772  unsigned int feNumber = static_cast<unsigned int>(iCh/sistrip::FEDCH_PER_FEUNIT);
773 
774  bool isBadFE = false;
775  bool isMissingFE = false;
776  //feErrors vector of FE 0 - 7, each FE has channels 0 -11, 12 .. - ,... - 96
777  for (unsigned int badfe(0); badfe<feErrors_.size(); badfe++) {
778  if ((feErrors_[badfe]).FeID == feNumber) {
779  isBadFE = true;
780  if ((feErrors_[badfe]).Missing) isMissingFE = true;
781  break;
782  }
783  }
784 
785  bool isBadChan = false;
786  bool isActiveChan = false;
787  //FED errors, apv
788  //for (unsigned int badCh(0); badCh<chErrors_.size(); badCh++) {
789  //if (chErrors_[badCh].first == iCh) {
790  //if (chErrors_[badCh].second) isActiveChan = true;
791  //isBadChan = true;
792  //break;
793  //}
794  //}
795 
796  //apvErrors_
797  bool isBadApv1 = false;
798  bool isBadApv2 = false;
799  for (unsigned int badApv(0); badApv<apvErrors_.size(); badApv++) {
800  if ((apvErrors_[badApv]).ChannelID == iCh) {
801  isBadChan = true;
802  if (apvErrors_[badApv].IsActive) isActiveChan = true;
803  }
804  if (apvErrors_[badApv].APVID == 2 * iCh ) isBadApv1 = true;
805  if (apvErrors_[badApv].APVID == 2 * iCh + 1 )
806  {
807  isBadApv2 = true;
808  break;
809  }
810  }
811 
812 
813  if (detid_[iCh] == lPrevId){
814  if (hasBeenProcessed) hasBeenProcessed = false;
815  }
816  //fill vector for previous detid
817  if (detid_[iCh] != lPrevId){
818  processDet(lPrevId,
819  lPrevTot,
820  doTkHistoMap,
821  nBad,
822  aTkMapPointer
823  );
824  lPrevId = detid_[iCh];
825  lPrevTot = nChInModule_[iCh];
826  hasBeenProcessed = true;
827  }
828 
829  bool lHasErr = lFailFED || isBadFE || isBadChan;
830  incrementLumiErrors(lHasErr,subDetId_[feNumber]);
831 
832  if ( lHasErr ) {
833  nBad++;
834  aNBadChannels++;
835  //define as active channel if channel locked AND not from an unlocked FE.
836  if ((isBadChan && isActiveChan) || lFailFED || (isBadFE && !isMissingFE)) aNBadActiveChannels++;
837  if ( isBadApv1 || lFailFED || isBadFE ) HistogramBase::fillHistogram ( aFedIdVsApvId , 2 * iCh , fedID_ ) ;
838  if ( isBadApv2 || lFailFED || isBadFE ) HistogramBase::fillHistogram ( aFedIdVsApvId , 2 * iCh + 1 , fedID_ ) ;
839  }
840 
841 
842 
843  }//loop on channels
844 
845  if (!hasBeenProcessed){
846  processDet(lPrevId,
847  lPrevTot,
848  doTkHistoMap,
849  nBad,
850  aTkMapPointer
851  );
852  }
853 
854 
855 }
856 
857 void FEDErrors::fillEventProperties(long long dbx) {
858  eventProp_.deltaBX = dbx;
859 }
860 
861 void FEDErrors::incrementLumiErrors(const bool hasError,
862  const unsigned int aSubDet){
863  if (!lumiErr_.nTotal.size()) return;
864  if (aSubDet >= lumiErr_.nTotal.size()) {
865  edm::LogError("SiStripMonitorHardware") << " -- FED " << fedID_
866  << ", invalid subdetid : " << aSubDet
867  << ", size of lumiErr : "
868  << lumiErr_.nTotal.size()
869  << std::endl;
870  }
871  else {
872  if (hasError) lumiErr_.nErrors[aSubDet]++;
873  lumiErr_.nTotal[aSubDet]++;
874  }
875 }
876 
877 void FEDErrors::processDet(const uint32_t aPrevId,
878  const uint16_t aPrevTot,
879  const bool doTkHistoMap,
880  uint16_t & nBad,
881  TkHistoMap *aTkMapPointer
882  )
883 {
884  if (aPrevTot < nBad){
885  edm::LogError("SiStripMonitorHardware") << " -- Number of bad channels in det " << aPrevId
886  << " = " << nBad
887  << ", total number of pairs for this det = " << aPrevTot
888  << std::endl;
889  }
890 
891  //tkHistoMap takes a uint & as argument
892  uint32_t lDetid = aPrevId;
893  if (aPrevTot != 0 && doTkHistoMap && aTkMapPointer)
894  HistogramBase::fillTkHistoMap(aTkMapPointer,lDetid,static_cast<float>(nBad)/aPrevTot);
895 
896  nBad=0;
897 }
898 
899 
900 const bool FEDErrors::failMonitoringFEDCheck()
901 {
902  return ( anyFEDErrors() ||
903  fedErrors_.CorruptBuffer
904  );
905 }
906 
907 const bool FEDErrors::anyDAQProblems()
908 {
909  return ( fedErrors_.DataMissing ||
910  fedErrors_.InvalidBuffers ||
911  fedErrors_.BadFEDCRCs ||
912  fedErrors_.BadDAQCRCs ||
913  fedErrors_.BadIDs ||
914  fedErrors_.BadDAQPacket
915  );
916 }
917 
918 const bool FEDErrors::anyFEDErrors()
919 {
920  return ( fedErrors_.InvalidBuffers ||
921  fedErrors_.BadFEDCRCs ||
922  fedErrors_.BadDAQCRCs ||
923  fedErrors_.BadIDs ||
924  fedErrors_.BadDAQPacket ||
925  fedErrors_.FEsOverflow
926  );
927 }
928 
929 const bool FEDErrors::anyFEProblems()
930 {
931  return ( fedErrors_.FEsOverflow ||
932  fedErrors_.FEsMissing ||
933  fedErrors_.FEsBadMajorityAddress
934  );
935 }
936 
937 const bool FEDErrors::printDebug()
938 {
939  return ( anyFEDErrors() ||
940  anyFEProblems() ||
941  fedErrors_.CorruptBuffer ||
942  fedErrors_.BadChannelStatusBit
943  );
944 
945 }
946 
947 const unsigned int FEDErrors::fedID(){
948  return fedID_;
949 }
950 
951 
952 FEDErrors::FEDCounters & FEDErrors::getFEDErrorsCounters()
953 {
954  static FEDCounters lFedCounter;
955  return lFedCounter;
956 }
957 
958 FEDErrors::ChannelCounters & FEDErrors::getChannelErrorsCounters()
959 {
960  static ChannelCounters lChCounter;
961  return lChCounter;
962 }
963 
964 FEDErrors::FECounters & FEDErrors::getFEErrorsCounters()
965 {
966  return feCounter_;
967 }
968 
969 FEDErrors::FEDLevelErrors & FEDErrors::getFEDLevelErrors()
970 {
971  return fedErrors_;
972 }
973 
974 FEDErrors::EventProperties & FEDErrors::getEventProperties()
975 {
976  return eventProp_;
977 }
978 
979 std::vector<FEDErrors::FELevelErrors> & FEDErrors::getFELevelErrors()
980 {
981  return feErrors_;
982 }
983 
984 std::vector<FEDErrors::ChannelLevelErrors> & FEDErrors::getChannelLevelErrors()
985 {
986  return chErrorsDetailed_;
987 }
988 
989 std::vector<FEDErrors::APVLevelErrors> & FEDErrors::getAPVLevelErrors()
990 {
991  return apvErrors_;
992 }
993 
994 std::vector<std::pair<unsigned int,bool> > & FEDErrors::getBadChannels()
995 {
996  return chErrors_;
997 }
998 
999 const FEDErrors::LumiErrors & FEDErrors::getLumiErrors(){
1000  return lumiErr_;
1001 }
1002 
1003 void FEDErrors::addBadFE(const FEDErrors::FELevelErrors & aFE)
1004 {
1005  if (aFE.Overflow) {
1006  fedErrors_.FEsOverflow = true;
1007  (feCounter_.nFEOverflows)++;
1008  }
1009  else if (aFE.Missing) {
1010  fedErrors_.FEsMissing = true;
1011  (feCounter_.nFEMissing)++;
1012  feErrors_.push_back(aFE);
1013  }
1014  else if (aFE.BadMajorityAddress) {
1015  fedErrors_.FEsBadMajorityAddress = true;
1016  (feCounter_.nFEBadMajorityAddresses)++;
1017  feErrors_.push_back(aFE);
1018  }
1019  else if (aFE.TimeDifference != 0) {
1020  feErrors_.push_back(aFE);
1021  }
1022 }
1023 
1024 void FEDErrors::addBadChannel(const FEDErrors::ChannelLevelErrors & aChannel)
1025 {
1026  if (aChannel.Connected) chErrorsDetailed_.push_back(aChannel);
1027  incrementChannelCounters(aChannel);
1028 }
1029 
1030 void FEDErrors::addBadAPV(const FEDErrors::APVLevelErrors & aAPV, bool & aFirst)
1031 {
1032  apvErrors_.push_back(aAPV);
1033  incrementAPVCounters(aAPV);
1034  if (aAPV.APVStatusBit && aFirst) {
1035  fedErrors_.BadChannelStatusBit = true;
1036  (FEDErrors::getFEDErrorsCounters().nBadChannels)++;
1037  chErrors_.push_back(std::pair<unsigned int, bool>(aAPV.ChannelID,aAPV.IsActive));
1038  if (aAPV.IsActive) {
1039  //print(aAPV);
1040  fedErrors_.BadActiveChannelStatusBit = true;
1041  (FEDErrors::getFEDErrorsCounters().nBadActiveChannels)++;
1042  //std::cout << "------ nBadActiveChannels = " << FEDErrors::getFEDErrorsCounters().nBadActiveChannels << std::endl;
1043  }
1044  aFirst = false;
1045  }
1046 }
1047 
1048 
1049 void FEDErrors::incrementFEDCounters()
1050 {
1051  if (fedErrors_.InvalidBuffers ||
1052  fedErrors_.BadFEDCRCs ||
1053  fedErrors_.BadDAQCRCs ||
1054  fedErrors_.BadIDs ||
1055  fedErrors_.BadDAQPacket
1056  ) {
1057  (FEDErrors::getFEDErrorsCounters().nDAQProblems)++;
1058  (FEDErrors::getFEDErrorsCounters().nFEDErrors)++;
1059  }
1060 
1061  //FElevel errors
1062  if (fedErrors_.FEsOverflow){
1063  (FEDErrors::getFEDErrorsCounters().nFEDsWithFEOverflows)++;
1064  }
1065  else if (fedErrors_.FEsMissing){
1066  (FEDErrors::getFEDErrorsCounters().nFEDsWithMissingFEs)++;
1067  }
1068  else if (fedErrors_.FEsBadMajorityAddress){
1069  (FEDErrors::getFEDErrorsCounters().nFEDsWithFEBadMajorityAddresses)++;
1070  }
1071 
1072  if (fedErrors_.FEsOverflow ||
1073  fedErrors_.FEsBadMajorityAddress ||
1074  fedErrors_.FEsMissing
1075  ){
1076  (FEDErrors::getFEDErrorsCounters().nFEDsWithFEProblems)++;
1077  (FEDErrors::getFEDErrorsCounters().nFEDErrors)++;
1078  }
1079  else if (fedErrors_.CorruptBuffer) {
1080  (FEDErrors::getFEDErrorsCounters().nCorruptBuffers)++;
1081  (FEDErrors::getFEDErrorsCounters().nFEDErrors)++;
1082  }
1083 
1084 
1085 }
1086 
1087 
1088 void FEDErrors::incrementChannelCounters(const FEDErrors::ChannelLevelErrors & aChannel)
1089 {
1090  if (aChannel.Unlocked && aChannel.Connected) (FEDErrors::getChannelErrorsCounters().nUnlocked)++;
1091  if (aChannel.OutOfSync && aChannel.Connected) (FEDErrors::getChannelErrorsCounters().nOutOfSync)++;
1092  if (!aChannel.Connected) (FEDErrors::getChannelErrorsCounters().nNotConnected)++;
1093 }
1094 
1095 void FEDErrors::incrementAPVCounters(const FEDErrors::APVLevelErrors & aAPV)
1096 {
1097  if (aAPV.Connected && aAPV.IsActive){
1098  if (aAPV.APVStatusBit) (FEDErrors::getChannelErrorsCounters().nAPVStatusBit)++;
1099  if (aAPV.APVAddressError) (FEDErrors::getChannelErrorsCounters().nAPVAddressError)++;
1100  if (aAPV.APVError) (FEDErrors::getChannelErrorsCounters().nAPVError)++;
1101  }
1102 }
1103 
1104 
1105 bool FEDErrors::ChannelLevelErrors::operator <(const FEDErrors::ChannelLevelErrors & aErr) const{
1106  if (this->ChannelID < aErr.ChannelID) return true;
1107  return false;
1108 }
1109 
1110 
1111 
1112 bool FEDErrors::APVLevelErrors::operator <(const FEDErrors::APVLevelErrors & aErr) const{
1113  if (this->ChannelID < aErr.ChannelID) return true;
1114  return false;
1115 }
1116 
1117 
1118 void FEDErrors::print(const FEDErrors::FEDCounters & aFEDCounter, std::ostream & aOs)
1119 {
1120 
1121  aOs << std::endl;
1122  aOs << "[FEDErrors]============================================" << std::endl
1123  << "[FEDErrors]==== Printing FEDCounters information : ====" << std::endl
1124  << "[FEDErrors]============================================" << std::endl
1125  << "[FEDErrors]======== nFEDErrors = " << aFEDCounter.nFEDErrors << std::endl
1126  << "[FEDErrors]======== nDAQProblems = " << aFEDCounter.nDAQProblems << std::endl
1127  << "[FEDErrors]======== nFEDsWithFEProblems = " << aFEDCounter.nFEDsWithFEProblems << std::endl
1128  << "[FEDErrors]======== nCorruptBuffers = " << aFEDCounter.nCorruptBuffers << std::endl
1129  << "[FEDErrors]======== nBadChannels = " << aFEDCounter.nBadChannels << std::endl
1130  << "[FEDErrors]======== nBadActiveChannels = " << aFEDCounter.nBadActiveChannels << std::endl
1131  << "[FEDErrors]======== nFEDsWithFEOverflows = " << aFEDCounter.nFEDsWithFEOverflows << std::endl
1132  << "[FEDErrors]======== nFEDsWithFEBadMajorityAddresses = " << aFEDCounter.nFEDsWithFEBadMajorityAddresses << std::endl
1133  << "[FEDErrors]======== nFEDsWithMissingFEs = " << aFEDCounter.nFEDsWithMissingFEs << std::endl
1134  << "[FEDErrors]======== nTotalBadChannels = " << aFEDCounter.nTotalBadChannels << std::endl
1135  << "[FEDErrors]======== nTotalBadActiveChannels = " << aFEDCounter.nTotalBadActiveChannels << std::endl
1136  << "[FEDErrors]============================================" << std::endl;
1137 
1138 
1139 }
1140 
1141 void FEDErrors::print(const FEDErrors::FECounters & aFECounter, std::ostream & aOs)
1142 {
1143 
1144  aOs << std::endl;
1145  aOs << "[FEDErrors]============================================" << std::endl
1146  << "[FEDErrors]==== Printing FECounters information : ====" << std::endl
1147  << "[FEDErrors]============================================" << std::endl
1148  << "[FEDErrors]======== nFEOverflows = " << aFECounter.nFEOverflows << std::endl
1149  << "[FEDErrors]======== nFEBadMajorityAddresses = " << aFECounter.nFEBadMajorityAddresses << std::endl
1150  << "[FEDErrors]======== nFEMissing = " << aFECounter.nFEMissing << std::endl
1151  << "[FEDErrors]============================================" << std::endl;
1152 
1153 
1154 }
1155 
1156 void FEDErrors::print(const FEDErrors::FEDLevelErrors & aFEDErr, std::ostream & aOs)
1157 {
1158 
1159  aOs << std::endl;
1160  aOs << "[FEDErrors]============================================" << std::endl
1161  << "[FEDErrors]==== Printing FED errors information : ====" << std::endl
1162  << "[FEDErrors]============================================" << std::endl
1163  << "[FEDErrors]======== HasCabledChannels = " << aFEDErr.HasCabledChannels << std::endl
1164  << "[FEDErrors]======== DataPresent = " << aFEDErr.DataPresent << std::endl
1165  << "[FEDErrors]======== DataMissing = " << aFEDErr.DataMissing << std::endl
1166  << "[FEDErrors]======== InvalidBuffers = " << aFEDErr.InvalidBuffers << std::endl
1167  << "[FEDErrors]======== BadFEDCRCs = " << aFEDErr.BadFEDCRCs << std::endl
1168  << "[FEDErrors]======== BadDAQCRCs = " << aFEDErr.BadDAQCRCs << std::endl
1169  << "[FEDErrors]======== BadIDs = " << aFEDErr.BadIDs << std::endl
1170  << "[FEDErrors]======== BadDAQPacket = " << aFEDErr.BadDAQPacket << std::endl
1171  << "[FEDErrors]======== CorruptBuffer = " << aFEDErr.CorruptBuffer << std::endl
1172  << "[FEDErrors]======== FEOverflows = " << aFEDErr.FEsOverflow << std::endl
1173  << "[FEDErrors]======== FEMissing = " << aFEDErr.FEsMissing << std::endl
1174  << "[FEDErrors]======== BadMajorityAddresses = " << aFEDErr.FEsBadMajorityAddress << std::endl
1175  << "[FEDErrors]============================================" << std::endl;
1176 
1177 }
1178 
1179 void FEDErrors::print(const FEDErrors::FELevelErrors & aErr, std::ostream & aOs)
1180 {
1181 
1182  aOs << std::endl;
1183  aOs << "[FEDErrors]============================================" << std::endl
1184  << "[FEDErrors]==== Printing FE errors information : ====" << std::endl
1185  << "[FEDErrors]============================================" << std::endl
1186  << "[FEDErrors]======== FE #" << aErr.FeID << std::endl
1187  << "[FEDErrors]======== subdet " << aErr.SubDetID << std::endl
1188  << "[FEDErrors]======== FEOverflow = " << aErr.Overflow << std::endl
1189  << "[FEDErrors]======== FEMissing = " << aErr.Missing << std::endl
1190  << "[FEDErrors]======== BadMajorityAddresses = " << aErr.BadMajorityAddress << std::endl
1191  << "[FEDErrors]======== TimeDifference = " << aErr.TimeDifference << std::endl
1192  << "[FEDErrors]============================================" << std::endl;
1193 
1194 }
1195 
1196 void FEDErrors::print(const FEDErrors::ChannelLevelErrors & aErr, std::ostream & aOs)
1197 {
1198  aOs << std::endl;
1199  aOs << "[FEDErrors]=================================================" << std::endl
1200  << "[FEDErrors]==== Printing channel errors information : ====" << std::endl
1201  << "[FEDErrors]=================================================" << std::endl
1202  << "[FEDErrors]============ Channel #" << aErr.ChannelID << std::endl
1203  << "[FEDErrors]============ connected = " << aErr.Connected << std::endl
1204  << "[FEDErrors]============ isActive = " << aErr.IsActive << std::endl
1205  << "[FEDErrors]============ Unlocked = " << aErr.Unlocked << std::endl
1206  << "[FEDErrors]============ OutOfSync = " << aErr.OutOfSync << std::endl
1207  << "[FEDErrors]=================================================" << std::endl;
1208 }
1209 
1210 
1211 void FEDErrors::print(const FEDErrors::APVLevelErrors & aErr, std::ostream & aOs)
1212 {
1213  aOs << std::endl;
1214  aOs << "[FEDErrors]=================================================" << std::endl
1215  << "[FEDErrors]==== Printing APV errors information : ====" << std::endl
1216  << "[FEDErrors]=================================================" << std::endl
1217  << "[FEDErrors]============ APV #" << aErr.APVID << std::endl
1218  << "[FEDErrors]============ Channel #" << aErr.ChannelID << std::endl
1219  << "[FEDErrors]============ connected = " << aErr.Connected << std::endl
1220  << "[FEDErrors]============ isActive = " << aErr.IsActive << std::endl
1221  << "[FEDErrors]============ APVStatusBit = " << aErr.APVStatusBit << std::endl
1222  << "[FEDErrors]============ APVError = " << aErr.APVError << std::endl
1223  << "[FEDErrors]============ APVAddressError = " << aErr.APVAddressError << std::endl
1224  << "[FEDErrors]=================================================" << std::endl;
1225 }
1226 
1227 
bool checkFEUnitLengths() const
static const uint32_t invalid32_
Definition: Constants.h:16
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition: print.cc:8
FEDReadoutMode readoutMode() const
#define NULL
Definition: scimark2.h:8
const FedChannelConnection & connection(uint16_t fed_id, uint16_t fed_ch) const
const FEDFEHeader * feHeader() const
virtual bool channelGood(const uint8_t internalFEDannelNum, const bool doAPVeCheck=true) const
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
uint16_t cmMedian(const uint8_t apvIndex) const
bool checkStatusBits(const uint8_t internalFEUnitNum, const uint8_t internalFEUnitChannelNum, const uint8_t apvNum) const
bool operator<(const FedChannelConnection &, const FedChannelConnection &)
bool fePresent(uint8_t internalFEUnitNum) const
bool majorityAddressErrorForFEUnit(const uint8_t internalFEUnitNum) const
const uint32_t & detId() const
Class containning control, module, detector and connection information, at the level of a FED channel...
static const uint16_t FEUNITS_PER_FED
bool feEnabled(const uint8_t internalFEUnitNum) const
void dump(std::ostream &os) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
const FEDChannel & channel(const uint8_t internalFEDChannelNum) const
bool checkChannelPacketCodes() const
static const uint8_t timeLocation(const uint8_t aPipelineAddress)
Definition: DetId.h:20
static const uint16_t FEDCH_PER_FEUNIT
const uint16_t & nApvPairs() const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
bool checkChannelLengthsMatchBufferLength() const
uint8_t feUnitMajorityAddress(const uint8_t internalFEUnitNum) const
FEDChannelStatus getChannelStatus(const uint8_t internalFEDChannelNum) const
static const uint16_t FEDCH_PER_FED
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
bool feGood(const uint8_t internalFEUnitNum) const
bool feOverflow(const uint8_t internalFEUnitNum) const