]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCHWCFData.cxx
empty block generation in AliHLTTPCHWClusterDecoder
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCHWCFData.cxx
index 4838afb9f2ae451aa08adba2a0b63c491b60dbe4..ccd659eef4846b20e1a03e40ca06a7f34b9cbb52 100644 (file)
@@ -25,7 +25,7 @@
 #include "AliHLTErrorGuard.h"
 #include "AliHLTTPCHWCFEmulator.h"
 #include "AliHLTTPCTransform.h"
-#include "AliRawDataHeader.h"
+#include "AliHLTCDHWrapper.h"
 #include "TFile.h"
 #include <memory>
 #include <ostream>
@@ -39,6 +39,8 @@ AliHLTTPCHWCFData::AliHLTTPCHWCFData(int forceVersion)
  , fForcedVersion(forceVersion)
  , fRCUTrailerSize(0)
  , fpFileBuffer(NULL)
+ , fIterator()
+ , fIteratorEnd()
 {
   // constructor
 }
@@ -84,7 +86,7 @@ int AliHLTTPCHWCFData::Init(const AliHLTUInt8_t* pBuffer, int bufferSize)
     // check if the first RCU trailer word starts with pattern '10'
     rcuTrailer-=nofRCUTrailerWords-1;
     if ((*rcuTrailer >> 30) != 2) {
-      HLTError("inconsistent RCU trailer word: can not find indicator patter '10' in bit 30 and 31 (0x08x)", *rcuTrailer);
+      HLTError("inconsistent first RCU trailer word: can not find indicator pattern '10' in bit 31 and 30 (0x%08x): trailer size %d word(s), buffer size %d byte", *rcuTrailer, nofRCUTrailerWords, bufferSize);
       return -ENODATA;
     }
 
@@ -146,30 +148,6 @@ Int_t AliHLTTPCHWCFData::GetNumberOfClusters() const
   return (fBufferSize-fRCUTrailerSize)/elementsize;
 }
 
-int AliHLTTPCHWCFData::GetElementSize(int version) const
-{
-  // get the size of one element
-  switch (version) {
-  case 0: return sizeof(AliHLTTPCHWClusterV0);
-  case 1: return sizeof(AliHLTTPCHWClusterV1);
-  default:
-    ALIHLTERRORGUARD(1, "invalid format version %d", fVersion);
-  }
-  return -1;
-}
-
-bool AliHLTTPCHWCFData::CheckBounds(int i) const
-{
-  // check if index is within bounds
-  if (fVersion<0) {
-    ALIHLTERRORGUARD(1, "");
-    return false;
-  }
-  int elementsize=GetElementSize(fVersion);
-  if (elementsize<0) return false;
-  return ((i+1)*elementsize+fRCUTrailerSize<=fBufferSize);
-}
-
 Int_t    AliHLTTPCHWCFData::GetPadRow(int i)  const
 {
   // get raw coordinate
@@ -251,7 +229,7 @@ Int_t    AliHLTTPCHWCFData::GetCharge(int i)  const
       ALIHLTERRORGUARD(1, "invalid format version %d", fVersion);
     }
   }
-  return -10000.;
+  return -1;
 }
 
 Int_t    AliHLTTPCHWCFData::GetQMax(int i)    const
@@ -265,7 +243,7 @@ Int_t    AliHLTTPCHWCFData::GetQMax(int i)    const
       ALIHLTERRORGUARD(1, "invalid format version %d", fVersion);
     }
   }
-  return -10000.;
+  return -1;
 }
 
 void AliHLTTPCHWCFData::Print(const char* option)
@@ -294,6 +272,11 @@ void AliHLTTPCHWCFData::Print(const char* option)
   }
 }
 
+void AliHLTTPCHWCFData::ErrorMsg( const char *str ) const
+{
+  ALIHLTERRORGUARD(1, str);
+}
+
 int AliHLTTPCHWCFData::Open(const char* filename)
 {
   // open block from file and add to collection
@@ -322,8 +305,9 @@ int AliHLTTPCHWCFData::Open(const char* filename)
     iResult=-ENODATA;
   }
 
-  AliHLTUInt8_t* pBuffer=reinterpret_cast<AliHLTUInt8_t*>(buffer->GetArray()+sizeof(AliRawDataHeader));
-  unsigned bufferSize=buffer->GetSize()-sizeof(AliRawDataHeader);
+  AliHLTCDHWrapper header(buffer->GetArray());
+  AliHLTUInt8_t* pBuffer=reinterpret_cast<AliHLTUInt8_t*>(buffer->GetArray()+header.GetHeaderSize());
+  unsigned bufferSize=buffer->GetSize()-header.GetHeaderSize();
   if ((iResult=Init(pBuffer, bufferSize))<0 ||
       (iResult=CheckVersion())<0) {
     Reset();
@@ -365,7 +349,7 @@ Int_t    AliHLTTPCHWCFData::AliHLTTPCHWClusterV1::GetCharge()  const
 
 Int_t    AliHLTTPCHWCFData::AliHLTTPCHWClusterV1::GetQMax()    const
 {
-  // 24 bit fixed point number with 6 bits after the point
+  // 24 bit fixed point number with 12 bits after the point
   AliHLTUInt32_t header=AliHLTTPCHWCFEmulator::ReadBigEndian(fHeader);
-  return (header & 0xFFFFFF )>>6;
+  return (header & 0xFFFFFF )>>12;
 }