CMS 3D CMS Logo

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