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