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 #include "AliAltroRawStreamV3.h"
37 ClassImp(AliHLTTPCDigitReader32Bit)
39 AliHLTTPCDigitReader32Bit::AliHLTTPCDigitReader32Bit()
41 AliHLTTPCDigitReader(),
42 fRawReaderMemory(NULL),
43 fAltroRawStreamV3(NULL),
45 fSkipDataReadingFlag(kFALSE)
47 // see header file for class documentation
49 // refer to README to build package
51 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
53 // initlialized here to get more accurate comparison with the
54 // digitReaderDecoder when using SimpleComponentWrapper
55 if(fRawReaderMemory ==NULL){
56 fRawReaderMemory = new AliRawReaderMemory();
60 AliHLTTPCDigitReader32Bit::~AliHLTTPCDigitReader32Bit()
62 // see header file for class documentation
63 if (fRawReaderMemory){
64 delete fRawReaderMemory;
65 fRawReaderMemory=NULL;
68 if (fAltroRawStreamV3){
69 delete fAltroRawStreamV3;
70 fAltroRawStreamV3 = NULL;
78 int AliHLTTPCDigitReader32Bit::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice)
80 // see header file for class documentation
83 if (patch>1) ddlno+=72+4*slice+(patch-2);
84 else ddlno+=2*slice+patch;
86 if(fRawReaderMemory == NULL){
87 fRawReaderMemory = new AliRawReaderMemory();
89 if(!fRawReaderMemory){
92 fRawReaderMemory->SetMemory(reinterpret_cast<UChar_t*>(ptr), ULong_t(size));
93 fRawReaderMemory->SetEquipmentID(ddlno);
94 fRawReaderMemory->Reset();
95 fSkipDataReadingFlag = fRawReaderMemory->NextEvent();
97 if(fAltroRawStreamV3 != NULL){
98 delete fAltroRawStreamV3;
99 fAltroRawStreamV3=NULL;
101 fAltroRawStreamV3= new AliAltroRawStreamV3(fRawReaderMemory);
103 if (!fAltroRawStreamV3){
107 fSkipDataReadingFlag = fAltroRawStreamV3->NextDDL();
110 fMapping = new AliHLTTPCMapping(patch);
118 int AliHLTTPCDigitReader32Bit::Reset()
120 // see header file for class documentation
121 fRawReaderMemory->ClearBuffers();
125 void AliHLTTPCDigitReader32Bit::SetUnsorted(bool unsorted)
127 // see header file for class documentation
129 // The DigitReaderDecoder does not support sorted data, forward to
130 // default if sorted data requested
131 if (!unsorted) AliHLTTPCDigitReader::SetUnsorted(unsorted);
134 bool AliHLTTPCDigitReader32Bit::NextChannel()
136 // see header file for class documentation
137 if(fSkipDataReadingFlag == kFALSE){
141 return fAltroRawStreamV3->NextChannel();
144 int AliHLTTPCDigitReader32Bit::NextBunch()
146 // see header file for class documentation
147 return fAltroRawStreamV3->NextBunch();
150 bool AliHLTTPCDigitReader32Bit::NextSignal()
152 // see header file for class documentation
156 const UInt_t* AliHLTTPCDigitReader32Bit::GetSignals()
158 // see header file for class documentation
159 HLTError("AliHLTTPCDigitReader32Bit does not support the UInt_t* format, use GetSignalsShort instead");
163 const UShort_t* AliHLTTPCDigitReader32Bit::GetSignalsShort()
165 // see header file for class documentation
166 return fAltroRawStreamV3->GetSignals();
169 int AliHLTTPCDigitReader32Bit::GetRow()
171 // see header file for class documentation
172 return fMapping->GetRow(fAltroRawStreamV3->GetHWAddress());
175 int AliHLTTPCDigitReader32Bit::GetPad()
177 // see header file for class documentation
178 return fMapping->GetPad(fAltroRawStreamV3->GetHWAddress());
181 int AliHLTTPCDigitReader32Bit::GetSignal()
183 // see header file for class documentation
187 int AliHLTTPCDigitReader32Bit::GetTime()
189 // see header file for class documentation
191 iResult=fAltroRawStreamV3->GetStartTimeBin()-fAltroRawStreamV3->GetBunchLength()+1;
195 int AliHLTTPCDigitReader32Bit::GetBunchSize()
197 // see header file for class documentation
198 return fAltroRawStreamV3->GetBunchLength();
201 int AliHLTTPCDigitReader32Bit::GetRowOffset() const
203 return fMapping->GetRowOffset();
206 AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr() const
208 // see header file for class documentation
209 return (AliHLTUInt32_t)fAltroRawStreamV3->GetHWAddress();
212 AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr(Int_t row, Int_t pad) const
214 // see header file for class documentation
216 return fMapping->GetHwAddress(row,pad);
223 int AliHLTTPCDigitReader32Bit::GetRCUTrailerSize()
225 // see header file for class documentation
229 bool AliHLTTPCDigitReader32Bit::GetRCUTrailerData(UChar_t*& /*trData*/)
231 // see header file for class documentation