3 #ifndef ALIALTRODECODER_H
4 #define ALIALTRODECODER_H
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * See cxx source for full Copyright notice */
10 #define DDL_32BLOCK_SIZE 5
11 #define MAX_BRANCHES 2
12 #define MAX_FEE_PER_BRANCH 16
13 #define MAX_ALTROS_PER_FEE 8
14 #define CHANNELS_PER_ALTRO 16
15 #define MAX_SAMPLES_PER_CHANNEL 1024
16 #define ALTRO_TRAILER_SIZE 4
17 #define MAX_TRAILER_WORDS 3
21 class AliAltroDecoder: public TObject {
32 virtual ~AliAltroDecoder();
35 *Decode the RCU/DDL payload
40 *Reads the next altro channels
42 Bool_t NextChannel(AliAltroData *altroDataPtr);
46 * For debugging purphoses only, will be removed in near future
49 void DumpData(T *array, Int_t N, Int_t nPerLine)
51 cout << "DumpData N= " << N <<endl;
52 for(Int_t i= 0; i< N; i++)
54 if((i%nPerLine == 0) && (i != 0))
59 cout << array[i]<< "\t";
64 void SetMemory(UChar_t *dtaPtr, UInt_t size);
66 void PrintInfo(AliAltroData &altrodata, Int_t n = 0, Int_t nPerLine = 4);
69 *Prints to stdout the percent of altroblocks that
70 *is missing the 2aaa trailer.
72 Float_t GetFailureRate();
76 AliAltroDecoder& operator = (const AliAltroDecoder& decoder);
77 AliAltroDecoder(const AliAltroDecoder& decoder);
80 *Check wether or not there is consistency between the number of 40 bit altro words given by
81 *the RCU payload and the number of 40 bit words calculated from the size of the RCU payload.
83 Bool_t CheckPayloadTrailer();
86 *Decode one 160 bit DDL block into 16 x 16 bit integers (only least significant 10 bits are filled)
88 void DecodeDDLBlock();
91 *Decode one 160 bit DDL block into 16 integers.
92 *In order to use the same decoding function (DecodeDDLBlock())
93 *a copy of the the last DDL block is made and
94 *if the las block does not align with 160 bits then it is padded with zeroes
96 void DecodeLastDDLBlock();
99 *Use for simulated data only.
100 *Patch for incorrectly simulated data. Counts the number of
101 *2aaa word in the trailer of the payload and tries to figure out
102 *the correct number of 40 bit altro words in the RCU pauload
104 Int_t countAAApaddings();
106 UInt_t *f32DtaPtr; // Pointer to dat of the input buffer in entities of 32 bit words (the RCU/DDL block)
107 UChar_t *f8DtaPtr; // Pointer to dat of the input buffer in entities of 8 bit words (the RCU/DDL block)
108 const Long_t fN32HeaderWords; // Number of 32 bit words in the common data header
109 Int_t fN40AltroWords; // Number of 40 bit altro words contained in the RCU payload as calculated form the payload size
110 Int_t fN40RcuAltroWords; // Number of 40 bit altro words contained in the RCU payload as given by the RCU trailer
111 Int_t fNDDLBlocks; // Number of DDL blocks in the payload (the last blocj might/ight not be 160 bits )
112 Int_t f32LastDDLBlockSize; // Size of the last DDL block
113 UInt_t fDDLBlockDummy[DDL_32BLOCK_SIZE]; // buffer to contain the las DDL block, if the block is not aligned with 160 bitm the remaining fileds are padded with zeroes
114 UInt_t f32PayloadSize; // The size of the payload in entities of 32 bit words (after subtraction of the RCU header and the RCU trailer words)
115 Long_t fOutBufferIndex; // current buffer position of the buffer for the decoded data (10 bit words represnted as int's)
116 UInt_t fSize; // The size of the input RCU/DDL payload in entities of bytes, inluding the RCU header and trailer
117 UInt_t fOutBuffer[MAX_FEE_PER_BRANCH*MAX_BRANCHES*MAX_ALTROS_PER_FEE*CHANNELS_PER_ALTRO*(MAX_SAMPLES_PER_CHANNEL + ALTRO_TRAILER_SIZE)]; // Buffer to hold the decoded data
118 UInt_t fNAltro10bitWords; // The total number of 10 bit altro words in the RCU payload, including trailers (disregardin that the altro trialer is not aligned with 10 bit)
119 Int_t fComplete; // Number of altro channels that is only partially read out (0x2aaa pattern missing in trailer)
120 Int_t fInComplete; // Number of altro channels that is read out properly
121 Bool_t fDecodeIfCorruptedTrailer; // Wether or not to try to decode the data if the RCU trailer is incorrect (will succseed in most cases)
122 Bool_t fIsDecoded; // Wether or not the buffer set last by the "SetMemory()" function has been decoded
124 ClassDef(AliAltroDecoder, 0) // class for decoding Altro payload