CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
ErrorCheckerPhase0 Class Reference

#include <ErrorCheckerPhase0.h>

Inheritance diagram for ErrorCheckerPhase0:
ErrorCheckerBase

Public Types

typedef std::vector< SiPixelRawDataErrorDetErrors
 
typedef std::map< cms_uint32_t, DetErrorsErrors
 
typedef cms_uint32_t Word32
 
typedef cms_uint64_t Word64
 
- Public Types inherited from ErrorCheckerBase
typedef std::vector< SiPixelRawDataErrorDetErrors
 
typedef std::map< cms_uint32_t, DetErrorsErrors
 
typedef cms_uint32_t Word32
 
typedef cms_uint64_t Word64
 

Public Member Functions

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

Private Member Functions

cms_uint32_t errorDetId (const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const override
 

Private Attributes

bool includeErrors
 

Detailed Description

Definition at line 11 of file ErrorCheckerPhase0.h.

Member Typedef Documentation

Definition at line 16 of file ErrorCheckerPhase0.h.

Definition at line 17 of file ErrorCheckerPhase0.h.

Definition at line 13 of file ErrorCheckerPhase0.h.

Definition at line 14 of file ErrorCheckerPhase0.h.

Constructor & Destructor Documentation

ErrorCheckerPhase0::ErrorCheckerPhase0 ( )

Definition at line 46 of file ErrorCheckerPhase0.cc.

46 { includeErrors = false; }

Member Function Documentation

bool ErrorCheckerPhase0::checkCRC ( bool &  errorsInEvent,
int  fedId,
const Word64 trailer,
Errors errors 
)
overridevirtual

Implements ErrorCheckerBase.

Definition at line 50 of file ErrorCheckerPhase0.cc.

References relativeConstraints::error.

50  {
51  int CRC_BIT = (*trailer >> CRC_shift) & CRC_mask;
52  if (CRC_BIT == 0)
53  return true;
54  errorsInEvent = true;
55  if (includeErrors) {
56  int errorType = 39;
57  SiPixelRawDataError error(*trailer, errorType, fedId);
58  errors[dummyDetId].push_back(error);
59  }
60  return false;
61 }
Definition: errors.py:1
Pixel error – collection of errors and error information.
bool ErrorCheckerPhase0::checkHeader ( bool &  errorsInEvent,
int  fedId,
const Word64 header,
Errors errors 
)
overridevirtual

Implements ErrorCheckerBase.

Definition at line 63 of file ErrorCheckerPhase0.cc.

References FEDHeader::check(), relativeConstraints::error, l1tstage2_dqm_sourceclient-live_cfg::fedId, LogDebug, FEDHeader::moreHeaders(), and FEDHeader::sourceID().

63  {
64  FEDHeader fedHeader(reinterpret_cast<const unsigned char*>(header));
65  if (!fedHeader.check())
66  return false; // throw exception?
67  if (fedHeader.sourceID() != fedId) {
68  LogDebug("PixelDataFormatter::interpretRawData, fedHeader.sourceID() != fedId")
69  << ", sourceID = " << fedHeader.sourceID() << ", fedId = " << fedId << ", errorType = 32";
70  errorsInEvent = true;
71  if (includeErrors) {
72  int errorType = 32;
73  SiPixelRawDataError error(*header, errorType, fedId);
74  errors[dummyDetId].push_back(error);
75  }
76  }
77  return fedHeader.moreHeaders();
78 }
#define LogDebug(id)
Definition: errors.py:1
Pixel error – collection of errors and error information.
bool ErrorCheckerPhase0::checkROC ( bool &  errorsInEvent,
int  fedId,
const SiPixelFrameConverter converter,
const SiPixelFedCabling theCablingTree,
Word32 errorWord,
Errors errors 
)
overridevirtual

Implements ErrorCheckerBase.

Definition at line 105 of file ErrorCheckerPhase0.cc.

References relativeConstraints::error, LIKELY, and LogDebug.

110  {
111  int errorType = (errorWord >> ROC_shift) & ERROR_mask;
112  if
113  LIKELY(errorType < 25) return true;
114 
115  switch (errorType) {
116  case (25): {
117  LogDebug("") << " invalid ROC=25 found (errorType=25)";
118  errorsInEvent = true;
119  break;
120  }
121  case (26): {
122  return false;
123  }
124  case (27): {
125  return false;
126  }
127  case (28): {
128  LogDebug("") << " error fifo nearly full (errorType=28)";
129  errorsInEvent = true;
130  break;
131  }
132  case (29): {
133  LogDebug("") << " timeout on a channel (errorType=29)";
134  errorsInEvent = true;
135  if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
136  LogDebug("") << " ...first errorType=29 error, this gets masked out";
137  return false;
138  }
139  break;
140  }
141  case (30): {
142  LogDebug("") << " TBM error trailer (errorType=30)";
143  errorsInEvent = true;
144  break;
145  }
146  case (31): {
147  LogDebug("") << " event number error (errorType=31)";
148  errorsInEvent = true;
149  break;
150  }
151  default:
152  return true;
153  };
154 
155  if (includeErrors) {
156  // check to see if overflow error for type 30, change type to 40 if so
157  if (errorType == 30) {
158  int StateMach_bits = 4;
159  int StateMach_shift = 8;
160  uint32_t StateMach_mask = ~(~uint32_t(0) << StateMach_bits);
161  int StateMach = (errorWord >> StateMach_shift) & StateMach_mask;
162  if (StateMach == 4 || StateMach == 9)
163  errorType = 40;
164  }
165 
166  // store error
167  SiPixelRawDataError error(errorWord, errorType, fedId);
168  cms_uint32_t detId;
169  detId = errorDetId(converter, errorType, errorWord);
170  errors[detId].push_back(error);
171  }
172  return false;
173 }
#define LogDebug(id)
cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const override
#define LIKELY(x)
Definition: Likely.h:20
return((rh^lh)&mask)
unsigned int cms_uint32_t
Definition: typedefs.h:15
Definition: errors.py:1
Pixel error – collection of errors and error information.
bool ErrorCheckerPhase0::checkTrailer ( bool &  errorsInEvent,
int  fedId,
unsigned int  nWords,
const Word64 trailer,
Errors errors 
)
overridevirtual

