2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project *
4 //* ALICE Experiment at CERN, All rights reserved. *
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. *
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 //**************************************************************************
20 /** @file AliHLTTPCDigitReader32Bit.cxx
21 @author Kenneth Aamodt
23 @brief DigitReader implementation for the 32 bit offline decoder
31 #include "AliHLTTPCDigitReader32Bit.h"
32 #include "AliHLTTPCMapping.h"
33 #include "AliRawReader.h"
34 #include "AliRawReaderMemory.h"
35 #ifndef HAVE_NOT_ALTRORAWSTREAMV3
36 #include "AliAltroRawStreamV3.h"
37 #endif //HAVE_NOT_ALTRORAWSTREAMV3
38 #include "AliHLTTPCTransform.h"
40 ClassImp(AliHLTTPCDigitReader32Bit)
42 AliHLTTPCDigitReader32Bit::AliHLTTPCDigitReader32Bit()
44 AliHLTTPCDigitReader(),
46 fRawReaderMemory(NULL),
47 fAltroRawStreamV3(NULL),
49 fSkipDataReadingFlag(kFALSE)
51 // see header file for class documentation
53 // refer to README to build package
55 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
57 // initlialized here to get more accurate comparison with the
58 // digitReaderDecoder when using SimpleComponentWrapper
59 if(fRawReaderMemory ==NULL){
60 fRawReaderMemory = new AliRawReaderMemory();
64 AliHLTTPCDigitReader32Bit::~AliHLTTPCDigitReader32Bit()
66 // see header file for class documentation
67 if (fRawReaderMemory){
68 delete fRawReaderMemory;
69 fRawReaderMemory=NULL;
72 #ifndef HAVE_NOT_ALTRORAWSTREAMV3
73 if (fAltroRawStreamV3){
74 delete fAltroRawStreamV3;
75 fAltroRawStreamV3 = NULL;
77 #endif //HAVE_NOT_ALTRORAWSTREAMV3
84 int AliHLTTPCDigitReader32Bit::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice)
86 // see header file for class documentation
89 if (patch>1) ddlno+=72+4*slice+(patch-2);
90 else ddlno+=2*slice+patch;
92 if(fRawReaderMemory == NULL){
93 fRawReaderMemory = new AliRawReaderMemory();
95 if(!fRawReaderMemory){
98 fRawReaderMemory->SetMemory(reinterpret_cast<UChar_t*>(ptr), ULong_t(size));
99 fRawReaderMemory->SetEquipmentID(ddlno);
100 fRawReaderMemory->Reset();
101 fSkipDataReadingFlag = fRawReaderMemory->NextEvent();
103 #ifndef HAVE_NOT_ALTRORAWSTREAMV3
104 if(fAltroRawStreamV3 != NULL){
105 delete fAltroRawStreamV3;
106 fAltroRawStreamV3=NULL;
108 fAltroRawStreamV3= new AliAltroRawStreamV3(fRawReaderMemory);
110 if (!fAltroRawStreamV3){
114 fSkipDataReadingFlag = fAltroRawStreamV3->NextDDL();
117 HLTError("AltroRawStreamV3 is not available in this AliRoot version");
118 #endif //HAVE_NOT_ALTRORAWSTREAMV3
121 fMapping = new AliHLTTPCMapping(patch);
129 int AliHLTTPCDigitReader32Bit::Reset()
131 // see header file for class documentation
132 fRawReaderMemory->ClearBuffers();
136 void AliHLTTPCDigitReader32Bit::SetUnsorted(bool unsorted)
138 // see header file for class documentation
140 // The DigitReaderDecoder does not support sorted data, forward to
141 // default if sorted data requested
142 if (!unsorted) AliHLTTPCDigitReader::SetUnsorted(unsorted);
145 bool AliHLTTPCDigitReader32Bit::NextChannel()
147 // see header file for class documentation
148 if(fSkipDataReadingFlag == kFALSE){
152 #ifndef HAVE_NOT_ALTRORAWSTREAMV3
153 return fAltroRawStreamV3->NextChannel();
156 #endif //HAVE_NOT_ALTRORAWSTREAMV3
160 int AliHLTTPCDigitReader32Bit::NextBunch()
162 // see header file for class documentation
163 #ifndef HAVE_NOT_ALTRORAWSTREAMV3
164 return fAltroRawStreamV3->NextBunch();
167 #endif //HAVE_NOT_ALTRORAWSTREAMV3
170 bool AliHLTTPCDigitReader32Bit::NextSignal()
172 // see header file for class documentation
176 const UInt_t* AliHLTTPCDigitReader32Bit::GetSignals()
178 // see header file for class documentation
179 HLTError("AliHLTTPCDigitReader32Bit does not support the UInt_t* format, use GetSignalsShort instead");
183 const UShort_t* AliHLTTPCDigitReader32Bit::GetSignalsShort()
185 // see header file for class documentation
186 #ifndef HAVE_NOT_ALTRORAWSTREAMV3
187 return fAltroRawStreamV3->GetSignals();
190 #endif //HAVE_NOT_ALTRORAWSTREAMV3
193 int AliHLTTPCDigitReader32Bit::GetRow()
195 // see header file for class documentation
196 #ifndef HAVE_NOT_ALTRORAWSTREAMV3
197 return fMapping->GetRow(fAltroRawStreamV3->GetHWAddress());
200 #endif //HAVE_NOT_ALTRORAWSTREAMV3
203 int AliHLTTPCDigitReader32Bit::GetPad()
205 // see header file for class documentation
206 #ifndef HAVE_NOT_ALTRORAWSTREAMV3
207 return fMapping->GetPad(fAltroRawStreamV3->GetHWAddress());
210 #endif //HAVE_NOT_ALTRORAWSTREAMV3
213 int AliHLTTPCDigitReader32Bit::GetSignal()
215 // see header file for class documentation
219 int AliHLTTPCDigitReader32Bit::GetTime()
221 // see header file for class documentation
223 #ifndef HAVE_NOT_ALTRORAWSTREAMV3
224 iResult=fAltroRawStreamV3->GetStartTimeBin()-fAltroRawStreamV3->GetBunchLength()+1;
225 #endif //HAVE_NOT_ALTRORAWSTREAMV3
229 int AliHLTTPCDigitReader32Bit::GetBunchSize()
231 // see header file for class documentation
232 #ifndef HAVE_NOT_ALTRORAWSTREAMV3
233 return fAltroRawStreamV3->GetBunchLength();
236 #endif //HAVE_NOT_ALTRORAWSTREAMV3
239 int AliHLTTPCDigitReader32Bit::GetRowOffset() const
241 return fMapping->GetRowOffset();
244 AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr() const
246 // see header file for class documentation
247 #ifndef HAVE_NOT_ALTRORAWSTREAMV3
248 return (AliHLTUInt32_t)fAltroRawStreamV3->GetHWAddress();
251 #endif //HAVE_NOT_ALTRORAWSTREAMV3
254 AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr(Int_t row, Int_t pad) const
256 // see header file for class documentation
258 return fMapping->GetHwAddress(row,pad);
265 int AliHLTTPCDigitReader32Bit::GetRCUTrailerSize()
267 // see header file for class documentation
271 bool AliHLTTPCDigitReader32Bit::GetRCUTrailerData(UChar_t*& /*trData*/)
273 // see header file for class documentation