#include "AliMUONTrackerDDLDecoderEventHandler.h"
-#include <cassert>
-#include <ostream>
-#include <Rtypes.h>
-
-
/// \ingroup raw
/// \class AliMUONTrackerDDLDecoder
/// \brief A high performance decoder class for MUON tracking DDL data.
const UInt_t AliMUONTrackerDDLDecoder<EventHandler>::fgkPaddingWord = 0xBEEFFACE;
-inline const char* AliMUONTrackerDDLDecoderEventHandler::ErrorCodeToString(ErrorCode code)
-{
- /// This is a utility method which converts an error code to a string
- /// representation for printing purposes.
- /// \param code The error code as received in OnError for example.
- /// \return An ANSI string containing the name of the error code symbol.
-
- switch (code)
- {
- case kNoError: return "kNoError";
- case kBufferTooBig: return "kBufferTooBig";
- case kTooManyBlocks: return "kTooManyBlocks";
- case kTooManyDSPs: return "kTooManyDSPs";
- case kTooManyBusPatches: return "kTooManyBusPatches";
- case kNoBlockHeader: return "kNoBlockHeader";
- case kBadBlockKey: return "kBadBlockKey";
- case kBadBlockLength: return "kBadBlockLength";
- case kBadBlockTotalLength: return "kBadBlockTotalLength";
- case kBlockLengthMismatch: return "kBlockLengthMismatch";
- case kNoDSPHeader: return "kNoDSPHeader";
- case kBadDSPKey: return "kBadDSPKey";
- case kBadDSPLength: return "kBadDSPLength";
- case kBadDSPTotalLength: return "kBadDSPTotalLength";
- case kDSPLengthMismatch: return "kDSPLengthMismatch";
- case kNoBusPatchHeader: return "kNoBusPatchHeader";
- case kBadBusPatchKey: return "kBadBusPatchKey";
- case kBadBusPatchLength: return "kBadBusPatchLength";
- case kBadBusPatchTotalLength: return "kBadBusPatchTotalLength";
- case kBusPatchLengthMismatch: return "kBusPatchLengthMismatch";
- case kGlitchFound: return "kGlitchFound";
- case kBadPaddingWord: return "kBadPaddingWord";
- case kParityError: return "kParityError";
- default: return "INVALID";
- }
-}
-
-
-inline const char* AliMUONTrackerDDLDecoderEventHandler::ErrorCodeToMessage(ErrorCode code)
-{
- /// This is a utility method which converts an error code to user friendly
- /// descriptive message useful for printing to the screen.
- /// \param code The error code as received in OnError for example.
- /// \return An ANSI string containing a descriptive message of the error.
-
- switch (code)
- {
- case kNoError:
- return "Decoding was successful.";
- case kBufferTooBig:
- return "The DDL raw data is larger than indicated by the headers;"
- " extra bytes are probably just garbage.";
- case kTooManyBlocks:
- return "Too many block structures found.";
- case kTooManyDSPs:
- return "Too many DSP structures found in the block.";
- case kTooManyBusPatches:
- return "Too many bus patch structures found in the DSP structure.";
- case kNoBlockHeader:
- return "Missing a block header.";
- case kBadBlockKey:
- return "The block header key word does not contain the correct value.";
- case kBadBlockLength:
- return "The block length field points past the end of the raw data size.";
- case kBadBlockTotalLength:
- return "The total block length field points past the end of the"
- " raw data size.";
- case kBlockLengthMismatch:
- return "The block length and total length fields do not correspond."
- " One or both of these values is incorrect.";
- case kNoDSPHeader:
- return "Missing a DSP header.";
- case kBadDSPKey:
- return "The DSP header key word does not contain the correct value.";
- case kBadDSPLength:
- return "The DSP structure length field points past the end of the"
- " block structure.";
- case kBadDSPTotalLength:
- return "The total DSP structure length field points past the end of"
- " the block structure.";
- case kDSPLengthMismatch:
- return "The DSP structure length and total length fields do not"
- " correspond. One or both of these values is incorrect.";
- case kNoBusPatchHeader:
- return "Missing a bus patch header.";
- case kBadBusPatchKey:
- return "The bus patch header key word does not contain the correct value.";
- case kBadBusPatchLength:
- return "The bus patch length field points past the end of the"
- " DSP structure.";
- case kBadBusPatchTotalLength:
- return "The total bus patch length field points past the end of"
- " the DSP structure.";
- case kBusPatchLengthMismatch:
- return "The bus patch length and total length fields do not correspond."
- " One or both of these values is incorrect.";
- case kGlitchFound:
- return "Found a glitch. This means a 1 byte word has been randomly"
- " inserted into the raw data by mistake.";
- case kBadPaddingWord:
- return "The padding word does not contain the correct value.";
- case kParityError:
- return "Found a parity error in the data word.";
- default:
- return "Unknown error code!";
- }
-}
-
-
-inline std::ostream& operator << (std::ostream& os, AliMUONTrackerDDLDecoderEventHandler::ErrorCode code)
-{
- /// This is the stream operator for std::ostream classes to be able to
- /// easily write the error messages associated with the error codes generated
- /// by the decoder to 'cout' or 'cerr' for example.
-
- os << AliMUONTrackerDDLDecoderEventHandler::ErrorCodeToMessage(code);
- return os;
-}
-
-
template <class EventHandler>
bool AliMUONTrackerDDLDecoder<EventHandler>::Decode(const void* buffer, UInt_t bufferSize)
{