CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
ErrorCheckerBase Class Referenceabstract

#include <ErrorCheckerBase.h>

Inheritance diagram for ErrorCheckerBase:
ErrorChecker ErrorCheckerPhase0

Public Member Functions

bool checkCRC (bool &errorsInEvent, int fedId, const Word64 *trailer, SiPixelFormatterErrors &errors) const
 
bool checkHeader (bool &errorsInEvent, int fedId, const Word64 *header, SiPixelFormatterErrors &errors) const
 
virtual bool checkROC (bool &errorsInEvent, int fedId, const SiPixelFrameConverter *converter, const SiPixelFedCabling *theCablingTree, Word32 &errorWord, SiPixelFormatterErrors &errors) const =0
 
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

void addErrorToCollectionDummy (int errorType, int fedId, Word64 word, SiPixelFormatterErrors &errors) const
 
virtual cms_uint32_t errorDetId (const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const =0
 
int getConversionErrorTypeAndIssueLogMessage (int status, int fedId) const
 

Protected Attributes

bool includeErrors_
 

Detailed Description

Definition at line 14 of file ErrorCheckerBase.h.

Constructor & Destructor Documentation

◆ ErrorCheckerBase()

ErrorCheckerBase::ErrorCheckerBase ( )

Definition at line 21 of file ErrorCheckerBase.cc.

21 : includeErrors_(false) {}

◆ ~ErrorCheckerBase()

virtual ErrorCheckerBase::~ErrorCheckerBase ( )
virtualdefault

Member Function Documentation

◆ addErrorToCollectionDummy()

void ErrorCheckerBase::addErrorToCollectionDummy ( int  errorType,
int  fedId,
Word64  word,
SiPixelFormatterErrors errors 
) const
protected

◆ checkCRC()

bool ErrorCheckerBase::checkCRC ( bool &  errorsInEvent,
int  fedId,
const Word64 trailer,
SiPixelFormatterErrors errors 
) const

Definition at line 35 of file ErrorCheckerBase.cc.

References addErrorToCollectionDummy(), sipixelconstants::CRC_mask, sipixelconstants::CRC_shift, and l1tstage2_dqm_sourceclient-live_cfg::fedId.

38  {
39  const int CRC_BIT = (*trailer >> CRC_shift) & CRC_mask;
40  const bool isCRCcorrect = (CRC_BIT == 0);
41  if (!isCRCcorrect)
42  addErrorToCollectionDummy(39, fedId, *trailer, errors);
43  errorsInEvent = (errorsInEvent || !isCRCcorrect);
44  return isCRCcorrect;
45 }
constexpr uint64_t CRC_mask
constexpr uint32_t CRC_shift
Definition: errors.py:1
void addErrorToCollectionDummy(int errorType, int fedId, Word64 word, SiPixelFormatterErrors &errors) const

◆ checkHeader()

bool ErrorCheckerBase::checkHeader ( bool &  errorsInEvent,
int  fedId,
const Word64 header,
SiPixelFormatterErrors errors 
) const

Definition at line 47 of file ErrorCheckerBase.cc.

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

50  {
51  FEDHeader fedHeader(reinterpret_cast<const unsigned char*>(header));
52  const bool fedHeaderCorrect = fedHeader.check();
53  // if not fedHeaderCorrect throw exception?
54  if (fedHeaderCorrect && (fedHeader.sourceID() != fedId)) {
55  int errorType = 32;
57  LogDebug("PixelDataFormatter::interpretRawData, fedHeader.sourceID() != fedId")
58  << ", sourceID = " << fedHeader.sourceID() << ", fedId = " << fedId << ", errorType = " << errorType;
59  errorsInEvent = true;
60  }
61  return fedHeaderCorrect && fedHeader.moreHeaders();
62 }
Definition: errors.py:1
#define LogDebug(id)
void addErrorToCollectionDummy(int errorType, int fedId, Word64 word, SiPixelFormatterErrors &errors) const

◆ checkROC()

virtual bool ErrorCheckerBase::checkROC ( bool &  errorsInEvent,
int  fedId,
const SiPixelFrameConverter converter,
const SiPixelFedCabling theCablingTree,
Word32 errorWord,
SiPixelFormatterErrors errors 
) const
pure virtual

Implemented in ErrorChecker, and ErrorCheckerPhase0.

◆ checkTrailer()

bool ErrorCheckerBase::checkTrailer ( bool &  errorsInEvent,
int  fedId,
unsigned int  nWords,
const Word64 trailer,
SiPixelFormatterErrors errors 
) const

Definition at line 64 of file ErrorCheckerBase.cc.

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

65  {
66  FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
67  const bool fedTrailerCorrect = fedTrailer.check();
68  if (!fedTrailerCorrect) {
69  int errorType = 33;
70  addErrorToCollectionDummy(errorType, fedId, *trailer, errors);
71  LogError("FedTrailerCheck") << "fedTrailer.check failed, Fed: " << fedId << ", errorType = " << errorType;
72  errorsInEvent = true;
73  } else if (fedTrailer.fragmentLength() != nWords) {
74  int errorType = 34;
75  addErrorToCollectionDummy(errorType, fedId, *trailer, errors);
76  LogError("FedTrailerLenght") << "fedTrailer.fragmentLength()!= nWords !! Fed: " << fedId
77  << ", errorType = " << errorType;
78  errorsInEvent = true;
79  }
80  return fedTrailerCorrect && fedTrailer.moreTrailers();
81 }
Log< level::Error, false > LogError
Definition: errors.py:1
void addErrorToCollectionDummy(int errorType, int fedId, Word64 word, SiPixelFormatterErrors &errors) const

◆ conversionError()

void ErrorCheckerBase::conversionError ( int  fedId,
const SiPixelFrameConverter converter,
int  status,
Word32 errorWord,
SiPixelFormatterErrors errors 
) const

Definition at line 83 of file ErrorCheckerBase.cc.

References relativeConstraints::error, errorDetId(), l1tstage2_dqm_sourceclient-live_cfg::fedId, getConversionErrorTypeAndIssueLogMessage(), includeErrors_, and mps_update::status.

87  {
89  // errorType == 0 means unexpected error, in this case we don't include it in the error collection
90  if (errorType && includeErrors_) {
91  SiPixelRawDataError error(errorWord, errorType, fedId);
92  cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
93  errors[detId].push_back(error);
94  }
95 }
virtual cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const =0
unsigned int cms_uint32_t
Definition: typedefs.h:15
int getConversionErrorTypeAndIssueLogMessage(int status, int fedId) const
Definition: errors.py:1
Pixel error – collection of errors and error information.

◆ errorDetId()

virtual cms_uint32_t ErrorCheckerBase::errorDetId ( const SiPixelFrameConverter converter,
int  errorType,
const Word32 word 
) const
protectedpure virtual

Implemented in ErrorChecker, and ErrorCheckerPhase0.

Referenced by conversionError().

◆ getConversionErrorTypeAndIssueLogMessage()

int ErrorCheckerBase::getConversionErrorTypeAndIssueLogMessage ( int  status,
int  fedId 
) const
protected

Definition at line 97 of file ErrorCheckerBase.cc.

References l1tstage2_dqm_sourceclient-live_cfg::fedId, LogDebug, mps_update::status, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by conversionError().

97  {
98  int errorType = 0;
99  std::string debugMessage;
100  switch (status) {
101  case (1): {
102  debugMessage = "invalid channel Id";
103  errorType = 35;
104  break;
105  }
106  case (2): {
107  debugMessage = "invalid ROC Id";
108  errorType = 36;
109  break;
110  }
111  case (3): {
112  debugMessage = "invalid dcol/pixel value";
113  errorType = 37;
114  break;
115  }
116  case (4): {
117  debugMessage = "dcol/pixel read out of order";
118  errorType = 38;
119  break;
120  }
121  };
122  if (errorType) {
123  LogDebug("ErrorChecker::conversionError") << "Fed:" << fedId << debugMessage << "(errorType =" << errorType << ")";
124  } else {
125  LogDebug("ErrorChecker::conversionError") << "cabling check returned unexpected result, status =" << status;
126  }
127  return errorType;
128 }
#define LogDebug(id)

◆ setErrorStatus()

void ErrorCheckerBase::setErrorStatus ( bool  ErrorStatus)

Definition at line 23 of file ErrorCheckerBase.cc.

References includeErrors_.

23 { includeErrors_ = ErrorStatus; }

Member Data Documentation

◆ includeErrors_

bool ErrorCheckerBase::includeErrors_
protected