]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCDigitReader.cxx
loading beam type from GRP and read configuration object according to it
[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 const 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
143 void AliHLTTPCDigitReader::EnableCaching(bool bCache)
144 {
145   // see header file for class documentation
146   if (bCache) SetFlag(kChannelCaching);
147   else ClearFlag(kChannelCaching);
148 }
149
150 int AliHLTTPCDigitReader::RewindChannel()
151 {
152   // see header file for class documentation
153   int iResult=0;
154   
155   return iResult;
156 }
157
158 unsigned int AliHLTTPCDigitReader::SetFlag(unsigned int flag)
159 {
160   // see header file for class documentation
161   return fFlags|=flag;
162 }
163         
164 unsigned int AliHLTTPCDigitReader::ClearFlag(unsigned int flag)
165 {
166   // see header file for class documentation
167   return fFlags&=~flag;
168 }
169
170 // int operator[](int timebin)
171 // {
172 //   return -1;
173 // }
174
175 int AliHLTTPCDigitReader::RewindCurrentChannel()
176 {
177   // see header file for class documentation
178   SetFlag(kNoRewind);
179   if (!CheckFlag(kChannelCaching)) return -ENODATA;
180   return -ENOSYS;
181 }
182
183 int AliHLTTPCDigitReader::RewindToPrevChannel()
184 {
185   // see header file for class documentation
186   SetFlag(kNoRewind);
187   if (!CheckFlag(kChannelCaching)) return -ENODATA;
188   return -ENOSYS;
189 }
190
191 int AliHLTTPCDigitReader::GetBunchSize()
192 {
193   // see header file for class documentation
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 !!!");
197   return 0;
198 }
199
200 int AliHLTTPCDigitReader::GetRowOffset() const
201 {
202   // see header file for class documentation
203   return 0;
204 }
205
206 AliHLTUInt32_t AliHLTTPCDigitReader::GetAltroBlockHWaddr() const
207 {
208   // see header file for class documentation
209   return 0;
210 }
211
212 AliHLTUInt32_t AliHLTTPCDigitReader::GetAltroBlockHWaddr(Int_t /*row*/, Int_t /*pad*/) const
213 {
214   // see header file for class documentation
215   return 0;
216 }
217
218 int AliHLTTPCDigitReader::GetRCUTrailerSize()
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   return 0;
225 }
226
227 bool AliHLTTPCDigitReader::GetRCUTrailerData(UChar_t*& trData)
228 {
229   // see header file for class documentation
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;
234   return 0;
235 }
236
237
238 void AliHLTTPCDigitReader::PrintWarningOnce(int type, const char* message)
239 {
240   // see header file for class documentation
241   if (CheckFlag(type)) return;
242   SetFlag(type);
243   HLTWarning(message);
244 }
245