]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCDigitReader.cxx
Updated SNM Glauber fit
[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 #include "AliHLTTPCDigitReader.h"
34 #include "AliHLTTPCTransform.h"
35 #include "AliHLTStdIncludes.h"
36
37 using namespace std;
38
39 ClassImp(AliHLTTPCDigitReader)
40
41 AliHLTTPCDigitReader::AliHLTTPCDigitReader()
42   :
43   fFlags(0),
44   fLckRow(-1),
45   fLckPad(-1)
46 {
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 }
53
54 AliHLTTPCDigitReader::~AliHLTTPCDigitReader()
55 {
56   // see header file for class documentation
57 }
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   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
77 void AliHLTTPCDigitReader::SetOldRCUFormat(Bool_t /*oldrcuformat*/)
78 {
79   // default method of the base class
80 }
81
82 void AliHLTTPCDigitReader::SetUnsorted(Bool_t /*unsorted*/)
83 {
84   // default method of the base class
85   HLTWarning("common sorting functionality has not yet been implemented");
86 }
87
88 bool AliHLTTPCDigitReader::Next(int /*type*/)
89 {
90   // see header file for class documentation
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
105 bool AliHLTTPCDigitReader::NextChannel()
106 {
107   // see header file for class documentation
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 !!!");
111   return false;
112 }
113
114 int AliHLTTPCDigitReader::NextBunch()
115 {
116   // see header file for class documentation
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 !!!");
120   return false;
121 }
122
123 const UInt_t* AliHLTTPCDigitReader::GetSignals()
124 {
125   // see header file for class documentation
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 !!!");
129   return 0;
130 }
131
132 const 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
141 void AliHLTTPCDigitReader::EnableCaching(bool bCache)
142 {
143   // see header file for class documentation
144   if (bCache) SetFlag(kChannelCaching);
145   else ClearFlag(kChannelCaching);
146 }
147
148 int AliHLTTPCDigitReader::RewindChannel()
149 {
150   // see header file for class documentation
151   int iResult=0;
152   
153   return iResult;
154 }
155
156 unsigned int AliHLTTPCDigitReader::SetFlag(unsigned int flag)
157 {
158   // see header file for class documentation
159   return fFlags|=flag;
160 }
161         
162 unsigned int AliHLTTPCDigitReader::ClearFlag(unsigned int flag)
163 {
164   // see header file for class documentation
165   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   SetFlag(kNoRewind);
177   if (!CheckFlag(kChannelCaching)) return -ENODATA;
178   return -ENOSYS;
179 }
180
181 int AliHLTTPCDigitReader::RewindToPrevChannel()
182 {
183   // see header file for class documentation
184   SetFlag(kNoRewind);
185   if (!CheckFlag(kChannelCaching)) return -ENODATA;
186   return -ENOSYS;
187 }
188
189 int AliHLTTPCDigitReader::GetBunchSize()
190 {
191   // see header file for class documentation
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 !!!");
195   return 0;
196 }
197
198 int AliHLTTPCDigitReader::GetRowOffset() const
199 {
200   // see header file for class documentation
201   return 0;
202 }
203
204 AliHLTUInt32_t AliHLTTPCDigitReader::GetAltroBlockHWaddr() const
205 {
206   // see header file for class documentation
207   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   return 0;
214 }
215
216 int AliHLTTPCDigitReader::GetRCUTrailerSize()
217 {
218   // see header file for class documentation
219   PrintWarningOnce(kWarnMissTrailerGetters,"\n"
220                    "      !!! This digit reader does not implement the Getters       !!!\n"
221                    "      !!! for RCU trailer. Ignoring call.                        !!!");
222   return 0;
223 }
224
225 bool AliHLTTPCDigitReader::GetRCUTrailerData(UChar_t*& trData)
226 {
227   // see header file for class documentation
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;
232   return 0;
233 }
234
235
236 void AliHLTTPCDigitReader::PrintWarningOnce(int type, const char* message)
237 {
238   // see header file for class documentation
239   if (CheckFlag(type)) return;
240   SetFlag(type);
241   HLTWarning(message);
242 }
243