3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
9 * Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
10 * for The ALICE HLT Project. *
12 * Permission to use, copy, modify and distribute this software and its *
13 * documentation strictly for non-commercial purposes is hereby granted *
14 * without fee, provided that the above copyright notice appears in all *
15 * copies and that both the copyright notice and this permission notice *
16 * appear in the supporting documentation. The authors make no claims *
17 * about the suitability of this software for any purpose. It is *
18 * provided "as is" without express or implied warranty. *
19 **************************************************************************/
21 /** @file AliHLTTPCDigitReaderRaw.cxx
22 @author Timm Steinbeck
24 @brief A digit reader implementation for the RAW data coming from the RCU.
31 #include "AliHLTTPCDigitReaderRaw.h"
32 #include "AliHLTTPCTransform.h"
33 #include "AliHLTTPCRootTypes.h"
34 #include "AliHLTStdIncludes.h"
35 #include "AliHLTTPCLogging.h"
37 ClassImp(AliHLTTPCDigitReaderRaw)
39 AliHLTTPCDigitReaderRaw::AliHLTTPCDigitReaderRaw( unsigned formatVersion )
47 fAltroBlockPositionBytes(0),
48 fAltroBlockLengthBytes(0),
49 fAltroBlockHWAddress(0),
50 fAltroBlock10BitWordCnt(0),
51 fAltroBlock10BitFillWordCnt(0),
52 fDataFormatVersion(formatVersion),
54 fBunchPosition(0xFFFFU),
55 fBunchTimebinStart(~0U),
57 fWordInBunch((unsigned)-1),
70 // see header file for class documentation
72 // refer to README to build package
74 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
75 #ifndef HAVE_TPC_MAPPING
76 memset(fgMapping0, 0, fgkMapping0Size*fgkMappingDimension*sizeof(Int_t));
77 memset(fgMapping1, 0, fgkMapping1Size*fgkMappingDimension*sizeof(Int_t));
78 memset(fgMapping2, 0, fgkMapping2Size*fgkMappingDimension*sizeof(Int_t));
79 memset(fgMapping3, 0, fgkMapping3Size*fgkMappingDimension*sizeof(Int_t));
80 memset(fgMapping4, 0, fgkMapping4Size*fgkMappingDimension*sizeof(Int_t));
81 memset(fgMapping5, 0, fgkMapping5Size*fgkMappingDimension*sizeof(Int_t));
82 #endif //#ifndef HAVE_TPC_MAPPING
84 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
87 // get max number of rows
88 for (Int_t ii=0; ii < 6; ii++)
89 if (AliHLTTPCTransform::GetNRows(ii) > fNMaxRows)
90 fNMaxRows = AliHLTTPCTransform::GetNRows(ii);
92 // get max number of pads
93 for (Int_t ii=0; ii < AliHLTTPCTransform::GetNRows();ii++ )
94 if (AliHLTTPCTransform::GetNPads(ii) > fNMaxPads)
95 fNMaxPads = AliHLTTPCTransform::GetNPads(ii);
97 // get max number of bins
98 fNTimeBins = AliHLTTPCTransform::GetNTimeBins();
100 // HLTDebug("Array Borders ||| MAXPAD=%d ||| MAXROW=%d ||| MAXBIN=%d ||| MAXMUL=%d",
101 // fNMaxPads, fNMaxRows, fNTimeBins, fNTimeBins*fNMaxRows*fNMaxPads);
104 fData = new Int_t[ fNMaxRows*fNMaxPads*fNTimeBins ];
108 AliHLTTPCDigitReaderRaw::AliHLTTPCDigitReaderRaw(const AliHLTTPCDigitReaderRaw& src)
116 fAltroBlockPositionBytes(0),
117 fAltroBlockLengthBytes(0),
118 fAltroBlockHWAddress(0),
119 fAltroBlock10BitWordCnt(0),
120 fAltroBlock10BitFillWordCnt(0),
121 fDataFormatVersion(src.fDataFormatVersion),
123 fBunchPosition(0xFFFFU),
124 fBunchTimebinStart(~0U),
126 fWordInBunch((unsigned)-1),
139 // see header file for class documentation
140 #ifndef HAVE_TPC_MAPPING
141 memset(fgMapping0, 0, fgkMapping0Size*fgkMappingDimension*sizeof(Int_t));
142 memset(fgMapping1, 0, fgkMapping1Size*fgkMappingDimension*sizeof(Int_t));
143 memset(fgMapping2, 0, fgkMapping2Size*fgkMappingDimension*sizeof(Int_t));
144 memset(fgMapping3, 0, fgkMapping3Size*fgkMappingDimension*sizeof(Int_t));
145 memset(fgMapping4, 0, fgkMapping4Size*fgkMappingDimension*sizeof(Int_t));
146 memset(fgMapping5, 0, fgkMapping5Size*fgkMappingDimension*sizeof(Int_t));
147 #endif //#ifndef HAVE_TPC_MAPPING
148 HLTFatal("copy constructor not for use");
151 AliHLTTPCDigitReaderRaw& AliHLTTPCDigitReaderRaw::operator=(const AliHLTTPCDigitReaderRaw& src)
153 // see header file for class documentation
154 #ifndef HAVE_TPC_MAPPING
155 memset(fgMapping0, 0, fgkMapping0Size*fgkMappingDimension*sizeof(Int_t));
156 memset(fgMapping1, 0, fgkMapping1Size*fgkMappingDimension*sizeof(Int_t));
157 memset(fgMapping2, 0, fgkMapping2Size*fgkMappingDimension*sizeof(Int_t));
158 memset(fgMapping3, 0, fgkMapping3Size*fgkMappingDimension*sizeof(Int_t));
159 memset(fgMapping4, 0, fgkMapping4Size*fgkMappingDimension*sizeof(Int_t));
160 memset(fgMapping5, 0, fgkMapping5Size*fgkMappingDimension*sizeof(Int_t));
161 #endif //#ifndef HAVE_TPC_MAPPING
168 fDataFormatVersion=src.fDataFormatVersion;
182 HLTFatal("assignment operator not for use");
186 AliHLTTPCDigitReaderRaw::~AliHLTTPCDigitReaderRaw()
188 // see header file for class documentation
189 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
197 int AliHLTTPCDigitReaderRaw::InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice)
199 // see header file for class documentation
200 return AliHLTTPCDigitReader::InitBlock(ptr, size, firstrow, lastrow, patch, slice);
203 int AliHLTTPCDigitReaderRaw::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice)
205 // see header file for class documentation
207 fBuffer = (AliHLTUInt8_t*) ptr;
209 HLTError("invalid data buffer");
213 if (fBufferSize<=0) HLTWarning("no data available: zero length buffer");
219 fAltroBlockPositionBytes = 0;
220 fAltroBlockLengthBytes = 0;
221 fAltroBlock10BitWordCnt = 0xFFFFU;
222 fAltroBlockHWAddress = 0xFFFFU;
223 fBunchPosition = 0xFFFFU;
224 fBunchTimebinStart = ~0U;
226 fWordInBunch = (unsigned)-1;
228 Int_t firstrow=AliHLTTPCTransform::GetFirstRow(patch);
229 Int_t lastrow=AliHLTTPCTransform::GetLastRow(patch);
231 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
237 fNRows = lastrow - firstrow + 1;
240 if (patch > 1) offset = AliHLTTPCTransform::GetFirstRow( 2 );
242 fRowOffset = firstrow - offset;
246 // Init array with -1
247 memset( fData, 0xFF, sizeof(Int_t)*(fNMaxRows*fNMaxPads*fNTimeBins) );
249 const Int_t kMaxErrorPrintout=20;
252 // read data and fill in array
257 Int_t row = GetRealRow();
258 Int_t pad = GetRealPad();
259 Int_t bin = GetRealTime();
261 // HLTFatal("Index out of array range: PAD=%d ||| ROW=%d ||| BIN=%d ||| OFFSET=%d ||| ROWOFFSET=%d", pad, row, bin, offset, fRowOffset);
263 if ( row < firstrow || row > lastrow || pad > AliHLTTPCTransform::GetNPads(row + offset) || bin > fNTimeBins || pad<0 || bin<0){
264 // if ( row < firstrow || row > lastrow || pad > AliHLTTPCTransform::GetNPads(row + offset) || bin > fNTimeBins){
265 if (errorCount++<kMaxErrorPrintout) {
266 HLTFatal("Index out of range. Probably wrong patch! slice %d - patch %d", slice, patch);
267 HLTFatal("PAD=%d out of %d ||| ROW=%d (%d to %d) ||| BIN=%d out of %d ||| OFFSET=%d ||| ROWOFFSET=%d",
268 pad, AliHLTTPCTransform::GetNPads(row + offset), row, firstrow, lastrow, bin, fNTimeBins,
271 if ( row < firstrow || row > lastrow )
272 HLTFatal("Row out of range: %d ( %d to %d)", row, firstrow, lastrow);
273 if ( pad > AliHLTTPCTransform::GetNPads(row + offset) )
274 HLTFatal("Pad out of range: %d (pad count %d)", pad, AliHLTTPCTransform::GetNPads(row + offset));
275 if ( bin > fNTimeBins )
276 HLTFatal("Time bin out of range: %d (bin count %d)", bin, fNTimeBins);
278 // stop at the fist error message in order to avoid endless messages and
279 // to handle corrupted events
282 } else if ((row-fRowOffset)*fNMaxPads*fNTimeBins+ pad*fNTimeBins + bin >= fNMaxRows*fNMaxPads*fNTimeBins ) {
283 if (errorCount++<kMaxErrorPrintout) {
284 HLTFatal("index out of range: PAD=%d ||| ROW=%d ||| BIN=%d ||| OFFSET=%d ||| ROWOFFSET=%d", pad, row, bin, offset, fRowOffset);
286 // stop at the fist error message in order to avoid endless messages and
287 // to handle corrupted events
291 fData[ (row-fRowOffset)*fNMaxPads*fNTimeBins+ pad*fNTimeBins + bin ] = GetRealSignal() ;
295 HLTFatal("%d of %d entries out of range", errorCount, entryCount);
302 bool AliHLTTPCDigitReaderRaw::Next()
304 // see header file for class documentation
306 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
308 Bool_t readvalue = kTRUE;
311 if (fCurrentBin >= fNTimeBins){
315 if (fCurrentPad >=fNMaxPads){
319 if (fCurrentRow >= fNMaxRows){
326 if (fCurrentRow*fNMaxPads*fNTimeBins+ fCurrentPad*fNTimeBins + fCurrentBin >= fNMaxRows*fNMaxPads*fNTimeBins ) {
327 HLTFatal("Overflow: fCurrentRow=%d fCurrentPad=%d fCurrentBin=%d", fCurrentRow, fCurrentPad, fCurrentBin);
332 if (fData[ fCurrentRow*fNMaxPads*fNTimeBins + fCurrentPad*fNTimeBins + fCurrentBin ] != -1) break;
340 int AliHLTTPCDigitReaderRaw::GetRow()
342 // see header file for class documentation
344 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
346 return (fCurrentRow + fRowOffset);
352 int AliHLTTPCDigitReaderRaw::GetPad()
354 // see header file for class documentation
356 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
364 int AliHLTTPCDigitReaderRaw::GetSignal()
366 // see header file for class documentation
368 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
370 return fData[ fCurrentRow*fNMaxPads*fNTimeBins+ fCurrentPad*fNTimeBins + fCurrentBin ];
373 return GetRealSignal();
376 int AliHLTTPCDigitReaderRaw::GetTime()
378 // see header file for class documentation
380 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
385 return GetRealTime();
388 bool AliHLTTPCDigitReaderRaw::RealNext()
390 // see header file for class documentation
392 // printf( "%u %u %u %u %u\n", fBunchPosition, fBunchLength, fBunchTimebinStart, fWordInBunch, (unsigned)fAltroBlock10BitWordCnt );
393 fWordInBunch++; // use next word in bunch
394 if ( fWordInBunch==fBunchLength ) { // we have a bunch at all but have reached its end (or do not have an altro block yet)
395 if ( fBunchPosition+fBunchLength==fAltroBlock10BitWordCnt ) { // We were at the last bunch of this altro block (or do not have an altro block yet)
396 if ( !NextAltroBlock() )
401 fBunchPosition += fBunchLength;
403 fBunchLength = GetAltroBlock10BitWord( fBunchPosition );
404 fBunchTimebinStart = GetAltroBlock10BitWord( fBunchPosition+1 );
407 //HLTDebug( "%u %u %u %u %u\n", fBunchPosition, fBunchLength, fBunchTimebinStart, fWordInBunch, (unsigned)fAltroBlock10BitWordCnt );
411 int AliHLTTPCDigitReaderRaw::GetRealRow() const
413 // see header file for class documentation
417 int AliHLTTPCDigitReaderRaw::GetRealPad() const
419 // see header file for class documentation
423 int AliHLTTPCDigitReaderRaw::GetRealSignal()
425 // see header file for class documentation
426 return GetAltroBlock10BitWord( fBunchPosition+fWordInBunch );
429 int AliHLTTPCDigitReaderRaw::GetRealTime() const
431 // see header file for class documentation
432 //HLTDebug( "GetRealTime: %u - %u\n", fBunchTimebinStart, fWordInBunch );
433 return fBunchTimebinStart-(fWordInBunch-2);
436 AliHLTUInt32_t AliHLTTPCDigitReaderRaw::GetRCUTrailer( unsigned offset ) const
438 // see header file for class documentation
439 if (fBufferSize<=0) return 0;
440 unsigned rcuDataBlockLen = GetRCUDataBlockLength();
441 if ( offset >= rcuDataBlockLen ) return 0;
442 return ((AliHLTUInt32_t*)(fBuffer+fBufferSize-rcuDataBlockLen))[offset];
445 bool AliHLTTPCDigitReaderRaw::NextAltroBlock()
447 // see header file for class documentation
448 if (fBufferSize<=0) return 0;
450 if ( !fAltroBlockLengthBytes )
452 // First block in back linked list (last block in memory)
453 fAltroBlockPositionBytes = fBufferSize-GetRCUDataBlockLength();
458 if ( fAltroBlockPositionBytes<fAltroBlockLengthBytes+GetCommonDataHeaderSize() )
460 HLTFatal("Inconsistent Data: fAltroBlockPositionBytes=%d fAltroBlockLengthBytes=%d", fAltroBlockPositionBytes, fAltroBlockLengthBytes);
462 if ( fAltroBlockPositionBytes<=fAltroBlockLengthBytes+GetCommonDataHeaderSize() )
463 return false; // We have reached the end of the back linked list
464 fAltroBlockPositionBytes -= fAltroBlockLengthBytes;
467 AliHLTUInt64_t altroTrailerWord = GetAltroBlock40BitWord( 0 );
468 // Undefined hack from experience to match fill words appearing in simulated data
469 // Seem to be between 0 and 3 fill words, most likely to bring the number of 40bit words
470 // to a multiple of four / to bring the total number of bytes to a common multiple of 4 and 5.
471 // (RCU sends 40 bit (5 byte) words, DDL uses 32 bit (4 bytes) words.
472 unsigned short tmpCnt=0;
473 //HLTDebug( "Altro trailer word 0: 0x%016LX\n", altroTrailerWord );
474 while ( first && altroTrailerWord==0x000000AAAAAAAAAAULL && tmpCnt++<4 ) // Allow up to 4 fill values
476 altroTrailerWord = GetAltroBlock40BitWord( tmpCnt );
477 //HLTDebug( "Altro trailer word %hu: 0x%016LX\n", tmpCnt, altroTrailerWord );
480 fAltroBlockPositionBytes -= 5*tmpCnt;
481 if ( fVerify && ((altroTrailerWord & 0xFFFC000000ULL)!=0xAAA8000000ULL) )
483 HLTFatal("Data inconsistency in Altro Block at byte position %#x (%d): Expected 0x2AAA in high 14 bits of altro trailer word; Found %#llx (%#llx)",
484 fAltroBlockPositionBytes, fAltroBlockPositionBytes,
485 ((altroTrailerWord & 0xFFFC000000ULL) >> 26), altroTrailerWord);
491 if ( fVerify && ((altroTrailerWord & 0x000000F000ULL)!=0x000000A000ULL) )
493 HLTFatal("Data inconsistency in Altro Block at byte position %#x (%d): Expected 0xA in bits 12-15 of altro trailer word; Found %#llx .",
494 fAltroBlockPositionBytes, fAltroBlockPositionBytes, ((altroTrailerWord & 0x000000F000ULL) >> 12));
499 fAltroBlock10BitWordCnt = (altroTrailerWord >> 16) & 0x3FF;
500 fAltroBlockHWAddress = altroTrailerWord & 0xFFF;
505 HLTFatal("Mapping failed Patch %d HWA %#x (%d) - maxHWA %#x (%d)",
506 fPatch, fAltroBlockHWAddress, fAltroBlockHWAddress, fgMaxHWA[fPatch], fgMaxHWA[fPatch]);
510 unsigned words40Bit = fAltroBlock10BitWordCnt/4;
511 if ( fAltroBlock10BitWordCnt % 4 )
514 fAltroBlockLengthBytes = words40Bit*5;
515 if ( fAltroBlock10BitWordCnt % 4 )
516 fAltroBlock10BitFillWordCnt = 4-(fAltroBlock10BitWordCnt % 4);
518 fAltroBlock10BitFillWordCnt=0;
521 for ( unsigned b = 0; b < fAltroBlock10BitFillWordCnt; b++ )
523 if ( GetAltroBlockReal10BitWord(b)!=0x2AA )
525 HLTFatal("Data inconsistency in trailing 10 bit fill word of Altro Block at byte position %#x (%d): Expected 0x2AA; Found %#x",
526 fAltroBlockPositionBytes, fAltroBlockPositionBytes, GetAltroBlockReal10BitWord(b));
535 AliHLTUInt32_t AliHLTTPCDigitReaderRaw::GetAltroBlockHWaddr() const
537 // see header file for class documentation
538 return fAltroBlockHWAddress;
541 unsigned AliHLTTPCDigitReaderRaw::GetAltroBlock10BitWordCnt() const
543 // see header file for class documentation
544 return fAltroBlock10BitWordCnt;
547 AliHLTUInt64_t AliHLTTPCDigitReaderRaw::GetAltroBlock40BitWord( unsigned long ndx ) const
549 // see header file for class documentation
550 AliHLTUInt64_t val=0;
551 unsigned wordOffset32Bit = (ndx / 4)*5;
552 switch ( ndx % 4 ) // 40 bit word index in a 4*40 bit=5*32 bit group
555 val = (*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+1)*sizeof(AliHLTUInt32_t)));
557 val |= (*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+2)*sizeof(AliHLTUInt32_t))) >> 24;
560 val = ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+2)*sizeof(AliHLTUInt32_t))) & 0x00FFFFFF);
562 val |= ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+3)*sizeof(AliHLTUInt32_t))) >> 16) & 0xFFFF;
565 val = ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+3)*sizeof(AliHLTUInt32_t))) & 0xFFFF);
567 val |= ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+4)*sizeof(AliHLTUInt32_t))) >> 8);
570 val = ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+4)*sizeof(AliHLTUInt32_t))) & 0xFF);
572 val |= *(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+5)*sizeof(AliHLTUInt32_t));
578 AliHLTUInt16_t AliHLTTPCDigitReaderRaw::GetAltroBlock10BitWord( unsigned long ndx )
580 // see header file for class documentation
581 unsigned long realNdx = ndx+fAltroBlock10BitFillWordCnt;
582 unsigned long word40BitNdx = (realNdx / 4)+1;
583 AliHLTUInt64_t word40Bit = GetAltroBlock40BitWord( word40BitNdx );
584 switch ( realNdx % 4 )
587 return word40Bit & 0x3FF;
589 return (word40Bit>>10) & 0x3FF;
591 return (word40Bit>>20) & 0x3FF;
593 return (word40Bit>>30) & 0x3FF;
599 AliHLTUInt16_t AliHLTTPCDigitReaderRaw::GetAltroBlockReal10BitWord( unsigned long ndx )
601 // see header file for class documentation
602 unsigned long word40BitNdx = (ndx / 4)+1;
603 AliHLTUInt64_t word40Bit = GetAltroBlock40BitWord( word40BitNdx );
607 return word40Bit & 0x3FF;
609 return (word40Bit>>10) & 0x3FF;
611 return (word40Bit>>20) & 0x3FF;
613 return (word40Bit>>30) & 0x3FF;
619 unsigned AliHLTTPCDigitReaderRaw::GetRCUDataBlockLength() const
621 // see header file for class documentation
622 // Return length of trailing RCU data block in bytes
623 switch ( fDataFormatVersion )
642 unsigned AliHLTTPCDigitReaderRaw::GetCommonDataHeaderSize() const
644 // see header file for class documentation
649 Bool_t AliHLTTPCDigitReaderRaw::ApplyMapping()
651 // see header file for class documentation
653 #ifndef HAVE_TPC_MAPPING
654 if (fMapErrThrown++==0) {
655 HLTFatal("mapping not available, you must compile with HAVE_TPC_MAPPING");
658 #endif //#ifndef HAVE_TPC_MAPPING
659 if ( (unsigned)fAltroBlockHWAddress > fgMaxHWA[fPatch]){
667 fRow = fgMapping0[(unsigned)fAltroBlockHWAddress][0];
668 fPad = fgMapping0[(unsigned)fAltroBlockHWAddress][1];
671 fRow = AliHLTTPCDigitReaderRaw::fgMapping1[(unsigned)fAltroBlockHWAddress][0];
672 fPad = AliHLTTPCDigitReaderRaw::fgMapping1[(unsigned)fAltroBlockHWAddress][1];
674 printf ("pad %d # row %d (hwa: %u / 0x%08X\n", fgMapping1[(unsigned)fAltroBlockHWAddress][0],fgMapping1[(unsigned)fAltroBlockHWAddress][1], (unsigned)fAltroBlockHWAddress, (unsigned)fAltroBlockHWAddress);
675 printf ("pad %d # row %d (hwa: %u / 0x%08X\n", fgMapping1[(unsigned)fAltroBlockHWAddress-1][0],fgMapping1[(unsigned)fAltroBlockHWAddress-1][1], (unsigned)fAltroBlockHWAddress-1, (unsigned)fAltroBlockHWAddress-1);
676 printf ("pad %d # row %d (hwa: %u / 0x%08X\n", fgMapping1[(unsigned)fAltroBlockHWAddress+1][0],fgMapping1[(unsigned)fAltroBlockHWAddress+1][1], (unsigned)fAltroBlockHWAddress+1, (unsigned)fAltroBlockHWAddress+1);
680 fRow = fgMapping2[(unsigned)fAltroBlockHWAddress][0];
681 fPad = fgMapping2[(unsigned)fAltroBlockHWAddress][1];
684 fRow = fgMapping3[(unsigned)fAltroBlockHWAddress][0];
685 fPad = fgMapping3[(unsigned)fAltroBlockHWAddress][1];
688 fRow = fgMapping4[(unsigned)fAltroBlockHWAddress][0];
689 fPad = fgMapping4[(unsigned)fAltroBlockHWAddress][1];
692 fRow = fgMapping5[(unsigned)fAltroBlockHWAddress][0];
693 fPad = fgMapping5[(unsigned)fAltroBlockHWAddress][1];
704 Int_t AliHLTTPCDigitReaderRaw::GetRow( unsigned patch, unsigned hwAddr )
706 // see header file for class documentation
708 #ifndef HAVE_TPC_MAPPING
709 if (fMapErrThrown++==0) {
710 HLTFatal("mapping not available, you must compile with HAVE_TPC_MAPPING");
713 #endif //#ifndef HAVE_TPC_MAPPING
714 if ( (unsigned)hwAddr > fgMaxHWA[fPatch]){
720 return fgMapping0[hwAddr][0];
722 return fgMapping1[hwAddr][0];
724 return fgMapping2[hwAddr][0];
726 return fgMapping3[hwAddr][0];
728 return fgMapping4[hwAddr][0];
730 return fgMapping5[hwAddr][0];
736 Int_t AliHLTTPCDigitReaderRaw::GetPad( unsigned patch, unsigned hwAddr )
738 // see header file for class documentation
740 #ifndef HAVE_TPC_MAPPING
741 if (fMapErrThrown++==0) {
742 HLTFatal("mapping not available, you must compile with HAVE_TPC_MAPPING");
745 #endif //#ifndef HAVE_TPC_MAPPING
746 if ( (unsigned)hwAddr > fgMaxHWA[fPatch]){
752 return fgMapping0[hwAddr][1];
754 return fgMapping1[hwAddr][1];
756 return fgMapping2[hwAddr][1];
758 return fgMapping3[hwAddr][1];
760 return fgMapping4[hwAddr][1];
762 return fgMapping5[hwAddr][1];
768 unsigned AliHLTTPCDigitReaderRaw::GetMaxHWA( unsigned patch ) const
770 // see header file for class documentation
772 if ( (int)patch>=fgkNofPatches )
774 return fgMaxHWA[patch];
777 Int_t AliHLTTPCDigitReaderRaw::DecodeMode(Int_t mode)
779 // see header file for class documentation
783 if ( mode >= kNofRawReaderModes )
791 Int_t AliHLTTPCDigitReaderRaw::DecodeMode(const Char_t *mode)
793 // see header file for class documentation
798 // Check if String is convertible to Int_t
799 // if not decode the string, otherwise, check if Int_t is valid
800 Int_t intMode = strtoul( mode, &cpErr ,0);
803 if ( !strcmp( mode, "sorted_3_trailerword" ) )
804 decodedMode = kSorted3Trailerword;
806 else if ( !strcmp( mode, "sorted_2_trailerword" ) )
807 decodedMode = kSorted2Trailerword;
809 else if ( !strcmp( mode, "sorted_1_trailerword" ) )
810 decodedMode = kSorted1Trailerword;
812 else if ( !strcmp( mode, "unsorted_3_trailerword" ) )
813 decodedMode = kUnsorted3Trailerword;
815 else if ( !strcmp( mode, "unsorted_2_trailerword" ) )
816 decodedMode = kUnsorted2Trailerword;
818 else if ( !strcmp( mode, "unsorted_1_trailerword" ) )
819 decodedMode = kUnsorted1Trailerword;
821 else if ( ! strcmp( mode, "offline" ) )
826 } // END if ( *cpErr ) {
828 if ( intMode >= kNofRawReaderModes )
831 decodedMode = intMode;
838 // ----- MAPPING ARRAYS
839 #if defined(HAVE_TPC_MAPPING)
840 #include "mapping_array_out.inc"
842 // dummy definitions in case of missing mapping
843 unsigned AliHLTTPCDigitReaderRaw::fgMaxHWA[fgkNofPatches];
844 Int_t AliHLTTPCDigitReaderRaw::fgMapping0[fgkMapping0Size][fgkMappingDimension];
845 Int_t AliHLTTPCDigitReaderRaw::fgMapping1[fgkMapping1Size][fgkMappingDimension];
846 Int_t AliHLTTPCDigitReaderRaw::fgMapping2[fgkMapping2Size][fgkMappingDimension];
847 Int_t AliHLTTPCDigitReaderRaw::fgMapping3[fgkMapping3Size][fgkMappingDimension];
848 Int_t AliHLTTPCDigitReaderRaw::fgMapping4[fgkMapping4Size][fgkMappingDimension];
849 Int_t AliHLTTPCDigitReaderRaw::fgMapping5[fgkMapping5Size][fgkMappingDimension];
850 #endif //#if defined(HAVE_TPC_MAPPING)