- code version from TPC commissioning merged
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDigitReaderRaw.cxx
CommitLineData
db16520a 1// $Id$
2
3/**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
8 * Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
9 * for The ALICE Off-line Project. *
10 * *
11 * Permission to use, copy, modify and distribute this software and its *
12 * documentation strictly for non-commercial purposes is hereby granted *
13 * without fee, provided that the above copyright notice appears in all *
14 * copies and that both the copyright notice and this permission notice *
15 * appear in the supporting documentation. The authors make no claims *
16 * about the suitability of this software for any purpose. It is *
17 * provided "as is" without express or implied warranty. *
18 **************************************************************************/
19
20///////////////////////////////////////////////////////////////////////////////
21// //
22// base class for reading packed and unpacked data for the HLT //
23// //
24///////////////////////////////////////////////////////////////////////////////
25
26#if __GNUC__>= 3
27using namespace std;
28#endif
29
30#if defined(HAVE_TPC_MAPPING)
31
32#include "AliHLTTPCDigitReaderRaw.h"
33#include "AliHLTTPCTransform.h"
34#include "AliHLTTPCRootTypes.h"
35#include "AliHLTTPCStandardIncludes.h"
36#include "AliHLTTPCLogging.h"
37
38ClassImp(AliHLTTPCDigitReaderRaw)
39
40 char gTmpHexBuffer[16][128];
41char* AsHex( AliHLTUInt64_t value, unsigned off=0 )
42{
43 sprintf( gTmpHexBuffer[off], "%016LX", (unsigned long long)value );
44 return gTmpHexBuffer[off];
45}
46
47AliHLTTPCDigitReaderRaw::AliHLTTPCDigitReaderRaw( unsigned formatVersion ){
48 fBuffer = NULL;
49 fBufferSize = 0;
50 fPatch = -1;
51 fSlice = -1;
52 fDataFormatVersion = formatVersion;
53 fCurrentRow = 0;
54 fCurrentPad = 0;
55 fCurrentBin = -1;
56 fVerify = false;
57
58 // For sorting
59 fNRows = 0;
60 fRowOffset = 0;
61 fNMaxRows = 0;
62 fNMaxPads = 0;
63 fNTimeBins = 0;
64 fData = NULL;
65
66 if ( fDataFormatVersion==0 || fDataFormatVersion==2 )
67 {
68
69 // get max number of rows
70 for (Int_t ii=0; ii < 6; ii++)
71 if (AliHLTTPCTransform::GetNRows(ii) > fNMaxRows)
72 fNMaxRows = AliHLTTPCTransform::GetNRows(ii);
73
74 // get max number of pads
75 for (Int_t ii=0; ii < AliHLTTPCTransform::GetNRows();ii++ )
76 if (AliHLTTPCTransform::GetNPads(ii) > fNMaxPads)
77 fNMaxPads = AliHLTTPCTransform::GetNPads(ii);
78
79 // get max number of bins
80 fNTimeBins = AliHLTTPCTransform::GetNTimeBins();
81
82 LOG(AliHLTTPCLog::kDebug,"AliHLTTPCDigitReaderRaw::AliHLTTPCDigitReaderRaw","Array Borders")
83 << " ||| MAXPAD=" << fNMaxPads << " ||| MAXROW=" << fNMaxRows
84 << " ||| MAXBIN=" << fNTimeBins << " ||| MAXMUL=" << fNTimeBins*fNMaxRows*fNMaxPads << ENDLOG;
85
86 // init Data array
87 fData = new Int_t[ fNMaxRows*fNMaxPads*fNTimeBins ];
88 }
89}
90
91AliHLTTPCDigitReaderRaw::~AliHLTTPCDigitReaderRaw(){
92 if ( fDataFormatVersion==0 || fDataFormatVersion==2 )
93 {
94 if ( fData )
95 delete [] fData;
96 fData = NULL;
97 }
98}
99
100int AliHLTTPCDigitReaderRaw::InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice){
101
102 fBuffer = (AliHLTUInt8_t*) ptr;
103 fBufferSize = size;
104 fPatch = patch;
105 fSlice = slice;
106 fPad = -1;
107 fRow = -1;
108
109 fAltroBlockPositionBytes = 0;
110 fAltroBlockLengthBytes = 0;
111 fAltroBlock10BitWordCnt = 0xFFFFU;
112 fAltroBlockHWAddress = 0xFFFFU;
113 fBunchPosition = 0xFFFFU;
114 fBunchTimebinStart = ~0U;
115 fBunchLength = 0;
116 fWordInBunch = (unsigned)-1;
117
118
119 if ( fDataFormatVersion==0 || fDataFormatVersion==2 )
120 {
121 fCurrentRow = 0;
122 fCurrentPad = 0;
123 fCurrentBin = -1;
124
125 fNRows = lastrow - firstrow + 1;
126
127 Int_t offset=0;
128 if (patch > 1) offset = AliHLTTPCTransform::GetFirstRow( 2 );
129
130 fRowOffset = firstrow - offset;
131 firstrow -= offset;
132 lastrow -= offset;
133
134 // Init array with -1
135 memset( fData, 0xFF, sizeof(Int_t)*(fNMaxRows*fNMaxPads*fNTimeBins) );
136
137 // read data and fill in array
138 while( RealNext()){
139
140 Int_t row = GetRealRow();
141 Int_t pad = GetRealPad();
142 Int_t bin = GetRealTime();
143
144// LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::FILL","Index out of array range")
145// << "PAD=" << pad << " ||| ROW=" << row << " ||| BIN=" << bin <<" ||| OFFSET="<< offset <<" ||| ROWOFFSET="<< fRowOffset << ENDLOG;
146
147 if ( row < firstrow || row > lastrow || pad > AliHLTTPCTransform::GetNPads(row + offset) || bin > fNTimeBins || pad<0 || bin<0){
148// if ( row < firstrow || row > lastrow || pad > AliHLTTPCTransform::GetNPads(row + offset) || bin > fNTimeBins){
149 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::InitBlock","Index out of Range") << "Probably wrong patch!"<< slice << "-" << patch << ENDLOG;
150 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::FILL","Index out of array range")
151 << "PAD=" << pad <<"|" << AliHLTTPCTransform::GetNPads(row + offset)
152 << " ||| ROW=" << row <<"|" << firstrow <<"|" << lastrow
153 << " ||| BIN=" << bin <<"|" << fNTimeBins
154 <<" ||| OFFSET="<< offset <<" ||| ROWOFFSET="<< fRowOffset << ENDLOG;
155
156 if ( row < firstrow || row > lastrow )
157 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::InitBlock","Row out of Range") << firstrow << "<" << row << "<" << lastrow << ENDLOG;
158 if ( pad > AliHLTTPCTransform::GetNPads(row + offset) )
159 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::InitBlock","Pad out of Range") << pad << "<" << AliHLTTPCTransform::GetNPads(row + offset) << ENDLOG;
160 if ( bin > fNTimeBins )
161 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::InitBlock","Bin out of Range") << bin << "<" << fNTimeBins << ENDLOG;
162 }
163 else {
164 if ((row-fRowOffset)*fNMaxPads*fNTimeBins+ pad*fNTimeBins + bin >= fNMaxRows*fNMaxPads*fNTimeBins ) {
165 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::FILL","Index out of array range")
166 << "PAD=" << pad << " ||| ROW=" << row << " ||| BIN=" << bin <<" ||| OFFSET="<< offset <<" ||| ROWOFFSET="<< fRowOffset << ENDLOG;
167 continue;
168 }
169 else {
170 fData[ (row-fRowOffset)*fNMaxPads*fNTimeBins+ pad*fNTimeBins + bin ] = GetRealSignal() ;
171 }
172 }
173 }
174 }
175
176 return 0;
177}
178
179bool AliHLTTPCDigitReaderRaw::Next(){
180 if ( fDataFormatVersion==0 || fDataFormatVersion==2 )
181 {
182 Bool_t readvalue = kTRUE;
183 while (1) {
184 fCurrentBin++;
185 if (fCurrentBin >= fNTimeBins){
186 fCurrentBin = 0;
187 fCurrentPad++;
188
189 if (fCurrentPad >=fNMaxPads){
190 fCurrentPad = 0;
191 fCurrentRow++;
192
193 if (fCurrentRow >= fNMaxRows){
194 readvalue = kFALSE;
195 break;
196 }
197 }
198 }
199
200 if (fCurrentRow*fNMaxPads*fNTimeBins+ fCurrentPad*fNTimeBins + fCurrentBin >= fNMaxRows*fNMaxPads*fNTimeBins ) {
201 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::NEXT","Overflow") << fCurrentRow << " " << fCurrentPad << " " << fCurrentBin << ENDLOG;
202 readvalue = kFALSE;
203 break;
204 }
205
206 if (fData[ fCurrentRow*fNMaxPads*fNTimeBins + fCurrentPad*fNTimeBins + fCurrentBin ] != -1) break;
207 }
208 return readvalue;
209 }
210 else
211 return RealNext();
212}
213
214int AliHLTTPCDigitReaderRaw::GetRow(){
215 if ( fDataFormatVersion==0 || fDataFormatVersion==2 )
216 {
217 return (fCurrentRow + fRowOffset);
218 }
219 else
220 return GetRealRow();
221}
222int AliHLTTPCDigitReaderRaw::GetPad(){
223 if ( fDataFormatVersion==0 || fDataFormatVersion==2 )
224 {
225 return fCurrentPad;
226 }
227 else
228 return GetRealPad();
229}
230int AliHLTTPCDigitReaderRaw::GetSignal(){
231 if ( fDataFormatVersion==0 || fDataFormatVersion==2 )
232 {
233 return fData[ fCurrentRow*fNMaxPads*fNTimeBins+ fCurrentPad*fNTimeBins + fCurrentBin ];
234 }
235 else
236 return GetRealSignal();
237}
238int AliHLTTPCDigitReaderRaw::GetTime(){
239 if ( fDataFormatVersion==0 || fDataFormatVersion==2 )
240 {
241 return fCurrentBin;
242 }
243 else
244 return GetRealTime();
245}
246
247
248bool AliHLTTPCDigitReaderRaw::RealNext(){
249// printf( "%u %u %u %u %u\n", fBunchPosition, fBunchLength, fBunchTimebinStart, fWordInBunch, (unsigned)fAltroBlock10BitWordCnt );
250 fWordInBunch++; // use next word in bunch
251 if ( fWordInBunch==fBunchLength ) { // we have a bunch at all but have reached its end (or do not have an altro block yet)
252 if ( fBunchPosition+fBunchLength==fAltroBlock10BitWordCnt ) { // We were at the last bunch of this altro block (or do not have an altro block yet)
253 if ( !NextAltroBlock() )
254 return false;
255 fBunchPosition = 0;
256 }
257 else {
258 fBunchPosition += fBunchLength;
259 }
260 fBunchLength = GetAltroBlock10BitWord( fBunchPosition );
261 fBunchTimebinStart = GetAltroBlock10BitWord( fBunchPosition+1 );
262 fWordInBunch = 2;
263 }
264// printf( "%u %u %u %u %u\n", fBunchPosition, fBunchLength, fBunchTimebinStart, fWordInBunch, (unsigned)fAltroBlock10BitWordCnt );
265 return true;
266}
267int AliHLTTPCDigitReaderRaw::GetRealRow(){
268 return fRow;
269}
270int AliHLTTPCDigitReaderRaw::GetRealPad(){
271 return fPad;
272}
273int AliHLTTPCDigitReaderRaw::GetRealSignal(){
274 return GetAltroBlock10BitWord( fBunchPosition+fWordInBunch );
275}
276int AliHLTTPCDigitReaderRaw::GetRealTime(){
277 //printf( "GetRealTime: %u - %u\n", fBunchTimebinStart, fWordInBunch );
278 return fBunchTimebinStart-(fWordInBunch-2);
279}
280
281AliHLTUInt32_t AliHLTTPCDigitReaderRaw::GetRCUTrailer(){
282unsigned rcuDataBlockLen = GetRCUDataBlockLength();
283return *((AliHLTUInt32_t*)(fBuffer+fBufferSize-rcuDataBlockLen));
284}
285
286bool AliHLTTPCDigitReaderRaw::NextAltroBlock()
287 {
288 if ( !fAltroBlockLengthBytes )
289 {
290 // First block in back linked list (last block in memory)
291 fAltroBlockPositionBytes = fBufferSize-GetRCUDataBlockLength();
292 }
293 else
294 {
295 if ( fAltroBlockPositionBytes<fAltroBlockLengthBytes+GetCommonDataHeaderSize() )
296 {
297 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::NextAltroBlock","Data Error")
298 << "Inconsistent Data: fAltroBlockPositionBytes: " << AliHLTTPCLog::kDec << fAltroBlockPositionBytes << " - fAltroBlockLengthBytes: " << fAltroBlockLengthBytes << "." << ENDLOG;
299 }
300 if ( fAltroBlockPositionBytes<=fAltroBlockLengthBytes+GetCommonDataHeaderSize() )
301 return false; // We have reached the end of the back linked list
302 fAltroBlockPositionBytes -= fAltroBlockLengthBytes;
303 }
304
305 AliHLTUInt64_t altroTrailerWord = GetAltroBlock40BitWord( 0 );
306
307 if ( fVerify && ((altroTrailerWord & 0xFFFC000000ULL)!=0xAAA8000000ULL) )
308 {
309 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::NextAltroBlock","Data Error")
310 << "Data inconsistency in Altro Block at byte position 0x" << AsHex( fAltroBlockPositionBytes, 0 ) << " (" << AliHLTTPCLog::kDec
311 << fAltroBlockPositionBytes << "): Expected 0x2AAA in high 14 bits of altro trailer word; Found 0x" << AsHex( ((altroTrailerWord & 0xFFFC000000ULL) >> 26), 1 ) << " (" << AsHex( altroTrailerWord, 2 ) << ")" << "." << ENDLOG;
312
313
314 return false;
315 }
316
317 if ( fVerify && ((altroTrailerWord & 0x000000F000ULL)!=0x000000A000ULL) )
318 {
319 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::NextAltroBlock","Data Error")
320 << "Data inconsistency in Altro Block at byte position 0x" << AsHex( fAltroBlockPositionBytes, 0 ) << " (" << AliHLTTPCLog::kDec
321 << fAltroBlockPositionBytes << "): Expected 0xA in bits 12-15 of altro trailer word; Found 0x" << AsHex( ((altroTrailerWord & 0x000000F000ULL) >> 12), 1 ) << "." << ENDLOG;
322
323 return false;
324 }
325
326 fAltroBlock10BitWordCnt = (altroTrailerWord >> 16) & 0x3FF;
327 fAltroBlockHWAddress = altroTrailerWord & 0xFFF;
328
329 // ApplyMapping
330 if (!ApplyMapping())
331 {
332 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::NextAltroBlock","Mapping Error")
333 << "Mapping failed Patch " << AliHLTTPCLog::kDec << fPatch << " HWA 0x"
334 << AsHex( fAltroBlockHWAddress, 0 ) << " (" << AliHLTTPCLog::kDec
335 << fAltroBlockHWAddress << ") - maxHWA 0x" << AsHex( fMaxHWA[fPatch], 1 )
336 << AliHLTTPCLog::kDec << " (" << fMaxHWA[fPatch] << ")." << ENDLOG;
337
338 }
339
340 unsigned words40Bit = fAltroBlock10BitWordCnt/4;
341 if ( fAltroBlock10BitWordCnt % 4 )
342 words40Bit++;
343 words40Bit++;
344 fAltroBlockLengthBytes = words40Bit*5;
345 if ( fAltroBlock10BitWordCnt % 4 )
346 fAltroBlock10BitFillWordCnt = 4-(fAltroBlock10BitWordCnt % 4);
347 else
348 fAltroBlock10BitFillWordCnt=0;
349 if ( fVerify )
350 {
351 for ( unsigned b = 0; b < fAltroBlock10BitFillWordCnt; b++ )
352 {
353 if ( GetAltroBlockReal10BitWord(b)!=0x2AA )
354 {
355 LOG(AliHLTTPCLog::kFatal,"AliHLTTPCDigitReaderRaw::NextAltroBlock","Data Error")
356 << "Data inconsistency in trailing 10 bit fill word of Altro Block at byte position 0x" << AliHLTTPCLog::kHex
357 << AsHex( fAltroBlockPositionBytes, 0 ) << " (" << AliHLTTPCLog::kDec
358 << fAltroBlockPositionBytes << "): Expected 0x2AA; Found 0x" << AliHLTTPCLog::kHex << AsHex( GetAltroBlockReal10BitWord(b), 1 ) << "." << ENDLOG;
359
360 return false;
361 }
362 }
363 }
364 return true;
365 }
366
367AliHLTUInt32_t AliHLTTPCDigitReaderRaw::GetAltroBlockHWaddr(){
368return fAltroBlockHWAddress;
369}
370unsigned AliHLTTPCDigitReaderRaw::GetAltroBlock10BitWordCnt(){
371return fAltroBlock10BitWordCnt;
372}
373AliHLTUInt64_t AliHLTTPCDigitReaderRaw::GetAltroBlock40BitWord( unsigned long ndx ){
374AliHLTUInt64_t val=0;
375unsigned wordOffset32Bit = (ndx / 4)*5;
376switch ( ndx % 4 ) // 40 bit word index in a 4*40 bit=5*32 bit group
377 {
378 case 0:
379 val = (*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+1)*sizeof(AliHLTUInt32_t)));
380 val <<= 8;
381 val |= (*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+2)*sizeof(AliHLTUInt32_t))) >> 24;
382 break;
383 case 1:
384 val = ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+2)*sizeof(AliHLTUInt32_t))) & 0x00FFFFFF);
385 val <<= 16;
386 val |= ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+3)*sizeof(AliHLTUInt32_t))) >> 16) & 0xFFFF;
387 break;
388 case 2:
389 val = ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+3)*sizeof(AliHLTUInt32_t))) & 0xFFFF);
390 val <<= 24;
391 val |= ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+4)*sizeof(AliHLTUInt32_t))) >> 8);
392 break;
393 case 3:
394 val = ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+4)*sizeof(AliHLTUInt32_t))) & 0xFF);
395 val <<= 32;
396 val |= *(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+5)*sizeof(AliHLTUInt32_t));
397 break;
398 }
399return val;
400}
401AliHLTUInt16_t AliHLTTPCDigitReaderRaw::GetAltroBlock10BitWord( unsigned long ndx ){
402unsigned long realNdx = ndx+fAltroBlock10BitFillWordCnt;
403unsigned long word40BitNdx = (realNdx / 4)+1;
404AliHLTUInt64_t word40Bit = GetAltroBlock40BitWord( word40BitNdx );
405switch ( realNdx % 4 )
406 {
407 case 3:
408 return word40Bit & 0x3FF;
409 case 2:
410 return (word40Bit>>10) & 0x3FF;
411 case 1:
412 return (word40Bit>>20) & 0x3FF;
413 case 0:
414 return (word40Bit>>30) & 0x3FF;
415 }
416
417 return 0xFFFF;
418}
419
420AliHLTUInt16_t AliHLTTPCDigitReaderRaw::GetAltroBlockReal10BitWord( unsigned long ndx ){
421unsigned long word40BitNdx = (ndx / 4)+1;
422AliHLTUInt64_t word40Bit = GetAltroBlock40BitWord( word40BitNdx );
423switch ( ndx % 4 )
424 {
425 case 3:
426 return word40Bit & 0x3FF;
427 case 2:
428 return (word40Bit>>10) & 0x3FF;
429 case 1:
430 return (word40Bit>>20) & 0x3FF;
431 case 0:
432 return (word40Bit>>30) & 0x3FF;
433 }
434
435 return 0xFFFF;
436}
437
438// Return length of trailing RCU data block in bytes
439unsigned AliHLTTPCDigitReaderRaw::GetRCUDataBlockLength() const
440 {
441 switch ( fDataFormatVersion )
442 {
443 case 0:
444 case 1:
445 return 4;
446 break;
447 case 2:
448 case 3:
449 return 12;
450 break;
451 default:
452 return fBufferSize;
453 }
454 }
455
456unsigned AliHLTTPCDigitReaderRaw::GetCommonDataHeaderSize() const
457 {
458 return 32;
459 }
460
461
462Bool_t AliHLTTPCDigitReaderRaw::ApplyMapping(){
463
464 if ( (unsigned)fAltroBlockHWAddress > fMaxHWA[fPatch]){
465 fPad = -1;
466 fRow = -1;
467 return kFALSE;
468 }
469
470 switch(fPatch){
471 case 0:
472 fRow = fMapping_0[(unsigned)fAltroBlockHWAddress][0];
473 fPad = fMapping_0[(unsigned)fAltroBlockHWAddress][1];
474 break;
475 case 1:
476 fRow = AliHLTTPCDigitReaderRaw::fMapping_1[(unsigned)fAltroBlockHWAddress][0];
477 fPad = AliHLTTPCDigitReaderRaw::fMapping_1[(unsigned)fAltroBlockHWAddress][1];
478#if 0
479 printf ("pad %d # row %d (hwa: %u / 0x%08X\n", fMapping_1[(unsigned)fAltroBlockHWAddress][0],fMapping_1[(unsigned)fAltroBlockHWAddress][1], (unsigned)fAltroBlockHWAddress, (unsigned)fAltroBlockHWAddress);
480 printf ("pad %d # row %d (hwa: %u / 0x%08X\n", fMapping_1[(unsigned)fAltroBlockHWAddress-1][0],fMapping_1[(unsigned)fAltroBlockHWAddress-1][1], (unsigned)fAltroBlockHWAddress-1, (unsigned)fAltroBlockHWAddress-1);
481 printf ("pad %d # row %d (hwa: %u / 0x%08X\n", fMapping_1[(unsigned)fAltroBlockHWAddress+1][0],fMapping_1[(unsigned)fAltroBlockHWAddress+1][1], (unsigned)fAltroBlockHWAddress+1, (unsigned)fAltroBlockHWAddress+1);
482#endif
483 break;
484 case 2:
485 fRow = fMapping_2[(unsigned)fAltroBlockHWAddress][0];
486 fPad = fMapping_2[(unsigned)fAltroBlockHWAddress][1];
487 break;
488 case 3:
489 fRow = fMapping_3[(unsigned)fAltroBlockHWAddress][0];
490 fPad = fMapping_3[(unsigned)fAltroBlockHWAddress][1];
491 break;
492 case 4:
493 fRow = fMapping_4[(unsigned)fAltroBlockHWAddress][0];
494 fPad = fMapping_4[(unsigned)fAltroBlockHWAddress][1];
495 break;
496 case 5:
497 fRow = fMapping_5[(unsigned)fAltroBlockHWAddress][0];
498 fPad = fMapping_5[(unsigned)fAltroBlockHWAddress][1];
499 break;
500 default:
501 fRow = -1;
502 fPad = -1;
503 return kFALSE;
504 }
505 return kTRUE;
506}
507
508
509Int_t AliHLTTPCDigitReaderRaw::GetRow( unsigned patch, unsigned hw_addr )
510{
511 if ( (unsigned)hw_addr > fMaxHWA[fPatch]){
512 return -1;
513 }
514
515 switch(fPatch){
516 case 0:
517 return fMapping_0[hw_addr][0];
518 case 1:
519 return fMapping_1[hw_addr][0];
520 case 2:
521 return fMapping_2[hw_addr][0];
522 case 3:
523 return fMapping_3[hw_addr][0];
524 case 4:
525 return fMapping_4[hw_addr][0];
526 case 5:
527 return fMapping_5[hw_addr][0];
528 default:
529 return -1;
530 }
531}
532Int_t AliHLTTPCDigitReaderRaw::GetPad( unsigned patch, unsigned hw_addr )
533{
534 if ( (unsigned)hw_addr > fMaxHWA[fPatch]){
535 return -1;
536 }
537
538 switch(fPatch){
539 case 0:
540 return fMapping_0[hw_addr][1];
541 case 1:
542 return fMapping_1[hw_addr][1];
543 case 2:
544 return fMapping_2[hw_addr][1];
545 case 3:
546 return fMapping_3[hw_addr][1];
547 case 4:
548 return fMapping_4[hw_addr][1];
549 case 5:
550 return fMapping_5[hw_addr][1];
551 default:
552 return -1;
553 }
554}
555
556unsigned AliHLTTPCDigitReaderRaw::GetMaxHWA( unsigned patch )
557{
558 if ( patch>=6 )
559 return 0;
560 return fMaxHWA[patch];
561}
562
563
564// ----- MAPPING ARRAYS
565#include "mapping_array_out.inc"
566
567#endif //#if defined(HAVE_TPC_MAPPING)