Line data Source code
1 : // $Id$
2 : //**************************************************************************
3 : //* This file is property of and copyright by the ALICE HLT Project *
4 : //* ALICE Experiment at CERN, All rights reserved. *
5 : //* *
6 : //* Primary 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 HLT 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 :
20 : /// @file AliHLTTPCDigitReader32Bit.cxx
21 : /// @author Kenneth Aamodt
22 : /// @date
23 : /// @brief DigitReader implementation for the 32 bit offline decoder
24 : ///
25 :
26 : #include <cassert>
27 : #include "AliHLTTPCDigitReader32Bit.h"
28 : #include "AliHLTTPCMapping.h"
29 : #include "AliRawReader.h"
30 : #include "AliRawReaderMemory.h"
31 : #include "AliAltroRawStreamV3.h"
32 :
33 : using namespace std;
34 :
35 6 : ClassImp(AliHLTTPCDigitReader32Bit)
36 :
37 : AliHLTTPCDigitReader32Bit::AliHLTTPCDigitReader32Bit()
38 : :
39 0 : AliHLTTPCDigitReader(),
40 0 : fRawReaderMemory(NULL),
41 0 : fAltroRawStreamV3(NULL),
42 0 : fMapping(NULL),
43 0 : fSkipDataReadingFlag(kFALSE)
44 0 : {
45 : // see header file for class documentation
46 : // or
47 : // refer to README to build package
48 : // or
49 : // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
50 :
51 : // initlialized here to get more accurate comparison with the
52 : // digitReaderDecoder when using SimpleComponentWrapper
53 0 : if(fRawReaderMemory ==NULL){
54 0 : fRawReaderMemory = new AliRawReaderMemory();
55 0 : }
56 0 : }
57 :
58 : AliHLTTPCDigitReader32Bit::~AliHLTTPCDigitReader32Bit()
59 0 : {
60 : // see header file for class documentation
61 0 : if (fRawReaderMemory){
62 0 : delete fRawReaderMemory;
63 0 : fRawReaderMemory=NULL;
64 0 : }
65 :
66 0 : if (fAltroRawStreamV3){
67 0 : delete fAltroRawStreamV3;
68 0 : fAltroRawStreamV3 = NULL;
69 0 : }
70 :
71 0 : if(fMapping){
72 0 : delete fMapping;
73 : }
74 0 : }
75 :
76 : int AliHLTTPCDigitReader32Bit::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice)
77 : {
78 : // see header file for class documentation
79 :
80 : Int_t ddlno=768;
81 0 : if (patch>1) ddlno+=72+4*slice+(patch-2);
82 0 : else ddlno+=2*slice+patch;
83 :
84 0 : if(fRawReaderMemory == NULL){
85 0 : fRawReaderMemory = new AliRawReaderMemory();
86 0 : }
87 0 : if(!fRawReaderMemory){
88 0 : return -ENODEV;
89 : }
90 0 : fRawReaderMemory->SetMemory(reinterpret_cast<UChar_t*>(ptr), ULong_t(size));
91 0 : fRawReaderMemory->SetEquipmentID(ddlno);
92 0 : fRawReaderMemory->Reset();
93 0 : fSkipDataReadingFlag = fRawReaderMemory->NextEvent();
94 :
95 0 : if(fAltroRawStreamV3 != NULL){
96 0 : delete fAltroRawStreamV3;
97 0 : fAltroRawStreamV3=NULL;
98 0 : }
99 0 : fAltroRawStreamV3= new AliAltroRawStreamV3(fRawReaderMemory);
100 :
101 0 : if (!fAltroRawStreamV3){
102 0 : return -ENODEV;
103 : }
104 :
105 0 : fSkipDataReadingFlag = fAltroRawStreamV3->NextDDL();
106 :
107 0 : if(!fMapping){
108 0 : fMapping = new AliHLTTPCMapping(patch);
109 0 : if(!fMapping){
110 0 : return -ENODEV;
111 : }
112 : }
113 0 : return 0;
114 0 : }
115 :
116 : int AliHLTTPCDigitReader32Bit::Reset()
117 : {
118 : // see header file for class documentation
119 0 : fRawReaderMemory->ClearBuffers();
120 0 : return 0;
121 : }
122 :
123 : void AliHLTTPCDigitReader32Bit::SetUnsorted(bool unsorted)
124 : {
125 : // see header file for class documentation
126 :
127 : // The DigitReaderDecoder does not support sorted data, forward to
128 : // default if sorted data requested
129 0 : if (!unsorted) AliHLTTPCDigitReader::SetUnsorted(unsorted);
130 0 : }
131 :
132 : bool AliHLTTPCDigitReader32Bit::NextChannel()
133 : {
134 : // see header file for class documentation
135 0 : if(fSkipDataReadingFlag == kFALSE){
136 0 : return kFALSE;
137 : }
138 :
139 0 : return fAltroRawStreamV3->NextChannel();
140 0 : }
141 :
142 : int AliHLTTPCDigitReader32Bit::NextBunch()
143 : {
144 : // see header file for class documentation
145 0 : return fAltroRawStreamV3->NextBunch();
146 : }
147 :
148 : bool AliHLTTPCDigitReader32Bit::NextSignal()
149 : {
150 : // see header file for class documentation
151 0 : return false;
152 : }
153 :
154 : const UInt_t* AliHLTTPCDigitReader32Bit::GetSignals()
155 : {
156 : // see header file for class documentation
157 0 : HLTError("AliHLTTPCDigitReader32Bit does not support the UInt_t* format, use GetSignalsShort instead");
158 0 : return 0;
159 : }
160 :
161 : const UShort_t* AliHLTTPCDigitReader32Bit::GetSignalsShort()
162 : {
163 : // see header file for class documentation
164 0 : return fAltroRawStreamV3->GetSignals();
165 : }
166 :
167 : int AliHLTTPCDigitReader32Bit::GetRow()
168 : {
169 : // see header file for class documentation
170 0 : return fMapping->GetRow(fAltroRawStreamV3->GetHWAddress());
171 : }
172 :
173 : int AliHLTTPCDigitReader32Bit::GetPad()
174 : {
175 : // see header file for class documentation
176 0 : return fMapping->GetPad(fAltroRawStreamV3->GetHWAddress());
177 : }
178 :
179 : int AliHLTTPCDigitReader32Bit::GetSignal()
180 : {
181 : // see header file for class documentation
182 0 : return 0;
183 : }
184 :
185 : int AliHLTTPCDigitReader32Bit::GetTime()
186 : {
187 : // see header file for class documentation
188 : int iResult=-1;
189 0 : iResult=fAltroRawStreamV3->GetStartTimeBin()-fAltroRawStreamV3->GetBunchLength()+1;
190 0 : return iResult;
191 : }
192 :
193 : int AliHLTTPCDigitReader32Bit::GetBunchSize()
194 : {
195 : // see header file for class documentation
196 0 : return fAltroRawStreamV3->GetBunchLength();
197 : }
198 :
199 : int AliHLTTPCDigitReader32Bit::GetRowOffset() const
200 : {
201 0 : return fMapping->GetRowOffset();
202 : }
203 :
204 : AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr() const
205 : {
206 : // see header file for class documentation
207 0 : return (AliHLTUInt32_t)fAltroRawStreamV3->GetHWAddress();
208 : }
209 :
210 : AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr(Int_t row, Int_t pad) const
211 : {
212 : // see header file for class documentation
213 0 : if(fMapping){
214 0 : return fMapping->GetHwAddress(row,pad);
215 : }
216 : else{
217 0 : return 0;
218 : }
219 0 : }
220 :
221 : int AliHLTTPCDigitReader32Bit::GetRCUTrailerSize()
222 : {
223 : // see header file for class documentation
224 0 : return 0;
225 : }
226 :
227 : bool AliHLTTPCDigitReader32Bit::GetRCUTrailerData(UChar_t*& /*trData*/)
228 : {
229 : // see header file for class documentation
230 0 : return false;
231 : }
|