]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.cxx
documentation
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDigitReaderUnpacked.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   AliHLTTPCDigitReaderUnpacked.cxx
22     @author Timm Steinbeck, Jochen Thaeder, Matthias Richter
23     @date   
24     @brief  A digit reader implementation for unpacked TPC data.
25 */
26
27 #if __GNUC__== 3
28 using namespace std;
29 #endif
30
31 #include "AliHLTTPCDigitReaderUnpacked.h"
32 #include "AliHLTTPCDigitData.h"
33 #include "AliHLTTPCRawDataFormat.h"
34 #include "AliHLTTPCTransform.h"
35 #include "AliHLTStdIncludes.h"
36
37 ClassImp(AliHLTTPCDigitReaderUnpacked)
38
39 AliHLTTPCDigitReaderUnpacked::AliHLTTPCDigitReaderUnpacked()
40   :
41   fDigitRowData(NULL),
42   fActRowData(NULL),
43   fData(NULL),
44   fPtr(NULL),
45   fSize(0),
46   fBin(0),
47   fRow(0),
48   fFirstRow(0),
49   fLastRow(0)
50 {
51   // see header file for class documentation
52   // or
53   // refer to README to build package
54   // or
55   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
56 }
57
58 AliHLTTPCDigitReaderUnpacked::AliHLTTPCDigitReaderUnpacked(const AliHLTTPCDigitReaderUnpacked& src)
59   :
60   fDigitRowData(NULL),
61   fActRowData(NULL),
62   fData(NULL),
63   fPtr(NULL),
64   fSize(0),
65   fBin(0),
66   fRow(0),
67   fFirstRow(0),
68   fLastRow(0)
69 {
70   // see header file for class documentation
71   HLTFatal("copy constructor not for use");
72 }
73
74 AliHLTTPCDigitReaderUnpacked& AliHLTTPCDigitReaderUnpacked::operator=(const AliHLTTPCDigitReaderUnpacked& src)
75 {
76   // see header file for class documentation
77   fDigitRowData=NULL;
78   fActRowData=NULL;
79   fData=NULL;
80   fPtr=NULL;
81   fSize=0;
82   fBin=0;
83   fRow=0;
84   fFirstRow=0;
85   fLastRow=0;
86   HLTFatal("assignment operator not for use");
87   return (*this);
88 }
89
90 AliHLTTPCDigitReaderUnpacked::~AliHLTTPCDigitReaderUnpacked(){
91   // see header file for class documentation
92 }
93
94 int AliHLTTPCDigitReaderUnpacked::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice){
95   // see header file for class documentation
96   AliHLTTPCUnpackedRawData *tmpptr=NULL;
97   fPtr = ptr;
98   fSize = size;
99
100   tmpptr = (AliHLTTPCUnpackedRawData*) fPtr;
101   fDigitRowData = (AliHLTTPCDigitRowData*) tmpptr->fDigits;
102   fActRowData = (AliHLTTPCDigitRowData*) fDigitRowData;
103
104   fBin = -1;
105
106   fFirstRow=AliHLTTPCTransform::GetFirstRow(patch);
107   fLastRow=AliHLTTPCTransform::GetLastRow(patch);
108
109   return 0;
110   fRow = fFirstRow; 
111
112   if ((Int_t)fActRowData->fRow != fRow){
113       HLTWarning("Row number should match! fActRowData->fRow=%d fRow=%d", fActRowData->fRow, fRow);
114   }
115 }
116
117 bool AliHLTTPCDigitReaderUnpacked::Next(){
118   // see header file for class documentation
119   bool rreadvalue = true;
120
121   fBin++;
122
123   if ( fBin >= (Int_t)fActRowData->fNDigit ){
124
125     fRow++;
126
127     if ((fRow >= fFirstRow) && (fRow <= fLastRow)){
128
129       //new row 
130       Byte_t *tmp = (Byte_t*) fActRowData;
131       Int_t size = sizeof(AliHLTTPCDigitRowData) + fActRowData->fNDigit*sizeof(AliHLTTPCDigitData);
132       tmp += size;
133       fActRowData = (AliHLTTPCDigitRowData*) tmp;
134      
135       if (((Byte_t*)fPtr) + fSize <= tmp){
136         rreadvalue = false;
137         return rreadvalue;
138       }
139
140       fBin = 0;
141     }
142     else {
143       rreadvalue = false;
144       return rreadvalue;
145     }
146     
147     if ((Int_t)fActRowData->fRow != fRow){
148       HLTWarning("Row number should match! fActRowData->fRow=%d fRow=%d", fActRowData->fRow, fRow);
149     }
150   }
151
152   fData = fActRowData->fDigitData;
153  
154   return rreadvalue;
155 }
156
157 int AliHLTTPCDigitReaderUnpacked::GetRow(){
158   // see header file for class documentation
159   int rrow;
160   rrow = fRow;
161   return rrow;
162 }
163
164 int AliHLTTPCDigitReaderUnpacked::GetPad(){
165   // see header file for class documentation
166   int rpad;
167   rpad = (int)fData[fBin].fPad;
168   return rpad   ;
169 }
170
171 int AliHLTTPCDigitReaderUnpacked::GetSignal(){ 
172   // see header file for class documentation
173   int rsignal;
174   rsignal = (int)fData[fBin].fCharge;
175   return rsignal;
176 }
177
178 int AliHLTTPCDigitReaderUnpacked::GetTime(){
179   // see header file for class documentation
180   int rtime;
181   rtime = (int)fData[fBin].fTime;
182   return rtime;
183 }