1 #ifndef ALIMUONRAWSTREAMTRACKERHP_H 2 #define ALIMUONRAWSTREAMTRACKERHP_H 63 virtual Bool_t
IsDone()
const;
66 virtual Bool_t
Next(Int_t& busPatchId,
67 UShort_t& manuId, UChar_t& manuChannel,
68 UShort_t& adc) {
return Next(busPatchId,manuId,manuChannel,adc,kTRUE); }
71 virtual Bool_t
Next(Int_t& busPatchId,
75 Bool_t skipParityErrors);
106 return (Int_t)
fDecoder.GetHandler().ParityErrorCount();
112 return (Int_t)
fDecoder.GetHandler().GlitchErrorCount();
118 return (Int_t)
fDecoder.GetHandler().PaddingErrorCount();
124 return (Int_t)
fDecoder.GetHandler().TokenLostCount();
252 fBlock(block),
fNext(NULL), fBusPatchCount(0),
253 fFirstBusPatch(busPatchArray),
fHeader(header)
259 fBlock(o.fBlock),
fNext(o.
fNext), fBusPatchCount(o.fBusPatchCount),
313 return i < fBusPatchCount ? GetFirstBusPatch() + i : NULL;
342 const UInt_t* data = NULL,
343 const Bool_t* parityOk = NULL
359 fParityOk(o.fParityOk)
392 assert(
fHeader != NULL && n < fHeader->fLength );
393 return (Char_t)(fData[n] >> 31) & 0x1;
399 assert(
fHeader != NULL && n < fHeader->fLength );
400 return (UShort_t)(fData[n] >> 18) & 0x7FF;
406 assert(
fHeader != NULL && n < fHeader->fLength );
407 return (Char_t)(fData[n] >> 12) & 0x3F;
413 assert(
fHeader != NULL && n < fHeader->fLength );
414 return (UShort_t)(fData[n] & 0xFFF);
420 assert(
fHeader != NULL && n < fHeader->fLength );
428 assert(
fHeader != NULL && n < fHeader->fLength );
434 Bool_t
GetData(UInt_t n, UShort_t& manuId, UChar_t& channelId, UShort_t& adc)
const 436 assert(
fHeader != NULL && n < fHeader->fLength );
451 void Print(
const Option_t* opt =
"")
const;
465 return fDecoder.GetHandler().BlockCount();
471 return fDecoder.GetHandler().BlockHeader(0);
477 return fDecoder.GetHandler().BlockHeader(i);
519 return (busPatch != NULL) ? busPatch->
GetDspHeader() : NULL;
601 virtual void Swap(UInt_t* buffer, Int_t size)
const;
616 void SetMaxStructs(UInt_t maxBlocks, UInt_t maxDsps, UInt_t maxBusPatches);
627 return i < fBlockCount ? &fBlocks[i] : NULL;
648 void OnNewBuffer(
const void* buffer, UInt_t bufferSize);
653 fEndOfBusPatches = fCurrentBusPatch+1;
674 assert( fCurrentParityOkFlag < fParityOk + fMaxChannels );
675 *(++fCurrentParityOkFlag) = Bool_t(not parityError);
679 void OnError(
ErrorCode error,
const void* location);
758 assert( header != NULL );
759 assert( fBlockCount < fMaxBlocks );
761 if (fBlockCount > 0) fCurrentBlock->SetNext(fCurrentBlock+1);
774 assert( header != NULL );
775 assert( fCurrentBlock->GetDspCount() < fMaxDsps );
777 if (fCurrentBlock->GetDspCount() > 0) fCurrentDSP->SetNext(fCurrentDSP+1);
778 *(++fCurrentDSP) =
AliDspHeader(fCurrentBlock, fCurrentBusPatch+1, header);
779 fCurrentBlock->IncDspCount();
790 assert( header != NULL );
791 assert( data != NULL );
792 assert( fCurrentDSP->GetBusPatchCount() < fMaxBusPatches );
794 if (fCurrentDSP->GetBusPatchCount() > 0) fCurrentBusPatch->SetNext(fCurrentBusPatch+1);
798 reinterpret_cast<const UInt_t*>(data),
799 fCurrentParityOkFlag+1
801 fCurrentDSP->IncBusPatchCount();
804 #endif // ALIMUONRAWSTREAMTRACKERHP_H A high performance decoder class for MUON tracking DDL data.
virtual Int_t GetMaxDsp() const
Return maximum number of Dsp per block allowed.
const AliDspHeader * CurrentDspHeader() const
Returns the current DSP being decoded or NULL if none found.
virtual void EnabbleErrorLogger()
Enable error logging to the raw reader.
void CheckForTrailer(Bool_t value)
A high performance stream decoder for muon tracking DDL streams.
static const Int_t fgkMaxDDL
! max number of tracker DDLs
virtual Int_t GetMaxBlock() const
Return maximum number of blocks per DDL allowed.
const AliMUONBusPatchHeaderStruct * GetHeader() const
Return raw data of header.
const AliMUONLogger * GetMUONErrorLogger() const
Returns the logger object. (constant version)
void DisableRawReaderErrorLogger()
Disable logging to the raw reader.
const AliBlockHeader * BlockHeader(UInt_t i) const
Return the i'th block structure.
const AliBusPatch * EndOfBusPatch() const
Returns the marker to the end of bus patches. i.e. one position past the last bus patch...
UInt_t NumberOfParityErrors() const
Number of parity errors since First() was called.
void OnEndOfBuffer(const void *, UInt_t)
End of buffer handler marks the end of bus patches.
Bool_t IsWarningsEnabled() const
Returns the flag indicating if we should generate a warning for errors.
const AliBusPatch * Next()
Returns the next batch of decoded channel data.
void EnableWarnings()
Set warnings flag to enable warnings on data errors.
UInt_t BlockCount() const
Return the number of blocks found in the payload.
Bool_t HasParityError() const
Whether we got parity errors or not.
UInt_t GetBusPatchCount(UInt_t block, UInt_t dsp) const
Returns the number of bus patches for the given block and dsp number.
void EnableRawReaderErrorLogger()
Enable error info logging to raw reader.
UInt_t NumberOfTokenLostErrors() const
Number of token lost errors since First() was called.
virtual AliMUONDDLTracker * GetDDLTracker() const
Construct and return a pointer to the DDL payload object.
UInt_t fParityErrors
! Number of parity errors found in DDL.
UChar_t * fBuffer
! This is the buffer in which we store the DDL payload read from AliRawReader.
Bool_t fEnableRawReaderErrorLogger
! whether or not we log errors to the raw reader.
Logs a medium level of detail in the error messages.
AliDspHeader * fCurrentDSP
! Current DSP in fDSPs.
UInt_t fPaddingErrors
! Number of padding errors found in DDL.
const void * fBufferStart
! Pointer to the start of the current DDL payload buffer.
EDetailLevel GetLoggingDetailLevel() const
Returns the level of detail used in the error messages.
UInt_t fTokenLostErrors
! Number of token lost errors found in DDL.
const UInt_t * fkCurrentData
! The current data word to return by Next().
const AliDspHeader * GetDspHeader(UInt_t block, UInt_t i) const
Returns the i'th DSP header for the given block number or NULL if not found.
AliMUONDDLTracker * fDDLObject
! Temporary DDL object used by GetDDLTracker() for caching.
UInt_t ParityErrorCount() const
Returns the number of parity errors found in the DDL.
virtual void SetMaxBus(Int_t bus)
Set maximum number of Buspatch per Dsp allowed.
void TryRecover(Bool_t value)
Int_t GetTotalLength() const
Return total length of buspatch structure.
Int_t GetTokenLostErrors() const
Get number of token lost errors in the DDL last decoded.
~AliBusPatch()
Default destructor.
Bool_t * fCurrentParityOkFlag
! Current parity flag to be set in fParityOk.
UInt_t GetDataCount() const
Returns the number of raw data words within this bus patch.
AliBusPatch(const AliBusPatch &o)
Implement shallow copying in the copy constructor.
void OnNewBusPatch(const AliMUONBusPatchHeaderStruct *header, const void *data)
AliDspHeader * fDSPs
! Array of DSPs. [0..fMaxDsps*fMaxBlocks-1]
void SetNext(const AliBusPatch *next)
Sets the next bus patch.
AliBusPatch * fCurrentBusPatch
! Current bus patch in fBusPatches.
EDetailLevel
Values indicating the logging detail level to use for error messages.
Int_t GetLength() const
Return length of raw data.
UInt_t fMaxBusPatches
! max number of buspatches per dsp
UInt_t fTotalNumberOfGlitchErrors
! number of glitch errors since First() was called
UInt_t GetData(UInt_t n) const
Returns the n'th raw data word.
void SetLoggingDetailLevel(EDetailLevel level)
Sets the level of detail used in the error messages.
virtual ~AliMUONRawStreamTrackerHP()
Default destructor.
Bool_t IsMUONErrorLoggerEnabled() const
Check if the AliMUONLogger is enabled for error logging.
const AliBusPatch * GetBusPatch(UInt_t block, UInt_t dsp, UInt_t i) const
Returns the i'th bus patch for the given block and dsp.
void DisableWarnings()
Set warnings flag to disable warnings on data errors.
Bool_t CheckForTrailer() const
AliMUONLogger * GetMUONErrorLogger()
Returns the logger object.
UInt_t fMaxChannels
! Maximum number of elements that can be stored in fParityOk.
AliMUONLogger * fLogger
! Logger object to store error messages.
const Bool_t * fParityOk
Array of flags indicating if the parity of the given data word in fData is good or not...
void OnNewDSP(const AliMUONDSPHeaderStruct *header, const void *)
AliBusPatch * fBusPatches
! Array of bus patches. [0..fMaxBusPatches*fMaxDsps*fMaxBlocks-1]
AliMUONRawStreamTrackerHP()
Default constructor.
AliBlockHeader * fCurrentBlock
! Current block in fBlocks.
Bool_t IsParityOk(UInt_t n) const
A logger that keeps track of the number of times a message appeared.
const AliBlockHeader * CurrentBlockHeader() const
Returns the current block header being decoded or NULL if none found.
Bool_t TryRecover() const
Returns the "try to recover from errors" flag.
Bool_t fEnableMUONErrorLogger
! whether or not we log errors to AliMUONLogger
static void UnpackADC(UInt_t data, UShort_t &manuId, UChar_t &channelId, UShort_t &adc)
const UInt_t * fData
Pointer to the bus patch data.
Implementation of a high performance DDL decoder for the muon tracking stations.
Bool_t HasPaddingError() const
Whether we got padding errors or not.
Int_t GetBusPatchId() const
Return bus patch id.
void SetMUONErrorLogger(AliMUONLogger *logger)
Sets the logger object to use. Ownership of the logger object remains with the caller.
Bool_t * fParityOk
! Array of flags for indicating if the parity is good for a raw data word.
Int_t fBufferSize
! This is the buffer size in bytes of fBuffer.
void OnData(UInt_t, bool parityError)
Raw data word handler.
AliMUONRawStreamTrackerHP * fRawStream
! Pointer to the parent raw stream object.
virtual Bool_t IsDone() const
Whether the iteration is finished or not.
const UInt_t * GetData() const
Return raw digit data.
void OnNewBlock(const AliMUONBlockHeaderStruct *header, const void *)
virtual Bool_t IsErrorMessage() const
check error/Warning presence
virtual Int_t GetDDL() const
Return number of the current DDL being processed in the range [0..19] or -1 if no DDL set...
UInt_t fBlockCount
! Number of blocks filled in fBlocks.
const AliDspHeader * fDSP
The DSP this bus patch belongs to.
UInt_t fTotalNumberOfTokenLostErrors
! number of token lost errors since First() was called
Int_t GetPaddingErrors() const
Get number of padding word errors in the DDL last decoded.
UInt_t fMaxDsps
! max number of dsps per block
Int_t GetParityErrors() const
Get number of parity errors in the DDL last decoded.
Bool_t fDone
! Flag indicating if the iteration is done or not.
Logs minimal information in the error messages.
UInt_t fTotalNumberOfPaddingErrors
! number of padding errors since First() was called
UInt_t fGlitchErrors
! Number of glitch errors found in DDL.
AliRawReader * fRawReader
! Pointer to the raw reader
void SetRawStream(AliMUONRawStreamTrackerHP *rawStream)
Sets the raw stream object which should be the parent of this class.
virtual void SetMaxDsp(Int_t dsp)
Set maximum number of Dsp per block allowed.
virtual void Swap(UInt_t *buffer, Int_t size) const
swap method for Power PC
UShort_t GetManuId(UInt_t n) const
Returns the MANU ID of the n'th raw data word.
void DisableMUONErrorLogger()
Disable logging to AliMUONLogger.
UInt_t TokenLostCount() const
Returns the number of token lost errors found in the DDL.
Int_t GetMaxDDL() const
Return max number of tracker DDLs.
Bool_t HasTokenLostError() const
Whether we got token lost errors or not.
EDetailLevel fDetailLevel
! The logging detail level used in the error messages generated in OnError.
void SetReader(AliRawReader *reader)
Set the raw reader.
UShort_t GetCharge(UInt_t n) const
Returns the charge/signal of the n'th raw data word.
const AliBusPatch * fNext
Next bus patch object in the DSP.
Bool_t HasGlitchError() const
Whether we got glitch errors or not.
UInt_t GetDspCount(UInt_t block) const
Returns the number of DSPs for the given block number.
virtual void First()
Initialize iterator.
virtual Int_t GetMaxBus() const
Return maximum number of Buspatch per Dsp allowed.
AliMUONTrackerDDLDecoder< AliDecoderEventHandler > fDecoder
! The decoder for the DDL payload.
Light weight interface class to the bus patch data.
const UInt_t * fkEndOfData
! The last data word in the current bus patch.
Int_t GetGlitchErrors() const
Get number of glitch errors in the DDL last decoded.
Int_t fDDL
! The current DDL number being handled.
Bool_t fWarnings
! Flag indicating if we should generate a warning for errors.
Bool_t fHadError
! Flag indicating if there was a decoding error or not.
virtual AliRawReader * GetReader()
Get object for reading the raw data.
void AutoDetectTrailer(Bool_t value)
Bool_t IsRawReaderErrorLoggerEnabled() const
Check if the AliMUONLogger is enabled for error logging.
Int_t GetDataKey() const
Return Data key word for bus patch header.
UInt_t GetBlockCount() const
Return the number of blocks in the DDL payload.
Char_t GetParity(UInt_t n) const
Returns the parity bit of the n'th raw data word.
const AliBlockHeader * GetFirstBlockHeader() const
Return the first block header.
Callback event handler class for the AliMUONTrackerDDLDecoder.
void EnableMUONErrorLogger()
Enable error info logging to AliMUONLogger.
const AliBusPatch * FirstBusPatch() const
Return the first bus patch decoded.
UChar_t GetChannelId(UInt_t n) const
Returns the channel ID of the n'th raw data word.
UInt_t GlitchErrorCount() const
Returns the number of glitch errors found in the DDL.
virtual void SetMaxBlock(Int_t blk)
Set maximum number of blocks per DDL allowed.
AliBlockHeader * fBlocks
! Array of blocks. [0..fMaxBlocks-1]
const AliBusPatch * Next() const
Return the next bus patch header.
Bool_t AutoDetectTrailer() const
Returns the auto-detect trailer words flag.
UInt_t fMaxBlocks
! max number of blocks
const AliDspHeader * GetDspHeader() const
Return the parent block header.
AliBusPatch * fEndOfBusPatches
! Marks the last bus patch.
virtual Bool_t Next(Int_t &busPatchId, UShort_t &manuId, UChar_t &manuChannel, UShort_t &adc)
Advance one step in the iteration. Returns false if finished.
Bool_t GetData(UInt_t n, UShort_t &manuId, UChar_t &channelId, UShort_t &adc) const
const AliMUONBusPatchHeaderStruct * fHeader
Pointer to bus patch in DDL payload.
UInt_t PaddingErrorCount() const
Returns the number of padding errors found in the DDL.
UInt_t NumberOfPaddingErrors() const
Number of padding errors since First() was called.
UInt_t NumberOfGlitchErrors() const
Number of glitch errors since First() was called.
const AliBusPatch * fkCurrentBusPatch
! The current bus patch being handled by Next().
AliBusPatch(const AliDspHeader *dsp=NULL, const AliMUONBusPatchHeaderStruct *header=NULL, const UInt_t *data=NULL, const Bool_t *parityOk=NULL)
Default constructor.
virtual Bool_t NextDDL()
DDL iterator.
const AliBlockHeader * GetBlockHeader(UInt_t i) const
Return the i'th block header or NULL if not found.
const AliBusPatch * CurrentBusPatch() const
Returns the current bus patch being decoded or NULL if none found.
UInt_t fTotalNumberOfParityErrors
! number of parity errors since First() was called
ErrorCode
All the possible error codes for the parsing.