]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCDigitReader.cxx
speedup of track model compression by another factor 2
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDigitReader.cxx
CommitLineData
a38a7850 1// $Id$
2
3/**************************************************************************
9be2600f 4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
a38a7850 6 * *
9be2600f 7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
9 * Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
10 * for The ALICE HLT Project. *
a38a7850 11 * *
12 * Permission to use, copy, modify and distribute this software and its *
13 * documentation strictly for non-commercial purposes is hereby granted *
14 * without fee, provided that the above copyright notice appears in all *
15 * copies and that both the copyright notice and this permission notice *
16 * appear in the supporting documentation. The authors make no claims *
17 * about the suitability of this software for any purpose. It is *
18 * provided "as is" without express or implied warranty. *
19 **************************************************************************/
20
84645eb0 21/** @file AliHLTTPCDigitReader.cxx
27f5f8ed 22 @author Timm Steinbeck, Jochen Thaeder, Matthias Richter, Kenneth Aamodt
84645eb0 23 @date
24 @brief An abstract reader class for TPC data.
25*/
a38a7850 26
f32b83e1 27// see header file for class documentation
28// or
29// refer to README to build package
30// or
31// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
32
db16520a 33#if __GNUC__>= 3
a38a7850 34using namespace std;
35#endif
36
37#include "AliHLTTPCDigitReader.h"
84645eb0 38#include "AliHLTTPCTransform.h"
39#include "AliHLTStdIncludes.h"
a38a7850 40
41ClassImp(AliHLTTPCDigitReader)
42
f44e97dc 43AliHLTTPCDigitReader::AliHLTTPCDigitReader()
44 :
45 fFlags(0),
46 fLckRow(-1),
47 fLckPad(-1)
48{
f32b83e1 49 // see header file for class documentation
50 // or
51 // refer to README to build package
52 // or
53 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
a38a7850 54}
55
f44e97dc 56AliHLTTPCDigitReader::~AliHLTTPCDigitReader()
57{
f32b83e1 58 // see header file for class documentation
a38a7850 59}
60
f44e97dc 61int AliHLTTPCDigitReader::InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice)
62{
f32b83e1 63 // see header file for class documentation
84645eb0 64 if (patch<0 || patch>=AliHLTTPCTransform::GetNumberOfPatches()) {
65 HLTError("invalid readout partition number %d", patch);
66 return -EINVAL;
67 }
68 if (firstrow!=AliHLTTPCTransform::GetFirstRow(patch)) {
69 HLTWarning("The firstrow parameter does not match the layout of the readout partition %d "
70 "(firstrow=%d). Parameter is ignored", patch, AliHLTTPCTransform::GetFirstRow(patch));
71 }
72 if (lastrow!=AliHLTTPCTransform::GetLastRow(patch)) {
73 HLTWarning("The lastrow parameter does not match the layout of the readout partition %d "
74 "(lastrow=%d). Parameter is ignored", patch, AliHLTTPCTransform::GetLastRow(patch));
75 }
76 return InitBlock(ptr, size, patch, slice);
77}
78
e419b223 79void AliHLTTPCDigitReader::SetOldRCUFormat(Bool_t /*oldrcuformat*/)
80{
f32b83e1 81 // default method of the base class
27f5f8ed 82}
f32b83e1 83
84void AliHLTTPCDigitReader::SetUnsorted(Bool_t /*unsorted*/)
85{
86 // default method of the base class
e03c4cc0 87 HLTWarning("common sorting functionality has not yet been implemented");
01f43166 88}
f44e97dc 89
a74855c2 90bool AliHLTTPCDigitReader::Next(int /*type*/)
f44e97dc 91{
f32b83e1 92 // see header file for class documentation
f44e97dc 93 if (!CheckFlag(kLocked)) return NextSignal();
94
95 bool haveData=false;
96 if (!CheckFlag(kChannelOverwrap))
97 haveData=NextSignal();
98
99 if (haveData && (fLckRow!=GetRow() || fLckPad!=GetPad())) {
100 SetFlag(kChannelOverwrap);
101 haveData=false;
102 }
103
104 return haveData;
105}
106
e03c4cc0 107bool AliHLTTPCDigitReader::NextChannel()
108{
109 // see header file for class documentation
4ea087a6 110 PrintWarningOnce(kWarnMissFastAccess,"\n"
111 " !!! This digit reader does not implement the methods for !!!\n"
112 " !!! fast data access on channel/bunch basis. Data is discarded !!!");
e03c4cc0 113 return false;
114}
115
116int AliHLTTPCDigitReader::NextBunch()
117{
118 // see header file for class documentation
4ea087a6 119 PrintWarningOnce(kWarnMissFastAccess,"\n"
120 " !!! This digit reader does not implement the methods for !!!\n"
121 " !!! fast data access on channel/bunch basis. Data is discarded !!!");
e03c4cc0 122 return false;
123}
124
7dceaa9b 125const UInt_t* AliHLTTPCDigitReader::GetSignals()
e03c4cc0 126{
127 // see header file for class documentation
4ea087a6 128 PrintWarningOnce(kWarnMissFastAccess,"\n"
129 " !!! This digit reader does not implement the methods for !!!\n"
130 " !!! fast data access on channel/bunch basis. Data is discarded !!!");
e03c4cc0 131 return 0;
132}
133
deba5d85 134const UShort_t* AliHLTTPCDigitReader::GetSignalsShort()
135{
136 // see header file for class documentation
137 PrintWarningOnce(kWarnMissFastAccess,"\n"
138 " !!! This digit reader does not implement the methods for !!!\n"
139 " !!! fast data access on channel/bunch basis. Data is discarded !!!");
140 return 0;
141}
142
f44e97dc 143void AliHLTTPCDigitReader::EnableCaching(bool bCache)
144{
f32b83e1 145 // see header file for class documentation
f44e97dc 146 if (bCache) SetFlag(kChannelCaching);
147 else ClearFlag(kChannelCaching);
148}
149
150int AliHLTTPCDigitReader::RewindChannel()
151{
f32b83e1 152 // see header file for class documentation
f44e97dc 153 int iResult=0;
154
155 return iResult;
156}
157
158unsigned int AliHLTTPCDigitReader::SetFlag(unsigned int flag)
159{
f32b83e1 160 // see header file for class documentation
f44e97dc 161 return fFlags|=flag;
162}
163
164unsigned int AliHLTTPCDigitReader::ClearFlag(unsigned int flag)
165{
f32b83e1 166 // see header file for class documentation
f44e97dc 167 return fFlags&=~flag;
168}
169
170// int operator[](int timebin)
171// {
172// return -1;
173// }
174
175int AliHLTTPCDigitReader::RewindCurrentChannel()
176{
f32b83e1 177 // see header file for class documentation
f44e97dc 178 SetFlag(kNoRewind);
179 if (!CheckFlag(kChannelCaching)) return -ENODATA;
180 return -ENOSYS;
181}
182
183int AliHLTTPCDigitReader::RewindToPrevChannel()
184{
f32b83e1 185 // see header file for class documentation
f44e97dc 186 SetFlag(kNoRewind);
187 if (!CheckFlag(kChannelCaching)) return -ENODATA;
188 return -ENOSYS;
189}
e03c4cc0 190
7dceaa9b 191int AliHLTTPCDigitReader::GetBunchSize()
192{
193 // see header file for class documentation
4ea087a6 194 PrintWarningOnce(kWarnMissFastAccess,"\n"
195 " !!! This digit reader does not implement the methods for !!!\n"
196 " !!! fast data access on channel/bunch basis. Data is discarded !!!");
7dceaa9b 197 return 0;
198}
199
d2f725e4 200int AliHLTTPCDigitReader::GetRowOffset() const
201{
202 // see header file for class documentation
203 return 0;
204}
205
70d0b23e 206AliHLTUInt32_t AliHLTTPCDigitReader::GetAltroBlockHWaddr() const
207{
092a1374 208 // see header file for class documentation
209 return 0;
210}
211
212AliHLTUInt32_t AliHLTTPCDigitReader::GetAltroBlockHWaddr(Int_t /*row*/, Int_t /*pad*/) const
213{
214 // see header file for class documentation
70d0b23e 215 return 0;
216}
217
436467f5 218int AliHLTTPCDigitReader::GetRCUTrailerSize()
219{
220 // see header file for class documentation
4ea087a6 221 PrintWarningOnce(kWarnMissTrailerGetters,"\n"
222 " !!! This digit reader does not implement the Getters !!!\n"
223 " !!! for RCU trailer. Ignoring call. !!!");
436467f5 224 return 0;
225}
226
4ea087a6 227bool AliHLTTPCDigitReader::GetRCUTrailerData(UChar_t*& trData)
436467f5 228{
229 // see header file for class documentation
4ea087a6 230 PrintWarningOnce(kWarnMissTrailerGetters,"\n"
231 " !!! This digit reader does not implement the Getters !!!\n"
232 " !!! for RCU trailer. Ignoring call. !!!");
233 if (trData) trData=NULL;
436467f5 234 return 0;
235}
236
237
4ea087a6 238void AliHLTTPCDigitReader::PrintWarningOnce(int type, const char* message)
e03c4cc0 239{
240 // see header file for class documentation
4ea087a6 241 if (CheckFlag(type)) return;
242 SetFlag(type);
243 HLTWarning(message);
e03c4cc0 244}
436467f5 245