CMS 3D CMS Logo

RPixErrorChecker.cc
Go to the documentation of this file.
2 
5 
7 
8 using namespace edm;
9 
11 
12 RPixErrorChecker::RPixErrorChecker() { includeErrors_ = false; }
13 
14 void RPixErrorChecker::setErrorStatus(bool errorStatus) { includeErrors_ = errorStatus; }
15 
16 bool RPixErrorChecker::checkCRC(bool& errorsInEvent, int fedId, const Word64* trailer, Errors& errors) const {
17  int CRC_BIT = (*trailer >> CRC_shift) & CRC_mask;
18  if (CRC_BIT == 0)
19  return true;
20  errorsInEvent = true;
21  LogDebug("CRCCheck") << "CRC check failed, errorType = 39";
22  if (includeErrors_) {
23  int errorType = 39;
24  errors[dummyDetId].emplace_back(*trailer, errorType, fedId);
25  }
26  return false;
27 }
28 
29 bool RPixErrorChecker::checkHeader(bool& errorsInEvent, int fedId, const Word64* header, Errors& errors) const {
30  FEDHeader fedHeader(reinterpret_cast<const unsigned char*>(header));
31  if (!fedHeader.check())
32  return false;
33  if (fedHeader.sourceID() != fedId) {
34  LogDebug("CTPPSPixelDataFormatter::interpretRawData, fedHeader.sourceID() != fedId")
35  << ", sourceID = " << fedHeader.sourceID() << ", fedId = " << fedId << ", errorType = 32";
36  errorsInEvent = true;
37  if (includeErrors_) {
38  int errorType = 32;
39  errors[dummyDetId].emplace_back(*header, errorType, fedId);
40  }
41  }
42  return fedHeader.moreHeaders();
43 }
44 
46  bool& errorsInEvent, int fedId, unsigned int nWords, const Word64* trailer, Errors& errors) const {
47  FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
48  if (!fedTrailer.check()) {
49  if (includeErrors_) {
50  int errorType = 33;
51  errors[dummyDetId].emplace_back(*trailer, errorType, fedId);
52  }
53  errorsInEvent = true;
54  LogDebug("FedTrailerCheck") << "fedTrailer.check failed, Fed: " << fedId << ", errorType = 33";
55  return false;
56  }
57  if (fedTrailer.fragmentLength() != nWords) {
58  LogDebug("FedTrailerLenght") << "fedTrailer.fragmentLength()!= nWords !! Fed: " << fedId << ", errorType = 34";
59  errorsInEvent = true;
60  if (includeErrors_) {
61  int errorType = 34;
62  errors[dummyDetId].emplace_back(*trailer, errorType, fedId);
63  }
64  }
65  return fedTrailer.moreTrailers();
66 }
67 
69  bool& errorsInEvent, int fedId, uint32_t iD, const Word32& errorWord, Errors& errors) const {
70  int errorType = (errorWord >> ROC_shift) & ERROR_mask;
71  if LIKELY (errorType < 25)
72  return true;
73 
74  switch (errorType) {
75  case (25): {
76  LogDebug("") << " invalid ROC=25 found (errorType=25)";
77  errorsInEvent = true;
78  break;
79  }
80  case (26): {
81  LogDebug("") << " gap word found (errorType=26)";
82  return false;
83  }
84  case (27): {
85  LogDebug("") << " dummy word found (errorType=27)";
86  return false;
87  }
88  case (28): {
89  LogDebug("") << " error fifo nearly full (errorType=28)";
90  errorsInEvent = true;
91  break;
92  }
93  case (29): {
94  LogDebug("") << " timeout on a channel (errorType=29)";
95  errorsInEvent = true;
96  if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
97  LogDebug("") << " ...first errorType=29 error, this gets masked out";
98  return false;
99  }
100  break;
101  }
102  case (30): {
103  LogDebug("") << " TBM error trailer (errorType=30)";
104  errorsInEvent = true;
105  break;
106  }
107  case (31): {
108  LogDebug("") << " event number error (errorType=31)";
109  errorsInEvent = true;
110  break;
111  }
112  default:
113  return true;
114  };
115 
116  if (includeErrors_) {
118  if (errorType == 30) {
119  uint32_t stateMach_bits = 4;
120  uint32_t stateMach_shift = 8;
121  uint32_t stateMach_mask = ~(~uint32_t(0) << stateMach_bits);
122  uint32_t stateMach = (errorWord >> stateMach_shift) & stateMach_mask;
123  if (stateMach == 4 || stateMach == 9)
124  errorType = 40;
125  }
126 
128  errors[iD].emplace_back(errorWord, errorType, fedId);
129  }
130 
131  return false;
132 }
133 
135  int fedId, uint32_t iD, const State& state, const Word32& errorWord, Errors& errors) const {
136  int errorType = 0;
137 
138  switch (state) {
139  case (InvalidLinkId): {
140  LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " invalid channel Id (errorType=35)";
141  errorType = 35;
142  break;
143  }
144  case (InvalidROCId): {
145  LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " invalid ROC Id (errorType=36)";
146  errorType = 36;
147  break;
148  }
149  case (InvalidPixelId): {
150  LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " invalid dcol/pixel value (errorType=37)";
151  errorType = 37;
152  break;
153  }
154 
155  default:
156  LogDebug("ErrorChecker::conversionError") << " cabling check returned unexpected result, status = " << state;
157  };
158 
159  if (includeErrors_ && errorType > 0)
160  errors[iD].emplace_back(errorWord, errorType, fedId);
161 }
MessageLogger.h
RPixErrorChecker.h
RPixErrorChecker::dummyDetId
static constexpr Word32 dummyDetId
Definition: RPixErrorChecker.h:39
FEDHeader::moreHeaders
bool moreHeaders() const
Definition: FEDHeader.cc:23
RPixErrorChecker::Word64
uint64_t Word64
Definition: RPixErrorChecker.h:20
edm
HLT enums.
Definition: AlignableModifier.h:19
sipixelconstants::dummyDetId
constexpr cms_uint32_t dummyDetId
Definition: SiPixelDigiConstants.h:11
RPixErrorChecker::setErrorStatus
void setErrorStatus(bool errorStatus)
Definition: RPixErrorChecker.cc:14
sipixelconstants::ROC_shift
constexpr uint32_t ROC_shift
Definition: SiPixelDigiConstants.h:26
FEDTrailer::check
bool check() const
Check that the trailer is OK.
Definition: FEDTrailer.cc:45
RPixErrorChecker::conversionError
void conversionError(int fedId, uint32_t iD, const State &state, const Word32 &errorWord, Errors &errors) const
Definition: RPixErrorChecker.cc:134
errors
Definition: errors.py:1
sipixelconstants::OMIT_ERR_shift
constexpr uint32_t OMIT_ERR_shift
Definition: SiPixelDigiConstants.h:28
InvalidPixelId
Definition: RPixErrorChecker.h:15
InvalidLinkId
Definition: RPixErrorChecker.h:15
sipixelconstants::OMIT_ERR_mask
constexpr uint32_t OMIT_ERR_mask
Definition: SiPixelDigiConstants.h:34
RPixErrorChecker::checkHeader
bool checkHeader(bool &errorsInEvent, int fedId, const Word64 *header, Errors &errors) const
Definition: RPixErrorChecker.cc:29
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
FEDTrailer
Definition: FEDTrailer.h:14
InvalidROCId
Definition: RPixErrorChecker.h:15
sipixelconstants::ERROR_mask
constexpr uint32_t ERROR_mask
Definition: SiPixelDigiConstants.h:31
RPixErrorChecker::RPixErrorChecker
RPixErrorChecker()
Definition: RPixErrorChecker.cc:12
State
State
Definition: RPixErrorChecker.h:15
FEDTrailer::moreTrailers
bool moreTrailers() const
Definition: FEDTrailer.cc:21
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:89
RPixErrorChecker::checkROC
bool checkROC(bool &errorsInEvent, int fedId, uint32_t iD, const Word32 &errorWord, Errors &errors) const
Definition: RPixErrorChecker.cc:68
RPixErrorChecker::checkCRC
bool checkCRC(bool &errorsInEvent, int fedId, const Word64 *trailer, Errors &errors) const
Definition: RPixErrorChecker.cc:16
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
RPixErrorChecker::Word32
uint32_t Word32
Definition: RPixErrorChecker.h:19
FEDHeader::check
bool check() const
Check that the header is OK.
Definition: FEDHeader.cc:44
RPixErrorChecker::checkTrailer
bool checkTrailer(bool &errorsInEvent, int fedId, unsigned int nWords, const Word64 *trailer, Errors &errors) const
Definition: RPixErrorChecker.cc:45
FEDHeader::sourceID
uint16_t sourceID() const
Identifier of the FED.
Definition: FEDHeader.cc:19
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:291
FEDHeader
Definition: FEDHeader.h:14
FEDHeader.h
RPixErrorChecker::Errors
std::map< uint32_t, DetErrors > Errors
Definition: RPixErrorChecker.h:23
sipixelconstants::CRC_shift
constexpr uint32_t CRC_shift
Definition: SiPixelDigiConstants.h:22
FEDTrailer::fragmentLength
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
Definition: FEDTrailer.cc:13
FEDTrailer.h
sipixelconstants::CRC_mask
constexpr uint64_t CRC_mask
Definition: SiPixelDigiConstants.h:30