]>
Commit | Line | Data |
---|---|---|
17373fbf | 1 | // $Id$ |
d9a0c52c | 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 | ||
17373fbf | 20 | /// @file AliHLTTPCDigitReader32Bit.cxx |
21 | /// @author Kenneth Aamodt | |
22 | /// @date | |
23 | /// @brief DigitReader implementation for the 32 bit offline decoder | |
24 | /// | |
d9a0c52c | 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" | |
35 | #include "AliAltroRawStreamV3.h" | |
d9a0c52c | 36 | |
37 | ClassImp(AliHLTTPCDigitReader32Bit) | |
38 | ||
39 | AliHLTTPCDigitReader32Bit::AliHLTTPCDigitReader32Bit() | |
40 | : | |
41 | AliHLTTPCDigitReader(), | |
d9a0c52c | 42 | fRawReaderMemory(NULL), |
43 | fAltroRawStreamV3(NULL), | |
4f43db26 | 44 | fMapping(NULL), |
45 | fSkipDataReadingFlag(kFALSE) | |
d9a0c52c | 46 | { |
47 | // see header file for class documentation | |
48 | // or | |
49 | // refer to README to build package | |
50 | // or | |
51 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
e9791402 | 52 | |
53 | // initlialized here to get more accurate comparison with the | |
54 | // digitReaderDecoder when using SimpleComponentWrapper | |
55 | if(fRawReaderMemory ==NULL){ | |
56 | fRawReaderMemory = new AliRawReaderMemory(); | |
57 | } | |
d9a0c52c | 58 | } |
59 | ||
60 | AliHLTTPCDigitReader32Bit::~AliHLTTPCDigitReader32Bit() | |
61 | { | |
62 | // see header file for class documentation | |
63 | if (fRawReaderMemory){ | |
64 | delete fRawReaderMemory; | |
65 | fRawReaderMemory=NULL; | |
66 | } | |
67 | ||
68 | if (fAltroRawStreamV3){ | |
69 | delete fAltroRawStreamV3; | |
70 | fAltroRawStreamV3 = NULL; | |
71 | } | |
d9a0c52c | 72 | |
73 | if(fMapping){ | |
74 | delete fMapping; | |
75 | } | |
76 | } | |
77 | ||
78 | int AliHLTTPCDigitReader32Bit::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice) | |
79 | { | |
80 | // see header file for class documentation | |
81 | ||
82 | Int_t ddlno=768; | |
83 | if (patch>1) ddlno+=72+4*slice+(patch-2); | |
84 | else ddlno+=2*slice+patch; | |
85 | ||
e9791402 | 86 | if(fRawReaderMemory == NULL){ |
87 | fRawReaderMemory = new AliRawReaderMemory(); | |
88 | } | |
d9a0c52c | 89 | if(!fRawReaderMemory){ |
90 | return -ENODEV; | |
91 | } | |
92 | fRawReaderMemory->SetMemory(reinterpret_cast<UChar_t*>(ptr), ULong_t(size)); | |
93 | fRawReaderMemory->SetEquipmentID(ddlno); | |
94 | fRawReaderMemory->Reset(); | |
4f43db26 | 95 | fSkipDataReadingFlag = fRawReaderMemory->NextEvent(); |
d9a0c52c | 96 | |
e9791402 | 97 | if(fAltroRawStreamV3 != NULL){ |
98 | delete fAltroRawStreamV3; | |
99 | fAltroRawStreamV3=NULL; | |
100 | } | |
d9a0c52c | 101 | fAltroRawStreamV3= new AliAltroRawStreamV3(fRawReaderMemory); |
e9791402 | 102 | |
d9a0c52c | 103 | if (!fAltroRawStreamV3){ |
104 | return -ENODEV; | |
105 | } | |
4f43db26 | 106 | |
107 | fSkipDataReadingFlag = fAltroRawStreamV3->NextDDL(); | |
108 | ||
d9a0c52c | 109 | if(!fMapping){ |
110 | fMapping = new AliHLTTPCMapping(patch); | |
111 | if(!fMapping){ | |
112 | return -ENODEV; | |
113 | } | |
114 | } | |
115 | return 0; | |
116 | } | |
117 | ||
118 | int AliHLTTPCDigitReader32Bit::Reset() | |
119 | { | |
120 | // see header file for class documentation | |
e3a7b017 | 121 | fRawReaderMemory->ClearBuffers(); |
d9a0c52c | 122 | return 0; |
123 | } | |
124 | ||
125 | void AliHLTTPCDigitReader32Bit::SetUnsorted(bool unsorted) | |
126 | { | |
127 | // see header file for class documentation | |
128 | ||
129 | // The DigitReaderDecoder does not support sorted data, forward to | |
130 | // default if sorted data requested | |
131 | if (!unsorted) AliHLTTPCDigitReader::SetUnsorted(unsorted); | |
132 | } | |
133 | ||
134 | bool AliHLTTPCDigitReader32Bit::NextChannel() | |
135 | { | |
136 | // see header file for class documentation | |
4f43db26 | 137 | if(fSkipDataReadingFlag == kFALSE){ |
138 | return kFALSE; | |
139 | } | |
140 | ||
d9a0c52c | 141 | return fAltroRawStreamV3->NextChannel(); |
d9a0c52c | 142 | } |
143 | ||
144 | int AliHLTTPCDigitReader32Bit::NextBunch() | |
145 | { | |
146 | // see header file for class documentation | |
147 | return fAltroRawStreamV3->NextBunch(); | |
148 | } | |
149 | ||
150 | bool AliHLTTPCDigitReader32Bit::NextSignal() | |
151 | { | |
152 | // see header file for class documentation | |
153 | return false; | |
154 | } | |
155 | ||
156 | const UInt_t* AliHLTTPCDigitReader32Bit::GetSignals() | |
157 | { | |
158 | // see header file for class documentation | |
159 | HLTError("AliHLTTPCDigitReader32Bit does not support the UInt_t* format, use GetSignalsShort instead"); | |
160 | return 0; | |
161 | } | |
162 | ||
163 | const UShort_t* AliHLTTPCDigitReader32Bit::GetSignalsShort() | |
164 | { | |
165 | // see header file for class documentation | |
166 | return fAltroRawStreamV3->GetSignals(); | |
167 | } | |
168 | ||
169 | int AliHLTTPCDigitReader32Bit::GetRow() | |
170 | { | |
171 | // see header file for class documentation | |
172 | return fMapping->GetRow(fAltroRawStreamV3->GetHWAddress()); | |
173 | } | |
174 | ||
175 | int AliHLTTPCDigitReader32Bit::GetPad() | |
176 | { | |
177 | // see header file for class documentation | |
178 | return fMapping->GetPad(fAltroRawStreamV3->GetHWAddress()); | |
179 | } | |
180 | ||
181 | int AliHLTTPCDigitReader32Bit::GetSignal() | |
182 | { | |
183 | // see header file for class documentation | |
184 | return 0; | |
185 | } | |
186 | ||
187 | int AliHLTTPCDigitReader32Bit::GetTime() | |
188 | { | |
189 | // see header file for class documentation | |
a553c904 | 190 | int iResult=-1; |
a553c904 | 191 | iResult=fAltroRawStreamV3->GetStartTimeBin()-fAltroRawStreamV3->GetBunchLength()+1; |
d9a0c52c | 192 | return iResult; |
193 | } | |
194 | ||
195 | int AliHLTTPCDigitReader32Bit::GetBunchSize() | |
196 | { | |
197 | // see header file for class documentation | |
198 | return fAltroRawStreamV3->GetBunchLength(); | |
199 | } | |
200 | ||
201 | int AliHLTTPCDigitReader32Bit::GetRowOffset() const | |
202 | { | |
203 | return fMapping->GetRowOffset(); | |
204 | } | |
a553c904 | 205 | |
d9a0c52c | 206 | AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr() const |
207 | { | |
208 | // see header file for class documentation | |
209 | return (AliHLTUInt32_t)fAltroRawStreamV3->GetHWAddress(); | |
210 | } | |
211 | ||
212 | AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr(Int_t row, Int_t pad) const | |
213 | { | |
214 | // see header file for class documentation | |
215 | if(fMapping){ | |
216 | return fMapping->GetHwAddress(row,pad); | |
217 | } | |
218 | else{ | |
219 | return 0; | |
220 | } | |
221 | } | |
222 | ||
223 | int AliHLTTPCDigitReader32Bit::GetRCUTrailerSize() | |
224 | { | |
225 | // see header file for class documentation | |
226 | return 0; | |
227 | } | |
228 | ||
229 | bool AliHLTTPCDigitReader32Bit::GetRCUTrailerData(UChar_t*& /*trData*/) | |
230 | { | |
231 | // see header file for class documentation | |
232 | return false; | |
233 | } |