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
27 #include "AliHLTTPCDigitReader32Bit.h"
28 #include "AliHLTTPCMapping.h"
29 #include "AliRawReader.h"
30 #include "AliRawReaderMemory.h"
31 #include "AliAltroRawStreamV3.h"
35 ClassImp(AliHLTTPCDigitReader32Bit)
37 AliHLTTPCDigitReader32Bit::AliHLTTPCDigitReader32Bit()
39 AliHLTTPCDigitReader(),
40 fRawReaderMemory(NULL),
41 fAltroRawStreamV3(NULL),
43 fSkipDataReadingFlag(kFALSE)
45 // see header file for class documentation
47 // refer to README to build package
49 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
51 // initlialized here to get more accurate comparison with the
52 // digitReaderDecoder when using SimpleComponentWrapper
53 if(fRawReaderMemory ==NULL){
54 fRawReaderMemory = new AliRawReaderMemory();
58 AliHLTTPCDigitReader32Bit::~AliHLTTPCDigitReader32Bit()
60 // see header file for class documentation
61 if (fRawReaderMemory){
62 delete fRawReaderMemory;
63 fRawReaderMemory=NULL;
66 if (fAltroRawStreamV3){
67 delete fAltroRawStreamV3;
68 fAltroRawStreamV3 = NULL;
76 int AliHLTTPCDigitReader32Bit::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice)
78 // see header file for class documentation
81 if (patch>1) ddlno+=72+4*slice+(patch-2);
82 else ddlno+=2*slice+patch;
84 if(fRawReaderMemory == NULL){
85 fRawReaderMemory = new AliRawReaderMemory();
87 if(!fRawReaderMemory){
90 fRawReaderMemory->SetMemory(reinterpret_cast<UChar_t*>(ptr), ULong_t(size));
91 fRawReaderMemory->SetEquipmentID(ddlno);
92 fRawReaderMemory->Reset();
93 fSkipDataReadingFlag = fRawReaderMemory->NextEvent();
95 if(fAltroRawStreamV3 != NULL){
96 delete fAltroRawStreamV3;
97 fAltroRawStreamV3=NULL;
99 fAltroRawStreamV3= new AliAltroRawStreamV3(fRawReaderMemory);
101 if (!fAltroRawStreamV3){
105 fSkipDataReadingFlag = fAltroRawStreamV3->NextDDL();
108 fMapping = new AliHLTTPCMapping(patch);
116 int AliHLTTPCDigitReader32Bit::Reset()
118 // see header file for class documentation
119 fRawReaderMemory->ClearBuffers();
123 void AliHLTTPCDigitReader32Bit::SetUnsorted(bool unsorted)
125 // see header file for class documentation
127 // The DigitReaderDecoder does not support sorted data, forward to
128 // default if sorted data requested
129 if (!unsorted) AliHLTTPCDigitReader::SetUnsorted(unsorted);
132 bool AliHLTTPCDigitReader32Bit::NextChannel()
134 // see header file for class documentation
135 if(fSkipDataReadingFlag == kFALSE){
139 return fAltroRawStreamV3->NextChannel();
142 int AliHLTTPCDigitReader32Bit::NextBunch()
144 // see header file for class documentation
145 return fAltroRawStreamV3->NextBunch();
148 bool AliHLTTPCDigitReader32Bit::NextSignal()
150 // see header file for class documentation
154 const UInt_t* AliHLTTPCDigitReader32Bit::GetSignals()
156 // see header file for class documentation
157 HLTError("AliHLTTPCDigitReader32Bit does not support the UInt_t* format, use GetSignalsShort instead");
161 const UShort_t* AliHLTTPCDigitReader32Bit::GetSignalsShort()
163 // see header file for class documentation
164 return fAltroRawStreamV3->GetSignals();
167 int AliHLTTPCDigitReader32Bit::GetRow()
169 // see header file for class documentation
170 return fMapping->GetRow(fAltroRawStreamV3->GetHWAddress());
173 int AliHLTTPCDigitReader32Bit::GetPad()
175 // see header file for class documentation
176 return fMapping->GetPad(fAltroRawStreamV3->GetHWAddress());
179 int AliHLTTPCDigitReader32Bit::GetSignal()
181 // see header file for class documentation
185 int AliHLTTPCDigitReader32Bit::GetTime()
187 // see header file for class documentation
189 iResult=fAltroRawStreamV3->GetStartTimeBin()-fAltroRawStreamV3->GetBunchLength()+1;
193 int AliHLTTPCDigitReader32Bit::GetBunchSize()
195 // see header file for class documentation
196 return fAltroRawStreamV3->GetBunchLength();
199 int AliHLTTPCDigitReader32Bit::GetRowOffset() const
201 return fMapping->GetRowOffset();
204 AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr() const
206 // see header file for class documentation
207 return (AliHLTUInt32_t)fAltroRawStreamV3->GetHWAddress();
210 AliHLTUInt32_t AliHLTTPCDigitReader32Bit::GetAltroBlockHWaddr(Int_t row, Int_t pad) const
212 // see header file for class documentation
214 return fMapping->GetHwAddress(row,pad);
221 int AliHLTTPCDigitReader32Bit::GetRCUTrailerSize()
223 // see header file for class documentation
227 bool AliHLTTPCDigitReader32Bit::GetRCUTrailerData(UChar_t*& /*trData*/)
229 // see header file for class documentation