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