CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions
ErrorChecker Class Reference

#include <ErrorChecker.h>

Inheritance diagram for ErrorChecker:
ErrorCheckerBase

Public Member Functions

bool checkROC (bool &errorsInEvent, int fedId, const SiPixelFrameConverter *converter, const SiPixelFedCabling *theCablingTree, Word32 &errorWord, SiPixelFormatterErrors &errors) const override
 
 ErrorChecker ()
 
- Public Member Functions inherited from ErrorCheckerBase
bool checkCRC (bool &errorsInEvent, int fedId, const Word64 *trailer, SiPixelFormatterErrors &errors) const
 
bool checkHeader (bool &errorsInEvent, int fedId, const Word64 *header, SiPixelFormatterErrors &errors) const
 
bool checkTrailer (bool &errorsInEvent, int fedId, unsigned int nWords, const Word64 *trailer, SiPixelFormatterErrors &errors) const
 
void conversionError (int fedId, const SiPixelFrameConverter *converter, int status, Word32 &errorWord, SiPixelFormatterErrors &errors) const
 
 ErrorCheckerBase ()
 
void setErrorStatus (bool ErrorStatus)
 
virtual ~ErrorCheckerBase ()=default
 

Protected Member Functions

cms_uint32_t errorDetId (const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const override
 
- Protected Member Functions inherited from ErrorCheckerBase
void addErrorToCollectionDummy (int errorType, int fedId, Word64 word, SiPixelFormatterErrors &errors) const
 
int getConversionErrorTypeAndIssueLogMessage (int status, int fedId) const
 

Additional Inherited Members

- Protected Attributes inherited from ErrorCheckerBase
bool includeErrors_
 

Detailed Description

Definition at line 12 of file ErrorChecker.h.

Constructor & Destructor Documentation

◆ ErrorChecker()

ErrorChecker::ErrorChecker ( )

Definition at line 21 of file ErrorChecker.cc.

Member Function Documentation

◆ checkROC()

bool ErrorChecker::checkROC ( bool &  errorsInEvent,
int  fedId,
const SiPixelFrameConverter converter,
const SiPixelFedCabling theCablingTree,
Word32 errorWord,
SiPixelFormatterErrors errors 
) const
overridevirtual

Implements ErrorCheckerBase.

Definition at line 23 of file ErrorChecker.cc.

References relativeConstraints::error, sipixelconstants::ERROR_mask, errorDetId(), l1tstage2_dqm_sourceclient-live_cfg::fedId, SiPixelFedCabling::findItem(), ErrorCheckerBase::includeErrors_, LIKELY, sipixelconstants::LINK_mask, sipixelconstants::LINK_shift, LogDebug, sipixelconstants::OMIT_ERR_mask, sipixelconstants::OMIT_ERR_shift, and sipixelconstants::ROC_shift.

28  {
29  int errorType = (errorWord >> ROC_shift) & ERROR_mask;
30  if LIKELY (errorType < 25)
31  return true;
32 
33  switch (errorType) {
34  case (25): {
35  CablingPathToDetUnit cablingPath = {unsigned(fedId), (errorWord >> LINK_shift) & LINK_mask, 1};
36  if (!theCablingTree->findItem(cablingPath))
37  return false;
38  LogDebug("") << " invalid ROC=25 found (errorType=25)";
39  errorsInEvent = true;
40  break;
41  }
42  case (26): {
43  //LogDebug("")<<" gap word found (errorType=26)";
44  return false;
45  }
46  case (27): {
47  //LogDebug("")<<" dummy word found (errorType=27)";
48  return false;
49  }
50  case (28): {
51  LogDebug("") << " error fifo nearly full (errorType=28)";
52  errorsInEvent = true;
53  break;
54  }
55  case (29): {
56  LogDebug("") << " timeout on a channel (errorType=29)";
57  errorsInEvent = true;
58  if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
59  LogDebug("") << " ...first errorType=29 error, this gets masked out";
60  return false;
61  }
62  break;
63  }
64  case (30): {
65  LogDebug("") << " TBM error trailer (errorType=30)";
66  int StateMatch_bits = 4;
67  int StateMatch_shift = 8;
68  uint32_t StateMatch_mask = ~(~uint32_t(0) << StateMatch_bits);
69  int StateMatch = (errorWord >> StateMatch_shift) & StateMatch_mask;
70  if (StateMatch != 1 && StateMatch != 8) {
71  LogDebug("") << " FED error 30 with unexpected State Bits (errorType=30)";
72  return false;
73  }
74  if (StateMatch == 1)
75  errorType = 40; // 1=Overflow -> 40, 8=number of ROCs -> 30
76  errorsInEvent = true;
77  break;
78  }
79  case (31): {
80  LogDebug("") << " event number error (errorType=31)";
81  errorsInEvent = true;
82  break;
83  }
84  default:
85  return true;
86  };
87 
88  if (includeErrors_) {
89  // store error
90  SiPixelRawDataError error(errorWord, errorType, fedId);
91  cms_uint32_t detId;
92  detId = errorDetId(converter, errorType, errorWord);
93  errors[detId].push_back(error);
94  }
95  return false;
96 }
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
return((rh ^ lh) &mask)
constexpr uint32_t ROC_shift
#define LIKELY(x)
Definition: Likely.h:20
constexpr uint32_t ERROR_mask
constexpr uint32_t OMIT_ERR_shift
unsigned int cms_uint32_t
Definition: typedefs.h:15
constexpr uint32_t LINK_shift
cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const override
Definition: ErrorChecker.cc:99
constexpr uint32_t LINK_mask
constexpr uint32_t OMIT_ERR_mask
Definition: errors.py:1
Pixel error – collection of errors and error information.
#define LogDebug(id)