Implements ErrorCheckerBase.

Definition at line 80 of file ErrorCheckerPhase0.cc.

References FEDTrailer::check(), relativeConstraints::error, FEDTrailer::fragmentLength(), and FEDTrailer::moreTrailers().

81  {
82  FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
83  if (!fedTrailer.check()) {
84  if (includeErrors) {
85  int errorType = 33;
86  SiPixelRawDataError error(*trailer, errorType, fedId);
87  errors[dummyDetId].push_back(error);
88  }
89  errorsInEvent = true;
90  LogError("FedTrailerCheck") << "fedTrailer.check failed, Fed: " << fedId << ", errorType = 33";
91  return false;
92  }
93  if (fedTrailer.fragmentLength() != nWords) {
94  LogError("FedTrailerLenght") << "fedTrailer.fragmentLength()!= nWords !! Fed: " << fedId << ", errorType = 34";
95  errorsInEvent = true;
96  if (includeErrors) {
97  int errorType = 34;
98  SiPixelRawDataError error(*trailer, errorType, fedId);
99  errors[dummyDetId].push_back(error);
100  }
101  }
102  return fedTrailer.moreTrailers();
103 }
Definition: errors.py:1
Pixel error – collection of errors and error information.
void ErrorCheckerPhase0::conversionError ( int  fedId,
const SiPixelFrameConverter converter,
int  status,
Word32 errorWord,
Errors errors 
)
overridevirtual

Implements ErrorCheckerBase.

Definition at line 175 of file ErrorCheckerPhase0.cc.

References relativeConstraints::error, LogDebug, and mps_update::status.

176  {
177  switch (status) {
178  case (1): {
179  LogDebug("ErrorCheckerPhase0::conversionError") << " Fed: " << fedId << " invalid channel Id (errorType=35)";
180  if (includeErrors) {
181  int errorType = 35;
182  SiPixelRawDataError error(errorWord, errorType, fedId);
183  cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
184  errors[detId].push_back(error);
185  }
186  break;
187  }
188  case (2): {
189  LogDebug("ErrorCheckerPhase0::conversionError") << " Fed: " << fedId << " invalid ROC Id (errorType=36)";
190  if (includeErrors) {
191  int errorType = 36;
192  SiPixelRawDataError error(errorWord, errorType, fedId);
193  cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
194  errors[detId].push_back(error);
195  }
196  break;
197  }
198  case (3): {
199  LogDebug("ErrorCheckerPhase0::conversionError")
200  << " Fed: " << fedId << " invalid dcol/pixel value (errorType=37)";
201  if (includeErrors) {
202  int errorType = 37;
203  SiPixelRawDataError error(errorWord, errorType, fedId);
204  cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
205  errors[detId].push_back(error);
206  }
207  break;
208  }
209  case (4): {
210  LogDebug("ErrorCheckerPhase0::conversionError")
211  << " Fed: " << fedId << " dcol/pixel read out of order (errorType=38)";
212  if (includeErrors) {
213  int errorType = 38;
214  SiPixelRawDataError error(errorWord, errorType, fedId);
215  cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
216  errors[detId].push_back(error);
217  }
218  break;
219  }
220  default:
221  LogDebug("ErrorCheckerPhase0::conversionError")
222  << " cabling check returned unexpected result, status = " << status;
223  };
224 }
#define LogDebug(id)
cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const override
unsigned int cms_uint32_t
Definition: typedefs.h:15
Definition: errors.py:1
Pixel error – collection of errors and error information.
cms_uint32_t ErrorCheckerPhase0::errorDetId ( const SiPixelFrameConverter converter,
int  errorType,
const Word32 word 
) const
overrideprivatevirtual

