]>
Commit | Line | Data |
---|---|---|
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 | |
27 | using 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 | 36 | ClassImp(AliHLTTPCDigitReaderUnpacked) |
a38a7850 | 37 | |
84645eb0 | 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 | } | |
a38a7850 | 51 | |
84645eb0 | 52 | AliHLTTPCDigitReaderUnpacked::AliHLTTPCDigitReaderUnpacked(const AliHLTTPCDigitReaderUnpacked& src) |
53 | : | |
54 | fDigitRowData(NULL), | |
55 | fActRowData(NULL), | |
56 | fData(NULL), | |
57 | fPtr(NULL), | |
58 | fSize(0), | |
59 | fBin(0), | |
60 | fRow(0), | |
61 | fFirstRow(0), | |
62 | fLastRow(0) | |
63 | { | |
64 | HLTFatal("copy constructor not for use"); | |
65 | } | |
a38a7850 | 66 | |
84645eb0 | 67 | AliHLTTPCDigitReaderUnpacked& AliHLTTPCDigitReaderUnpacked::operator=(const AliHLTTPCDigitReaderUnpacked& src) |
68 | { | |
69 | fDigitRowData=NULL; | |
70 | fActRowData=NULL; | |
71 | fData=NULL; | |
72 | fPtr=NULL; | |
73 | fSize=0; | |
74 | fBin=0; | |
75 | fRow=0; | |
76 | fFirstRow=0; | |
77 | fLastRow=0; | |
78 | HLTFatal("assignment operator not for use"); | |
79 | return (*this); | |
a38a7850 | 80 | } |
81 | ||
82 | AliHLTTPCDigitReaderUnpacked::~AliHLTTPCDigitReaderUnpacked(){ | |
83 | } | |
84 | ||
84645eb0 | 85 | int AliHLTTPCDigitReaderUnpacked::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice){ |
a38a7850 | 86 | AliHLTTPCUnpackedRawData *tmpptr; |
87 | fPtr = ptr; | |
88 | fSize = size; | |
89 | ||
90 | tmpptr = (AliHLTTPCUnpackedRawData*) fPtr; | |
91 | fDigitRowData = (AliHLTTPCDigitRowData*) tmpptr->fDigits; | |
92 | fActRowData = (AliHLTTPCDigitRowData*) fDigitRowData; | |
93 | ||
94 | fBin = -1; | |
95 | ||
84645eb0 | 96 | fFirstRow=AliHLTTPCTransform::GetFirstRow(patch); |
97 | fLastRow=AliHLTTPCTransform::GetLastRow(patch); | |
98 | ||
a38a7850 | 99 | return 0; |
100 | fRow = fFirstRow; | |
101 | ||
102 | if ((Int_t)fActRowData->fRow != fRow){ | |
84645eb0 | 103 | HLTWarning("Row number should match! fActRowData->fRow=%d fRow=%d", fActRowData->fRow, fRow); |
a38a7850 | 104 | } |
105 | } | |
106 | ||
107 | bool AliHLTTPCDigitReaderUnpacked::Next(){ | |
108 | bool rreadvalue = true; | |
109 | ||
110 | fBin++; | |
111 | ||
112 | if ( fBin >= (Int_t)fActRowData->fNDigit ){ | |
113 | ||
114 | fRow++; | |
115 | ||
116 | if ((fRow >= fFirstRow) && (fRow <= fLastRow)){ | |
117 | ||
118 | //new row | |
119 | Byte_t *tmp = (Byte_t*) fActRowData; | |
120 | Int_t size = sizeof(AliHLTTPCDigitRowData) + fActRowData->fNDigit*sizeof(AliHLTTPCDigitData); | |
121 | tmp += size; | |
122 | fActRowData = (AliHLTTPCDigitRowData*) tmp; | |
123 | ||
124 | if (((Byte_t*)fPtr) + fSize <= tmp){ | |
125 | rreadvalue = false; | |
126 | return rreadvalue; | |
127 | } | |
128 | ||
129 | fBin = 0; | |
130 | } | |
131 | else { | |
132 | rreadvalue = false; | |
133 | return rreadvalue; | |
134 | } | |
135 | ||
136 | if ((Int_t)fActRowData->fRow != fRow){ | |
84645eb0 | 137 | HLTWarning("Row number should match! fActRowData->fRow=%d fRow=%d", fActRowData->fRow, fRow); |
a38a7850 | 138 | } |
139 | } | |
140 | ||
141 | fData = fActRowData->fDigitData; | |
142 | ||
143 | return rreadvalue; | |
144 | } | |
145 | ||
146 | int AliHLTTPCDigitReaderUnpacked::GetRow(){ | |
147 | int rrow; | |
148 | rrow = fRow; | |
149 | return rrow; | |
150 | } | |
151 | ||
152 | int AliHLTTPCDigitReaderUnpacked::GetPad(){ | |
153 | int rpad; | |
154 | rpad = (int)fData[fBin].fPad; | |
155 | return rpad ; | |
156 | } | |
157 | ||
158 | int AliHLTTPCDigitReaderUnpacked::GetSignal(){ | |
159 | int rsignal; | |
160 | rsignal = (int)fData[fBin].fCharge; | |
161 | return rsignal; | |
162 | } | |
163 | ||
164 | int AliHLTTPCDigitReaderUnpacked::GetTime(){ | |
165 | int rtime; | |
166 | rtime = (int)fData[fBin].fTime; | |
167 | return rtime; | |
168 | } |