4 #ifndef ALIHLTTPCDIGITREADERRAW_H
5 #define ALIHLTTPCDIGITREADERRAW_H
7 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
8 * See cxx source for full Copyright notice */
10 /** @file AliHLTTPCDigitReaderRaw.h
11 @author Timm Steinbeck, Jochen Thaeder, Matthias Richter
13 @brief A digit reader implementation for the RAW data coming from the RCU.
18 #if defined(HAVE_TPC_MAPPING)
19 #include "AliHLTTPCDigitReader.h"
20 #include "AliHLTDataTypes.h"
23 * @class AliHLTTPCDigitReaderRaw
24 * A digit reader implementation for the RAW data coming from the RCU.
25 * The reader decodes the data package to the level of the ALtro 10 bit words.
27 * The reader supports the following data format modes:
28 * - 0: RCU Data format as delivered during TPC commissioning, pads/padrows
29 * are sorted, RCU trailer is one 32 bit word.
30 * - 1: As 0, but pads/padrows are delivered "as is", without sorting
31 * - 2: As 0, but RCU trailer is 3 32 bit words.
32 * - 3: As 1, but RCU trailer is 3 32 bit words.
33 * - 4: As 0, but RCU trailer is 2 32 bit words.
34 * - 5: As 1, but RCU trailer is 2 32 bit words.
37 class AliHLTTPCDigitReaderRaw : public AliHLTTPCDigitReader {
39 /** standard constructor
40 * @param formatVersion Data Format version numbers:
41 * - 0: RCU Data format as delivered during TPC commissioning, pads/padrows
42 * are sorted, RCU trailer is one 32 bit word.
43 * - 1: As 0, but pads/padrows are delivered "as is", without sorting
44 * - 2: As 0, but RCU trailer is 3 32 bit words.
45 * - 3: As 1, but RCU trailer is 3 32 bit words.
47 AliHLTTPCDigitReaderRaw( unsigned formatVersion );
48 /** not a valid copy constructor, defined according to effective C++ style */
49 AliHLTTPCDigitReaderRaw(const AliHLTTPCDigitReaderRaw&);
50 /** not a valid assignment op, but defined according to effective C++ style */
51 AliHLTTPCDigitReaderRaw& operator=(const AliHLTTPCDigitReaderRaw&);
53 virtual ~AliHLTTPCDigitReaderRaw();
56 * Init the reader with a data block.
57 * The function fetches the first and last row for the readout partition
58 * from @ref AliHLTTransform.
59 * @param ptr pointer to data buffer
60 * @param size size of the data buffer
61 * @param patch patch (readout partition) number within the slice
62 * @param slice sector no (0 to 35)
64 virtual int InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice);
68 * <b>Note:</b> This method is for backward compatibility only, not for further
69 * use. The <i>firstrow</i> and <i>lastrow</i> parameters are fetched from
70 * @ref AliHLTTPCTransform. The method is implemented in the raw reader base class
71 * but is defined here to keep the signature of the library interface.
73 * @param ptr pointer to data buffer
74 * @param size size of the data buffer
75 * @param firstrow first row occuring in the data
76 * @param lastrow last row occuring in the data
77 * @param patch patch (readout partition) number within the slice
78 * @param slice sector no (0 to 35)
80 int InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice);
82 // Deliver values sorted for format 0, otherwise pass through to corresponding *Real* method
86 virtual int GetSignal();
87 virtual int GetTime();
89 bool Verify( bool verify )
96 bool GetVerify() const
101 // Deliver values unsorted
108 // Low level methods for accessing the data
109 AliHLTUInt32_t GetRCUTrailer( unsigned offset=0 );
110 bool NextAltroBlock();
111 AliHLTUInt32_t GetAltroBlockHWaddr();
112 unsigned GetAltroBlock10BitWordCnt();
113 AliHLTUInt64_t GetAltroBlock40BitWord( unsigned long ndx ); // ndx counts from end, 0 is last
114 AliHLTUInt16_t GetAltroBlock10BitWord( unsigned long ndx );
115 AliHLTUInt16_t GetAltroBlockReal10BitWord( unsigned long ndx );
117 unsigned GetAltroBlockPositionBytes() const
118 {return fAltroBlockPositionBytes;}
119 unsigned GetAltroBlockLengthBytes() const
120 {return fAltroBlockLengthBytes;}
122 // Return length of trailing RCU data block in bytes
123 unsigned GetRCUDataBlockLength() const;
124 unsigned GetCommonDataHeaderSize() const;
126 Bool_t ApplyMapping();
128 Int_t GetRow( unsigned patch, unsigned hw_addr );
129 Int_t GetPad( unsigned patch, unsigned hw_addr );
130 unsigned GetMaxHWA( unsigned patch );
134 AliHLTUInt8_t* fBuffer;
135 unsigned long fBufferSize;
145 unsigned fAltroBlockPositionBytes;
146 unsigned fAltroBlockLengthBytes;
148 AliHLTUInt16_t fAltroBlockHWAddress;
149 AliHLTUInt16_t fAltroBlock10BitWordCnt;
150 AliHLTUInt16_t fAltroBlock10BitFillWordCnt;
152 unsigned fDataFormatVersion;
154 unsigned fBunchPosition;
155 unsigned fBunchTimebinStart;
156 unsigned fBunchLength;
157 unsigned fWordInBunch;
162 static Int_t fMapping_0[3200][2];
163 static Int_t fMapping_1[3584][2];
164 static Int_t fMapping_2[3200][2];
165 static Int_t fMapping_3[3328][2];
166 static Int_t fMapping_4[3328][2];
167 static Int_t fMapping_5[3328][2];
169 static unsigned fMaxHWA[6];
186 ClassDef(AliHLTTPCDigitReaderRaw, 0)
191 // add a dummy class to make CINT happy
192 class AliHLTTPCDigitReaderRaw : public AliHLTLogging{
194 AliHLTTPCDigitReaderRaw()
196 HLTFatal("AliHLTTPCDigitReaderRaw not build");
199 #endif //#if defined(HAVE_TPC_MAPPING)