CMS 3D CMS Logo

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

#include <ErrorChecker.h>

Inheritance diagram for ErrorChecker:
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
 
 ErrorChecker ()
 
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 ErrorChecker.h.

Member Typedef Documentation

◆ DetErrors

Definition at line 16 of file ErrorChecker.h.

◆ Errors

Definition at line 17 of file ErrorChecker.h.

◆ Word32

Definition at line 13 of file ErrorChecker.h.

◆ Word64

Definition at line 14 of file ErrorChecker.h.

Constructor & Destructor Documentation

◆ ErrorChecker()

ErrorChecker::ErrorChecker ( )

Definition at line 46 of file ErrorChecker.cc.

46 { includeErrors = false; }

Member Function Documentation

◆ checkCRC()

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

Implements ErrorCheckerBase.

Definition at line 50 of file ErrorChecker.cc.

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 }

References relativeConstraints::error, and l1tstage2_dqm_sourceclient-live_cfg::fedId.

Referenced by SiPixelRawToClusterCUDA::acquire().

◆ checkHeader()

bool ErrorChecker::checkHeader ( bool &  errorsInEvent,
int  fedId,
const Word64 header,
Errors errors 
)
overridevirtual

Implements ErrorCheckerBase.

Definition at line 63 of file ErrorChecker.cc.

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 }

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

Referenced by SiPixelRawToClusterCUDA::acquire().

◆ checkROC()

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

Implements ErrorCheckerBase.

Definition at line 105 of file ErrorChecker.cc.

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  CablingPathToDetUnit cablingPath = {unsigned(fedId), (errorWord >> LINK_shift) & LINK_mask, 1};
118  if (!theCablingTree->findItem(cablingPath))
119  return false;
120  LogDebug("") << " invalid ROC=25 found (errorType=25)";
121  errorsInEvent = true;
122  break;
123  }
124  case (26): {
125  //LogDebug("")<<" gap word found (errorType=26)";
126  return false;
127  }
128  case (27): {
129  //LogDebug("")<<" dummy word found (errorType=27)";
130  return false;
131  }
132  case (28): {
133  LogDebug("") << " error fifo nearly full (errorType=28)";
134  errorsInEvent = true;
135  break;
136  }
137  case (29): {
138  LogDebug("") << " timeout on a channel (errorType=29)";
139  errorsInEvent = true;
140  if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
141  LogDebug("") << " ...first errorType=29 error, this gets masked out";
142  return false;
143  }
144  break;
145  }
146  case (30): {
147  LogDebug("") << " TBM error trailer (errorType=30)";
148  int StateMatch_bits = 4;
149  int StateMatch_shift = 8;
150  uint32_t StateMatch_mask = ~(~uint32_t(0) << StateMatch_bits);
151  int StateMatch = (errorWord >> StateMatch_shift) & StateMatch_mask;
152  if (StateMatch != 1 && StateMatch != 8) {
153  LogDebug("") << " FED error 30 with unexpected State Bits (errorType=30)";
154  return false;
155  }
156  if (StateMatch == 1)
157  errorType = 40; // 1=Overflow -> 40, 8=number of ROCs -> 30
158  errorsInEvent = true;
159  break;
160  }
161  case (31): {
162  LogDebug("") << " event number error (errorType=31)";
163  errorsInEvent = true;
164  break;
165  }
166  default:
167  return true;
168  };
169 
170  if (includeErrors) {
171  // store error
172  SiPixelRawDataError error(errorWord, errorType, fedId);
173  cms_uint32_t detId;
174  detId = errorDetId(converter, errorType, errorWord);
175  errors[detId].push_back(error);
176  }
177  return false;
178 }

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

◆ checkTrailer()

bool ErrorChecker::checkTrailer ( bool &  errorsInEvent,
int  fedId,
unsigned int  nWords,
const Word64 trailer,
Errors errors 
)
overridevirtual

Implements ErrorCheckerBase.

Definition at line 80 of file ErrorChecker.cc.

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 }

