]>
Commit | Line | Data |
---|---|---|
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 | |
28 | using namespace std; | |
29 | #endif | |
30 | ||
31 | #include "AliHLTTPCDigitReaderUnpacked.h" | |
32 | #include "AliHLTTPCDigitData.h" | |
33 | #include "AliHLTTPCRawDataFormat.h" | |
84645eb0 | 34 | #include "AliHLTTPCTransform.h" |
35 | #include "AliHLTStdIncludes.h" | |
a38a7850 | 36 | |
84645eb0 | 37 | ClassImp(AliHLTTPCDigitReaderUnpacked) |
a38a7850 | 38 | |
84645eb0 | 39 | AliHLTTPCDigitReaderUnpacked::AliHLTTPCDigitReaderUnpacked() |
40 | : | |
41 | fDigitRowData(NULL), | |
42 | fActRowData(NULL), | |
43 | fData(NULL), | |
44 | fPtr(NULL), | |
45 | fSize(0), | |
46 | fBin(0), | |
47 | fRow(0), | |
48 | fFirstRow(0), | |
49 | fLastRow(0) | |
50 | { | |
5df0cbb9 | 51 | // see header file for class documentation |
52 | // or | |
53 | // refer to README to build package | |
54 | // or | |
55 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
84645eb0 | 56 | } |
a38a7850 | 57 | |
84645eb0 | 58 | AliHLTTPCDigitReaderUnpacked::AliHLTTPCDigitReaderUnpacked(const AliHLTTPCDigitReaderUnpacked& src) |
59 | : | |
60 | fDigitRowData(NULL), | |
61 | fActRowData(NULL), | |
62 | fData(NULL), | |
63 | fPtr(NULL), | |
64 | fSize(0), | |
65 | fBin(0), | |
66 | fRow(0), | |
67 | fFirstRow(0), | |
68 | fLastRow(0) | |
69 | { | |
5df0cbb9 | 70 | // see header file for class documentation |
84645eb0 | 71 | HLTFatal("copy constructor not for use"); |
72 | } | |
a38a7850 | 73 | |
84645eb0 | 74 | AliHLTTPCDigitReaderUnpacked& AliHLTTPCDigitReaderUnpacked::operator=(const AliHLTTPCDigitReaderUnpacked& src) |
75 | { | |
5df0cbb9 | 76 | // see header file for class documentation |
84645eb0 | 77 | fDigitRowData=NULL; |
78 | fActRowData=NULL; | |
79 | fData=NULL; | |
80 | fPtr=NULL; | |
81 | fSize=0; | |
82 | fBin=0; | |
83 | fRow=0; | |
84 | fFirstRow=0; | |
85 | fLastRow=0; | |
86 | HLTFatal("assignment operator not for use"); | |
87 | return (*this); | |
a38a7850 | 88 | } |
89 | ||
90 | AliHLTTPCDigitReaderUnpacked::~AliHLTTPCDigitReaderUnpacked(){ | |
5df0cbb9 | 91 | // see header file for class documentation |
a38a7850 | 92 | } |
93 | ||
84645eb0 | 94 | int AliHLTTPCDigitReaderUnpacked::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice){ |
5df0cbb9 | 95 | // see header file for class documentation |
96 | AliHLTTPCUnpackedRawData *tmpptr=NULL; | |
a38a7850 | 97 | fPtr = ptr; |
98 | fSize = size; | |
99 | ||
100 | tmpptr = (AliHLTTPCUnpackedRawData*) fPtr; | |
101 | fDigitRowData = (AliHLTTPCDigitRowData*) tmpptr->fDigits; | |
102 | fActRowData = (AliHLTTPCDigitRowData*) fDigitRowData; | |
103 | ||
104 | fBin = -1; | |
105 | ||
84645eb0 | 106 | fFirstRow=AliHLTTPCTransform::GetFirstRow(patch); |
107 | fLastRow=AliHLTTPCTransform::GetLastRow(patch); | |
108 | ||
a38a7850 | 109 | return 0; |
110 | fRow = fFirstRow; | |
111 | ||
112 | if ((Int_t)fActRowData->fRow != fRow){ | |
84645eb0 | 113 | HLTWarning("Row number should match! fActRowData->fRow=%d fRow=%d", fActRowData->fRow, fRow); |
a38a7850 | 114 | } |
115 | } | |
116 | ||
117 | bool AliHLTTPCDigitReaderUnpacked::Next(){ | |
5df0cbb9 | 118 | // see header file for class documentation |
a38a7850 | 119 | bool rreadvalue = true; |
120 | ||
121 | fBin++; | |
122 | ||
123 | if ( fBin >= (Int_t)fActRowData->fNDigit ){ | |
124 | ||
125 | fRow++; | |
126 | ||
127 | if ((fRow >= fFirstRow) && (fRow <= fLastRow)){ | |
128 | ||
129 | //new row | |
130 | Byte_t *tmp = (Byte_t*) fActRowData; | |
131 | Int_t size = sizeof(AliHLTTPCDigitRowData) + fActRowData->fNDigit*sizeof(AliHLTTPCDigitData); | |
132 | tmp += size; | |
133 | fActRowData = (AliHLTTPCDigitRowData*) tmp; | |
134 | ||
135 | if (((Byte_t*)fPtr) + fSize <= tmp){ | |
136 | rreadvalue = false; | |
137 | return rreadvalue; | |
138 | } | |
139 | ||
140 | fBin = 0; | |
141 | } | |
142 | else { | |
143 | rreadvalue = false; | |
144 | return rreadvalue; | |
145 | } | |
146 | ||
147 | if ((Int_t)fActRowData->fRow != fRow){ | |
84645eb0 | 148 | HLTWarning("Row number should match! fActRowData->fRow=%d fRow=%d", fActRowData->fRow, fRow); |
a38a7850 | 149 | } |
150 | } | |
151 | ||
152 | fData = fActRowData->fDigitData; | |
153 | ||
154 | return rreadvalue; | |
155 | } | |
156 | ||
157 | int AliHLTTPCDigitReaderUnpacked::GetRow(){ | |
5df0cbb9 | 158 | // see header file for class documentation |
a38a7850 | 159 | int rrow; |
160 | rrow = fRow; | |
161 | return rrow; | |
162 | } | |
163 | ||
164 | int AliHLTTPCDigitReaderUnpacked::GetPad(){ | |
5df0cbb9 | 165 | // see header file for class documentation |
a38a7850 | 166 | int rpad; |
167 | rpad = (int)fData[fBin].fPad; | |
168 | return rpad ; | |
169 | } | |
170 | ||
171 | int AliHLTTPCDigitReaderUnpacked::GetSignal(){ | |
5df0cbb9 | 172 | // see header file for class documentation |
a38a7850 | 173 | int rsignal; |
174 | rsignal = (int)fData[fBin].fCharge; | |
175 | return rsignal; | |
176 | } | |
177 | ||
178 | int AliHLTTPCDigitReaderUnpacked::GetTime(){ | |
5df0cbb9 | 179 | // see header file for class documentation |
a38a7850 | 180 | int rtime; |
181 | rtime = (int)fData[fBin].fTime; | |
182 | return rtime; | |
183 | } |