Implements ErrorCheckerBase.

Definition at line 227 of file ErrorCheckerPhase0.cc.

References sipixelobjects::ElectronicIndex::dcol, sipixelobjects::ElectronicIndex::link, PixelSubdetector::PixelBarrel, sipixelobjects::ElectronicIndex::pxid, sipixelobjects::DetectorIndex::rawId, sipixelobjects::ElectronicIndex::roc, mps_update::status, DetId::subdetId(), and SiPixelFrameConverter::toDetector().

229  {
230  if (!converter)
231  return dummyDetId;
232 
233  ElectronicIndex cabling;
234 
235  switch (errorType) {
236  case 25:
237  case 30:
238  case 31:
239  case 36:
240  case 40: {
241  // set dummy values for cabling just to get detId from link if in Barrel
242  cabling.dcol = 0;
243  cabling.pxid = 2;
244  cabling.roc = 1;
245  cabling.link = (word >> LINK_shift) & LINK_mask;
246 
247  DetectorIndex detIdx;
248  int status = converter->toDetector(cabling, detIdx);
249  if (status)
250  break;
251  if (DetId(detIdx.rawId).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel))
252  return detIdx.rawId;
253  break;
254  }
255  case 29: {
256  int chanNmbr = 0;
257  const int DB0_shift = 0;
258  const int DB1_shift = DB0_shift + 1;
259  const int DB2_shift = DB1_shift + 1;
260  const int DB3_shift = DB2_shift + 1;
261  const int DB4_shift = DB3_shift + 1;
262  const cms_uint32_t DataBit_mask = ~(~cms_uint32_t(0) << 1);
263 
264  int CH1 = (word >> DB0_shift) & DataBit_mask;
265  int CH2 = (word >> DB1_shift) & DataBit_mask;
266  int CH3 = (word >> DB2_shift) & DataBit_mask;
267  int CH4 = (word >> DB3_shift) & DataBit_mask;
268  int CH5 = (word >> DB4_shift) & DataBit_mask;
269  int BLOCK_bits = 3;
270  int BLOCK_shift = 8;
271  cms_uint32_t BLOCK_mask = ~(~cms_uint32_t(0) << BLOCK_bits);
272  int BLOCK = (word >> BLOCK_shift) & BLOCK_mask;
273  int localCH = 1 * CH1 + 2 * CH2 + 3 * CH3 + 4 * CH4 + 5 * CH5;
274  if (BLOCK % 2 == 0)
275  chanNmbr = (BLOCK / 2) * 9 + localCH;
276  else
277  chanNmbr = ((BLOCK - 1) / 2) * 9 + 4 + localCH;
278  if ((chanNmbr < 1) || (chanNmbr > 36))
279  break; // signifies unexpected result
280 
281  // set dummy values for cabling just to get detId from link if in Barrel
282  cabling.dcol = 0;
283  cabling.pxid = 2;
284  cabling.roc = 1;
285  cabling.link = chanNmbr;
286  DetectorIndex detIdx;
287  int status = converter->toDetector(cabling, detIdx);
288  if (status)
289  break;
290  if (DetId(detIdx.rawId).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel))
291  return detIdx.rawId;
292  break;
293  }
294  case 37:
295  case 38: {
296  cabling.dcol = 0;
297  cabling.pxid = 2;
298  cabling.roc = (word >> ROC_shift) & ROC_mask;
299  cabling.link = (word >> LINK_shift) & LINK_mask;
300 
301  DetectorIndex detIdx;
302  int status = converter->toDetector(cabling, detIdx);
303  if (status)
304  break;
305 
306  return detIdx.rawId;
307  break;
308  }
309  default:
310  break;
311  };
312  return dummyDetId;
313 }
uint64_t word
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
unsigned int cms_uint32_t
Definition: typedefs.h:15
Definition: DetId.h:17
int toDetector(const sipixelobjects::ElectronicIndex &cabling, sipixelobjects::DetectorIndex &detector) const
void ErrorCheckerPhase0::setErrorStatus ( bool  ErrorStatus)
overridevirtual

Implements ErrorCheckerBase.

Definition at line 48 of file ErrorCheckerPhase0.cc.

48 { includeErrors = ErrorStatus; }

Member Data Documentation

bool ErrorCheckerPhase0::includeErrors
private

Definition at line 40 of file ErrorCheckerPhase0.h.