Line data Source code
1 : // $Id$
2 :
3 : /**************************************************************************
4 : * This file is property of and copyright by the ALICE HLT Project *
5 : * ALICE Experiment at CERN, All rights reserved. *
6 : * *
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. *
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 :
21 : /** @file AliHLTTPCDigitReader.cxx
22 : @author Timm Steinbeck, Jochen Thaeder, Matthias Richter, Kenneth Aamodt
23 : @date
24 : @brief An abstract reader class for TPC data.
25 : */
26 :
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 :
33 : #include "AliHLTTPCDigitReader.h"
34 : #include "AliHLTTPCGeometry.h"
35 : #include "AliHLTStdIncludes.h"
36 :
37 : using namespace std;
38 :
39 6 : ClassImp(AliHLTTPCDigitReader)
40 :
41 0 : AliHLTTPCDigitReader::AliHLTTPCDigitReader()
42 : :
43 0 : fFlags(0),
44 0 : fLckRow(-1),
45 0 : fLckPad(-1)
46 0 : {
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
52 0 : }
53 :
54 : AliHLTTPCDigitReader::~AliHLTTPCDigitReader()
55 0 : {
56 : // see header file for class documentation
57 0 : }
58 :
59 : int AliHLTTPCDigitReader::InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice)
60 : {
61 : // see header file for class documentation
62 0 : if (patch<0 || patch>=AliHLTTPCGeometry::GetNumberOfPatches()) {
63 0 : HLTError("invalid readout partition number %d", patch);
64 0 : return -EINVAL;
65 : }
66 0 : if (firstrow!=AliHLTTPCGeometry::GetFirstRow(patch)) {
67 0 : HLTWarning("The firstrow parameter does not match the layout of the readout partition %d "
68 : "(firstrow=%d). Parameter is ignored", patch, AliHLTTPCGeometry::GetFirstRow(patch));
69 : }
70 0 : if (lastrow!=AliHLTTPCGeometry::GetLastRow(patch)) {
71 0 : HLTWarning("The lastrow parameter does not match the layout of the readout partition %d "
72 : "(lastrow=%d). Parameter is ignored", patch, AliHLTTPCGeometry::GetLastRow(patch));
73 : }
74 0 : return InitBlock(ptr, size, patch, slice);
75 0 : }
76 :
77 : void AliHLTTPCDigitReader::SetOldRCUFormat(Bool_t /*oldrcuformat*/)
78 : {
79 : // default method of the base class
80 0 : }
81 :
82 : void AliHLTTPCDigitReader::SetUnsorted(Bool_t /*unsorted*/)
83 : {
84 : // default method of the base class
85 0 : HLTWarning("common sorting functionality has not yet been implemented");
86 0 : }
87 :
88 : bool AliHLTTPCDigitReader::Next(int /*type*/)
89 : {
90 : // see header file for class documentation
91 0 : if (!CheckFlag(kLocked)) return NextSignal();
92 :
93 : bool haveData=false;
94 0 : if (!CheckFlag(kChannelOverwrap))
95 0 : haveData=NextSignal();
96 :
97 0 : if (haveData && (fLckRow!=GetRow() || fLckPad!=GetPad())) {
98 0 : SetFlag(kChannelOverwrap);
99 : haveData=false;
100 0 : }
101 :
102 0 : return haveData;
103 0 : }
104 :
105 : bool AliHLTTPCDigitReader::NextChannel()
106 : {
107 : // see header file for class documentation
108 0 : 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 !!!");
111 0 : return false;
112 : }
113 :
114 : int AliHLTTPCDigitReader::NextBunch()
115 : {
116 : // see header file for class documentation
117 0 : 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 !!!");
120 0 : return false;
121 : }
122 :
123 : const UInt_t* AliHLTTPCDigitReader::GetSignals()
124 : {
125 : // see header file for class documentation
126 0 : 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 !!!");
129 0 : return 0;
130 : }
131 :
132 : const UShort_t* AliHLTTPCDigitReader::GetSignalsShort()
133 : {
134 : // see header file for class documentation
135 0 : 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 0 : return 0;
139 : }
140 :
141 : void AliHLTTPCDigitReader::EnableCaching(bool bCache)
142 : {
143 : // see header file for class documentation
144 0 : if (bCache) SetFlag(kChannelCaching);
145 0 : else ClearFlag(kChannelCaching);
146 0 : }
147 :
148 : int AliHLTTPCDigitReader::RewindChannel()
149 : {
150 : // see header file for class documentation
151 : int iResult=0;
152 :
153 0 : return iResult;
154 : }
155 :
156 : unsigned int AliHLTTPCDigitReader::SetFlag(unsigned int flag)
157 : {
158 : // see header file for class documentation
159 0 : return fFlags|=flag;
160 : }
161 :
162 : unsigned int AliHLTTPCDigitReader::ClearFlag(unsigned int flag)
163 : {
164 : // see header file for class documentation
165 0 : return fFlags&=~flag;
166 : }
167 :
168 : // int operator[](int timebin)
169 : // {
170 : // return -1;
171 : // }
172 :
173 : int AliHLTTPCDigitReader::RewindCurrentChannel()
174 : {
175 : // see header file for class documentation
176 0 : SetFlag(kNoRewind);
177 0 : if (!CheckFlag(kChannelCaching)) return -ENODATA;
178 0 : return -ENOSYS;
179 0 : }
180 :
181 : int AliHLTTPCDigitReader::RewindToPrevChannel()
182 : {
183 : // see header file for class documentation
184 0 : SetFlag(kNoRewind);
185 0 : if (!CheckFlag(kChannelCaching)) return -ENODATA;
186 0 : return -ENOSYS;
187 0 : }
188 :
189 : int AliHLTTPCDigitReader::GetBunchSize()
190 : {
191 : // see header file for class documentation
192 0 : 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 !!!");
195 0 : return 0;
196 : }
197 :
198 : int AliHLTTPCDigitReader::GetRowOffset() const
199 : {
200 : // see header file for class documentation
201 0 : return 0;
202 : }
203 :
204 : AliHLTUInt32_t AliHLTTPCDigitReader::GetAltroBlockHWaddr() const
205 : {
206 : // see header file for class documentation
207 0 : return 0;
208 : }
209 :
210 : AliHLTUInt32_t AliHLTTPCDigitReader::GetAltroBlockHWaddr(Int_t /*row*/, Int_t /*pad*/) const
211 : {
212 : // see header file for class documentation
213 0 : return 0;
214 : }
215 :
216 : int AliHLTTPCDigitReader::GetRCUTrailerSize()
217 : {
218 : // see header file for class documentation
219 0 : PrintWarningOnce(kWarnMissTrailerGetters,"\n"
220 : " !!! This digit reader does not implement the Getters !!!\n"
221 : " !!! for RCU trailer. Ignoring call. !!!");
222 0 : return 0;
223 : }
224 :
225 : bool AliHLTTPCDigitReader::GetRCUTrailerData(UChar_t*& trData)
226 : {
227 : // see header file for class documentation
228 0 : PrintWarningOnce(kWarnMissTrailerGetters,"\n"
229 : " !!! This digit reader does not implement the Getters !!!\n"
230 : " !!! for RCU trailer. Ignoring call. !!!");
231 0 : if (trData) trData=NULL;
232 0 : return 0;
233 : }
234 :
235 :
236 : void AliHLTTPCDigitReader::PrintWarningOnce(int type, const char* message)
237 : {
238 : // see header file for class documentation
239 0 : if (CheckFlag(type)) return;
240 0 : SetFlag(type);
241 0 : HLTWarning(message);
242 0 : }
243 :
|