]>
Commit | Line | Data |
---|---|---|
d9a0c52c | 1 | |
2 | //************************************************************************** | |
3 | //* This file is property of and copyright by the ALICE HLT Project * | |
4 | //* ALICE Experiment at CERN, All rights reserved. * | |
5 | //* * | |
6 | //* Primary 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 HLT 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 | /** @file AliHLTTPCDigitReader32Bit.cxx | |
21 | @author Kenneth Aamodt | |
22 | @date | |
23 | @brief DigitReader implementation for the 32 bit offline decoder | |
24 | */ | |
25 | ||
26 | #if __GNUC__>= 3 | |
27 | using namespace std; | |
28 | #endif | |
29 | ||
30 | #include <cassert> | |
31 | #include "AliHLTTPCDigitReader32Bit.h" | |
32 | #include "AliHLTTPCMapping.h" | |
33 | #include "AliRawReader.h" | |
34 | #include "AliRawReaderMemory.h" | |
a553c904 | 35 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 36 | #include "AliAltroRawStreamV3.h" |
f273a6dd | 37 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 38 | #include "AliHLTTPCTransform.h" |
39 | ||
40 | ClassImp(AliHLTTPCDigitReader32Bit) | |
41 | ||
42 | AliHLTTPCDigitReader32Bit::AliHLTTPCDigitReader32Bit() | |
43 | : | |
44 | AliHLTTPCDigitReader(), | |
d9a0c52c | 45 | fRawReaderMemory(NULL), |
46 | fAltroRawStreamV3(NULL), | |
4f43db26 | 47 | fMapping(NULL), |
48 | fSkipDataReadingFlag(kFALSE) | |
d9a0c52c | 49 | { |
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 | |
e9791402 | 55 | |
56 | // initlialized here to get more accurate comparison with the | |
57 | // digitReaderDecoder when using SimpleComponentWrapper | |
58 | if(fRawReaderMemory ==NULL){ | |
59 | fRawReaderMemory = new AliRawReaderMemory(); | |
60 | } | |
d9a0c52c | 61 | } |
62 | ||
63 | AliHLTTPCDigitReader32Bit::~AliHLTTPCDigitReader32Bit() | |
64 | { | |
65 | // see header file for class documentation | |
66 | if (fRawReaderMemory){ | |
67 | delete fRawReaderMemory; | |
68 | fRawReaderMemory=NULL; | |
69 | } | |
70 | ||
a553c904 | 71 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 72 | if (fAltroRawStreamV3){ |
73 | delete fAltroRawStreamV3; | |
74 | fAltroRawStreamV3 = NULL; | |
75 | } | |
a553c904 | 76 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 77 | |
78 | if(fMapping){ | |
79 | delete fMapping; | |
80 | } | |
81 | } | |
82 | ||
83 | int AliHLTTPCDigitReader32Bit::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice) | |
84 | { | |
85 | // see header file for class documentation | |
86 | ||
87 | Int_t ddlno=768; | |
88 | if (patch>1) ddlno+=72+4*slice+(patch-2); | |
89 | else ddlno+=2*slice+patch; | |
90 | ||
e9791402 | 91 | if(fRawReaderMemory == NULL){ |
92 | fRawReaderMemory = new AliRawReaderMemory(); | |
93 | } | |
d9a0c52c | 94 | if(!fRawReaderMemory){ |
95 | return -ENODEV; | |
96 | } | |
97 | fRawReaderMemory->SetMemory(reinterpret_cast<UChar_t*>(ptr), ULong_t(size)); | |
98 | fRawReaderMemory->SetEquipmentID(ddlno); | |
99 | fRawReaderMemory->Reset(); | |
4f43db26 | 100 | fSkipDataReadingFlag = fRawReaderMemory->NextEvent(); |
d9a0c52c | 101 | |
a553c904 | 102 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
e9791402 | 103 | if(fAltroRawStreamV3 != NULL){ |
104 | delete fAltroRawStreamV3; | |
105 | fAltroRawStreamV3=NULL; | |
106 | } | |
d9a0c52c | 107 | fAltroRawStreamV3= new AliAltroRawStreamV3(fRawReaderMemory); |
e9791402 | 108 | |
d9a0c52c | 109 | if (!fAltroRawStreamV3){ |
110 | return -ENODEV; | |
111 | } | |
4f43db26 | 112 | |
113 | fSkipDataReadingFlag = fAltroRawStreamV3->NextDDL(); | |
114 | ||
a553c904 | 115 | #else |
116 | HLTError("AltroRawStreamV3 is not available in this AliRoot version"); | |
117 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 118 | |
119 | if(!fMapping){ | |
120 | fMapping = new AliHLTTPCMapping(patch); | |
121 | if(!fMapping){ | |
122 | return -ENODEV; | |
123 | } | |
124 | } | |
125 | return 0; | |
126 | } | |
127 | ||
128 | int AliHLTTPCDigitReader32Bit::Reset() | |
129 | { | |
130 | // see header file for class documentation | |
e3a7b017 | 131 | fRawReaderMemory->ClearBuffers(); |
d9a0c52c | 132 | return 0; |
133 | } | |
134 | ||
135 | void AliHLTTPCDigitReader32Bit::SetUnsorted(bool unsorted) | |
136 | { | |
137 | // see header file for class documentation | |
138 | ||
139 | // The DigitReaderDecoder does not support sorted data, forward to | |
140 | // default if sorted data requested | |
141 | if (!unsorted) AliHLTTPCDigitReader::SetUnsorted(unsorted); | |
142 | } | |
143 | ||
144 | bool AliHLTTPCDigitReader32Bit::NextChannel() | |
145 | { | |
146 | // see header file for class documentation | |
4f43db26 | 147 | if(fSkipDataReadingFlag == kFALSE){ |
148 | return kFALSE; | |
149 | } | |
150 | ||
a553c904 | 151 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 152 | return fAltroRawStreamV3->NextChannel(); |
a553c904 | 153 | #else |
154 | return false; | |
155 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 156 | |
157 | } | |
158 | ||
159 | int AliHLTTPCDigitReader32Bit::NextBunch() | |
160 | { | |
161 | // see header file for class documentation | |
a553c904 | 162 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 163 | return fAltroRawStreamV3->NextBunch(); |
a553c904 | 164 | #else |
86ebad76 | 165 | return -1; |
a553c904 | 166 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 167 | } |
168 | ||
169 | bool AliHLTTPCDigitReader32Bit::NextSignal() | |
170 | { | |
171 | // see header file for class documentation | |
172 | return false; | |
173 | } | |
174 | ||
175 | const UInt_t* AliHLTTPCDigitReader32Bit::GetSignals() | |
176 | { | |
177 | // see header file for class documentation | |
178 | HLTError("AliHLTTPCDigitReader32Bit does not support the UInt_t* format, use GetSignalsShort instead"); | |
179 | return 0; | |
180 | } | |
181 | ||
182 | const UShort_t* AliHLTTPCDigitReader32Bit::GetSignalsShort() | |
183 | { | |
184 | // see header file for class documentation | |
a553c904 | 185 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 186 | return fAltroRawStreamV3->GetSignals(); |
a553c904 | 187 | #else |
86ebad76 | 188 | return NULL; |
a553c904 | 189 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 190 | } |
191 | ||
192 | int AliHLTTPCDigitReader32Bit::GetRow() | |
193 | { | |
194 | // see header file for class documentation | |
a553c904 | 195 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 196 | return fMapping->GetRow(fAltroRawStreamV3->GetHWAddress()); |
a553c904 | 197 | #else |
198 | return -1; | |
199 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 200 | } |
201 | ||
202 | int AliHLTTPCDigitReader32Bit::GetPad() | |
203 | { | |
204 | // see header file for class documentation | |
a553c904 | 205 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 206 | return fMapping->GetPad(fAltroRawStreamV3->GetHWAddress()); |
a553c904 | 207 | #else |
208 | return -1; | |
209 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 210 | } |
211 | ||
212 | int AliHLTTPCDigitReader32Bit::GetSignal() | |
213 | { | |
214 | // see header file for class documentation | |
215 | return 0; | |
216 | } | |
217 | ||
218 | int AliHLTTPCDigitReader32Bit::GetTime() | |
219 | { | |
220 | // see header file for class documentation | |
a553c904 | 221 | int iResult=-1; |
222 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 | |
223 | iResult=fAltroRawStreamV3->GetStartTimeBin()-fAltroRawStreamV3->GetBunchLength()+1; | |
224 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 225 | return iResult; |
226 | } | |
227 | ||
228 | int AliHLTTPCDigitReader32Bit::GetBunchSize() | |
229 | { | |
230 | // see header file for class documentation | |
a553c904 | 231 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 232 | return fAltroRawStreamV3->GetBunchLength(); |
a553c904 | 233 | #else |
234 | return -1; | |
235 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 236 | } |
237 | ||
238 | int AliHLTTPCDigitReader32Bit::GetRowOffset() const | |
239 | { | |
240 | return fMapping->GetRowOffset(); | |
241 | } | |
a553c904 | 242 | |
d9a0c52c | 243 | AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr() const |
244 | { | |
245 | // see header file for class documentation | |
a553c904 | 246 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 247 | return (AliHLTUInt32_t)fAltroRawStreamV3->GetHWAddress(); |
a553c904 | 248 | #else |
249 | return 0; | |
250 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 251 | } |
252 | ||
253 | AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr(Int_t row, Int_t pad) const | |
254 | { | |
255 | // see header file for class documentation | |
256 | if(fMapping){ | |
257 | return fMapping->GetHwAddress(row,pad); | |
258 | } | |
259 | else{ | |
260 | return 0; | |
261 | } | |
262 | } | |
263 | ||
264 | int AliHLTTPCDigitReader32Bit::GetRCUTrailerSize() | |
265 | { | |
266 | // see header file for class documentation | |
267 | return 0; | |
268 | } | |
269 | ||
270 | bool AliHLTTPCDigitReader32Bit::GetRCUTrailerData(UChar_t*& /*trData*/) | |
271 | { | |
272 | // see header file for class documentation | |
273 | return false; | |
274 | } |