Skip to content

Commit

Permalink
Merge pull request #42033 from sroychow/sipixelErrorCheckerUpdate_fro…
Browse files Browse the repository at this point in the history
…m-CMSSW_13_0_0

[13.0.X] Fixed channel decoding for the timeout error in SiPixel RawToDigi
  • Loading branch information
cmsbuild authored Jun 26, 2023
2 parents 26651f7 + 1e8b5fd commit 8d8e22c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 12 deletions.
4 changes: 4 additions & 0 deletions EventFilter/SiPixelRawToDigi/interface/ErrorChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class ErrorChecker : public ErrorCheckerBase {

protected:
cms_uint32_t errorDetId(const SiPixelFrameConverter* converter, int errorType, const Word32& word) const override;
cms_uint32_t errorDetIdSimple(const SiPixelFrameConverter* converter,
int errorType,
unsigned int channel,
unsigned int roc) const;
};

#endif // EventFilter_SiPixelRawToDigi_interface_ErrorChecker_h
58 changes: 46 additions & 12 deletions EventFilter/SiPixelRawToDigi/src/ErrorChecker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ bool ErrorChecker::checkROC(bool& errorsInEvent,
int errorType = (errorWord >> ROC_shift) & ERROR_mask;
if LIKELY (errorType < 25)
return true;
unsigned int channel = (errorWord >> LINK_shift) & LINK_mask;
unsigned int roc = 1;

switch (errorType) {
case (25): {
CablingPathToDetUnit cablingPath = {unsigned(fedId), (errorWord >> LINK_shift) & LINK_mask, 1};
if (!theCablingTree->findItem(cablingPath))
CablingPathToDetUnit cablingPath = {unsigned(fedId), channel, 1};
if (!theCablingTree->findItem(cablingPath)) {
return false;
}
LogDebug("") << " invalid ROC=25 found (errorType=25)";
errorsInEvent = true;
break;
Expand All @@ -55,8 +58,8 @@ bool ErrorChecker::checkROC(bool& errorsInEvent,
case (29): {
LogDebug("") << " timeout on a channel (errorType=29)";
errorsInEvent = true;
if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
LogDebug("") << " ...first errorType=29 error, this gets masked out";
if (!((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask)) { //exit on the 2nd TO word
LogDebug("") << " ...2nd errorType=29 error, skip";
return false;
}
break;
Expand All @@ -81,25 +84,52 @@ bool ErrorChecker::checkROC(bool& errorsInEvent,
errorsInEvent = true;
break;
}
case (37):
case (38): {
roc = (errorWord >> ROC_shift) & ROC_mask;
break;
}
default:
return true;
};

if (includeErrors_) {
// store error
SiPixelRawDataError error(errorWord, errorType, fedId);
cms_uint32_t detId;
detId = errorDetId(converter, errorType, errorWord);
cms_uint32_t detId = errorDetIdSimple(converter, errorType, channel, roc);
errors[detId].push_back(error);
}
return false;
}

// new, simpler version
cms_uint32_t ErrorChecker::errorDetIdSimple(const SiPixelFrameConverter* converter,
int errorType,
unsigned int channel,
unsigned int roc) const {
if (!converter) {
return dummyDetId;
}

ElectronicIndex cabling;
DetectorIndex detIdx;
cabling.dcol = 0;
cabling.pxid = 2;
cabling.roc = roc;
cabling.link = channel;
int status = converter->toDetector(cabling, detIdx);
if (!status) {
return detIdx.rawId;
} // all OK return valid module id

return dummyDetId; // failed, return dummy
}

// this function finds the detId for an error word that cannot be processed in word2digi
cms_uint32_t ErrorChecker::errorDetId(const SiPixelFrameConverter* converter, int errorType, const Word32& word) const {
if (!converter)
if (!converter) {
return dummyDetId;

}
ElectronicIndex cabling;

switch (errorType) {
Expand All @@ -116,8 +146,9 @@ cms_uint32_t ErrorChecker::errorDetId(const SiPixelFrameConverter* converter, in

DetectorIndex detIdx;
int status = converter->toDetector(cabling, detIdx);
if (!status)
if (!status) {
return detIdx.rawId;
}
break;
}
case 29: {
Expand All @@ -143,18 +174,20 @@ cms_uint32_t ErrorChecker::errorDetId(const SiPixelFrameConverter* converter, in
chanNmbr = (BLOCK / 2) * 9 + localCH;
else
chanNmbr = ((BLOCK - 1) / 2) * 9 + 4 + localCH;
if ((chanNmbr < 1) || (chanNmbr > 36))
break; // signifies unexpected result

if ((chanNmbr < 1) || (chanNmbr > 36)) {
break; // signifies unexpected result WRONG!
}
// set dummy values for cabling just to get detId from link if in Barrel
cabling.dcol = 0;
cabling.pxid = 2;
cabling.roc = 1;
cabling.link = chanNmbr;
DetectorIndex detIdx;
int status = converter->toDetector(cabling, detIdx);
if (!status)
if (!status) {
return detIdx.rawId;
}
break;
}
case 37:
Expand All @@ -175,5 +208,6 @@ cms_uint32_t ErrorChecker::errorDetId(const SiPixelFrameConverter* converter, in
default:
break;
};

return dummyDetId;
}

0 comments on commit 8d8e22c

Please sign in to comment.