]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.cxx
incremented library version
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDigitReaderUnpacked.cxx
CommitLineData
a38a7850 1// $Id$
2
3/**************************************************************************
9be2600f 4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
a38a7850 6 * *
9be2600f 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. *
a38a7850 11 * *
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 **************************************************************************/
20
84645eb0 21/** @file AliHLTTPCDigitReaderUnpacked.cxx
22 @author Timm Steinbeck, Jochen Thaeder, Matthias Richter
23 @date
24 @brief A digit reader implementation for unpacked TPC data.
25*/
a38a7850 26
27#if __GNUC__== 3
28using namespace std;
29#endif
30
31#include "AliHLTTPCDigitReaderUnpacked.h"
32#include "AliHLTTPCDigitData.h"
84645eb0 33#include "AliHLTTPCTransform.h"
34#include "AliHLTStdIncludes.h"
a38a7850 35
84645eb0 36ClassImp(AliHLTTPCDigitReaderUnpacked)
a38a7850 37
84645eb0 38AliHLTTPCDigitReaderUnpacked::AliHLTTPCDigitReaderUnpacked()
39 :
40 fDigitRowData(NULL),
41 fActRowData(NULL),
42 fData(NULL),
43 fPtr(NULL),
44 fSize(0),
45 fBin(0),
46 fRow(0),
47 fFirstRow(0),
48 fLastRow(0)
49{
5df0cbb9 50 // see header file for class documentation
51 // or
52 // refer to README to build package
53 // or
54 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
84645eb0 55}
a38a7850 56
a38a7850 57AliHLTTPCDigitReaderUnpacked::~AliHLTTPCDigitReaderUnpacked(){
5df0cbb9 58 // see header file for class documentation
a38a7850 59}
60
84645eb0 61int AliHLTTPCDigitReaderUnpacked::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice){
5df0cbb9 62 // see header file for class documentation
63 AliHLTTPCUnpackedRawData *tmpptr=NULL;
a38a7850 64 fPtr = ptr;
65 fSize = size;
66
d3905cf0 67 tmpptr = reinterpret_cast<AliHLTTPCUnpackedRawData*>(fPtr);
a38a7850 68 fDigitRowData = (AliHLTTPCDigitRowData*) tmpptr->fDigits;
69 fActRowData = (AliHLTTPCDigitRowData*) fDigitRowData;
70
71 fBin = -1;
72
055fed30 73 int dummy=0;
74 AliHLTTPCTransform::Slice2Sector(slice, AliHLTTPCTransform::GetFirstRow(patch), dummy, fFirstRow);
75 AliHLTTPCTransform::Slice2Sector(slice, AliHLTTPCTransform::GetLastRow(patch), dummy, fLastRow);
84645eb0 76
a38a7850 77 fRow = fFirstRow;
78
79 if ((Int_t)fActRowData->fRow != fRow){
84645eb0 80 HLTWarning("Row number should match! fActRowData->fRow=%d fRow=%d", fActRowData->fRow, fRow);
a38a7850 81 }
d3905cf0 82 return 0;
a38a7850 83}
84
f44e97dc 85bool AliHLTTPCDigitReaderUnpacked::NextSignal(){
5df0cbb9 86 // see header file for class documentation
a38a7850 87 bool rreadvalue = true;
88
89 fBin++;
90
91 if ( fBin >= (Int_t)fActRowData->fNDigit ){
92
93 fRow++;
94
95 if ((fRow >= fFirstRow) && (fRow <= fLastRow)){
96
97 //new row
98 Byte_t *tmp = (Byte_t*) fActRowData;
99 Int_t size = sizeof(AliHLTTPCDigitRowData) + fActRowData->fNDigit*sizeof(AliHLTTPCDigitData);
100 tmp += size;
101 fActRowData = (AliHLTTPCDigitRowData*) tmp;
102
103 if (((Byte_t*)fPtr) + fSize <= tmp){
104 rreadvalue = false;
105 return rreadvalue;
106 }
107
108 fBin = 0;
109 }
110 else {
111 rreadvalue = false;
112 return rreadvalue;
113 }
114
115 if ((Int_t)fActRowData->fRow != fRow){
84645eb0 116 HLTWarning("Row number should match! fActRowData->fRow=%d fRow=%d", fActRowData->fRow, fRow);
a38a7850 117 }
118 }
119
120 fData = fActRowData->fDigitData;
121
122 return rreadvalue;
123}
124
125int AliHLTTPCDigitReaderUnpacked::GetRow(){
5df0cbb9 126 // see header file for class documentation
a38a7850 127 int rrow;
128 rrow = fRow;
129 return rrow;
130}
131
132int AliHLTTPCDigitReaderUnpacked::GetPad(){
5df0cbb9 133 // see header file for class documentation
f44e97dc 134 if (!fData) return -1;
a38a7850 135 int rpad;
136 rpad = (int)fData[fBin].fPad;
137 return rpad ;
138}
139
140int AliHLTTPCDigitReaderUnpacked::GetSignal(){
5df0cbb9 141 // see header file for class documentation
f44e97dc 142 if (!fData) return -1;
a38a7850 143 int rsignal;
144 rsignal = (int)fData[fBin].fCharge;
145 return rsignal;
146}
147
148int AliHLTTPCDigitReaderUnpacked::GetTime(){
5df0cbb9 149 // see header file for class documentation
f44e97dc 150 if (!fData) return -1;
a38a7850 151 int rtime;
152 rtime = (int)fData[fBin].fTime;
153 return rtime;
154}