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 fDataFormatVersion(formatVersion),
61 // see header file for class documentation
63 // refer to README to build package
65 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
66 #ifndef HAVE_TPC_MAPPING
67 memset(fgMapping0, 0, fgkMapping0Size*fgkMappingDimension*sizeof(Int_t));
68 memset(fgMapping1, 0, fgkMapping1Size*fgkMappingDimension*sizeof(Int_t));
69 memset(fgMapping2, 0, fgkMapping2Size*fgkMappingDimension*sizeof(Int_t));
70 memset(fgMapping3, 0, fgkMapping3Size*fgkMappingDimension*sizeof(Int_t));
71 memset(fgMapping4, 0, fgkMapping4Size*fgkMappingDimension*sizeof(Int_t));
72 memset(fgMapping5, 0, fgkMapping5Size*fgkMappingDimension*sizeof(Int_t));
73 #endif //#ifndef HAVE_TPC_MAPPING
75 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
78 // get max number of rows
79 for (Int_t ii=0; ii < 6; ii++)
80 if (AliHLTTPCTransform::GetNRows(ii) > fNMaxRows)
81 fNMaxRows = AliHLTTPCTransform::GetNRows(ii);
83 // get max number of pads
84 for (Int_t ii=0; ii < AliHLTTPCTransform::GetNRows();ii++ )
85 if (AliHLTTPCTransform::GetNPads(ii) > fNMaxPads)
86 fNMaxPads = AliHLTTPCTransform::GetNPads(ii);
88 // get max number of bins
89 fNTimeBins = AliHLTTPCTransform::GetNTimeBins();
91 // HLTDebug("Array Borders ||| MAXPAD=%d ||| MAXROW=%d ||| MAXBIN=%d ||| MAXMUL=%d",
92 // fNMaxPads, fNMaxRows, fNTimeBins, fNTimeBins*fNMaxRows*fNMaxPads);
95 fData = new Int_t[ fNMaxRows*fNMaxPads*fNTimeBins ];
99 AliHLTTPCDigitReaderRaw::AliHLTTPCDigitReaderRaw(const AliHLTTPCDigitReaderRaw& src)
107 fDataFormatVersion(src.fDataFormatVersion),
121 // see header file for class documentation
122 #ifndef HAVE_TPC_MAPPING
123 memset(fgMapping0, 0, fgkMapping0Size*fgkMappingDimension*sizeof(Int_t));
124 memset(fgMapping1, 0, fgkMapping1Size*fgkMappingDimension*sizeof(Int_t));
125 memset(fgMapping2, 0, fgkMapping2Size*fgkMappingDimension*sizeof(Int_t));
126 memset(fgMapping3, 0, fgkMapping3Size*fgkMappingDimension*sizeof(Int_t));
127 memset(fgMapping4, 0, fgkMapping4Size*fgkMappingDimension*sizeof(Int_t));
128 memset(fgMapping5, 0, fgkMapping5Size*fgkMappingDimension*sizeof(Int_t));
129 #endif //#ifndef HAVE_TPC_MAPPING
130 HLTFatal("copy constructor not for use");
133 AliHLTTPCDigitReaderRaw& AliHLTTPCDigitReaderRaw::operator=(const AliHLTTPCDigitReaderRaw& src)
135 // see header file for class documentation
136 #ifndef HAVE_TPC_MAPPING
137 memset(fgMapping0, 0, fgkMapping0Size*fgkMappingDimension*sizeof(Int_t));
138 memset(fgMapping1, 0, fgkMapping1Size*fgkMappingDimension*sizeof(Int_t));
139 memset(fgMapping2, 0, fgkMapping2Size*fgkMappingDimension*sizeof(Int_t));
140 memset(fgMapping3, 0, fgkMapping3Size*fgkMappingDimension*sizeof(Int_t));
141 memset(fgMapping4, 0, fgkMapping4Size*fgkMappingDimension*sizeof(Int_t));
142 memset(fgMapping5, 0, fgkMapping5Size*fgkMappingDimension*sizeof(Int_t));
143 #endif //#ifndef HAVE_TPC_MAPPING
150 fDataFormatVersion=src.fDataFormatVersion;
164 HLTFatal("assignment operator not for use");
168 AliHLTTPCDigitReaderRaw::~AliHLTTPCDigitReaderRaw()
170 // see header file for class documentation
171 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
179 int AliHLTTPCDigitReaderRaw::InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice)
181 // see header file for class documentation
182 return AliHLTTPCDigitReader::InitBlock(ptr, size, firstrow, lastrow, patch, slice);
185 int AliHLTTPCDigitReaderRaw::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice)
187 // see header file for class documentation
189 fBuffer = (AliHLTUInt8_t*) ptr;
191 HLTError("invalid data buffer");
195 if (fBufferSize<=0) HLTWarning("no data available: zero length buffer");
201 fAltroBlockPositionBytes = 0;
202 fAltroBlockLengthBytes = 0;
203 fAltroBlock10BitWordCnt = 0xFFFFU;
204 fAltroBlockHWAddress = 0xFFFFU;
205 fBunchPosition = 0xFFFFU;
206 fBunchTimebinStart = ~0U;
208 fWordInBunch = (unsigned)-1;
210 Int_t firstrow=AliHLTTPCTransform::GetFirstRow(patch);
211 Int_t lastrow=AliHLTTPCTransform::GetLastRow(patch);
213 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
219 fNRows = lastrow - firstrow + 1;
222 if (patch > 1) offset = AliHLTTPCTransform::GetFirstRow( 2 );
224 fRowOffset = firstrow - offset;
228 // Init array with -1
229 memset( fData, 0xFF, sizeof(Int_t)*(fNMaxRows*fNMaxPads*fNTimeBins) );
231 const Int_t kMaxErrorPrintout=20;
234 // read data and fill in array
239 Int_t row = GetRealRow();
240 Int_t pad = GetRealPad();
241 Int_t bin = GetRealTime();
243 // HLTFatal("Index out of array range: PAD=%d ||| ROW=%d ||| BIN=%d ||| OFFSET=%d ||| ROWOFFSET=%d", pad, row, bin, offset, fRowOffset);
245 if ( row < firstrow || row > lastrow || pad > AliHLTTPCTransform::GetNPads(row + offset) || bin > fNTimeBins || pad<0 || bin<0){
246 // if ( row < firstrow || row > lastrow || pad > AliHLTTPCTransform::GetNPads(row + offset) || bin > fNTimeBins){
247 if (errorCount++<kMaxErrorPrintout) {
248 HLTFatal("Index out of range. Probably wrong patch! slice %d - patch %d", slice, patch);
249 HLTFatal("PAD=%d out of %d ||| ROW=%d (%d to %d) ||| BIN=%d out of %d ||| OFFSET=%d ||| ROWOFFSET=%d",
250 pad, AliHLTTPCTransform::GetNPads(row + offset), row, firstrow, lastrow, bin, fNTimeBins,
253 if ( row < firstrow || row > lastrow )
254 HLTFatal("Row out of range: %d ( %d to %d)", row, firstrow, lastrow);
255 if ( pad > AliHLTTPCTransform::GetNPads(row + offset) )
256 HLTFatal("Pad out of range: %d (pad count %d)", pad, AliHLTTPCTransform::GetNPads(row + offset));
257 if ( bin > fNTimeBins )
258 HLTFatal("Time bin out of range: %d (bin count %d)", bin, fNTimeBins);
260 // stop at the fist error message in order to avoid endless messages and
261 // to handle corrupted events
264 } else if ((row-fRowOffset)*fNMaxPads*fNTimeBins+ pad*fNTimeBins + bin >= fNMaxRows*fNMaxPads*fNTimeBins ) {
265 if (errorCount++<kMaxErrorPrintout) {
266 HLTFatal("index out of range: PAD=%d ||| ROW=%d ||| BIN=%d ||| OFFSET=%d ||| ROWOFFSET=%d", pad, row, bin, offset, fRowOffset);
268 // stop at the fist error message in order to avoid endless messages and
269 // to handle corrupted events
273 fData[ (row-fRowOffset)*fNMaxPads*fNTimeBins+ pad*fNTimeBins + bin ] = GetRealSignal() ;
277 HLTFatal("%d of %d entries out of range", errorCount, entryCount);
284 bool AliHLTTPCDigitReaderRaw::Next()
286 // see header file for class documentation
288 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
290 Bool_t readvalue = kTRUE;
293 if (fCurrentBin >= fNTimeBins){
297 if (fCurrentPad >=fNMaxPads){
301 if (fCurrentRow >= fNMaxRows){
308 if (fCurrentRow*fNMaxPads*fNTimeBins+ fCurrentPad*fNTimeBins + fCurrentBin >= fNMaxRows*fNMaxPads*fNTimeBins ) {
309 HLTFatal("Overflow: fCurrentRow=%d fCurrentPad=%d fCurrentBin=%d", fCurrentRow, fCurrentPad, fCurrentBin);
314 if (fData[ fCurrentRow*fNMaxPads*fNTimeBins + fCurrentPad*fNTimeBins + fCurrentBin ] != -1) break;
322 int AliHLTTPCDigitReaderRaw::GetRow()
324 // see header file for class documentation
326 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
328 return (fCurrentRow + fRowOffset);
334 int AliHLTTPCDigitReaderRaw::GetPad()
336 // see header file for class documentation
338 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
346 int AliHLTTPCDigitReaderRaw::GetSignal()
348 // see header file for class documentation
350 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
352 return fData[ fCurrentRow*fNMaxPads*fNTimeBins+ fCurrentPad*fNTimeBins + fCurrentBin ];
355 return GetRealSignal();
358 int AliHLTTPCDigitReaderRaw::GetTime()
360 // see header file for class documentation
362 if ( fDataFormatVersion==0 || fDataFormatVersion==2 || fDataFormatVersion==4 )
367 return GetRealTime();
370 bool AliHLTTPCDigitReaderRaw::RealNext()
372 // see header file for class documentation
374 // printf( "%u %u %u %u %u\n", fBunchPosition, fBunchLength, fBunchTimebinStart, fWordInBunch, (unsigned)fAltroBlock10BitWordCnt );
375 fWordInBunch++; // use next word in bunch
376 if ( fWordInBunch==fBunchLength ) { // we have a bunch at all but have reached its end (or do not have an altro block yet)
377 if ( fBunchPosition+fBunchLength==fAltroBlock10BitWordCnt ) { // We were at the last bunch of this altro block (or do not have an altro block yet)
378 if ( !NextAltroBlock() )
383 fBunchPosition += fBunchLength;
385 fBunchLength = GetAltroBlock10BitWord( fBunchPosition );
386 fBunchTimebinStart = GetAltroBlock10BitWord( fBunchPosition+1 );
389 //HLTDebug( "%u %u %u %u %u\n", fBunchPosition, fBunchLength, fBunchTimebinStart, fWordInBunch, (unsigned)fAltroBlock10BitWordCnt );
393 int AliHLTTPCDigitReaderRaw::GetRealRow() const
395 // see header file for class documentation
399 int AliHLTTPCDigitReaderRaw::GetRealPad() const
401 // see header file for class documentation
405 int AliHLTTPCDigitReaderRaw::GetRealSignal()
407 // see header file for class documentation
408 return GetAltroBlock10BitWord( fBunchPosition+fWordInBunch );
411 int AliHLTTPCDigitReaderRaw::GetRealTime() const
413 // see header file for class documentation
414 //HLTDebug( "GetRealTime: %u - %u\n", fBunchTimebinStart, fWordInBunch );
415 return fBunchTimebinStart-(fWordInBunch-2);
418 AliHLTUInt32_t AliHLTTPCDigitReaderRaw::GetRCUTrailer( unsigned offset ) const
420 // see header file for class documentation
421 if (fBufferSize<=0) return 0;
422 unsigned rcuDataBlockLen = GetRCUDataBlockLength();
423 if ( offset >= rcuDataBlockLen ) return 0;
424 return ((AliHLTUInt32_t*)(fBuffer+fBufferSize-rcuDataBlockLen))[offset];
427 bool AliHLTTPCDigitReaderRaw::NextAltroBlock()
429 // see header file for class documentation
430 if (fBufferSize<=0) return 0;
432 if ( !fAltroBlockLengthBytes )
434 // First block in back linked list (last block in memory)
435 fAltroBlockPositionBytes = fBufferSize-GetRCUDataBlockLength();
440 if ( fAltroBlockPositionBytes<fAltroBlockLengthBytes+GetCommonDataHeaderSize() )
442 HLTFatal("Inconsistent Data: fAltroBlockPositionBytes=%d fAltroBlockLengthBytes=%d", fAltroBlockPositionBytes, fAltroBlockLengthBytes);
444 if ( fAltroBlockPositionBytes<=fAltroBlockLengthBytes+GetCommonDataHeaderSize() )
445 return false; // We have reached the end of the back linked list
446 fAltroBlockPositionBytes -= fAltroBlockLengthBytes;
449 AliHLTUInt64_t altroTrailerWord = GetAltroBlock40BitWord( 0 );
450 // Undefined hack from experience to match fill words appearing in simulated data
451 // Seem to be between 0 and 3 fill words, most likely to bring the number of 40bit words
452 // to a multiple of four / to bring the total number of bytes to a common multiple of 4 and 5.
453 // (RCU sends 40 bit (5 byte) words, DDL uses 32 bit (4 bytes) words.
454 unsigned short tmpCnt=0;
455 //HLTDebug( "Altro trailer word 0: 0x%016LX\n", altroTrailerWord );
456 while ( first && altroTrailerWord==0x000000AAAAAAAAAAULL && tmpCnt++<4 ) // Allow up to 4 fill values
458 altroTrailerWord = GetAltroBlock40BitWord( tmpCnt );
459 //HLTDebug( "Altro trailer word %hu: 0x%016LX\n", tmpCnt, altroTrailerWord );
462 fAltroBlockPositionBytes -= 5*tmpCnt;
463 if ( fVerify && ((altroTrailerWord & 0xFFFC000000ULL)!=0xAAA8000000ULL) )
465 HLTFatal("Data inconsistency in Altro Block at byte position %#x (%d): Expected 0x2AAA in high 14 bits of altro trailer word; Found %#llx (%#llx)",
466 fAltroBlockPositionBytes, fAltroBlockPositionBytes,
467 ((altroTrailerWord & 0xFFFC000000ULL) >> 26), altroTrailerWord);
473 if ( fVerify && ((altroTrailerWord & 0x000000F000ULL)!=0x000000A000ULL) )
475 HLTFatal("Data inconsistency in Altro Block at byte position %#x (%d): Expected 0xA in bits 12-15 of altro trailer word; Found %#llx .",
476 fAltroBlockPositionBytes, fAltroBlockPositionBytes, ((altroTrailerWord & 0x000000F000ULL) >> 12));
481 fAltroBlock10BitWordCnt = (altroTrailerWord >> 16) & 0x3FF;
482 fAltroBlockHWAddress = altroTrailerWord & 0xFFF;
487 HLTFatal("Mapping failed Patch %d HWA %#x (%d) - maxHWA %#x (%d)",
488 fPatch, fAltroBlockHWAddress, fAltroBlockHWAddress, fgMaxHWA[fPatch], fgMaxHWA[fPatch]);
492 unsigned words40Bit = fAltroBlock10BitWordCnt/4;
493 if ( fAltroBlock10BitWordCnt % 4 )
496 fAltroBlockLengthBytes = words40Bit*5;
497 if ( fAltroBlock10BitWordCnt % 4 )
498 fAltroBlock10BitFillWordCnt = 4-(fAltroBlock10BitWordCnt % 4);
500 fAltroBlock10BitFillWordCnt=0;
503 for ( unsigned b = 0; b < fAltroBlock10BitFillWordCnt; b++ )
505 if ( GetAltroBlockReal10BitWord(b)!=0x2AA )
507 HLTFatal("Data inconsistency in trailing 10 bit fill word of Altro Block at byte position %#x (%d): Expected 0x2AA; Found %#x",
508 fAltroBlockPositionBytes, fAltroBlockPositionBytes, GetAltroBlockReal10BitWord(b));
517 AliHLTUInt32_t AliHLTTPCDigitReaderRaw::GetAltroBlockHWaddr() const
519 // see header file for class documentation
520 return fAltroBlockHWAddress;
523 unsigned AliHLTTPCDigitReaderRaw::GetAltroBlock10BitWordCnt() const
525 // see header file for class documentation
526 return fAltroBlock10BitWordCnt;
529 AliHLTUInt64_t AliHLTTPCDigitReaderRaw::GetAltroBlock40BitWord( unsigned long ndx ) const
531 // see header file for class documentation
532 AliHLTUInt64_t val=0;
533 unsigned wordOffset32Bit = (ndx / 4)*5;
534 switch ( ndx % 4 ) // 40 bit word index in a 4*40 bit=5*32 bit group
537 val = (*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+1)*sizeof(AliHLTUInt32_t)));
539 val |= (*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+2)*sizeof(AliHLTUInt32_t))) >> 24;
542 val = ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+2)*sizeof(AliHLTUInt32_t))) & 0x00FFFFFF);
544 val |= ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+3)*sizeof(AliHLTUInt32_t))) >> 16) & 0xFFFF;
547 val = ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+3)*sizeof(AliHLTUInt32_t))) & 0xFFFF);
549 val |= ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+4)*sizeof(AliHLTUInt32_t))) >> 8);
552 val = ((*(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+4)*sizeof(AliHLTUInt32_t))) & 0xFF);
554 val |= *(AliHLTUInt32_t*)(fBuffer+fAltroBlockPositionBytes-(wordOffset32Bit+5)*sizeof(AliHLTUInt32_t));
560 AliHLTUInt16_t AliHLTTPCDigitReaderRaw::GetAltroBlock10BitWord( unsigned long ndx )
562 // see header file for class documentation
563 unsigned long realNdx = ndx+fAltroBlock10BitFillWordCnt;
564 unsigned long word40BitNdx = (realNdx / 4)+1;
565 AliHLTUInt64_t word40Bit = GetAltroBlock40BitWord( word40BitNdx );
566 switch ( realNdx % 4 )
569 return word40Bit & 0x3FF;
571 return (word40Bit>>10) & 0x3FF;
573 return (word40Bit>>20) & 0x3FF;
575 return (word40Bit>>30) & 0x3FF;
581 AliHLTUInt16_t AliHLTTPCDigitReaderRaw::GetAltroBlockReal10BitWord( unsigned long ndx )
583 // see header file for class documentation
584 unsigned long word40BitNdx = (ndx / 4)+1;
585 AliHLTUInt64_t word40Bit = GetAltroBlock40BitWord( word40BitNdx );
589 return word40Bit & 0x3FF;
591 return (word40Bit>>10) & 0x3FF;
593 return (word40Bit>>20) & 0x3FF;
595 return (word40Bit>>30) & 0x3FF;
601 unsigned AliHLTTPCDigitReaderRaw::GetRCUDataBlockLength() const
603 // see header file for class documentation
604 // Return length of trailing RCU data block in bytes
605 switch ( fDataFormatVersion )
624 unsigned AliHLTTPCDigitReaderRaw::GetCommonDataHeaderSize() const
626 // see header file for class documentation
631 Bool_t AliHLTTPCDigitReaderRaw::ApplyMapping()
633 // see header file for class documentation
635 #ifndef HAVE_TPC_MAPPING
636 if (fMapErrThrown++==0) {
637 HLTFatal("mapping not available, you must compile with HAVE_TPC_MAPPING");
640 #endif //#ifndef HAVE_TPC_MAPPING
641 if ( (unsigned)fAltroBlockHWAddress > fgMaxHWA[fPatch]){
649 fRow = fgMapping0[(unsigned)fAltroBlockHWAddress][0];
650 fPad = fgMapping0[(unsigned)fAltroBlockHWAddress][1];
653 fRow = AliHLTTPCDigitReaderRaw::fgMapping1[(unsigned)fAltroBlockHWAddress][0];
654 fPad = AliHLTTPCDigitReaderRaw::fgMapping1[(unsigned)fAltroBlockHWAddress][1];
656 printf ("pad %d # row %d (hwa: %u / 0x%08X\n", fgMapping1[(unsigned)fAltroBlockHWAddress][0],fgMapping1[(unsigned)fAltroBlockHWAddress][1], (unsigned)fAltroBlockHWAddress, (unsigned)fAltroBlockHWAddress);
657 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);
658 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);
662 fRow = fgMapping2[(unsigned)fAltroBlockHWAddress][0];
663 fPad = fgMapping2[(unsigned)fAltroBlockHWAddress][1];
666 fRow = fgMapping3[(unsigned)fAltroBlockHWAddress][0];
667 fPad = fgMapping3[(unsigned)fAltroBlockHWAddress][1];
670 fRow = fgMapping4[(unsigned)fAltroBlockHWAddress][0];
671 fPad = fgMapping4[(unsigned)fAltroBlockHWAddress][1];
674 fRow = fgMapping5[(unsigned)fAltroBlockHWAddress][0];
675 fPad = fgMapping5[(unsigned)fAltroBlockHWAddress][1];
686 Int_t AliHLTTPCDigitReaderRaw::GetRow( unsigned patch, unsigned hwAddr )
688 // see header file for class documentation
690 #ifndef HAVE_TPC_MAPPING
691 if (fMapErrThrown++==0) {
692 HLTFatal("mapping not available, you must compile with HAVE_TPC_MAPPING");
695 #endif //#ifndef HAVE_TPC_MAPPING
696 if ( (unsigned)hwAddr > fgMaxHWA[fPatch]){
702 return fgMapping0[hwAddr][0];
704 return fgMapping1[hwAddr][0];
706 return fgMapping2[hwAddr][0];
708 return fgMapping3[hwAddr][0];
710 return fgMapping4[hwAddr][0];
712 return fgMapping5[hwAddr][0];
718 Int_t AliHLTTPCDigitReaderRaw::GetPad( unsigned patch, unsigned hwAddr )
720 // see header file for class documentation
722 #ifndef HAVE_TPC_MAPPING
723 if (fMapErrThrown++==0) {
724 HLTFatal("mapping not available, you must compile with HAVE_TPC_MAPPING");
727 #endif //#ifndef HAVE_TPC_MAPPING
728 if ( (unsigned)hwAddr > fgMaxHWA[fPatch]){
734 return fgMapping0[hwAddr][1];
736 return fgMapping1[hwAddr][1];
738 return fgMapping2[hwAddr][1];
740 return fgMapping3[hwAddr][1];
742 return fgMapping4[hwAddr][1];
744 return fgMapping5[hwAddr][1];
750 unsigned AliHLTTPCDigitReaderRaw::GetMaxHWA( unsigned patch ) const
752 // see header file for class documentation
754 if ( (int)patch>=fgkNofPatches )
756 return fgMaxHWA[patch];
759 Int_t AliHLTTPCDigitReaderRaw::DecodeMode(Int_t mode)
761 // see header file for class documentation
765 if ( mode >= kNofRawReaderModes )
773 Int_t AliHLTTPCDigitReaderRaw::DecodeMode(const Char_t *mode)
775 // see header file for class documentation
780 // Check if String is convertible to Int_t
781 // if not decode the string, otherwise, check if Int_t is valid
782 Int_t intMode = strtoul( mode, &cpErr ,0);
785 if ( !strcmp( mode, "sorted_3_trailerword" ) )
786 decodedMode = kSorted3Trailerword;
788 else if ( !strcmp( mode, "sorted_2_trailerword" ) )
789 decodedMode = kSorted2Trailerword;
791 else if ( !strcmp( mode, "sorted_1_trailerword" ) )
792 decodedMode = kSorted1Trailerword;
794 else if ( !strcmp( mode, "unsorted_3_trailerword" ) )
795 decodedMode = kUnsorted3Trailerword;
797 else if ( !strcmp( mode, "unsorted_2_trailerword" ) )
798 decodedMode = kUnsorted2Trailerword;
800 else if ( !strcmp( mode, "unsorted_1_trailerword" ) )
801 decodedMode = kUnsorted1Trailerword;
803 else if ( ! strcmp( mode, "offline" ) )
808 } // END if ( *cpErr ) {
810 if ( intMode >= kNofRawReaderModes )
813 decodedMode = intMode;
820 // ----- MAPPING ARRAYS
821 #if defined(HAVE_TPC_MAPPING)
822 #include "mapping_array_out.inc"
824 // dummy definitions in case of missing mapping
825 unsigned AliHLTTPCDigitReaderRaw::fgMaxHWA[fgkNofPatches];
826 Int_t AliHLTTPCDigitReaderRaw::fgMapping0[fgkMapping0Size][fgkMappingDimension];
827 Int_t AliHLTTPCDigitReaderRaw::fgMapping1[fgkMapping1Size][fgkMappingDimension];
828 Int_t AliHLTTPCDigitReaderRaw::fgMapping2[fgkMapping2Size][fgkMappingDimension];
829 Int_t AliHLTTPCDigitReaderRaw::fgMapping3[fgkMapping3Size][fgkMappingDimension];
830 Int_t AliHLTTPCDigitReaderRaw::fgMapping4[fgkMapping4Size][fgkMappingDimension];
831 Int_t AliHLTTPCDigitReaderRaw::fgMapping5[fgkMapping5Size][fgkMappingDimension];
832 #endif //#if defined(HAVE_TPC_MAPPING)