1 #ifndef ALIHLTDDLDECODER_H
2 #define ALIHLTDDLDECODER_H
4 /**************************************************************************
5 * This file is property of and copyright by the Experimental Nuclear *
6 * Physics Group, Dep. of Physics *
7 * University of Oslo, Norway, 2007 *
9 * Authors: Øystein Djuvsland <oystein.djuvsland@gmail.com> *
10 * & Per Thomas Hille <perthi@fys.uio.no> *
11 * for the ALICE HLT Project. *
12 * Contributors are mentioned in the code where appropriate. *
13 * Please report bugs to perthi@fys.uio.no *
15 * Permission to use, copy, modify and distribute this software and its *
16 * documentation strictly for non-commercial purposes is hereby granted *
17 * without fee, provided that the above copyright notice appears in all *
18 * copies and that both the copyright notice and this permission notice *
19 * appear in the supporting documentation. The authors make no claims *
20 * about the suitability of this software for any purpose. It is *
21 * provided "as is" without express or implied warranty. *
22 **************************************************************************/
23 #define DDL_32BLOCK_SIZE 5
27 #include "AliHLTPHOSConstants.h"
31 using namespace PhosHLTConst;
34 class AliHLTAltroData;
37 class AliHLTDDLDecoder
49 virtual ~AliHLTDDLDecoder();
52 *Check wether or not there is consistency between the number of 40 bit altro words given by
53 *the RCU payload and the number of 40 bit words calculated from the size of the RCU payload.
58 *Decode the RCU/DDL payload
63 bool NextChannel(AliHLTAltroData *altroDataPtr);
66 void DumpData(T *array, int N, int nPerLine)
68 cout << "DumpData N= " << N <<endl;
69 for(int i= 0; i< N; i++)
71 if((i%nPerLine == 0) && (i != 0))
76 cout << array[i]<< "\t";
86 void SetMemory(UChar_t *dtaPtr, UInt_t size);
87 void PrintInfo(AliHLTAltroData &altrodata, int n = 0, int nPerLine = 4);
92 float GetFailureRate();
96 *Decode one 160 bit DDL block into 16 x 16 bit integers (only least significant 10 bits are filled)
98 void DecodeDDLBlock();
101 *Decode one 160 bit DDL block into 16 integers,
102 *if the las blaock does not align with 160 bits then first pad with zeroes
104 void DecodeLastDDLBlock();
106 int countAAApaddings();
108 UInt_t *f32DtaPtr; /**<Pointer to dat of the input buffer in entities of 32 bit words (the RCU/DDL block) */
109 UChar_t *f8DtaPtr; /**<Pointer to dat of the input buffer in entities of 8 bit words (the RCU/DDL block) */
110 const long int fN32HeaderWords; /**<Number of 32 bit words in the common data header*/
111 const long int fN32RcuTrailerWords; /**<Number of 32 bit words in the RCU trailer*/
112 int fN40AltroWords; /**<Number of 40 bit altro words contained in the RCU payload as calculated form the payload size*/
113 int fN40RcuAltroWords; /**<Number of 40 bit altro words contained in the RCU payload as given by the RCU trailer*/
114 int fNDDLBlocks; /**<Number of DDL blocks in the payload (the last blocj might/ight not be 160 bits )*/
115 int f32LastDDLBlockSize; /**<Size of the last DDL block*/
116 UInt_t fDDLBlockDummy[DDL_BLOCK_SIZE]; /**<buffer to contain the las DDL block, if the block is not aligned with 160 bitm the remaining fileds are padded with zeroes*/
117 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)*/
118 long int fOutBufferIndex; /**<current buffer position of the buffer for the decoded data (10 bit words represnted as int's)*/
119 UInt_t fSize; /**<The size of the input RCU/DDL payload in entities of bytes, inluding the RCU header and trailer */
120 UInt_t fOutBuffer[N_FEECS*N_BRANCHES*8*N_ALTROCHANNELS*(ALTRO_MAX_SAMPLES + ALTRO_MAX_TRALER_SIZE)]; /**<Buffer to hold the decoded data*/
121 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)*/
122 int fComplete; /**<Number of altro channels that is only partially read out (0x2aaa pattern missing in trailer)*/
123 int fInComplete; /**<Number of altro channels that is read out properly*/
124 bool fDecodeIfCorruptedTrailer; /**<Wether or not to try to decode the data if the RCU trailer is incorrect (will succseed in most cases)*/
125 bool fIsDecoded; /**<Wether or not the buffer set last by the "SetMemory()" function has been decoded*/