CMS 3D CMS Logo

ErrorCheckerBase.cc
Go to the documentation of this file.
2 
4 
9 
11 
12 #include <bitset>
13 #include <sstream>
14 #include <iostream>
15 
16 using namespace std;
17 using namespace edm;
18 using namespace sipixelobjects;
19 using namespace sipixelconstants;
20 
22 
23 void ErrorCheckerBase::setErrorStatus(bool ErrorStatus) { includeErrors_ = ErrorStatus; }
24 
26  int fedId,
27  Word64 word,
29  if (includeErrors_) {
30  SiPixelRawDataError error(word, errorType, fedId);
32  }
33 }
34 
35 bool ErrorCheckerBase::checkCRC(bool& errorsInEvent,
36  int fedId,
37  const Word64* trailer,
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 }
46 
47 bool ErrorCheckerBase::checkHeader(bool& errorsInEvent,
48  int fedId,
49  const Word64* header,
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 }
63 
65  bool& errorsInEvent, int fedId, unsigned int nWords, const Word64* trailer, SiPixelFormatterErrors& errors) const {
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 }
82 
85  int status,
86  Word32& errorWord,
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 }
96 
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 }
cms_uint32_t
unsigned int cms_uint32_t
Definition: typedefs.h:15
PixelSubdetector.h
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
FEDHeader::moreHeaders
bool moreHeaders() const
Definition: FEDHeader.cc:23
SiPixelRawDataError
Pixel error – collection of errors and error information.
Definition: SiPixelRawDataError.h:19
ErrorCheckerBase::includeErrors_
bool includeErrors_
Definition: ErrorCheckerBase.h:43
ErrorCheckerBase::addErrorToCollectionDummy
void addErrorToCollectionDummy(int errorType, int fedId, Word64 word, SiPixelFormatterErrors &errors) const
Definition: ErrorCheckerBase.cc:25
mps_update.status
status
Definition: mps_update.py:68
converter
Definition: CandidateProducer.h:25
edm
HLT enums.
Definition: AlignableModifier.h:19
sipixelconstants::dummyDetId
constexpr cms_uint32_t dummyDetId
Definition: SiPixelDigiConstants.h:11
ErrorCheckerBase::setErrorStatus
void setErrorStatus(bool ErrorStatus)
Definition: ErrorCheckerBase.cc:23
relativeConstraints.error
error
Definition: relativeConstraints.py:53
FEDTrailer::check
bool check() const
Check that the trailer is OK.
Definition: FEDTrailer.cc:45
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
ErrorCheckerBase::checkTrailer
bool checkTrailer(bool &errorsInEvent, int fedId, unsigned int nWords, const Word64 *trailer, SiPixelFormatterErrors &errors) const
Definition: ErrorCheckerBase.cc:64
errors
Definition: errors.py:1
sipixelobjects
Definition: CablingPathToDetUnit.h:4
Word64
cms_uint64_t Word64
Definition: SiPixelDigiConstants.h:7
sipixelconstants
Definition: SiPixelDigiConstants.h:10
ErrorCheckerBase::errorDetId
virtual cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const =0
ErrorCheckerBase::getConversionErrorTypeAndIssueLogMessage
int getConversionErrorTypeAndIssueLogMessage(int status, int fedId) const
Definition: ErrorCheckerBase.cc:97
ErrorCheckerBase::checkHeader
bool checkHeader(bool &errorsInEvent, int fedId, const Word64 *header, SiPixelFormatterErrors &errors) const
Definition: ErrorCheckerBase.cc:47
SiPixelFrameConverter.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
FEDTrailer
Definition: FEDTrailer.h:14
ErrorCheckerBase::conversionError
void conversionError(int fedId, const SiPixelFrameConverter *converter, int status, Word32 &errorWord, SiPixelFormatterErrors &errors) const
Definition: ErrorCheckerBase.cc:83
ErrorCheckerBase::ErrorCheckerBase
ErrorCheckerBase()
Definition: ErrorCheckerBase.cc:21
FEDTrailer::moreTrailers
bool moreTrailers() const
Definition: FEDTrailer.cc:21
SiPixelFrameConverter
Definition: SiPixelFrameConverter.h:15
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:89
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ErrorCheckerBase.h
Word32
cms_uint32_t Word32
Definition: SiPixelDigiConstants.h:8
std
Definition: JetResolutionObject.h:76
DetId.h
FEDHeader::check
bool check() const
Check that the header is OK.
Definition: FEDHeader.cc:44
SiPixelFormatterErrors
std::map< cms_uint32_t, std::vector< SiPixelRawDataError > > SiPixelFormatterErrors
Definition: SiPixelFormatterErrors.h:10
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
ErrorCheckerBase::checkCRC
bool checkCRC(bool &errorsInEvent, int fedId, const Word64 *trailer, SiPixelFormatterErrors &errors) const
Definition: ErrorCheckerBase.cc:35
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