X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HLT%2FTPCLib%2FAliHLTTPCDigitReaderDecoder.cxx;h=5087cc7588eda9c22ce9f87d10d5e802b5fbc0b7;hb=900fdfb269d2b4fc184ca63e6fda17e00a3f1481;hp=cfdb9db81b431a37c8bbb52a9a1003b253c3a234;hpb=f8121cb11e04219794d2e8e1905680bf349324e6;p=u%2Fmrichter%2FAliRoot.git diff --git a/HLT/TPCLib/AliHLTTPCDigitReaderDecoder.cxx b/HLT/TPCLib/AliHLTTPCDigitReaderDecoder.cxx index cfdb9db81b4..5087cc7588e 100644 --- a/HLT/TPCLib/AliHLTTPCDigitReaderDecoder.cxx +++ b/HLT/TPCLib/AliHLTTPCDigitReaderDecoder.cxx @@ -1,4 +1,4 @@ -// $Id: AliHLTTPCDigitReaderDecoder.cxx,v 1.18 2007/11/26 23:19:47 richterm Exp $ +// $Id$ //************************************************************************** //* This file is property of and copyright by the ALICE HLT Project * @@ -28,16 +28,26 @@ using namespace std; #endif +#include #include "AliHLTTPCDigitReaderDecoder.h" +#include "AliHLTTPCMapping.h" #include "AliAltroDecoder.h" #include "AliAltroData.h" #include "AliAltroBunch.h" +#include "AliHLTTPCTransform.h" ClassImp(AliHLTTPCDigitReaderDecoder) AliHLTTPCDigitReaderDecoder::AliHLTTPCDigitReaderDecoder() : - AliHLTTPCDigitReader() + AliHLTTPCDigitReader(), + fAltroDecoder(NULL), + fAltroData(), + fAltroBunch(NULL), + fMapping(NULL), + // initialization due to the logic in NextSignals + fNextCounter(-1), + fNextSignalMethodUsed(kFALSE) { // see header file for class documentation // or @@ -49,58 +59,155 @@ AliHLTTPCDigitReaderDecoder::AliHLTTPCDigitReaderDecoder() AliHLTTPCDigitReaderDecoder::~AliHLTTPCDigitReaderDecoder() { // see header file for class documentation + if(fAltroDecoder){ + delete fAltroDecoder; + } + if(fAltroBunch){ + delete fAltroBunch; + } + if(fMapping){ + delete fMapping; + } } -int AliHLTTPCDigitReaderDecoder::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice) +int AliHLTTPCDigitReaderDecoder::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t /*slice*/) { // see header file for class documentation + // HLTDebug("Initializing block in decoder"); + if(!fMapping){ + fMapping = new AliHLTTPCMapping(patch); + } + if(!fAltroDecoder){ + fAltroDecoder = new AliAltroDecoder(); + } + if(!fAltroBunch){ + fAltroBunch = new AliAltroBunch(); + } + fAltroDecoder->SetMemory((UChar_t*)ptr, size); + fAltroDecoder->Decode(); return 0; } +void AliHLTTPCDigitReaderDecoder::SetUnsorted(bool unsorted) +{ + // see header file for class documentation + + // The DigitReaderDecoder does not support sorted data, forward to + // default if sorted data requested + if (!unsorted) AliHLTTPCDigitReader::SetUnsorted(unsorted); +} + bool AliHLTTPCDigitReaderDecoder::NextChannel() { // see header file for class documentation - return false; + Bool_t result=fAltroDecoder->NextChannel(&fAltroData); + if(result && !fMapping->IsValidHWAddress(fAltroData.GetHadd())){ + result = fAltroDecoder->NextChannel(&fAltroData); + } + return result; } int AliHLTTPCDigitReaderDecoder::NextBunch() { // see header file for class documentation - return 0; + return fAltroData.NextBunch(fAltroBunch); } bool AliHLTTPCDigitReaderDecoder::NextSignal() { // see header file for class documentation + fNextSignalMethodUsed=kTRUE; + do { + if (fNextCounter>0) { + // there is data available in the current bunch + fNextCounter--; + return true; + } + + // there is no data left in the current bunch, search for the next one + while (NextBunch()) if (GetBunchSize()>0) { + fNextCounter=GetBunchSize()-1; + return true; + } + + fNextCounter=-1; + // there is no bunch left, go to the next channel + } while (NextChannel()); + return false; } -AliHLTUInt32_t* AliHLTTPCDigitReaderDecoder::GetSignals() +const UInt_t* AliHLTTPCDigitReaderDecoder::GetSignals() { // see header file for class documentation - return NULL; + return fAltroBunch->GetData(); } int AliHLTTPCDigitReaderDecoder::GetRow() { // see header file for class documentation - return 0; + return fMapping->GetRow(fAltroData.GetHadd()); } int AliHLTTPCDigitReaderDecoder::GetPad() { // see header file for class documentation - return 0; + return fMapping->GetPad(fAltroData.GetHadd()); } int AliHLTTPCDigitReaderDecoder::GetSignal() { // see header file for class documentation + if (fNextSignalMethodUsed) { + const UInt_t* pData=GetSignals(); + if (pData && fNextCounter>=0) { + assert(fNextCounterGetStartTimeBin(); + } + else{ + assert(fNextCounter>=0); + iResult = fAltroBunch->GetStartTimeBin()+fNextCounter; + } + if(iResult<0 || iResult>AliHLTTPCTransform::GetNTimeBins()){ + iResult=0; + } + return iResult; +} + +int AliHLTTPCDigitReaderDecoder::GetBunchSize() +{ + // see header file for class documentation + return fAltroBunch->GetBunchSize(); +} + +int AliHLTTPCDigitReaderDecoder::GetRowOffset() const +{ + return fMapping->GetRowOffset(); +} +AliHLTUInt32_t AliHLTTPCDigitReaderDecoder::GetAltroBlockHWaddr() const +{ + // see header file for class documentation + return (AliHLTUInt32_t)fAltroData.GetHadd(); +} +AliHLTUInt32_t AliHLTTPCDigitReaderDecoder::GetAltroBlockHWaddr(Int_t row, Int_t pad) const +{ + // see header file for class documentation + if(fMapping){ + return fMapping->GetHwAddress(row,pad); + } + else{ + return 0; + } }