]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTDataDeflater.h
The segmentations are made data member of the AliITSUGeomTGeo, will be loaded
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataDeflater.h
index b5d1e5ec91d5e3f37a2d4560c33bc4b8cb1a7848..4ae6c13713f6d21841c91714e5cfdd440c6d3e2d 100644 (file)
 #include "AliHLTLogging.h"
 #include "AliHLTDataTypes.h"
 #include "AliHLTStdIncludes.h"
+#include <bitset>
+
+class TObjArray;
+class TH1;
+class TH2;
 
 /**
  * @class AliHLTDataDeflater
@@ -85,6 +90,13 @@ public:
    */
   bool OutputBits( AliHLTUInt64_t const & value, UInt_t const & bitCount );
 
+  /** function to output bits from a bitset
+   * @param value     AliHLTUInt64_t const &
+   * @param bitCount  UInt_t const &
+   * @return zero upon success
+   */
+  bool OutputBits( std::bitset<64> const & value, UInt_t const & bitCount );
+
   /* function pad 8 bits */
   void Pad8Bits();
 
@@ -95,6 +107,29 @@ public:
    */
   bool OutputBytes( AliHLTUInt8_t const * data, UInt_t const & byteCount );      
 
+  /// add a histogram for deflater statistic of the corresponding parameter
+  /// a histogram is created with default settings if h is not specified; if
+  /// provided, the ownership goes over to the base class
+  int AddHistogram(int id, const char* name, int bitWidth, TH1* h=NULL);
+
+  /// enable statistics accounting
+  int EnableStatistics();
+
+  /// check if statistics writing is enabled
+  bool DoStatistics() const {return fHistograms!=NULL;}
+
+  /// fill statistics for a parameter
+  /// @param id           id of the parameter
+  /// @param value        value
+  /// @param length       bit length
+  /// @param codingWeight fraction of bit lenght used for this value
+  int FillStatistics(int id, AliHLTUInt64_t value, unsigned length, float codingWeight=0.0);
+
+  static float CalcEntropy(TH1* histo, const char* option="", int mode=0);
+
+  /// save data according to option
+  virtual void SaveAs(const char *filename="",Option_t *option="") const;
+
   /// clear the object and reset pointer references
   virtual void Clear(Option_t * /*option*/ ="");
 
@@ -104,9 +139,15 @@ public:
   /// print info
   virtual void Print(ostream& out, Option_t *option="") const;
 
+  /// find object
+  virtual TObject *FindObject(const char */*name*/) const {return NULL;}
+
   /// write bit pattern of a parameter to the current byte and position
   virtual bool OutputParameterBits( int parameterId, AliHLTUInt64_t const & value );
 
+  /// write bit pattern of a parameter to the current byte and position
+  virtual bool OutputParameterBits( int parameterId, AliHLTUInt64_t const & value, int lengthOffset );
+
   /// return unique version of the deflater, base class has version 0
   virtual int GetDeflaterVersion() const {return 0;}
 
@@ -129,6 +170,10 @@ private:
   /// bit data current output end
   AliHLTUInt8_t *fBitDataCurrentOutputEnd; //! bit data current output end 
 
+  TObjArray* fHistograms; //! list of histograms for parameters
+  TH2* fParameterCompression; //! compression for individual parameters
+  TH2* fParameterSize; //! accumulated size for individual parameters
+
   ClassDef(AliHLTDataDeflater, 0)
 };