Skip to content

Commit 30906bd

Browse files
aferrero2707aphecetche
authored andcommitted
[MCH] introduce digit time errors
The code introduces a check of the digit time values in the data decoder, and two new error codes to notify when the digit time is not ok: - ErrorInvalidDigitTime is emitted when the digit time is equal to DataDecoder::tfTimeInvalid - ErrorBadDigitTime is emitted when the digit time is outside user-defined limits The acceptable limits are expressed in units of orbits since the start of time-frame, and can be set via the MCHCoDecParam interface.
1 parent 8ff5013 commit 30906bd

6 files changed

Lines changed: 52 additions & 1 deletion

File tree

Detectors/MUON/MCH/Raw/Common/include/MCHRawCommon/CoDecParam.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ struct CoDecParam : public o2::conf::ConfigurableParamHelper<CoDecParam> {
2222

2323
int sampaBcOffset = 0; // default global sampa bunch-crossing offset
2424

25+
// default minimum allowed digit time, in orbit units
26+
int minDigitOrbitAccepted = -10;
27+
// default maximum allowed digit time, in orbit units
28+
// a negative value forces the value to be equal to the time-frame length
29+
int maxDigitOrbitAccepted = -1;
30+
2531
O2ParamDef(CoDecParam, "MCHCoDecParam")
2632
};
2733

Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/DataDecoder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class DataDecoder
180180
/// Compute the time of all the digits that have been decoded in the current TimeFrame
181181
void computeDigitsTimeBCRst();
182182
void computeDigitsTime();
183+
void checkDigitsTime(int minDigitTimeAccepted, int maxDigitTimeAccepted);
183184

184185
/// Get the vector of digits that have been decoded in the current TimeFrame
185186
const RawDigitVector& getDigits() const { return mDigits; }

Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/ErrorCodes.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ enum ErrorCodes {
3232
ErrorTruncatedData = 1 << 7, // 128
3333
ErrorBadELinkID = 1 << 8, // 256
3434
ErrorBadLinkID = 1 << 9, // 512
35-
ErrorUnknownLinkID = 1 << 10 // 1024
35+
ErrorUnknownLinkID = 1 << 10, // 1024
36+
ErrorBadDigitTime = 1 << 11, // 2048
37+
ErrorInvalidDigitTime = 1 << 12 // 4096
38+
3639
};
3740

41+
uint32_t getErrorCodesSize();
42+
3843
std::string errorCodeAsString(uint32_t code);
3944

4045
} // namespace raw

Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,31 @@ void DataDecoder::computeDigitsTimeBCRst()
824824

825825
//_________________________________________________________________________________________________
826826

827+
void DataDecoder::checkDigitsTime(int minDigitOrbitAccepted, int maxDigitOrbitAccepted)
828+
{
829+
if (maxDigitOrbitAccepted < 0) {
830+
maxDigitOrbitAccepted = mOrbitsInTF - 1;
831+
}
832+
833+
for (auto& digit : mDigits) {
834+
auto& d = digit.digit;
835+
auto& info = digit.info;
836+
auto tfTime = d.getTime();
837+
if (tfTime == DataDecoder::tfTimeInvalid) {
838+
// add invalid digit time error
839+
mErrors.emplace_back(o2::mch::DecoderError(info.solar, info.ds, info.chip, ErrorInvalidDigitTime));
840+
} else {
841+
auto orbit = tfTime / o2::constants::lhc::LHCMaxBunches;
842+
if (orbit < minDigitOrbitAccepted || orbit > maxDigitOrbitAccepted) {
843+
// add bad digit time error
844+
mErrors.emplace_back(o2::mch::DecoderError(info.solar, info.ds, info.chip, ErrorBadDigitTime));
845+
}
846+
}
847+
}
848+
}
849+
850+
//_________________________________________________________________________________________________
851+
827852
void DataDecoder::computeDigitsTime()
828853
{
829854
switch (mTimeRecoMode) {

Detectors/MUON/MCH/Raw/Decoder/src/ErrorCodes.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ namespace mch
1818
namespace raw
1919
{
2020

21+
uint32_t getErrorCodesSize()
22+
{
23+
return 13;
24+
}
25+
2126
void append(const char* msg, std::string& to)
2227
{
2328
std::string s = to.size() ? "& " + to : "";
@@ -65,6 +70,12 @@ std::string errorCodeAsString(uint32_t ec)
6570
if (ec & ErrorUnknownLinkID) {
6671
append("Unknown Link ID", msg);
6772
}
73+
if (ec & ErrorBadDigitTime) {
74+
append("Bad Digit Time", msg);
75+
}
76+
if (ec & ErrorInvalidDigitTime) {
77+
append("Invalid Digit Time", msg);
78+
}
6879
return msg;
6980
}
7081

Detectors/MUON/MCH/Workflow/src/DataDecoderSpec.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ class DataDecoderTask
241241
}
242242
}
243243
mDecoder->computeDigitsTime();
244+
int minDigitOrbitAccepted = CoDecParam::Instance().minDigitOrbitAccepted;
245+
int maxDigitOrbitAccepted = CoDecParam::Instance().maxDigitOrbitAccepted;
246+
mDecoder->checkDigitsTime(minDigitOrbitAccepted, maxDigitOrbitAccepted);
244247
auto tEnd = std::chrono::high_resolution_clock::now();
245248
mTimeDecoding += tEnd - tStart;
246249

0 commit comments

Comments
 (0)