test
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 
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;
117  iCh < sistrip::FEDCH_PER_FED;
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;
202  iCh < sistrip::FEDCH_PER_FED;
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;
216  iCh < sistrip::FEDCH_PER_FED;
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)) 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 = NULL;
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.size()) {
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) && 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 {
751 
752  uint32_t lPrevId = 0;
753  uint16_t nBad = 0;
754  uint16_t lPrevTot = 0;
755  bool hasBeenProcessed = false;
756  bool lFailFED = failMonitoringFEDCheck();
757 
758  for (unsigned int iCh = 0;
759  iCh < sistrip::FEDCH_PER_FED;
760  iCh++) {//loop on channels
761 
762  if (!connected_[iCh]) continue;
763  if (!detid_[iCh] || detid_[iCh] == sistrip::invalid32_) continue;
764 
765  if (lPrevId==0) {
766  lPrevId = detid_[iCh];
767  lPrevTot = nChInModule_[iCh];
768  }
769 
770  unsigned int feNumber = static_cast<unsigned int>(iCh/sistrip::FEDCH_PER_FEUNIT);
771 
772  bool isBadFE = false;
773  bool isMissingFE = false;
774  //feErrors vector of FE 0 - 7, each FE has channels 0 -11, 12 .. - ,... - 96
775  for (unsigned int badfe(0); badfe<feErrors_.size(); badfe++) {
776  if ((feErrors_[badfe]).FeID == feNumber) {
777  isBadFE = true;
778  if ((feErrors_[badfe]).Missing) isMissingFE = true;
779  break;
780  }
781  }
782 
783  bool isBadChan = false;
784  bool isActiveChan = false;
785  //FED errors, apv
786  //for (unsigned int badCh(0); badCh<chErrors_.size(); badCh++) {
787  //if (chErrors_[badCh].first == iCh) {
788  //if (chErrors_[badCh].second) isActiveChan = true;
789  //isBadChan = true;
790  //break;
791  //}
792  //}
793 
794  //apvErrors_
795  bool isBadApv1 = false;
796  bool isBadApv2 = false;
797  for (unsigned int badApv(0); badApv<apvErrors_.size(); badApv++) {
798  if ((apvErrors_[badApv]).ChannelID == iCh) {
799  isBadChan = true;
800  if (apvErrors_[badApv].IsActive) isActiveChan = true;
801  }
802  if (apvErrors_[badApv].APVID == 2 * iCh ) isBadApv1 = true;
803  if (apvErrors_[badApv].APVID == 2 * iCh + 1 )
804  {
805  isBadApv2 = true;
806  break;
807  }
808  }
809 
810 
811  if (detid_[iCh] == lPrevId){
812  if (hasBeenProcessed) hasBeenProcessed = false;
813  }
814  //fill vector for previous detid
815  if (detid_[iCh] != lPrevId){
816  processDet(lPrevId,
817  lPrevTot,
818  doTkHistoMap,
819  nBad,
820  aTkMapPointer
821  );
822  lPrevId = detid_[iCh];
823  lPrevTot = nChInModule_[iCh];
824  hasBeenProcessed = true;
825  }
826 
827  bool lHasErr = lFailFED || isBadFE || isBadChan;
828  incrementLumiErrors(lHasErr,subDetId_[feNumber]);
829 
830  if ( lHasErr ) {
831  nBad++;
832  aNBadChannels++;
833  //define as active channel if channel locked AND not from an unlocked FE.
834  if ((isBadChan && isActiveChan) || lFailFED || (isBadFE && !isMissingFE)) aNBadActiveChannels++;
835  if ( isBadApv1 || lFailFED || isBadFE ) HistogramBase::fillHistogram ( aFedIdVsApvId , 2 * iCh , fedID_ ) ;
836  if ( isBadApv2 || lFailFED || isBadFE ) HistogramBase::fillHistogram ( aFedIdVsApvId , 2 * iCh + 1 , fedID_ ) ;
837  }
838 
839 
840 
841  }//loop on channels
842 
843  if (!hasBeenProcessed){
844  processDet(lPrevId,
845  lPrevTot,
846  doTkHistoMap,
847  nBad,
848  aTkMapPointer
849  );
850  }
851 
852 
853 }
854 
855 void FEDErrors::fillEventProperties(long long dbx) {
856  eventProp_.deltaBX = dbx;
857 }
858 
859 void FEDErrors::incrementLumiErrors(const bool hasError,
860  const unsigned int aSubDet){
861  if (!lumiErr_.nTotal.size()) return;
862  if (aSubDet >= lumiErr_.nTotal.size()) {
863  edm::LogError("SiStripMonitorHardware") << " -- FED " << fedID_
864  << ", invalid subdetid : " << aSubDet
865  << ", size of lumiErr : "
866  << lumiErr_.nTotal.size()
867  << std::endl;
868  }
869  else {
870  if (hasError) lumiErr_.nErrors[aSubDet]++;
871  lumiErr_.nTotal[aSubDet]++;
872  }
873 }
874 
875 void FEDErrors::processDet(const uint32_t aPrevId,
876  const uint16_t aPrevTot,
877  const bool doTkHistoMap,
878  uint16_t & nBad,
879  TkHistoMap *aTkMapPointer
880  )
881 {
882  if (aPrevTot < nBad){
883  edm::LogError("SiStripMonitorHardware") << " -- Number of bad channels in det " << aPrevId
884  << " = " << nBad
885  << ", total number of pairs for this det = " << aPrevTot
886  << std::endl;
887  }
888 
889  //tkHistoMap takes a uint & as argument
890  uint32_t lDetid = aPrevId;
891  if (aPrevTot != 0 && doTkHistoMap && aTkMapPointer)
892  HistogramBase::fillTkHistoMap(aTkMapPointer,lDetid,static_cast<float>(nBad)/aPrevTot);
893 
894  nBad=0;
895 }
896 
897 
898 const bool FEDErrors::failMonitoringFEDCheck()
899 {
900  return ( anyFEDErrors() ||
901  fedErrors_.CorruptBuffer
902  );
903 }
904 
905 const bool FEDErrors::anyDAQProblems()
906 {
907  return ( fedErrors_.DataMissing ||
908  fedErrors_.InvalidBuffers ||
909  fedErrors_.BadFEDCRCs ||
910  fedErrors_.BadDAQCRCs ||
911  fedErrors_.BadIDs ||
912  fedErrors_.BadDAQPacket
913  );
914 }
915 
916 const bool FEDErrors::anyFEDErrors()
917 {
918  return ( fedErrors_.InvalidBuffers ||
919  fedErrors_.BadFEDCRCs ||
920  fedErrors_.BadDAQCRCs ||
921  fedErrors_.BadIDs ||
922  fedErrors_.BadDAQPacket ||
923  fedErrors_.FEsOverflow
924  );
925 }
926 
927 const bool FEDErrors::anyFEProblems()
928 {
929  return ( fedErrors_.FEsOverflow ||
930  fedErrors_.FEsMissing ||
931  fedErrors_.FEsBadMajorityAddress
932  );
933 }
934 
935 const bool FEDErrors::printDebug()
936 {
937  return ( anyFEDErrors() ||
938  anyFEProblems() ||
939  fedErrors_.CorruptBuffer ||
940  fedErrors_.BadChannelStatusBit
941  );
942 
943 }
944 
945 const unsigned int FEDErrors::fedID(){
946  return fedID_;
947 }
948 
949 
950 FEDErrors::FEDCounters & FEDErrors::getFEDErrorsCounters()
951 {
952  return lFedCounter_;
953 }
954 
955 FEDErrors::ChannelCounters & FEDErrors::getChannelErrorsCounters()
956 {
957  return lChCounter_;
958 }
959 
960 FEDErrors::FECounters & FEDErrors::getFEErrorsCounters()
961 {
962  return feCounter_;
963 }
964 
965 FEDErrors::FEDLevelErrors & FEDErrors::getFEDLevelErrors()
966 {
967  return fedErrors_;
968 }
969 
970 FEDErrors::EventProperties & FEDErrors::getEventProperties()
971 {
972  return eventProp_;
973 }
974 
975 std::vector<FEDErrors::FELevelErrors> & FEDErrors::getFELevelErrors()
976 {
977  return feErrors_;
978 }
979 
980 std::vector<FEDErrors::ChannelLevelErrors> & FEDErrors::getChannelLevelErrors()
981 {
982  return chErrorsDetailed_;
983 }
984 
985 std::vector<FEDErrors::APVLevelErrors> & FEDErrors::getAPVLevelErrors()
986 {
987  return apvErrors_;
988 }
989 
990 std::vector<std::pair<unsigned int,bool> > & FEDErrors::getBadChannels()
991 {
992  return chErrors_;
993 }
994 
995 const FEDErrors::LumiErrors & FEDErrors::getLumiErrors(){
996  return lumiErr_;
997 }
998 
999 void FEDErrors::addBadFE(const FEDErrors::FELevelErrors & aFE)
1000 {
1001  if (aFE.Overflow) {
1002  fedErrors_.FEsOverflow = true;
1003  (feCounter_.nFEOverflows)++;
1004  }
1005  else if (aFE.Missing) {
1006  fedErrors_.FEsMissing = true;
1007  (feCounter_.nFEMissing)++;
1008  feErrors_.push_back(aFE);
1009  }
1010  else if (aFE.BadMajorityAddress) {
1011  fedErrors_.FEsBadMajorityAddress = true;
1012  (feCounter_.nFEBadMajorityAddresses)++;
1013  feErrors_.push_back(aFE);
1014  }
1015  else if (aFE.TimeDifference != 0) {
1016  feErrors_.push_back(aFE);
1017  }
1018 }
1019 
1020 void FEDErrors::addBadChannel(const FEDErrors::ChannelLevelErrors & aChannel)
1021 {
1022  if (aChannel.Connected) chErrorsDetailed_.push_back(aChannel);
1023  incrementChannelCounters(aChannel);
1024 }
1025 
1026 void FEDErrors::addBadAPV(const FEDErrors::APVLevelErrors & aAPV, bool & aFirst)
1027 {
1028  apvErrors_.push_back(aAPV);
1029  incrementAPVCounters(aAPV);
1030  if (aAPV.APVStatusBit && aFirst) {
1031  fedErrors_.BadChannelStatusBit = true;
1032  lFedCounter_.nBadChannels++;
1033  chErrors_.push_back(std::pair<unsigned int, bool>(aAPV.ChannelID,aAPV.IsActive));
1034  if (aAPV.IsActive) {
1035  //print(aAPV);
1036  fedErrors_.BadActiveChannelStatusBit = true;
1037  lFedCounter_.nBadActiveChannels++;
1038  //std::cout << "------ nBadActiveChannels = " << FEDErrors::getFEDErrorsCounters().nBadActiveChannels << std::endl;
1039  }
1040  aFirst = false;
1041  }
1042 }
1043 
1044 
1045 void FEDErrors::incrementFEDCounters()
1046 {
1047  if (fedErrors_.InvalidBuffers ||
1048  fedErrors_.BadFEDCRCs ||
1049  fedErrors_.BadDAQCRCs ||
1050  fedErrors_.BadIDs ||
1051  fedErrors_.BadDAQPacket
1052  ) {
1053  lFedCounter_.nDAQProblems++;
1054  lFedCounter_.nFEDErrors++;
1055  }
1056 
1057  //FElevel errors
1058  if (fedErrors_.FEsOverflow){
1059  lFedCounter_.nFEDsWithFEOverflows++;
1060  }
1061  else if (fedErrors_.FEsMissing){
1062  lFedCounter_.nFEDsWithMissingFEs++;
1063  }
1064  else if (fedErrors_.FEsBadMajorityAddress){
1065  lFedCounter_.nFEDsWithFEBadMajorityAddresses++;
1066  }
1067 
1068  if (fedErrors_.FEsOverflow ||
1069  fedErrors_.FEsBadMajorityAddress ||
1070  fedErrors_.FEsMissing
1071  ){
1072  lFedCounter_.nFEDsWithFEProblems++;
1073  lFedCounter_.nFEDErrors++;
1074  }
1075  else if (fedErrors_.CorruptBuffer) {
1076  lFedCounter_.nCorruptBuffers++;
1077  lFedCounter_.nFEDErrors++;
1078  }
1079 
1080 
1081 }
1082 
1083 
1084 void FEDErrors::incrementChannelCounters(const FEDErrors::ChannelLevelErrors & aChannel)
1085 {
1086  if (aChannel.Unlocked && aChannel.Connected) lChCounter_.nUnlocked++;
1087  if (aChannel.OutOfSync && aChannel.Connected) lChCounter_.nOutOfSync++;
1088  if (!aChannel.Connected) lChCounter_.nNotConnected++;
1089 }
1090 
1091 void FEDErrors::incrementAPVCounters(const FEDErrors::APVLevelErrors & aAPV)
1092 {
1093  if (aAPV.Connected && aAPV.IsActive){
1094  if (aAPV.APVStatusBit) lChCounter_.nAPVStatusBit++;
1095  if (aAPV.APVAddressError) lChCounter_.nAPVAddressError++;
1096  if (aAPV.APVError) lChCounter_.nAPVError++;
1097  }
1098 }
1099 
1100 
1101 bool FEDErrors::ChannelLevelErrors::operator <(const FEDErrors::ChannelLevelErrors & aErr) const{
1102  if (this->ChannelID < aErr.ChannelID) return true;
1103  return false;
1104 }
1105 
1106 
1107 
1108 bool FEDErrors::APVLevelErrors::operator <(const FEDErrors::APVLevelErrors & aErr) const{
1109  if (this->ChannelID < aErr.ChannelID) return true;
1110  return false;
1111 }
1112 
1113 
1114 void FEDErrors::print(const FEDErrors::FEDCounters & aFEDCounter, std::ostream & aOs)
1115 {
1116 
1117  aOs << std::endl;
1118  aOs << "[FEDErrors]============================================" << std::endl
1119  << "[FEDErrors]==== Printing FEDCounters information : ====" << std::endl
1120  << "[FEDErrors]============================================" << std::endl
1121  << "[FEDErrors]======== nFEDErrors = " << aFEDCounter.nFEDErrors << std::endl
1122  << "[FEDErrors]======== nDAQProblems = " << aFEDCounter.nDAQProblems << std::endl
1123  << "[FEDErrors]======== nFEDsWithFEProblems = " << aFEDCounter.nFEDsWithFEProblems << std::endl
1124  << "[FEDErrors]======== nCorruptBuffers = " << aFEDCounter.nCorruptBuffers << std::endl
1125  << "[FEDErrors]======== nBadChannels = " << aFEDCounter.nBadChannels << std::endl
1126  << "[FEDErrors]======== nBadActiveChannels = " << aFEDCounter.nBadActiveChannels << std::endl
1127  << "[FEDErrors]======== nFEDsWithFEOverflows = " << aFEDCounter.nFEDsWithFEOverflows << std::endl
1128  << "[FEDErrors]======== nFEDsWithFEBadMajorityAddresses = " << aFEDCounter.nFEDsWithFEBadMajorityAddresses << std::endl
1129  << "[FEDErrors]======== nFEDsWithMissingFEs = " << aFEDCounter.nFEDsWithMissingFEs << std::endl
1130  << "[FEDErrors]======== nTotalBadChannels = " << aFEDCounter.nTotalBadChannels << std::endl
1131  << "[FEDErrors]======== nTotalBadActiveChannels = " << aFEDCounter.nTotalBadActiveChannels << std::endl
1132  << "[FEDErrors]============================================" << std::endl;
1133 
1134 
1135 }
1136 
1137 void FEDErrors::print(const FEDErrors::FECounters & aFECounter, std::ostream & aOs)
1138 {
1139 
1140  aOs << std::endl;
1141  aOs << "[FEDErrors]============================================" << std::endl
1142  << "[FEDErrors]==== Printing FECounters information : ====" << std::endl
1143  << "[FEDErrors]============================================" << std::endl
1144  << "[FEDErrors]======== nFEOverflows = " << aFECounter.nFEOverflows << std::endl
1145  << "[FEDErrors]======== nFEBadMajorityAddresses = " << aFECounter.nFEBadMajorityAddresses << std::endl
1146  << "[FEDErrors]======== nFEMissing = " << aFECounter.nFEMissing << std::endl
1147  << "[FEDErrors]============================================" << std::endl;
1148 
1149 
1150 }
1151 
1152 void FEDErrors::print(const FEDErrors::FEDLevelErrors & aFEDErr, std::ostream & aOs)
1153 {
1154 
1155  aOs << std::endl;
1156  aOs << "[FEDErrors]============================================" << std::endl
1157  << "[FEDErrors]==== Printing FED errors information : ====" << std::endl
1158  << "[FEDErrors]============================================" << std::endl
1159  << "[FEDErrors]======== HasCabledChannels = " << aFEDErr.HasCabledChannels << std::endl
1160  << "[FEDErrors]======== DataPresent = " << aFEDErr.DataPresent << std::endl
1161  << "[FEDErrors]======== DataMissing = " << aFEDErr.DataMissing << std::endl
1162  << "[FEDErrors]======== InvalidBuffers = " << aFEDErr.InvalidBuffers << std::endl
1163  << "[FEDErrors]======== BadFEDCRCs = " << aFEDErr.BadFEDCRCs << std::endl
1164  << "[FEDErrors]======== BadDAQCRCs = " << aFEDErr.BadDAQCRCs << std::endl
1165  << "[FEDErrors]======== BadIDs = " << aFEDErr.BadIDs << std::endl
1166  << "[FEDErrors]======== BadDAQPacket = " << aFEDErr.BadDAQPacket << std::endl
1167  << "[FEDErrors]======== CorruptBuffer = " << aFEDErr.CorruptBuffer << std::endl
1168  << "[FEDErrors]======== FEOverflows = " << aFEDErr.FEsOverflow << std::endl
1169  << "[FEDErrors]======== FEMissing = " << aFEDErr.FEsMissing << std::endl
1170  << "[FEDErrors]======== BadMajorityAddresses = " << aFEDErr.FEsBadMajorityAddress << std::endl
1171  << "[FEDErrors]============================================" << std::endl;
1172 
1173 }
1174 
1175 void FEDErrors::print(const FEDErrors::FELevelErrors & aErr, std::ostream & aOs)
1176 {
1177 
1178  aOs << std::endl;
1179  aOs << "[FEDErrors]============================================" << std::endl
1180  << "[FEDErrors]==== Printing FE errors information : ====" << std::endl
1181  << "[FEDErrors]============================================" << std::endl
1182  << "[FEDErrors]======== FE #" << aErr.FeID << std::endl
1183  << "[FEDErrors]======== subdet " << aErr.SubDetID << std::endl
1184  << "[FEDErrors]======== FEOverflow = " << aErr.Overflow << std::endl
1185  << "[FEDErrors]======== FEMissing = " << aErr.Missing << std::endl
1186  << "[FEDErrors]======== BadMajorityAddresses = " << aErr.BadMajorityAddress << std::endl
1187  << "[FEDErrors]======== TimeDifference = " << aErr.TimeDifference << std::endl
1188  << "[FEDErrors]============================================" << std::endl;
1189 
1190 }
1191 
1192 void FEDErrors::print(const FEDErrors::ChannelLevelErrors & aErr, std::ostream & aOs)
1193 {
1194  aOs << std::endl;
1195  aOs << "[FEDErrors]=================================================" << std::endl
1196  << "[FEDErrors]==== Printing channel errors information : ====" << std::endl
1197  << "[FEDErrors]=================================================" << std::endl
1198  << "[FEDErrors]============ Channel #" << aErr.ChannelID << std::endl
1199  << "[FEDErrors]============ connected = " << aErr.Connected << std::endl
1200  << "[FEDErrors]============ isActive = " << aErr.IsActive << std::endl
1201  << "[FEDErrors]============ Unlocked = " << aErr.Unlocked << std::endl
1202  << "[FEDErrors]============ OutOfSync = " << aErr.OutOfSync << std::endl
1203  << "[FEDErrors]=================================================" << std::endl;
1204 }
1205 
1206 
1207 void FEDErrors::print(const FEDErrors::APVLevelErrors & aErr, std::ostream & aOs)
1208 {
1209  aOs << std::endl;
1210  aOs << "[FEDErrors]=================================================" << std::endl
1211  << "[FEDErrors]==== Printing APV errors information : ====" << std::endl
1212  << "[FEDErrors]=================================================" << std::endl
1213  << "[FEDErrors]============ APV #" << aErr.APVID << std::endl
1214  << "[FEDErrors]============ Channel #" << aErr.ChannelID << std::endl
1215  << "[FEDErrors]============ connected = " << aErr.Connected << std::endl
1216  << "[FEDErrors]============ isActive = " << aErr.IsActive << std::endl
1217  << "[FEDErrors]============ APVStatusBit = " << aErr.APVStatusBit << std::endl
1218  << "[FEDErrors]============ APVError = " << aErr.APVError << std::endl
1219  << "[FEDErrors]============ APVAddressError = " << aErr.APVAddressError << std::endl
1220  << "[FEDErrors]=================================================" << std::endl;
1221 }
1222 
1223 
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:10
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