]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCMemHandler.h
get rid of compilation warning
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCMemHandler.h
index 7e9b183cfcf9db32f90a587f4bc6a395b60cc36f..9c2ace4e9a5ada94697ff9d2042107174d4c095a 100644 (file)
@@ -1,19 +1,18 @@
 // @(#) $Id$
-
+// Original: AliHLTMemHandler.h,v 1.30 2004/10/06 08:51:20 cvetan 
 #ifndef ALIHLTTPC_MEMHANDLER_H
 #define ALIHLTTPC_MEMHANDLER_H
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               *
 
-//_____________________________________________________________
-// AliHLTTPCMemHandler
-//
-// The HLT Binary File handler 
-//
-//  This class does all the memory I/O handling of HLT binary files.
-//  
-// Author: Uli Frankenfeld <mailto:franken@fi.uib.no>, 
-//         Anders Vestbo <mailto:vestbo$fi.uib.no>, 
-//         Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de>
-// *-- Copyright &copy ALICE HLT Group 
+/** @file   AliHLTTPCMemHandler.h
+    @author U. Frankenfeld, A. Vestbo, C. Loizides, maintained by
+            Matthias Richter
+    @date   
+    @brief  input interface base class for the TPC tracking code before
+            migration to the HLT component framework
+*/
 
 class AliHLTTPCDigitData;
 class AliHLTTPCSpacePointData;
@@ -23,20 +22,75 @@ class AliHLTTPCTrackArray;
 class AliHLTTPCRandomPointData;
 class AliHLTTPCRandomDigitData;
 
-#ifdef use_newio
 class AliRunLoader;
 class AliRawEvent;
-#endif
-class AliTPCRawStream;
+#include "AliTPCRawStream.h"
 
