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