]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCDigitReader.cxx
major revision of HLTTPCDigitReaders
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDigitReader.cxx
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 #if __GNUC__>= 3
34 using namespace std;
35 #endif
36
37 #include "AliHLTTPCDigitReader.h"
38 #include "AliHLTTPCTransform.h"
39 #include "AliHLTStdIncludes.h"
40
41 ClassImp(AliHLTTPCDigitReader)
42
43 AliHLTTPCDigitReader::AliHLTTPCDigitReader()
44   :
45   fFlags(0),
46   fLckRow(-1),
47   fLckPad(-1)
48 {
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
54 }
55
56 AliHLTTPCDigitReader::~AliHLTTPCDigitReader()
57 {
58   // see header file for class documentation
59 }
60
61 int AliHLTTPCDigitReader::InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice)
62 {
63   // see header file for class documentation
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
79 void AliHLTTPCDigitReader::SetOldRCUFormat(Bool_t /*oldrcuformat*/)
80 {
81   // default method of the base class
82 }
83
84 void AliHLTTPCDigitReader::SetUnsorted(Bool_t /*unsorted*/)
85 {
86   // default method of the base class
87   HLTWarning("common sorting functionality has not yet been implemented");
88 }
89
90 bool AliHLTTPCDigitReader::Next(int /*type*/)
91 {
92   // see header file for class documentation
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
107 bool AliHLTTPCDigitReader::NextChannel()
108 {
109   // see header file for class documentation
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 !!!");
113   return false;
114 }
115
116 int AliHLTTPCDigitReader::NextBunch()
117 {
118   // see header file for class documentation
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 !!!");
122   return false;
123 }
124
125 const UInt_t* AliHLTTPCDigitReader::GetSignals()
126 {
127   // see header file for class documentation
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 !!!");
131   return 0;
132 }
133
134 void AliHLTTPCDigitReader::EnableCaching(bool bCache)
135 {
136   // see header file for class documentation
137   if (bCache) SetFlag(kChannelCaching);
138   else ClearFlag(kChannelCaching);
139 }
140
141 int AliHLTTPCDigitReader::RewindChannel()
142 {
143   // see header file for class documentation
144   int iResult=0;
145   
146   return iResult;
147 }
148
149 unsigned int AliHLTTPCDigitReader::SetFlag(unsigned int flag)
150 {
151   // see header file for class documentation
152   return fFlags|=flag;
153 }
154         
155 unsigned int AliHLTTPCDigitReader::ClearFlag(unsigned int flag)
156 {
157   // see header file for class documentation
158   return fFlags&=~flag;
159 }
160
161 // int operator[](int timebin)
162 // {
163 //   return -1;
164 // }
165
166 int AliHLTTPCDigitReader::RewindCurrentChannel()
167 {
168   // see header file for class documentation
169   SetFlag(kNoRewind);
170   if (!CheckFlag(kChannelCaching)) return -ENODATA;
171   return -ENOSYS;
172 }
173
174 int AliHLTTPCDigitReader::RewindToPrevChannel()
175 {
176   // see header file for class documentation
177   SetFlag(kNoRewind);
178   if (!CheckFlag(kChannelCaching)) return -ENODATA;
179   return -ENOSYS;
180 }
181
182 int AliHLTTPCDigitReader::GetBunchSize()
183 {
184   // see header file for class documentation
185   PrintWarningOnce(kWarnMissFastAccess,"\n"
186                    "      !!! This digit reader does not implement the methods for       !!!\n"
187                    "      !!! fast data access on channel/bunch basis. Data is discarded !!!");
188   return 0;
189 }
190
191 int AliHLTTPCDigitReader::GetRowOffset() const
192 {
193   // see header file for class documentation
194   return 0;
195 }
196
197 AliHLTUInt32_t AliHLTTPCDigitReader::GetAltroBlockHWaddr() const
198 {
199   // see header file for class documentation
200   return 0;
201 }
202
203 AliHLTUInt32_t AliHLTTPCDigitReader::GetAltroBlockHWaddr(Int_t /*row*/, Int_t /*pad*/) const
204 {
205   // see header file for class documentation
206   return 0;
207 }
208
209 int AliHLTTPCDigitReader::GetRCUTrailerSize()
210 {
211   // see header file for class documentation
212   PrintWarningOnce(kWarnMissTrailerGetters,"\n"
213                    "      !!! This digit reader does not implement the Getters       !!!\n"
214                    "      !!! for RCU trailer. Ignoring call.                        !!!");
215   return 0;
216 }
217
218 bool AliHLTTPCDigitReader::GetRCUTrailerData(UChar_t*& trData)
219 {
220   // see header file for class documentation
221   PrintWarningOnce(kWarnMissTrailerGetters,"\n"
222                    "      !!! This digit reader does not implement the Getters       !!!\n"
223                    "      !!! for RCU trailer. Ignoring call.                        !!!");
224   if (trData) trData=NULL;
225   return 0;
226 }
227
228
229 void AliHLTTPCDigitReader::PrintWarningOnce(int type, const char* message)
230 {
231   // see header file for class documentation
232   if (CheckFlag(type)) return;
233   SetFlag(type);
234   HLTWarning(message);
235 }
236