]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCDigitReader.cxx
Bug fixes in HLT cluster transformation:
[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
a38a7850 33#include "AliHLTTPCDigitReader.h"
84645eb0 34#include "AliHLTTPCTransform.h"
35#include "AliHLTStdIncludes.h"
a38a7850 36
d5cf9283 37using namespace std;
38
a38a7850 39ClassImp(AliHLTTPCDigitReader)
40
f44e97dc 41AliHLTTPCDigitReader::AliHLTTPCDigitReader()
42 :
43 fFlags(0),
44 fLckRow(-1),
45 fLckPad(-1)
46{
f32b83e1 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
a38a7850 52}
53
f44e97dc 54AliHLTTPCDigitReader::~AliHLTTPCDigitReader()
55{
f32b83e1 56 // see header file for class documentation
a38a7850 57}
58
f44e97dc 59int AliHLTTPCDigitReader::InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice)
60{
f32b83e1 61 // see header file for class documentation
84645eb0 62 if (patch<0 || patch>=AliHLTTPCTransform::GetNumberOfPatches()) {
63 HLTError("invalid readout partition number %d", patch);
64 return -EINVAL;
65 }
66 if (firstrow!=AliHLTTPCTransform::GetFirstRow(patch)) {
67 HLTWarning("The firstrow parameter does not match the layout of the readout partition %d "
68 "(firstrow=%d). Parameter is ignored", patch, AliHLTTPCTransform::GetFirstRow(patch));
69 }
70 if (lastrow!=AliHLTTPCTransform::GetLastRow(patch)) {
71 HLTWarning("The lastrow parameter does not match the layout of the readout partition %d "
72 "(lastrow=%d). Parameter is ignored", patch, AliHLTTPCTransform::GetLastRow(patch));
73 }
74 return InitBlock(ptr, size, patch, slice);
75}
76
e419b223 77void AliHLTTPCDigitReader::SetOldRCUFormat(Bool_t /*oldrcuformat*/)
78{
f32b83e1 79 // default method of the base class
27f5f8ed 80}
f32b83e1 81
82void AliHLTTPCDigitReader::SetUnsorted(Bool_t /*unsorted*/)
83{
84 // default method of the base class
e03c4cc0 85 HLTWarning("common sorting functionality has not yet been implemented");
01f43166 86}
f44e97dc 87
a74855c2 88bool AliHLTTPCDigitReader::Next(int /*type*/)
f44e97dc 89{
f32b83e1 90 // see header file for class documentation
f44e97dc 91 if (!CheckFlag(kLocked)) return NextSignal();
92
93 bool haveData=false;
94 if (!CheckFlag(kChannelOverwrap))
95 haveData=NextSignal();
96
97 if (haveData && (fLckRow!=GetRow() || fLckPad!=GetPad())) {
98 SetFlag(kChannelOverwrap);
99 haveData=false;
100 }
101
102 return haveData;
103}
104
e03c4cc0 105bool AliHLTTPCDigitReader::NextChannel()
106{
107 // see header file for class documentation
4ea087a6 108 PrintWarningOnce(kWarnMissFastAccess,"\n"
109 " !!! This digit reader does not implement the methods for !!!\n"
110 " !!! fast data access on channel/bunch basis. Data is discarded !!!");
e03c4cc0 111 return false;
112}
113
114int AliHLTTPCDigitReader::NextBunch()
115{
116 // see header file for class documentation
4ea087a6 117 PrintWarningOnce(kWarnMissFastAccess,"\n"
118 " !!! This digit reader does not implement the methods for !!!\n"
119 " !!! fast data access on channel/bunch basis. Data is discarded !!!");
e03c4cc0 120 return false;
121}
122
7dceaa9b 123const UInt_t* AliHLTTPCDigitReader::GetSignals()
e03c4cc0 124{
125 // see header file for class documentation
4ea087a6 126 PrintWarningOnce(kWarnMissFastAccess,"\n"
127 " !!! This digit reader does not implement the methods for !!!\n"
128 " !!! fast data access on channel/bunch basis. Data is discarded !!!");
e03c4cc0 129 return 0;
130}
131
deba5d85 132const UShort_t* AliHLTTPCDigitReader::GetSignalsShort()
133{
134 // see header file for class documentation
135 PrintWarningOnce(kWarnMissFastAccess,"\n"
136 " !!! This digit reader does not implement the methods for !!!\n"
137 " !!! fast data access on channel/bunch basis. Data is discarded !!!");
138 return 0;
139}
140
f44e97dc 141void AliHLTTPCDigitReader::EnableCaching(bool bCache)
142{
f32b83e1 143 // see header file for class documentation
f44e97dc 144 if (bCache) SetFlag(kChannelCaching);
145 else ClearFlag(kChannelCaching);
146}
147
148int AliHLTTPCDigitReader::RewindChannel()
149{
f32b83e1 150 // see header file for class documentation
f44e97dc 151 int iResult=0;
152
153 return iResult;
154}
155
156unsigned int AliHLTTPCDigitReader::SetFlag(unsigned int flag)
157{
f32b83e1 158 // see header file for class documentation
f44e97dc 159 return fFlags|=flag;
160}
161
162unsigned int AliHLTTPCDigitReader::ClearFlag(unsigned int flag)
163{
f32b83e1 164 // see header file for class documentation
f44e97dc 165 return fFlags&=~flag;
166}
167
168// int operator[](int timebin)
169// {
170// return -1;
171// }
172
173int AliHLTTPCDigitReader::RewindCurrentChannel()
174{
f32b83e1 175 // see header file for class documentation
f44e97dc 176 SetFlag(kNoRewind);
177 if (!CheckFlag(kChannelCaching)) return -ENODATA;
178 return -ENOSYS;
179}
180
181int AliHLTTPCDigitReader::RewindToPrevChannel()
182{
f32b83e1 183 // see header file for class documentation
f44e97dc 184 SetFlag(kNoRewind);
185 if (!CheckFlag(kChannelCaching)) return -ENODATA;
186 return -ENOSYS;
187}
e03c4cc0 188
7dceaa9b 189int AliHLTTPCDigitReader::GetBunchSize()
190{
191 // see header file for class documentation
4ea087a6 192 PrintWarningOnce(kWarnMissFastAccess,"\n"
193 " !!! This digit reader does not implement the methods for !!!\n"
194 " !!! fast data access on channel/bunch basis. Data is discarded !!!");
7dceaa9b 195 return 0;
196}
197
d2f725e4 198int AliHLTTPCDigitReader::GetRowOffset() const
199{
200 // see header file for class documentation
201 return 0;
202}
203
70d0b23e 204AliHLTUInt32_t AliHLTTPCDigitReader::GetAltroBlockHWaddr() const
205{
092a1374 206 // see header file for class documentation
207 return 0;
208}
209
210AliHLTUInt32_t AliHLTTPCDigitReader::GetAltroBlockHWaddr(Int_t /*row*/, Int_t /*pad*/) const
211{
212 // see header file for class documentation
70d0b23e 213 return 0;
214}
215
436467f5 216int AliHLTTPCDigitReader::GetRCUTrailerSize()
217{
218 // see header file for class documentation
4ea087a6 219 PrintWarningOnce(kWarnMissTrailerGetters,"\n"
220 " !!! This digit reader does not implement the Getters !!!\n"
221 " !!! for RCU trailer. Ignoring call. !!!");
436467f5 222 return 0;
223}
224
4ea087a6 225bool AliHLTTPCDigitReader::GetRCUTrailerData(UChar_t*& trData)
436467f5 226{
227 // see header file for class documentation
4ea087a6 228 PrintWarningOnce(kWarnMissTrailerGetters,"\n"
229 " !!! This digit reader does not implement the Getters !!!\n"
230 " !!! for RCU trailer. Ignoring call. !!!");
231 if (trData) trData=NULL;
436467f5 232 return 0;
233}
234
235
4ea087a6 236void AliHLTTPCDigitReader::PrintWarningOnce(int type, const char* message)
e03c4cc0 237{
238 // see header file for class documentation
4ea087a6 239 if (CheckFlag(type)) return;
240 SetFlag(type);
241 HLTWarning(message);
e03c4cc0 242}
436467f5 243