◆ errorDetId()

cms_uint32_t ErrorChecker::errorDetId ( const SiPixelFrameConverter converter,
int  errorType,
const Word32 word 
) const
overrideprotectedvirtual

Implements ErrorCheckerBase.

Definition at line 99 of file ErrorChecker.cc.

References sipixelobjects::ElectronicIndex::dcol, sipixelconstants::dummyDetId, sipixelobjects::ElectronicIndex::link, sipixelconstants::LINK_mask, sipixelconstants::LINK_shift, sipixelobjects::ElectronicIndex::pxid, sipixelobjects::DetectorIndex::rawId, sipixelobjects::ElectronicIndex::roc, sipixelconstants::ROC_mask, sipixelconstants::ROC_shift, and mps_update::status.

Referenced by checkROC().

99  {
100  if (!converter)
101  return dummyDetId;
102 
103  ElectronicIndex cabling;
104 
105  switch (errorType) {
106  case 25:
107  case 30:
108  case 31:
109  case 36:
110  case 40: {
111  // set dummy values for cabling just to get detId from link
112  cabling.dcol = 0;
113  cabling.pxid = 2;
114  cabling.roc = 1;
115  cabling.link = (word >> LINK_shift) & LINK_mask;
116 
117  DetectorIndex detIdx;
118  int status = converter->toDetector(cabling, detIdx);
119  if (!status)
120  return detIdx.rawId;
121  break;
122  }
123  case 29: {
124  int chanNmbr = 0;
125  const int DB0_shift = 0;
126  const int DB1_shift = DB0_shift + 1;
127  const int DB2_shift = DB1_shift + 1;
128  const int DB3_shift = DB2_shift + 1;
129  const int DB4_shift = DB3_shift + 1;
130  const cms_uint32_t DataBit_mask = ~(~cms_uint32_t(0) << 1);
131 
132  int CH1 = (word >> DB0_shift) & DataBit_mask;
133  int CH2 = (word >> DB1_shift) & DataBit_mask;
134  int CH3 = (word >> DB2_shift) & DataBit_mask;
135  int CH4 = (word >> DB3_shift) & DataBit_mask;
136  int CH5 = (word >> DB4_shift) & DataBit_mask;
137  int BLOCK_bits = 3;
138  int BLOCK_shift = 8;
139  cms_uint32_t BLOCK_mask = ~(~cms_uint32_t(0) << BLOCK_bits);
140  int BLOCK = (word >> BLOCK_shift) & BLOCK_mask;
141  int localCH = 1 * CH1 + 2 * CH2 + 3 * CH3 + 4 * CH4 + 5 * CH5;
142  if (BLOCK % 2 == 0)
143  chanNmbr = (BLOCK / 2) * 9 + localCH;
144  else
145  chanNmbr = ((BLOCK - 1) / 2) * 9 + 4 + localCH;
146  if ((chanNmbr < 1) || (chanNmbr > 36))
147  break; // signifies unexpected result
148 
149  // set dummy values for cabling just to get detId from link if in Barrel
150  cabling.dcol = 0;
151  cabling.pxid = 2;
152  cabling.roc = 1;
153  cabling.link = chanNmbr;
154  DetectorIndex detIdx;
155  int status = converter->toDetector(cabling, detIdx);
156  if (!status)
157  return detIdx.rawId;
158  break;
159  }
160  case 37:
161  case 38: {
162  cabling.dcol = 0;
163  cabling.pxid = 2;
164  cabling.roc = (word >> ROC_shift) & ROC_mask;
165  cabling.link = (word >> LINK_shift) & LINK_mask;
166 
167  DetectorIndex detIdx;
168  int status = converter->toDetector(cabling, detIdx);
169  if (status)
170  break;
171 
172  return detIdx.rawId;
173  break;
174  }
175  default:
176  break;
177  };
178  return dummyDetId;
179 }
constexpr cms_uint32_t dummyDetId
constexpr uint32_t ROC_shift
uint64_t word
unsigned int cms_uint32_t
Definition: typedefs.h:15
constexpr uint32_t LINK_shift
constexpr uint32_t LINK_mask
constexpr uint32_t ROC_mask