]>
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(), | |
45 | fRawReader(NULL), | |
46 | fRawReaderMemory(NULL), | |
47 | fAltroRawStreamV3(NULL), | |
48 | fMapping(NULL) | |
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(); | |
100 | fRawReaderMemory->NextEvent(); | |
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 | } | |
112 | fAltroRawStreamV3->NextDDL(); | |
a553c904 | 113 | #else |
114 | HLTError("AltroRawStreamV3 is not available in this AliRoot version"); | |
115 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 116 | |
117 | if(!fMapping){ | |
118 | fMapping = new AliHLTTPCMapping(patch); | |
119 | if(!fMapping){ | |
120 | return -ENODEV; | |
121 | } | |
122 | } | |
123 | return 0; | |
124 | } | |
125 | ||
126 | int AliHLTTPCDigitReader32Bit::Reset() | |
127 | { | |
128 | // see header file for class documentation | |
e3a7b017 | 129 | fRawReaderMemory->ClearBuffers(); |
d9a0c52c | 130 | return 0; |
131 | } | |
132 | ||
133 | void AliHLTTPCDigitReader32Bit::SetUnsorted(bool unsorted) | |
134 | { | |
135 | // see header file for class documentation | |
136 | ||
137 | // The DigitReaderDecoder does not support sorted data, forward to | |
138 | // default if sorted data requested | |
139 | if (!unsorted) AliHLTTPCDigitReader::SetUnsorted(unsorted); | |
140 | } | |
141 | ||
142 | bool AliHLTTPCDigitReader32Bit::NextChannel() | |
143 | { | |
144 | // see header file for class documentation | |
a553c904 | 145 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 146 | return fAltroRawStreamV3->NextChannel(); |
a553c904 | 147 | #else |
148 | return false; | |
149 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 150 | |
151 | } | |
152 | ||
153 | int AliHLTTPCDigitReader32Bit::NextBunch() | |
154 | { | |
155 | // see header file for class documentation | |
a553c904 | 156 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 157 | return fAltroRawStreamV3->NextBunch(); |
a553c904 | 158 | #else |
159 | return false; | |
160 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 161 | } |
162 | ||
163 | bool AliHLTTPCDigitReader32Bit::NextSignal() | |
164 | { | |
165 | // see header file for class documentation | |
166 | return false; | |
167 | } | |
168 | ||
169 | const UInt_t* AliHLTTPCDigitReader32Bit::GetSignals() | |
170 | { | |
171 | // see header file for class documentation | |
172 | HLTError("AliHLTTPCDigitReader32Bit does not support the UInt_t* format, use GetSignalsShort instead"); | |
173 | return 0; | |
174 | } | |
175 | ||
176 | const UShort_t* AliHLTTPCDigitReader32Bit::GetSignalsShort() | |
177 | { | |
178 | // see header file for class documentation | |
a553c904 | 179 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 180 | return fAltroRawStreamV3->GetSignals(); |
a553c904 | 181 | #else |
182 | return false; | |
183 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 184 | } |
185 | ||
186 | int AliHLTTPCDigitReader32Bit::GetRow() | |
187 | { | |
188 | // see header file for class documentation | |
a553c904 | 189 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 190 | return fMapping->GetRow(fAltroRawStreamV3->GetHWAddress()); |
a553c904 | 191 | #else |
192 | return -1; | |
193 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 194 | } |
195 | ||
196 | int AliHLTTPCDigitReader32Bit::GetPad() | |
197 | { | |
198 | // see header file for class documentation | |
a553c904 | 199 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 200 | return fMapping->GetPad(fAltroRawStreamV3->GetHWAddress()); |
a553c904 | 201 | #else |
202 | return -1; | |
203 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 204 | } |
205 | ||
206 | int AliHLTTPCDigitReader32Bit::GetSignal() | |
207 | { | |
208 | // see header file for class documentation | |
209 | return 0; | |
210 | } | |
211 | ||
212 | int AliHLTTPCDigitReader32Bit::GetTime() | |
213 | { | |
214 | // see header file for class documentation | |
a553c904 | 215 | int iResult=-1; |
216 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 | |
217 | iResult=fAltroRawStreamV3->GetStartTimeBin()-fAltroRawStreamV3->GetBunchLength()+1; | |
218 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 219 | return iResult; |
220 | } | |
221 | ||
222 | int AliHLTTPCDigitReader32Bit::GetBunchSize() | |
223 | { | |
224 | // see header file for class documentation | |
a553c904 | 225 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 226 | return fAltroRawStreamV3->GetBunchLength(); |
a553c904 | 227 | #else |
228 | return -1; | |
229 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 230 | } |
231 | ||
232 | int AliHLTTPCDigitReader32Bit::GetRowOffset() const | |
233 | { | |
234 | return fMapping->GetRowOffset(); | |
235 | } | |
a553c904 | 236 | |
d9a0c52c | 237 | AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr() const |
238 | { | |
239 | // see header file for class documentation | |
a553c904 | 240 | #ifndef HAVE_NOT_ALTRORAWSTREAMV3 |
d9a0c52c | 241 | return (AliHLTUInt32_t)fAltroRawStreamV3->GetHWAddress(); |
a553c904 | 242 | #else |
243 | return 0; | |
244 | #endif //HAVE_NOT_ALTRORAWSTREAMV3 | |
d9a0c52c | 245 | } |
246 | ||
247 | AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr(Int_t row, Int_t pad) const | |
248 | { | |
249 | // see header file for class documentation | |
250 | if(fMapping){ | |
251 | return fMapping->GetHwAddress(row,pad); | |
252 | } | |
253 | else{ | |
254 | return 0; | |
255 | } | |
256 | } | |
257 | ||
258 | int AliHLTTPCDigitReader32Bit::GetRCUTrailerSize() | |
259 | { | |
260 | // see header file for class documentation | |
261 | return 0; | |
262 | } | |
263 | ||
264 | bool AliHLTTPCDigitReader32Bit::GetRCUTrailerData(UChar_t*& /*trData*/) | |
265 | { | |
266 | // see header file for class documentation | |
267 | return false; | |
268 | } |