References FEDTrailer::check(), relativeConstraints::error, l1tstage2_dqm_sourceclient-live_cfg::fedId, FEDTrailer::fragmentLength(), and FEDTrailer::moreTrailers().

Referenced by SiPixelRawToClusterCUDA::acquire().

◆ conversionError()

void ErrorChecker::conversionError ( int  fedId,
const SiPixelFrameConverter converter,
int  status,
Word32 errorWord,
Errors errors 
)
overridevirtual

Implements ErrorCheckerBase.

Definition at line 180 of file ErrorChecker.cc.

181  {
182  switch (status) {
183  case (1): {
184  LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " invalid channel Id (errorType=35)";
185  if (includeErrors) {
186  int errorType = 35;
187  SiPixelRawDataError error(errorWord, errorType, fedId);
188  cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
189  errors[detId].push_back(error);
190  }
191  break;
192  }
193  case (2): {
194  LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " invalid ROC Id (errorType=36)";
195  if (includeErrors) {
196  int errorType = 36;
197  SiPixelRawDataError error(errorWord, errorType, fedId);
198  cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
199  errors[detId].push_back(error);
200  }
201  break;
202  }
203  case (3): {
204  LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " invalid dcol/pixel value (errorType=37)";
205  if (includeErrors) {
206  int errorType = 37;
207  SiPixelRawDataError error(errorWord, errorType, fedId);
208  cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
209  errors[detId].push_back(error);
210  }
211  break;
212  }
213  case (4): {
214  LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " dcol/pixel read out of order (errorType=38)";
215  if (includeErrors) {
216  int errorType = 38;
217  SiPixelRawDataError error(errorWord, errorType, fedId);
218  cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
219  errors[detId].push_back(error);
220  }
221  break;
222  }
223  default:
224  LogDebug("ErrorChecker::conversionError") << " cabling check returned unexpected result, status = " << status;
225  };
226 }

References relativeConstraints::error, l1tstage2_dqm_sourceclient-live_cfg::fedId, LogDebug, and mps_update::status.

◆ errorDetId()

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

Implements ErrorCheckerBase.

Definition at line 229 of file ErrorChecker.cc.

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
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  return detIdx.rawId;
251  break;
252  }
253  case 29: {
254  int chanNmbr = 0;
255  const int DB0_shift = 0;
256  const int DB1_shift = DB0_shift + 1;
257  const int DB2_shift = DB1_shift + 1;
258  const int DB3_shift = DB2_shift + 1;
259  const int DB4_shift = DB3_shift + 1;
260  const cms_uint32_t DataBit_mask = ~(~cms_uint32_t(0) << 1);
261 
262  int CH1 = (word >> DB0_shift) & DataBit_mask;
263  int CH2 = (word >> DB1_shift) & DataBit_mask;
264  int CH3 = (word >> DB2_shift) & DataBit_mask;
265  int CH4 = (word >> DB3_shift) & DataBit_mask;
266  int CH5 = (word >> DB4_shift) & DataBit_mask;
267  int BLOCK_bits = 3;
268  int BLOCK_shift = 8;
269  cms_uint32_t BLOCK_mask = ~(~cms_uint32_t(0) << BLOCK_bits);
270  int BLOCK = (word >> BLOCK_shift) & BLOCK_mask;
271  int localCH = 1 * CH1 + 2 * CH2 + 3 * CH3 + 4 * CH4 + 5 * CH5;
272  if (BLOCK % 2 == 0)
273  chanNmbr = (BLOCK / 2) * 9 + localCH;
274  else
275  chanNmbr = ((BLOCK - 1) / 2) * 9 + 4 + localCH;
276  if ((chanNmbr < 1) || (chanNmbr > 36))
277  break; // signifies unexpected result
278 
279  // set dummy values for cabling just to get detId from link if in Barrel
280  cabling.dcol = 0;
281  cabling.pxid = 2;
282  cabling.roc = 1;
283  cabling.link = chanNmbr;
284  DetectorIndex detIdx;
285  int status = converter->toDetector(cabling, detIdx);
286  if (!status)
287  return detIdx.rawId;
288  break;
289  }
290  case 37:
291  case 38: {
292  cabling.dcol = 0;
293  cabling.pxid = 2;
294  cabling.roc = (word >> ROC_shift) & ROC_mask;
295  cabling.link = (word >> LINK_shift) & LINK_mask;
296 
297  DetectorIndex detIdx;
298  int status = converter->toDetector(cabling, detIdx);
299  if (status)
300  break;
301 
302  return detIdx.rawId;
303  break;
304  }
305  default:
306  break;
307  };
308  return dummyDetId;
309 }

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

