minor bugfix in argument scanning
[u/mrichter/AliRoot.git] / RAW / AliAltroDecoder.h
CommitLineData
31a920d3 1//#-*- Mode: c++ -*-
2
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 */
7
ac672c4c 8///////////////////////////////////////////////////////////////////////////////
9///
10/// This is the class for fats deocding of TPC/PHOS/EMCAL raw data
11// see .cxx file for more detailed comments.
12///
13///////////////////////////////////////////////////////////////////////////////
14
15
16
31a920d3 17#include <TObject.h>
ac672c4c 18
19#include <iostream>
20using namespace std;
31a920d3 21
22#define DDL_32BLOCK_SIZE 5
23#define MAX_BRANCHES 2
24#define MAX_FEE_PER_BRANCH 16
25#define MAX_ALTROS_PER_FEE 8
26#define CHANNELS_PER_ALTRO 16
27#define MAX_SAMPLES_PER_CHANNEL 1024
28#define ALTRO_TRAILER_SIZE 4
29#define MAX_TRAILER_WORDS 3
30
31class AliAltroData;
32
33class AliAltroDecoder: public TObject {
34 public:
31a920d3 35 AliAltroDecoder();
31a920d3 36 virtual ~AliAltroDecoder();
31a920d3 37 Bool_t Decode();
31a920d3 38 Bool_t NextChannel(AliAltroData *altroDataPtr);
39
40 /*
41 * DONT use !
42 * For debugging purphoses only, will be removed in near future
43 **/
44 template<typename T>
45 void DumpData(T *array, Int_t N, Int_t nPerLine)
46 {
47 cout << "DumpData N= " << N <<endl;
ac672c4c 48
31a920d3 49 for(Int_t i= 0; i< N; i++)
50 {
51 if((i%nPerLine == 0) && (i != 0))
52 {
53 printf("\n");
54 }
55
56 cout << array[i]<< "\t";
57
58 }
59 }
60
ebf7cafe 61 int SetMemory(UChar_t *dtaPtr, UInt_t size);
31a920d3 62 void PrintInfo(AliAltroData &altrodata, Int_t n = 0, Int_t nPerLine = 4);
31a920d3 63 Float_t GetFailureRate();
64
65 private:
66
67 AliAltroDecoder& operator = (const AliAltroDecoder& decoder);
68 AliAltroDecoder(const AliAltroDecoder& decoder);
ac672c4c 69 Bool_t CheckPayloadTrailer() const;
31a920d3 70 void DecodeDDLBlock();
31a920d3 71 void DecodeLastDDLBlock();
ac672c4c 72 Int_t CountAAApaddings() const;
31a920d3 73 UInt_t *f32DtaPtr; // Pointer to dat of the input buffer in entities of 32 bit words (the RCU/DDL block)
74 UChar_t *f8DtaPtr; // Pointer to dat of the input buffer in entities of 8 bit words (the RCU/DDL block)
ac672c4c 75 const Long_t fkN32HeaderWords; // Number of 32 bit words in the common data header
31a920d3 76 Int_t fN40AltroWords; // Number of 40 bit altro words contained in the RCU payload as calculated form the payload size
77 Int_t fN40RcuAltroWords; // Number of 40 bit altro words contained in the RCU payload as given by the RCU trailer
78 Int_t fNDDLBlocks; // Number of DDL blocks in the payload (the last blocj might/ight not be 160 bits )
79 Int_t f32LastDDLBlockSize; // Size of the last DDL block
80 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
81 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)
82 Long_t fOutBufferIndex; // current buffer position of the buffer for the decoded data (10 bit words represnted as int's)
83 UInt_t fSize; // The size of the input RCU/DDL payload in entities of bytes, inluding the RCU header and trailer
84 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
85 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)
86 Int_t fComplete; // Number of altro channels that is only partially read out (0x2aaa pattern missing in trailer)
87 Int_t fInComplete; // Number of altro channels that is read out properly
88 Bool_t fDecodeIfCorruptedTrailer; // Wether or not to try to decode the data if the RCU trailer is incorrect (will succseed in most cases)
89 Bool_t fIsDecoded; // Wether or not the buffer set last by the "SetMemory()" function has been decoded
ac672c4c 90 Bool_t fIsFatalCorruptedTrailer; // If trailer is fataly corrupted, not possible in any way to recover, then it is not allowed to decode the DDL payload.
ebf7cafe 91
31a920d3 92 ClassDef(AliAltroDecoder, 0) // class for decoding Altro payload
93};
94
95#endif