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
 
cms_uint32_t errorDetIdSimple (const SiPixelFrameConverter *converter, int errorType, unsigned int channel, unsigned int roc) const
 
- 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, errorDetIdSimple(), 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, PixelMapPlotter::roc, sipixelconstants::ROC_mask, and sipixelconstants::ROC_shift.

28  {
29  int errorType = (errorWord >> ROC_shift) & ERROR_mask;
30  if LIKELY (errorType < 25)
31  return true;
32  unsigned int channel = (errorWord >> LINK_shift) & LINK_mask;
33  unsigned int roc = 1;
34 
35  switch (errorType) {
36  case (25): {
37  CablingPathToDetUnit cablingPath = {unsigned(fedId), channel, 1};
38  if (!theCablingTree->findItem(cablingPath)) {
39  return false;
40  }
41  LogDebug("") << " invalid ROC=25 found (errorType=25)";
42  errorsInEvent = true;
43  break;
44  }
45  case (26): {
46  //LogDebug("")<<" gap word found (errorType=26)";
47  return false;
48  }
49  case (27): {
50  //LogDebug("")<<" dummy word found (errorType=27)";
51  return false;
52  }
53  case (28): {
54  LogDebug("") << " error fifo nearly full (errorType=28)";
55  errorsInEvent = true;
56  break;
57  }
58  case (29): {
59  LogDebug("") << " timeout on a channel (errorType=29)";
60  errorsInEvent = true;
61  if (!((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask)) { //exit on the 2nd TO word
62  LogDebug("") << " ...2nd errorType=29 error, skip";
63  return false;
64  }
65  break;
66  }
67  case (30): {
68  LogDebug("") << " TBM error trailer (errorType=30)";
69  int StateMatch_bits = 4;
70  int StateMatch_shift = 8;
71  uint32_t StateMatch_mask = ~(~uint32_t(0) << StateMatch_bits);
72  int StateMatch = (errorWord >> StateMatch_shift) & StateMatch_mask;
73  if (StateMatch != 1 && StateMatch != 8) {
74  LogDebug("") << " FED error 30 with unexpected State Bits (errorType=30)";
75  return false;
76  }
77  if (StateMatch == 1)
78  errorType = 40; // 1=Overflow -> 40, 8=number of ROCs -> 30
79  errorsInEvent = true;
80  break;
81  }
82  case (31): {
83  LogDebug("") << " event number error (errorType=31)";
84  errorsInEvent = true;
85  break;
86  }
87  case (37):
88  case (38): {
89  roc = (errorWord >> ROC_shift) & ROC_mask;
90  break;
91  }
92  default:
93  return true;
94  };
95 
96  if (includeErrors_) {
97  // store error
98  SiPixelRawDataError error(errorWord, errorType, fedId);
99  cms_uint32_t detId = errorDetIdSimple(converter, errorType, channel, roc);
100  errors[detId].push_back(error);
101  }
102  return false;
103 }
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
cms_uint32_t errorDetIdSimple(const SiPixelFrameConverter *converter, int errorType, unsigned int channel, unsigned int roc) const
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
constexpr uint32_t LINK_mask
constexpr uint32_t OMIT_ERR_mask
Definition: errors.py:1
constexpr uint32_t ROC_mask
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 129 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.

129  {
130  if (!converter) {
131  return dummyDetId;
132  }
133  ElectronicIndex cabling;
134 
135  switch (errorType) {
136  case 25:
137  case 30:
138  case 31:
139  case 36:
140  case 40: {
141  // set dummy values for cabling just to get detId from link
142  cabling.dcol = 0;
143  cabling.pxid = 2;
144  cabling.roc = 1;
145  cabling.link = (word >> LINK_shift) & LINK_mask;
146 
147  DetectorIndex detIdx;
148  int status = converter->toDetector(cabling, detIdx);
149  if (!status) {
150  return detIdx.rawId;
151  }
152  break;
153  }
154  case 29: {
155  int chanNmbr = 0;
156  const int DB0_shift = 0;
157  const int DB1_shift = DB0_shift + 1;
158  const int DB2_shift = DB1_shift + 1;
159  const int DB3_shift = DB2_shift + 1;
160  const int DB4_shift = DB3_shift + 1;
161  const cms_uint32_t DataBit_mask = ~(~cms_uint32_t(0) << 1);
162 
163  int CH1 = (word >> DB0_shift) & DataBit_mask;
164  int CH2 = (word >> DB1_shift) & DataBit_mask;
165  int CH3 = (word >> DB2_shift) & DataBit_mask;
166  int CH4 = (word >> DB3_shift) & DataBit_mask;
167  int CH5 = (word >> DB4_shift) & DataBit_mask;
168  int BLOCK_bits = 3;
169  int BLOCK_shift = 8;
170  cms_uint32_t BLOCK_mask = ~(~cms_uint32_t(0) << BLOCK_bits);
171  int BLOCK = (word >> BLOCK_shift) & BLOCK_mask;
172  int localCH = 1 * CH1 + 2 * CH2 + 3 * CH3 + 4 * CH4 + 5 * CH5;
173  if (BLOCK % 2 == 0)
174  chanNmbr = (BLOCK / 2) * 9 + localCH;
175  else
176  chanNmbr = ((BLOCK - 1) / 2) * 9 + 4 + localCH;
177 
178  if ((chanNmbr < 1) || (chanNmbr > 36)) {
179  break; // signifies unexpected result WRONG!
180  }
181  // set dummy values for cabling just to get detId from link if in Barrel
182  cabling.dcol = 0;
183  cabling.pxid = 2;
184  cabling.roc = 1;
185  cabling.link = chanNmbr;
186  DetectorIndex detIdx;
187  int status = converter->toDetector(cabling, detIdx);
188  if (!status) {
189  return detIdx.rawId;
190  }
191  break;
192  }
193  case 37:
194  case 38: {
195  cabling.dcol = 0;
196  cabling.pxid = 2;
197  cabling.roc = (word >> ROC_shift) & ROC_mask;
198  cabling.link = (word >> LINK_shift) & LINK_mask;
199 
200  DetectorIndex detIdx;
201  int status = converter->toDetector(cabling, detIdx);
202  if (status)
203  break;
204 
205  return detIdx.rawId;
206  break;
207  }
208  default:
209  break;
210  };
211 
212  return dummyDetId;
213 }
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

◆ errorDetIdSimple()

cms_uint32_t ErrorChecker::errorDetIdSimple ( const SiPixelFrameConverter converter,
int  errorType,
unsigned int  channel,
unsigned int  roc 
) const
protected

Definition at line 106 of file ErrorChecker.cc.

References sipixelobjects::ElectronicIndex::dcol, sipixelconstants::dummyDetId, sipixelobjects::ElectronicIndex::link, sipixelobjects::ElectronicIndex::pxid, sipixelobjects::DetectorIndex::rawId, sipixelobjects::ElectronicIndex::roc, PixelMapPlotter::roc, and mps_update::status.

Referenced by checkROC().

109  {
110  if (!converter) {
111  return dummyDetId;
112  }
113 
114  ElectronicIndex cabling;
115  DetectorIndex detIdx;
116  cabling.dcol = 0;
117  cabling.pxid = 2;
118  cabling.roc = roc;
119  cabling.link = channel;
120  int status = converter->toDetector(cabling, detIdx);
121  if (!status) {
122  return detIdx.rawId;
123  } // all OK return valid module id
124 
125  return dummyDetId; // failed, return dummy
126 }
constexpr cms_uint32_t dummyDetId