]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCHWCFData.h
Improving file handling at digitization time (item related to https://alice.its.cern...
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCHWCFData.h
index 3f1c56b5944c291a2aaabd398ea8e4303752b606..529d725399399606f352c4dc6bfc7985b21c4982 100644 (file)
@@ -12,7 +12,7 @@
 /// @brief  Decoder methods for the HWCF format
 ///
 
-#include "AliHLTTPCRootTypes.h"
+#include "Rtypes.h"
 #include "AliHLTDataTypes.h"
 #include "AliHLTLogging.h"
 #include "AliHLTErrorGuard.h"
@@ -72,9 +72,10 @@ class AliHLTTPCHWCFData : public AliHLTLogging {
   bool CheckAssumption(int format, const AliHLTUInt8_t* pData, int size) const;
 
   // check if index is within bounds
+
   bool CheckBounds(int i) const {
     if (fVersion<0) {
-      ALIHLTERRORGUARD(1, "");
+      ErrorMsg("");
       return false;
     }
     int elementsize=GetElementSize(fVersion);
@@ -88,7 +89,7 @@ class AliHLTTPCHWCFData : public AliHLTLogging {
     case 0: return sizeof(AliHLTTPCHWClusterV0);
     case 1: return sizeof(AliHLTTPCHWClusterV1);
     default:
-      ALIHLTERRORGUARD(1, "invalid format version %d", fVersion);
+      ErrorMsg(Form("invalid format version %d", fVersion));
     }
     return -1;
   }
@@ -97,7 +98,7 @@ class AliHLTTPCHWCFData : public AliHLTLogging {
   const AliHLTUInt8_t*  GetRCUTrailer() const
   {
     if (fRCUTrailerSize<=0 || fpBuffer==NULL || fBufferSize<fRCUTrailerSize) return NULL;
-    return fpBuffer+fRCUTrailerSize;
+    return fpBuffer+(fBufferSize-fRCUTrailerSize);
   }
 
   // size of RCU trailer
@@ -106,6 +107,9 @@ class AliHLTTPCHWCFData : public AliHLTLogging {
   // print info
   void Print(const char* option);
 
+  // print error message
+  void ErrorMsg( const char *str ) const;
+
   // open a file and init
   int Open(const char* filename);
 
@@ -124,8 +128,14 @@ class AliHLTTPCHWCFData : public AliHLTLogging {
     Int_t    GetPadRow()  const;
     Float_t  GetPad()     const {return fPad+0.5;}
     Float_t  GetTime()    const {return fTime;}
-    Float_t  GetSigmaY2() const {return fSigmaY2;}
-    Float_t  GetSigmaZ2() const {return fSigmaZ2;}
+    Float_t  GetSigmaY2() const {
+      Float_t sy2 = fSigmaY2 - fPad*fPad;
+      return (sy2>0) ?sy2 :0.;
+    }
+    Float_t  GetSigmaZ2() const {
+      Float_t sz2 = fSigmaZ2 - fTime*fTime;
+      return (sz2>0) ?sz2 :0.;
+    }
     Int_t    GetCharge()  const;
     Int_t    GetQMax()    const {return -1;}
   };
@@ -141,8 +151,14 @@ class AliHLTTPCHWCFData : public AliHLTLogging {
     Int_t    GetPadRow()  const;
     Float_t  GetPad()     const {return fPad+0.5;}
     Float_t  GetTime()    const {return fTime;}
-    Float_t  GetSigmaY2() const {return fSigmaY2;}
-    Float_t  GetSigmaZ2() const {return fSigmaZ2;}
+    Float_t  GetSigmaY2() const {
+      Float_t sy2 = fSigmaY2 - fPad*fPad;
+      return (sy2>0) ?sy2 :0.;
+    }
+    Float_t  GetSigmaZ2() const {
+      Float_t sz2 = fSigmaZ2 - fTime*fTime;
+      return (sz2>0) ?sz2 :0.;
+    }
     Int_t    GetCharge()  const;
     Int_t    GetQMax()    const;
   };
@@ -179,8 +195,10 @@ class AliHLTTPCHWCFData : public AliHLTLogging {
       : fData(pData), fVersion(version), fElementSize(elementSize) {}
     iterator(const iterator& i)
       : fData(i.fData), fVersion(i.fVersion), fElementSize(i.fElementSize) {}
-    iterator& operator=(const iterator& i)
-      { fData=i.fData; fVersion=i.fVersion; fElementSize=i.fElementSize; return *this;}
+    iterator& operator=(const iterator& i) {
+      if (this==&i) return *this;
+      fData=i.fData; fVersion=i.fVersion; fElementSize=i.fElementSize; return *this;
+    }
     ~iterator() {fData=NULL;}
 
     bool operator==(const iterator& i) const  {return (fData!=NULL) && (fData==i.fData);}