#include <EventFilter/SiPixelRawToDigi/interface/ErrorChecker.h>
Public Types | |
typedef std::vector < SiPixelRawDataError > | DetErrors |
typedef std::map< uint32_t, DetErrors > | Errors |
typedef unsigned int | Word32 |
typedef long long | Word64 |
Public Member Functions | |
bool | checkCRC (bool &errorsInEvent, int fedId, const Word64 *trailer, Errors &errors) |
bool | checkHeader (bool &errorsInEvent, int fedId, const Word64 *header, Errors &errors) |
bool | checkROC (bool &errorsInEvent, int fedId, const SiPixelFrameConverter *converter, Word32 &errorWord, Errors &errors) |
bool | checkTrailer (bool &errorsInEvent, int fedId, int nWords, const Word64 *trailer, Errors &errors) |
void | conversionError (int fedId, const SiPixelFrameConverter *converter, int status, Word32 &errorWord, Errors &errors) |
ErrorChecker () | |
void | setErrorStatus (bool ErrorStatus) |
Private Member Functions | |
uint32_t | errorDetId (const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const |
Private Attributes | |
bool | includeErrors |
Static Private Attributes | |
static const int | ADC_bits = 8 |
static const int | ADC_shift = 0 |
static const int | DCOL_bits = 5 |
static const int | DCOL_shift = PXID_shift + PXID_bits |
static const uint32_t | dummyDetId = 0xffffffff |
static const int | LINK_bits = 6 |
static const int | LINK_shift = ROC_shift + ROC_bits |
static const int | PXID_bits = 8 |
static const int | PXID_shift = ADC_shift + ADC_bits |
static const int | ROC_bits = 5 |
static const int | ROC_shift = DCOL_shift + DCOL_bits |
Definition at line 18 of file ErrorChecker.h.
typedef std::vector<SiPixelRawDataError> ErrorChecker::DetErrors |
Definition at line 23 of file ErrorChecker.h.
typedef std::map<uint32_t, DetErrors> ErrorChecker::Errors |
Definition at line 24 of file ErrorChecker.h.
typedef unsigned int ErrorChecker::Word32 |
Definition at line 21 of file ErrorChecker.h.
typedef long long ErrorChecker::Word64 |
Definition at line 22 of file ErrorChecker.h.
ErrorChecker::ErrorChecker | ( | ) |
Definition at line 35 of file ErrorChecker.cc.
References includeErrors.
00035 { 00036 includeErrors = false; 00037 }
bool ErrorChecker::checkCRC | ( | bool & | errorsInEvent, | |
int | fedId, | |||
const Word64 * | trailer, | |||
Errors & | errors | |||
) |
Definition at line 44 of file ErrorChecker.cc.
References dummyDetId, error, and includeErrors.
Referenced by PixelDataFormatter::interpretRawData().
00045 { 00046 int CRC_bits = 1; 00047 int CRC_shift = 2; 00048 Word64 CRC_mask = ~(~Word64(0) << CRC_bits); 00049 int CRC_BIT = (*trailer >> CRC_shift) & CRC_mask; 00050 if (CRC_BIT == 0) return true; 00051 errorsInEvent = true; 00052 if (includeErrors) { 00053 int errorType = 39; 00054 SiPixelRawDataError error(*trailer, errorType, fedId); 00055 errors[dummyDetId].push_back(error); 00056 } 00057 return false; 00058 }
bool ErrorChecker::checkHeader | ( | bool & | errorsInEvent, | |
int | fedId, | |||
const Word64 * | header, | |||
Errors & | errors | |||
) |
Definition at line 60 of file ErrorChecker.cc.
References FEDHeader::check(), dummyDetId, error, includeErrors, LogDebug, FEDHeader::moreHeaders(), and FEDHeader::sourceID().
Referenced by PixelDataFormatter::interpretRawData().
00061 { 00062 FEDHeader fedHeader( reinterpret_cast<const unsigned char*>(header)); 00063 if ( !fedHeader.check() ) return false; // throw exception? 00064 if ( fedHeader.sourceID() != fedId) { 00065 LogDebug("PixelDataFormatter::interpretRawData, fedHeader.sourceID() != fedId") 00066 <<", sourceID = " <<fedHeader.sourceID() 00067 <<", fedId = "<<fedId<<", errorType = 32"; 00068 errorsInEvent = true; 00069 if (includeErrors) { 00070 int errorType = 32; 00071 SiPixelRawDataError error(*header, errorType, fedId); 00072 errors[dummyDetId].push_back(error); 00073 } 00074 } 00075 return fedHeader.moreHeaders(); 00076 }
bool ErrorChecker::checkROC | ( | bool & | errorsInEvent, | |
int | fedId, | |||
const SiPixelFrameConverter * | converter, | |||
Word32 & | errorWord, | |||
Errors & | errors | |||
) |
Definition at line 104 of file ErrorChecker.cc.
References detId, error, errorDetId(), includeErrors, LogDebug, ROC_bits, and ROC_shift.
Referenced by PixelDataFormatter::interpretRawData().
00105 { 00106 static const Word32 ERROR_mask = ~(~Word32(0) << ROC_bits); 00107 int errorType = (errorWord >> ROC_shift) & ERROR_mask; 00108 00109 switch (errorType) { 00110 case(25) : { 00111 LogDebug("")<<" invalid ROC=25 found (errorType=25)"; 00112 errorsInEvent = true; 00113 break; 00114 } 00115 case(26) : { 00116 //LogDebug("")<<" gap word found (errorType=26)"; 00117 return false; 00118 } 00119 case(27) : { 00120 //LogDebug("")<<" dummy word found (errorType=27)"; 00121 return false; 00122 } 00123 case(28) : { 00124 LogDebug("")<<" error fifo nearly full (errorType=28)"; 00125 errorsInEvent = true; 00126 break; 00127 } 00128 case(29) : { 00129 LogDebug("")<<" timeout on a channel (errorType=29)"; 00130 errorsInEvent = true; 00131 break; 00132 } 00133 case(30) : { 00134 LogDebug("")<<" TBM error trailer (errorType=30)"; 00135 errorsInEvent = true; 00136 break; 00137 } 00138 case(31) : { 00139 LogDebug("")<<" event number error (errorType=31)"; 00140 errorsInEvent = true; 00141 break; 00142 } 00143 default: return true; 00144 }; 00145 00146 if(includeErrors) { 00147 SiPixelRawDataError error(errorWord, errorType, fedId); 00148 uint32_t detId; 00149 detId = errorDetId(converter, errorType, errorWord); 00150 errors[detId].push_back(error); 00151 } 00152 return false; 00153 }
bool ErrorChecker::checkTrailer | ( | bool & | errorsInEvent, | |
int | fedId, | |||
int | nWords, | |||
const Word64 * | trailer, | |||
Errors & | errors | |||
) |
Definition at line 78 of file ErrorChecker.cc.
References FEDTrailer::check(), dummyDetId, error, includeErrors, FEDTrailer::lenght(), and FEDTrailer::moreTrailers().
Referenced by PixelDataFormatter::interpretRawData().
00079 { 00080 FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer)); 00081 if ( !fedTrailer.check()) { 00082 if(includeErrors) { 00083 int errorType = 33; 00084 SiPixelRawDataError error(*trailer, errorType, fedId); 00085 errors[dummyDetId].push_back(error); 00086 } 00087 errorsInEvent = true; 00088 LogError("PixelDataFormatter::interpretRawData, fedTrailer.check: ") 00089 <<"fedTrailer.check failed, Fed: " << fedId << ", errorType = 33"; 00090 return false; 00091 } 00092 if ( fedTrailer.lenght()!= nWords) { 00093 LogError("PROBLEM in PixelDataFormatter, fedTrailer.lenght()!= nWords !!")<< " Fed: " << fedId << ", errorType = 34"; 00094 errorsInEvent = true; 00095 if(includeErrors) { 00096 int errorType = 34; 00097 SiPixelRawDataError error(*trailer, errorType, fedId); 00098 errors[dummyDetId].push_back(error); 00099 } 00100 } 00101 return fedTrailer.moreTrailers(); 00102 }
void ErrorChecker::conversionError | ( | int | fedId, | |
const SiPixelFrameConverter * | converter, | |||
int | status, | |||
Word32 & | errorWord, | |||
Errors & | errors | |||
) |
Definition at line 155 of file ErrorChecker.cc.
References detId, error, errorDetId(), includeErrors, and LogDebug.
Referenced by PixelDataFormatter::interpretRawData().
00156 { 00157 switch (status) { 00158 case(1) : { 00159 LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " invalid channel Id (errorType=35)"; 00160 if(includeErrors) { 00161 int errorType = 35; 00162 SiPixelRawDataError error(errorWord, errorType, fedId); 00163 uint32_t detId = errorDetId(converter, errorType, errorWord); 00164 errors[detId].push_back(error); 00165 } 00166 break; 00167 } 00168 case(2) : { 00169 LogDebug("ErrorChecker::conversionError")<< " Fed: " << fedId << " invalid ROC Id (errorType=36)"; 00170 if(includeErrors) { 00171 int errorType = 36; 00172 SiPixelRawDataError error(errorWord, errorType, fedId); 00173 uint32_t detId = errorDetId(converter, errorType, errorWord); 00174 errors[detId].push_back(error); 00175 } 00176 break; 00177 } 00178 case(3) : { 00179 LogDebug("ErrorChecker::conversionError")<< " Fed: " << fedId << " invalid dcol/pixel value (errorType=37)"; 00180 if(includeErrors) { 00181 int errorType = 37; 00182 SiPixelRawDataError error(errorWord, errorType, fedId); 00183 uint32_t detId = errorDetId(converter, errorType, errorWord); 00184 errors[detId].push_back(error); 00185 } 00186 break; 00187 } 00188 case(4) : { 00189 LogDebug("ErrorChecker::conversionError")<< " Fed: " << fedId << " dcol/pixel read out of order (errorType=38)"; 00190 if(includeErrors) { 00191 int errorType = 38; 00192 SiPixelRawDataError error(errorWord, errorType, fedId); 00193 uint32_t detId = errorDetId(converter, errorType, errorWord); 00194 errors[detId].push_back(error); 00195 } 00196 break; 00197 } 00198 default: LogDebug("ErrorChecker::conversionError")<<" cabling check returned unexpected result, status = "<< status; 00199 }; 00200 }
uint32_t ErrorChecker::errorDetId | ( | const SiPixelFrameConverter * | converter, | |
int | errorType, | |||
const Word32 & | word | |||
) | const [private] |
Definition at line 203 of file ErrorChecker.cc.
References sipixelobjects::ElectronicIndex::dcol, DCOL_bits, DetId::DetId(), dummyDetId, sipixelobjects::ElectronicIndex::link, LINK_bits, LINK_shift, PixelSubdetector::PixelBarrel, sipixelobjects::ElectronicIndex::pxid, PXID_bits, sipixelobjects::DetectorIndex::rawId, sipixelobjects::ElectronicIndex::roc, ROC_bits, ROC_shift, StDecayID::status, and SiPixelFrameConverter::toDetector().
Referenced by checkROC(), and conversionError().
00205 { 00206 if (!converter) return dummyDetId; 00207 00208 ElectronicIndex cabling; 00209 00210 static const Word32 LINK_mask = ~(~Word32(0) << LINK_bits); 00211 static const Word32 ROC_mask = ~(~Word32(0) << ROC_bits); 00212 static const Word32 DCOL_mask = ~(~Word32(0) << DCOL_bits); 00213 static const Word32 PXID_mask = ~(~Word32(0) << PXID_bits); 00214 00215 switch (errorType) { 00216 case 30 : case 31: case 36: { 00217 // set dummy values for cabling just to get detId from link if in Barrel 00218 cabling.dcol = 0; 00219 cabling.pxid = 2; 00220 cabling.roc = 1; 00221 cabling.link = (word >> LINK_shift) & LINK_mask; 00222 00223 DetectorIndex detIdx; 00224 int status = converter->toDetector(cabling, detIdx); 00225 00226 if(DetId::DetId(detIdx.rawId).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) return detIdx.rawId; 00227 break; 00228 } 00229 case 37 : case 38: { 00230 cabling.dcol = 0; 00231 cabling.pxid = 2; 00232 cabling.roc = (word >> ROC_shift) & ROC_mask; 00233 cabling.link = (word >> LINK_shift) & LINK_mask; 00234 00235 DetectorIndex detIdx; 00236 int status = converter->toDetector(cabling, detIdx); 00237 00238 return detIdx.rawId; 00239 break; 00240 } 00241 default : break; 00242 }; 00243 return dummyDetId; 00244 }
Definition at line 39 of file ErrorChecker.cc.
References includeErrors.
Referenced by PixelDataFormatter::setErrorStatus().
00040 { 00041 includeErrors = ErrorStatus; 00042 }
const int ErrorChecker::ADC_bits = 8 [static, private] |
Definition at line 48 of file ErrorChecker.h.
const int ErrorChecker::ADC_shift = 0 [static, private] |
Definition at line 49 of file ErrorChecker.h.
const int ErrorChecker::DCOL_bits = 5 [static, private] |
const int ErrorChecker::DCOL_shift = PXID_shift + PXID_bits [static, private] |
Definition at line 49 of file ErrorChecker.h.
const uint32_t ErrorChecker::dummyDetId = 0xffffffff [static, private] |
Definition at line 50 of file ErrorChecker.h.
Referenced by checkCRC(), checkHeader(), checkTrailer(), and errorDetId().
bool ErrorChecker::includeErrors [private] |
Definition at line 43 of file ErrorChecker.h.
Referenced by checkCRC(), checkHeader(), checkROC(), checkTrailer(), conversionError(), ErrorChecker(), and setErrorStatus().
const int ErrorChecker::LINK_bits = 6 [static, private] |
const int ErrorChecker::LINK_shift = ROC_shift + ROC_bits [static, private] |
const int ErrorChecker::PXID_bits = 8 [static, private] |
const int ErrorChecker::PXID_shift = ADC_shift + ADC_bits [static, private] |
Definition at line 49 of file ErrorChecker.h.
const int ErrorChecker::ROC_bits = 5 [static, private] |
const int ErrorChecker::ROC_shift = DCOL_shift + DCOL_bits [static, private] |