]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.cxx
coding conventions and compilation warnings
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDigitReaderUnpacked.cxx
CommitLineData
a38a7850 1// $Id$
2
3/**************************************************************************
9be2600f 4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
a38a7850 6 * *
9be2600f 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. *
a38a7850 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
84645eb0 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*/
a38a7850 26
27#if __GNUC__== 3
28using namespace std;
29#endif
30
31#include "AliHLTTPCDigitReaderUnpacked.h"
32#include "AliHLTTPCDigitData.h"
84645eb0 33#include "AliHLTTPCTransform.h"
34#include "AliHLTStdIncludes.h"
a38a7850 35
84645eb0 36ClassImp(AliHLTTPCDigitReaderUnpacked)
a38a7850 37
84645eb0 38AliHLTTPCDigitReaderUnpacked::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{
5df0cbb9 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
84645eb0 55}
a38a7850 56
84645eb0 57AliHLTTPCDigitReaderUnpacked::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{
5df0cbb9 69 // see header file for class documentation
84645eb0 70 HLTFatal("copy constructor not for use");
71}
a38a7850 72
84645eb0 73AliHLTTPCDigitReaderUnpacked& AliHLTTPCDigitReaderUnpacked::operator=(const AliHLTTPCDigitReaderUnpacked& src)
74{
5df0cbb9 75 // see header file for class documentation
84645eb0 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);
a38a7850 87}
88
89AliHLTTPCDigitReaderUnpacked::~AliHLTTPCDigitReaderUnpacked(){
5df0cbb9 90 // see header file for class documentation
a38a7850 91}
92
84645eb0 93int AliHLTTPCDigitReaderUnpacked::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice){
5df0cbb9 94 // see header file for class documentation
95 AliHLTTPCUnpackedRawData *tmpptr=NULL;
a38a7850 96 fPtr = ptr;
97 fSize = size;
98
d3905cf0 99 tmpptr = reinterpret_cast<AliHLTTPCUnpackedRawData*>(fPtr);
a38a7850 100 fDigitRowData = (AliHLTTPCDigitRowData*) tmpptr->fDigits;
101 fActRowData = (AliHLTTPCDigitRowData*) fDigitRowData;
102
103 fBin = -1;
104
84645eb0 105 fFirstRow=AliHLTTPCTransform::GetFirstRow(patch);
106 fLastRow=AliHLTTPCTransform::GetLastRow(patch);
107
a38a7850 108 fRow = fFirstRow;
109
110 if ((Int_t)fActRowData->fRow != fRow){
84645eb0 111 HLTWarning("Row number should match! fActRowData->fRow=%d fRow=%d", fActRowData->fRow, fRow);
a38a7850 112 }
d3905cf0 113 return 0;
a38a7850 114}
115
116bool AliHLTTPCDigitReaderUnpacked::Next(){
5df0cbb9 117 // see header file for class documentation
a38a7850 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){
84645eb0 147 HLTWarning("Row number should match! fActRowData->fRow=%d fRow=%d", fActRowData->fRow, fRow);
a38a7850 148 }
149 }
150
151 fData = fActRowData->fDigitData;
152
153 return rreadvalue;
154}
155
156int AliHLTTPCDigitReaderUnpacked::GetRow(){
5df0cbb9 157 // see header file for class documentation
a38a7850 158 int rrow;
159 rrow = fRow;
160 return rrow;
161}
162
163int AliHLTTPCDigitReaderUnpacked::GetPad(){
5df0cbb9 164 // see header file for class documentation
a38a7850 165 int rpad;
166 rpad = (int)fData[fBin].fPad;
167 return rpad ;
168}
169
170int AliHLTTPCDigitReaderUnpacked::GetSignal(){
5df0cbb9 171 // see header file for class documentation
a38a7850 172 int rsignal;
173 rsignal = (int)fData[fBin].fCharge;
174 return rsignal;
175}
176
177int AliHLTTPCDigitReaderUnpacked::GetTime(){
5df0cbb9 178 // see header file for class documentation
a38a7850 179 int rtime;
180 rtime = (int)fData[fBin].fTime;
181 return rtime;
182}