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