Fixing logging messages in AliHLTMUONTriggerReconstructor.
fNofBChannel(NULL),
fNofNBChannel(NULL),
fNofFiredDetElem(0),
- fIdToEntry()
+ fIdToEntry(),
+ fRecoveryMode(kDontTryRecover)
{
/// Default constructor
}
-void AliHLTMUONHitReconstructor::TryRecover(bool value)
+void AliHLTMUONHitReconstructor::TryRecover(ERecoveryMode mode)
{
/// Sets if the decoder should enable the error recovery logic.
- fHLTMUONDecoder.TryRecover(value);
- fHLTMUONDecoder.ExitOnError(not value);
- fHLTMUONDecoder.GetHandler().WarnOnly(value);
+ // Here we setup the various flags to control exactly how the DDL raw data
+ // decoder will behave and what output is generated during errors.
+ fRecoveryMode = mode;
+ switch (mode)
+ {
+ case kRecoverFull:
+ fHLTMUONDecoder.TryRecover(true);
+ fHLTMUONDecoder.ExitOnError(false);
+ fHLTMUONDecoder.GetHandler().WarnOnly(true);
+ fHLTMUONDecoder.GetHandler().PrintParityErrorAsWarning(true);
+ break;
+ case kRecoverJustSkip:
+ fHLTMUONDecoder.TryRecover(false);
+ fHLTMUONDecoder.ExitOnError(false);
+ fHLTMUONDecoder.GetHandler().WarnOnly(true);
+ fHLTMUONDecoder.GetHandler().PrintParityErrorAsWarning(true);
+ break;
+ case kRecoverFromParityErrorsOnly:
+ fHLTMUONDecoder.TryRecover(false);
+ fHLTMUONDecoder.ExitOnError(false);
+ fHLTMUONDecoder.GetHandler().WarnOnly(false);
+ fHLTMUONDecoder.GetHandler().PrintParityErrorAsWarning(true);
+ break;
+ default:
+ fRecoveryMode = kDontTryRecover;
+ fHLTMUONDecoder.TryRecover(false);
+ fHLTMUONDecoder.ExitOnError(true);
+ fHLTMUONDecoder.GetHandler().WarnOnly(false);
+ fHLTMUONDecoder.GetHandler().PrintParityErrorAsWarning(false);
+ break;
+ }
}
if(!fHLTMUONDecoder.Decode(rawData,bufferSize))
{
- if (TryRecover())
+ switch (TryRecover())
{
+ case kRecoverFull:
HLTWarning("There was a problem with the raw data."
" Recovered as much data as possible."
- " Will continue processing next event."
+ " Will continue processing the next event."
);
- }
- else
- {
- HLTError("Cannot decode the DDL.");
+ break;
+ case kRecoverJustSkip:
+ HLTWarning("There was a problem with the raw data."
+ " Skipped corrupted data structures."
+ " Will continue processing the next event."
+ );
+ break;
+ case kRecoverFromParityErrorsOnly:
+ if (fHLTMUONDecoder.GetHandler().NonParityErrorFound())
+ {
+ HLTError("Failed to decode the tracker DDL raw data.");
+ return false;
+ }
+ HLTWarning("Found parity errors in the raw data,"
+ " but will continue processing."
+ );
+ break;
+ default:
+ HLTError("Failed to decode the tracker DDL raw data.");
return false;
}
}
fCharge(0.0),
fIdManuChannel(0x0),
fLutEntry(0),
- fWarnOnly(false)
+ fWarnOnly(false),
+ fSkipParityErrors(false),
+ fDontPrintParityErrors(false),
+ fPrintParityErrorAsWarning(false),
+ fNonParityErrorFound(false)
{
// ctor
}
fDataCount = 1;
*fNofFiredDetElem = 0;
fPrevDetElemId = 0 ;
+ fNonParityErrorFound = false;
};
/// \param location A pointer to the location in the raw data buffer
/// where the problem was found.
+ if (code != kParityError) fNonParityErrorFound = true;
+ if (fDontPrintParityErrors and code == kParityError) return;
+
long bytepos = long(location) - long(fBufferStart) + sizeof(AliRawDataHeader);
- HLTError("There is a problem with decoding the raw data. %s (Error code: %d, at byte %d)",
- ErrorCodeToMessage(code), code, bytepos
- );
+ if (fWarnOnly or (fPrintParityErrorAsWarning and code == kParityError))
+ {
+ HLTWarning("There is a problem with decoding the raw data."
+ " %s (Error code: %d, at byte %d). Trying to recover from corrupt data.",
+ ErrorCodeToMessage(code), code, bytepos
+ );
+ }
+ else
+ {
+ HLTError("There is a problem with decoding the raw data. %s (Error code: %d, at byte %d)",
+ ErrorCodeToMessage(code), code, bytepos
+ );
+ }
};
-void AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::OnData(UInt_t dataWord, bool /*parityError*/)
+void AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::OnData(UInt_t dataWord, bool parityError)
{
//function to arrange the decoded Raw Data
+ if (fSkipParityErrors and parityError) return;
+
fIdManuChannel = 0x0;
fIdManuChannel = (fIdManuChannel|fBusPatchId)<<17;
fIdManuChannel |= (dataWord >> 12) & 0x1FFFF;
static AliHLTInt32_t GetkNofDDL() { return fgkNofDDL; }
static AliHLTInt32_t GetkDDLHeaderSize() { return fgkDDLHeaderSize; }
- /// Returns true if the decoder is set to enable recovery logic if
+ /// The error recovery mode used for TryRecover.
+ enum ERecoveryMode
+ {
+ kDontTryRecover = 0, /// Will not try recover from errors.
+ kRecoverFull, /// Try recover from all errors.
+ kRecoverJustSkip, /// Just skip any corrupt structures.
+ kRecoverFromParityErrorsOnly /// Recover only from parity errors.
+ };
+
+ /// Returns the recovery mode used for the TryRecover option.
+ /// This controls if the decoder is set to enable recovery logic if
/// raw data errors are found.
- bool TryRecover() const { return fHLTMUONDecoder.TryRecover(); };
+ ERecoveryMode TryRecover() const { return fRecoveryMode; }
+
+ /// Sets if the decoder should enable the error recovery logic and how.
+ void TryRecover(ERecoveryMode mode);
- /// Sets if the decoder should enable the error recovery logic.
- void TryRecover(bool value);
+ /// Returns true if ADC digits with parity errors are skipped.
+ bool SkipParityErrors() const { return fHLTMUONDecoder.GetHandler().SkipParityErrors(); }
+
+ /// Sets the flag indicating if ADC digits with parity errors are skipped.
+ void SkipParityErrors(bool value) { fHLTMUONDecoder.GetHandler().SkipParityErrors(value); }
+
+ /// Returns true if messages about parity errors are not printed.
+ bool DontPrintParityErrors() const { return fHLTMUONDecoder.GetHandler().DontPrintParityErrors(); }
+
+ /// Sets the flag indicating if messages about parity errors are not printed.
+ void DontPrintParityErrors(bool value) { fHLTMUONDecoder.GetHandler().DontPrintParityErrors(value); }
private:
* warnings rather than error messages.
*/
void WarnOnly(bool value) { fWarnOnly = value; }
+
+ /**
+ * Returns true if ADC digits with parity errors are skipped.
+ */
+ bool SkipParityErrors() const { return fSkipParityErrors; }
+
+ /**
+ * Sets the flag indicating if ADC digits with parity errors are skipped.
+ */
+ void SkipParityErrors(bool value) { fSkipParityErrors = value; }
+
+ /**
+ * Returns true if messages about parity errors are not printed.
+ */
+ bool DontPrintParityErrors() const { return fDontPrintParityErrors; }
+
+ /**
+ * Sets the flag indicating if messages about parity errors are not printed.
+ */
+ void DontPrintParityErrors(bool value) { fDontPrintParityErrors = value; }
+
+ /**
+ * Returns true if parity error messages are printed as warnings.
+ */
+ bool PrintParityErrorAsWarning() const { return fPrintParityErrorAsWarning; }
+
+ /**
+ * Sets the flag indicating if parity error messages are printed as warnings.
+ */
+ void PrintParityErrorAsWarning(bool value) { fPrintParityErrorAsWarning = value; }
+
+ /**
+ * Returns true if a non-parity error was found during the last call to Decode.
+ */
+ bool NonParityErrorFound() const { return fNonParityErrorFound; }
private:
// Do not allow copying of this class.
AliHLTInt32_t fLutEntry; // i-th entry in lookuptable
bool fWarnOnly; ///< Flag indicating if the OnError method should generate warnings rather than error messages.
+ bool fSkipParityErrors; ///< Flag indicating if ADC digits with parity errors should be skipped.
+ bool fDontPrintParityErrors; ///< Flag for controlling if messages about parity errors should be printed.
+ bool fPrintParityErrorAsWarning; ///< Flag for controlling if parity error messages are printed as warnings.
+ bool fNonParityErrorFound; ///< Flag which indicates if a non parity error code was found after a decoding pass.
};
AliMUONTrackerDDLDecoder<AliHLTMUONRawDecoder> fHLTMUONDecoder; // robust HLTMUON Decoder
AliHLTInt32_t fNofFiredDetElem,fMaxFiredPerDetElem[130]; // counter for detector elements that are fired
const IdManuChannelToEntry* fIdToEntry; // Mapping between Linenumber to IdManuChannel (The object is not owned by this component).
+ ERecoveryMode fRecoveryMode; ///< The recovery mode for the decoder.
+
bool DecodeDDL(const AliHLTUInt32_t* rawData, AliHLTUInt32_t rawDataSize);
void FindCentralHits(AliHLTInt32_t minPadId, AliHLTInt32_t maxPadId);
bool FindRecHits();
fUseIdealGain = false;
const char* lutFileName = NULL;
bool useCDB = false;
- bool tryRecover = false;
+ typedef AliHLTMUONHitReconstructor HR;
+ HR::ERecoveryMode recoveryMode = HR::kDontTryRecover;
AliHLTInt32_t dccut = -1;
+ bool skipParityErrors = false;
+ bool dontPrintParityErrors = false;
for (int i = 0; i < argc; i++)
{
if (strcmp( argv[i], "-tryrecover" ) == 0)
{
- tryRecover = true;
+ if (argc > i+1)
+ {
+ // There might be an optional parameter so check
+ // if it is a recognised one. If not then assume it
+ // is the next argument, so no error message.
+ if (strcmp(argv[i+1], "full") == 0)
+ {
+ recoveryMode = HR::kRecoverFull;
+ i++;
+ }
+ else if (strcmp(argv[i+1], "skip") == 0)
+ {
+ recoveryMode = HR::kRecoverJustSkip;
+ i++;
+ }
+ else if (strcmp(argv[i+1], "parityerrors") == 0)
+ {
+ recoveryMode = HR::kRecoverFromParityErrorsOnly;
+ i++;
+ }
+ else
+ {
+ recoveryMode = HR::kRecoverFull;
+ }
+ }
+ else
+ {
+ recoveryMode = HR::kRecoverFull;
+ }
+ continue;
+ }
+
+ if (strcmp( argv[i], "-skipparityerrors" ) == 0)
+ {
+ skipParityErrors = true;
+ continue;
+ }
+
+ if (strcmp( argv[i], "-dontprintparityerrors" ) == 0)
+ {
+ dontPrintParityErrors = true;
continue;
}
HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
}
- fHitRec->TryRecover(tryRecover);
+ fHitRec->TryRecover(recoveryMode);
+ fHitRec->SkipParityErrors(skipParityErrors);
+ fHitRec->DontPrintParityErrors(dontPrintParityErrors);
HLTDebug("dHLT hit reconstruction component is initialized.");
return 0;
}
* This will cause the component to generate warnings when it receives data block
* types it does not know how to handle. Without this option the component only
* generates debug messages when they are compiled in. <br>
- * \li -tryrecover <br>
+ * \li -tryrecover <i>mode</i> <br>
* This is a special option to the raw data decoder to turn on logic which will
* try and recover from corrupt raw DDL data. This is off by default. <br>
+ * The <i>mode</i> is and optional parameter which can be one of the
+ * following: <br>
+ * - full This turns on all recovery logic and the decoder tries is best
+ * to recover from all data corruption. <br>
+ * - skip This will just skip any data structures that are found to be
+ * corrupt in the raw data, without trying to recover the data inside. <br>
+ * - parityerrors Will only continue decoding if parity errors are found
+ * but the decoder will stop if any other corruption is found. <br>
+ * \li -skipparityerrors <br>
+ * Skips any ADC digit data words that contain parity errors. <br>
+ * \li -dontprintparityerrors <br>
+ * If specified then no error or warning messages are printed if any parity
+ * errors are found in the ADC digit data words. <br>
* \li -useidealgain <br>
* When this option is used then the gain correction parameters are not loaded
* from the CDB but ideal linear gain is assumed. <br>
{
HLTWarning("There was a problem with the raw data."
" Recovered as much data as possible."
- " Will continue processing next event."
+ " Will continue processing the next event."
);
}
else
{
+ HLTError("Failed to decode the trigger DDL raw data.");
return false;
}
}