]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCDigitReaderPacked.h
update
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDigitReaderPacked.h
index 80e0660afe118c0a2c1f9a276692975fe180279e..4cb1641e1898cd820e1e2d7a2dff815566bc17eb 100644 (file)
@@ -14,9 +14,8 @@
     @brief  A digit reader implementation for simulated, packed TPC 'raw' data.
 */
 
-//#define ENABLE_PAD_SORTING 1
-
 #include "AliHLTTPCDigitReader.h"
+#include <vector>
 
 class AliRawReaderMemory;
 class AliTPCRawStream;
@@ -47,14 +46,51 @@ public:
    * @param slice   sector no (0 to 35)
    */
   Int_t InitBlock(void* ptr,ULong_t size, Int_t patch, Int_t slice);
+  int Reset();
   void SetUnsorted(bool unsorted){fUnsorted=unsorted;}
   Bool_t NextSignal();
   Int_t GetRow();
   Int_t GetPad();
   Int_t GetSignal();
   Int_t GetTime();
+  bool NextChannel();
+  int NextBunch();
   AliHLTUInt32_t GetAltroBlockHWaddr() const;
-    
+  int GetRCUTrailerSize();
+  bool GetRCUTrailerData(UChar_t*& trData);
+  int GetBunchSize();
+  const UInt_t* GetSignals();
+  Int_t GetTimeOfUnsortedSignal();    
+
+  /**
+   * Compound to hold both the AliTPCRawStreamInstance and the RawReader
+   */
+  class AliHLTTPCRawStream {
+  public:
+    AliHLTTPCRawStream();
+    ~AliHLTTPCRawStream();
+
+    Bool_t SetMemory(Int_t ddlId, UChar_t* memory, ULong_t size );
+
+    bool Next();
+
+    Int_t GetRow() const;
+    Int_t GetPad() const;
+    Int_t GetTime() const;
+    Int_t GetSignal() const;
+    Int_t GetHWAddress() const;
+    Bool_t  GetRCUTrailerData(UChar_t*& data) const;
+    Int_t   GetRCUTrailerSize() const;
+
+  private:
+    /** copy constructor prohibited */
+    AliHLTTPCRawStream(const AliHLTTPCRawStream&);
+    /** assignment operator prohibited */
+    AliHLTTPCRawStream& operator=(const AliHLTTPCRawStream&);
+
+    AliRawReaderMemory *fRawMemoryReader; //!transient
+    AliTPCRawStream *fTPCRawStream; //!transient
+  };
 protected:
     
 private:
@@ -63,29 +99,76 @@ private:
   /** assignment operator prohibited */
   AliHLTTPCDigitReaderPacked& operator=(const AliHLTTPCDigitReaderPacked&);
 
-  // Initialize AliROOT TPC raw stream parsing class
-  AliRawReaderMemory *fRawMemoryReader; //!transient
+  /**
+   * Instance handling of the buffer to hold the sorted data.
+   * In order to keep memory consumption small, one global buffer will be used
+   * for the sorted data.
+   * This can actually be extended in order to support more than one global
+   * instance provided by a scheduler, but thats overkill for the moment.
+   */
+  static Int_t* GetBufferInstance();
+
+  /**
+   * Release an instance of the buffer.
+   */
+  static void ReleaseBufferInstance(Int_t* pInstance);
+
+  /**
+   * Instance handling of the TPCRawStream.
+   * In order to keep memory consumption small, one global instance of the
+   * TPCRawStream will be used to read data.
+   * This can actually be extended in order to support more than one global
+   * instance provided by a scheduler, but thats overkill for the moment.
+   */
+  AliHLTTPCRawStream* GetRawStreamInstance();
+
+  /**
+   * Release an instance of the TPCRawStream.
+   */
+  void ReleaseRawStreamInstance(AliHLTTPCRawStream* pInstance);
+
+  AliHLTTPCRawStream* fTPCRawStream; //!transient
 
-  AliTPCRawStream *fTPCRawStream; //!transient
-    
-  //#if ENABLE_PAD_SORTING 
   Int_t fCurrentRow; //!transient
   Int_t fCurrentPad; //!transient
   Int_t fCurrentBin; //!transient
  
   Int_t fRowOffset; //!transient
   Int_t fNRows; //!transient
+  Int_t fNPads; //!transient
 
-  Int_t fNMaxRows; //!transient
-  Int_t fNMaxPads; //!transient
-  Int_t fNTimeBins; //!transient
+  static Int_t fNMaxRows; //!transient
+  static Int_t fNMaxPads; //!transient
+  static Int_t fNTimeBins; //!transient
 
   Int_t *fData; //!transient
-  //#endif // ENABLE_PAD_SORTING
 
   Bool_t fUnsorted; //!transient
 
-  ClassDef(AliHLTTPCDigitReaderPacked, 2)
+  /** array to hold bunch data */
+  vector<UInt_t> fDataBunch;                             //! transient
+  /** the current channel for bulk read mode */
+  Int_t fCurrentChannel;                                 //! transient
+  /** last NextSignal returned data */
+  Int_t fbHaveData;                                      //! transient
+
+  /** partition the reader is initialized for */
+  Int_t fCurrentPatch;                                   //! transient
+
+  /** the global free instance of sorted data buffer */
+  static Int_t* fgpFreeBufferInstance;                   //! transient
+  /** occupied instance */
+  static Int_t* fgpIssuedBufferInstance;                 //! transient
+
+  /** the global free instance of the TPCRawStream */
+  static AliHLTTPCRawStream* fgpFreeStreamInstance;      //! transient
+  /** occupied instance of the TPCRawStream */
+  static AliHLTTPCRawStream* fgpIssuedStreamInstance;    //! transient
+
+  /** counter for instances of the reader */
+  static Int_t fgObjectCount;                            //! transient
+
+  ClassDef(AliHLTTPCDigitReaderPacked, 4)
        
 };