]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.cxx
corrections to write ESD format (Gaute)
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDigitReaderUnpacked.cxx
CommitLineData
a38a7850 1// $Id$
2
3/**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
8 * Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
9 * for The ALICE Off-line Project. *
10 * *
11 * Permission to use, copy, modify and distribute this software and its *
12 * documentation strictly for non-commercial purposes is hereby granted *
13 * without fee, provided that the above copyright notice appears in all *
14 * copies and that both the copyright notice and this permission notice *
15 * appear in the supporting documentation. The authors make no claims *
16 * about the suitability of this software for any purpose. It is *
17 * provided "as is" without express or implied warranty. *
18 **************************************************************************/
19
84645eb0 20/** @file AliHLTTPCDigitReaderUnpacked.cxx
21 @author Timm Steinbeck, Jochen Thaeder, Matthias Richter
22 @date
23 @brief A digit reader implementation for unpacked TPC data.
24*/
a38a7850 25
26#if __GNUC__== 3
27using namespace std;
28#endif
29
30#include "AliHLTTPCDigitReaderUnpacked.h"
31#include "AliHLTTPCDigitData.h"
32#include "AliHLTTPCRawDataFormat.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
99 tmpptr = (AliHLTTPCUnpackedRawData*) fPtr;
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 return 0;
109 fRow = fFirstRow;
110
111 if ((Int_t)fActRowData->fRow != fRow){
84645eb0 112 HLTWarning("Row number should match! fActRowData->fRow=%d fRow=%d", fActRowData->fRow, fRow);
a38a7850 113 }
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}