◆ setErrorStatus()

void ErrorChecker::setErrorStatus ( bool  ErrorStatus)
overridevirtual

Implements ErrorCheckerBase.

Definition at line 48 of file ErrorChecker.cc.

48 { includeErrors = ErrorStatus; }

Member Data Documentation

◆ includeErrors

bool ErrorChecker::includeErrors
private

Definition at line 40 of file ErrorChecker.h.

cms_uint32_t
unsigned int cms_uint32_t
Definition: typedefs.h:15
SiPixelRawDataError
Pixel error – collection of errors and error information.
Definition: SiPixelRawDataError.h:19
mps_update.status
status
Definition: mps_update.py:69
converter
Definition: CandidateProducer.h:25
SiPixelFedCabling::findItem
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
ErrorChecker::includeErrors
bool includeErrors
Definition: ErrorChecker.h:40
ErrorChecker::errorDetId
cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const override
Definition: ErrorChecker.cc:229
sipixelobjects::ElectronicIndex::dcol
int dcol
Definition: ElectronicIndex.h:8
mathSSE::return
return((rh ^ lh) &mask)
relativeConstraints.error
error
Definition: relativeConstraints.py:53
pixelgpudetails::OMIT_ERR_mask
const uint32_t OMIT_ERR_mask
Definition: SiPixelRawToClusterGPUKernel.h:78
pixelgpudetails::OMIT_ERR_shift
const uint32_t OMIT_ERR_shift
Definition: SiPixelRawToClusterGPUKernel.h:68
pixelgpudetails::ROC_mask
const uint32_t ROC_mask
Definition: SiPixelRawToClusterGPUKernel.h:71
Phase2TrackerMonitorDigi_cff.switch
switch
Definition: Phase2TrackerMonitorDigi_cff.py:13
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
errors
Definition: errors.py:1
sipixelobjects::CablingPathToDetUnit
Definition: CablingPathToDetUnit.h:5
sipixelobjects::ElectronicIndex::pxid
int pxid
Definition: ElectronicIndex.h:9
sipixelobjects::ElectronicIndex
Definition: ElectronicIndex.h:5
sipixelobjects::ElectronicIndex::link
int link
Definition: ElectronicIndex.h:6
funct::true
true
Definition: Factorize.h:173
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
FEDTrailer
Definition: FEDTrailer.h:14
pixelgpudetails::LINK_shift
const uint32_t LINK_shift
Definition: SiPixelRawToClusterGPUKernel.h:64
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
pixelgpudetails::LINK_mask
const uint32_t LINK_mask
Definition: SiPixelRawToClusterGPUKernel.h:70
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
pixelgpudetails::ROC_shift
const uint32_t ROC_shift
Definition: SiPixelRawToClusterGPUKernel.h:63
FEDHeader
Definition: FEDHeader.h:14
pixelgpudetails::ERROR_mask
const uint32_t ERROR_mask
Definition: SiPixelRawToClusterGPUKernel.h:77
sipixelobjects::DetectorIndex::rawId
uint32_t rawId
Definition: DetectorIndex.h:7
sipixelobjects::DetectorIndex
Definition: DetectorIndex.h:6
sipixelobjects::ElectronicIndex::roc
int roc
Definition: ElectronicIndex.h:7