+/**
+ * @class AliHLTTPCMemHandler
+ * The HLT Binary File handler 
+ *
+ * This class is the old memory I/O handler of HLT binary files.
+ * Some functionality is still used in the current code, mainly
+ * conversion of TPC digits into the format understandable by the
+ * components.
+ * <pre>
+ *  Examples:
+ *  ---------
+ *
+ *  1) Reading a binary file:
+ *  
+ *  AliHLTTPCMemHandler file;
+ *  file.SetBinaryInput(filename);
+ *  file.Init(slice,patch);
+ *
+ *  UInt_t nrowss;
+ *  AliHLTTPCDigitRowData *data = file.CompBinary2Memory(nrows);
+ *  
+ *  for(int i=0; i<nrows; i++) 
+ *    {
+ *    
+ *    AliHLTTPCDigitData *dataPt = (AliHLTTPCDigitData*)data->fDigitData;
+ *    for(int j=0; j<data->fNDigit; j++) 
+ *      {
+ *        pad = dataPt[j].fPad;
+ *        time = dataPt[j].fTime;
+ *        charge = dataPt[j].fCharge;
+ *      }
+ *     
+ *    file.UpdateRowPointer(data);
+ *  
+ *    }
+ *  file.CloseBinaryInput();
+ *  ________________________
+ *  
+ *  2) Writing a binary file:
+ *  
+ *  //First of all you need to store the data in memory,
+ *  //and have a pointer to it of type AliHLTTPCDigitRowData.
+ *  //E.g. if you just want to write the data you read in example 1)
+ *  //into a new file, you can do the following:
+ *  
+ *  AliHLTTPCMemHandler newfile;
+ *  newfile.Init(slice,patch);
+ *  newfile.SetBinaryOutput(newfilename);
+ *  newfile.Memory2CompBinary((UInt_t)NumberOfRowsInPatch,(AliHLTTPCDigitRowData*)data);
+ *  newfile.CloseBinaryOutput();
+ *
+ *
+ * Compressed file format:
+ * -----------------------
+ *
+ * The data is RLE encoded and currently using _10_ bit range for the ADC-values.
+ * </pre>
+ *  
+ * @ingroup alihlt_tpc
+ */
 class AliHLTTPCMemHandler { 
 
  public:
   AliHLTTPCMemHandler();
   virtual ~AliHLTTPCMemHandler();
-  AliHLTTPCMemHandler(const AliHLTTPCMemHandler& /*m*/){};
-  AliHLTTPCMemHandler& operator=(const AliHLTTPCMemHandler& /*&m*/)
-    {return (*this);}
    
   void Reset(){CloseBinaryInput();CloseBinaryOutput();Free();}  
   void Init(Int_t s,Int_t p, Int_t *r=0);
@@ -61,23 +115,50 @@ class AliHLTTPCMemHandler {
   void SetROI(Float_t *eta,Int_t *slice);
   void ResetROI();
 
-  //Digit IO
-  Bool_t Memory2Binary(UInt_t nrow,AliHLTTPCDigitRowData *data);
-  Bool_t Binary2Memory(UInt_t & nrow,AliHLTTPCDigitRowData *data);
+  ////////////////////////////////////////////////////////////////////////////////////
+  //
+  // Digit IO
+
+  /**
+   * Write digit data to binary file.
+   * The function loops over the rows and dumps all data of the
+   * AliHLTTPCDigitRowData in binary format to the file.
+   * @param nrow    size of the array
+   * @param data    data array
+   * @return kTRUE if succeeded, kFALSE if error
+   */
+  Bool_t Memory2BinaryFile(UInt_t nrow,AliHLTTPCDigitRowData *data);
+
+  /**
+   * Read digit data from binary file.
+   * @param nrow    size of the array
+   * @param data    data buffer to receive the data
+   * @param sz      [IN] buffer size [OUT] total output size
+   * @return kTRUE if succeeded, kFALSE if error
+   */
+  Bool_t Binary2Memory(UInt_t & nrow,AliHLTTPCDigitRowData *data, UInt_t& sz);
+
+  // Matthias 18.09.2007
+  // this function is highly error prone, no size check for data buffer
+  // depricated
+  //Bool_t Binary2Memory(UInt_t & nrow,AliHLTTPCDigitRowData *data){UInt_t tmp;return Binary2Memory(nrow,data,tmp);};
 
   Int_t Memory2CompMemory(UInt_t nrow,AliHLTTPCDigitRowData *data,UInt_t *comp);
-  Int_t CompMemory2Memory(UInt_t nrow,AliHLTTPCDigitRowData *data,UInt_t *comp);
+  Int_t CompMemory2Memory(UInt_t nrow,AliHLTTPCDigitRowData *data,UInt_t *comp,UInt_t& sz);
+  Int_t CompMemory2Memory(UInt_t nrow,AliHLTTPCDigitRowData *data,UInt_t *comp) {UInt_t tmp;return CompMemory2Memory(nrow,data,comp,tmp);};
   Bool_t CompMemory2CompBinary(UInt_t nrow,UInt_t *comp, UInt_t size=0);
   Bool_t CompBinary2CompMemory(UInt_t & nrow,UInt_t *comp);
 
-  virtual AliHLTTPCDigitRowData *CompBinary2Memory(UInt_t & nrow);
+  virtual AliHLTTPCDigitRowData *CompBinary2Memory(UInt_t & nrow, UInt_t& sz);
+  virtual AliHLTTPCDigitRowData *CompBinary2Memory(UInt_t & nrow){UInt_t tmp;return CompBinary2Memory(nrow,tmp);};
   virtual Bool_t Memory2CompBinary(UInt_t nrow,AliHLTTPCDigitRowData *data);
   
   UInt_t GetNRow(UInt_t *comp,UInt_t size);
 
   //Point IO
   Bool_t Memory2Binary(UInt_t npoint,AliHLTTPCSpacePointData *data);
-  Bool_t Binary2Memory(UInt_t & npoint,AliHLTTPCSpacePointData *data);
+  Bool_t Binary2Memory(UInt_t & npoint,AliHLTTPCSpacePointData *data, UInt_t& sz);
+  Bool_t Binary2Memory(UInt_t & npoint,AliHLTTPCSpacePointData *data) {UInt_t tmp; return Binary2Memory(npoint,data,tmp);};
   Bool_t Transform(UInt_t npoint,AliHLTTPCSpacePointData *data,Int_t slice);
   static void UpdateRowPointer(AliHLTTPCDigitRowData *&tempPt);
   
@@ -113,9 +194,7 @@ class AliHLTTPCMemHandler {
   //virtual functions:
   virtual void FreeDigitsTree() {fDummy=0; return;}
   virtual Bool_t SetAliInput(char */*name*/){fDummy=0; return 0;}
-#ifdef use_newio
   virtual Bool_t SetAliInput(AliRunLoader */*runloader*/){fDummy=0; return 0;}
-#endif
   virtual void CloseAliInput(){fDummy=0; return;} 
   virtual Bool_t IsDigit(Int_t /*i*/=0){fDummy=0; return 0;}
   virtual Bool_t SetMCOutput(char */*name*/){fDummy=0; return 0;}
@@ -155,12 +234,8 @@ class AliHLTTPCMemHandler {
   virtual Bool_t RawData2CompMemory(Int_t /*event*/=-1){fDummy=0; return 0;}
 
   //AliHLTTPCDDLDataFileHandler
-#ifdef use_newio
   virtual Bool_t SetReaderInput(AliRawEvent */*rawevent*/){fDummy=0; return 0;}
   virtual Bool_t SetReaderInput(Char_t */*name*/,Int_t /*event*/=0){fDummy=0; return 0;}
-#else
-  virtual Bool_t SetReaderInput(Char_t */*name*/,Bool_t /*add*/=kTRUE){fDummy=0; return 0;}
-#endif
   virtual void CloseReaderInput(){};
 
   virtual AliHLTTPCDigitRowData* DDLData2Memory(UInt_t &/*nrow*/,Int_t /*event*/=-1){fDummy=0; return 0;}
@@ -174,13 +249,20 @@ class AliHLTTPCMemHandler {
   Int_t fSlice;  //slice
   Int_t fPatch;  //patch
 
-  Int_t fEtaMinTimeBin[159]; //for ROI in eta only
-  Int_t fEtaMaxTimeBin[159]; //for ROI in eta only
+  static const Int_t fgkNSlice = 36; //!
+  static const Int_t fgkNRow = 159; //!
+
+  Int_t fEtaMinTimeBin[fgkNRow]; //for ROI in eta only
+  Int_t fEtaMaxTimeBin[fgkNRow]; //for ROI in eta only
   
   FILE *fInBinary;//!
   FILE *fOutBinary;//!
 
  private:
+  /** copy constructor prohibited */
+  AliHLTTPCMemHandler(const AliHLTTPCMemHandler& src);
+  /** assignment operator prohibited */
+  AliHLTTPCMemHandler& operator=(const AliHLTTPCMemHandler& src);
   
   Byte_t *fPt;//!
   UInt_t fSize; //size of allocated data structure