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