]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSparseHisto.h
set titles of variables in histograms to italic
[u/mrichter/AliRoot.git] / MUON / AliMUONSparseHisto.h
index af70755c0308e970da6041a3841a93bf6b876eab..817ad754f9ddee77b46b9b17929b7ee7afe1b408 100644 (file)
@@ -6,9 +6,9 @@
 
 // $Id$
 
-/// \ingroup graphics
+/// \ingroup calib
 /// \class AliMUONSparseHisto
-/// \brief A very memory compact histogram to hold tracker ADC distributions
+/// \brief A very memory compact histogram to hold some tracker distributions
 /// 
 // Author Laurent Aphecetche, Subatech
 
 class AliMUONSparseHisto : public TObject
 {
 public:
-  AliMUONSparseHisto();
+  
+  enum 
+  {
+    kUnderflow = BIT(20),
+    kOverflow = BIT(21)
+  };
+  
+  AliMUONSparseHisto(Double_t xmin=0.0, Double_t xmax=4096.0); 
   AliMUONSparseHisto(const AliMUONSparseHisto& rhs);
   AliMUONSparseHisto& operator=(const AliMUONSparseHisto& rhs);
   
   virtual ~AliMUONSparseHisto();
   
-  Int_t Fill(Int_t adc);
+  Bool_t Add(const AliMUONSparseHisto& h);
+  
+  /// Whether this histogram has underflow values 
+  /// (no way to know the number of underflow, though)
+  Bool_t HasUnderflow() const { return TestBit(kUnderflow); }
+  
+  /// Whether this histogram has overflow values  
+  /// (no way to know the number of underflow, though)
+  Bool_t HasOverflow() const { return TestBit(kOverflow); }
+  
+  Int_t Fill(Double_t value);
   
   /// Return number of bins we hold
   Int_t GetNbins() const { return fNbins; }
+
+  Double_t GetBinCenter(Int_t bin) const;
   
   Int_t GetBinContent(Int_t bin) const;
   
   virtual void Print(Option_t* opt="") const;
   
   virtual void Clear(Option_t* opt="");
+    
+  Int_t Find(Int_t binCenter) const;
   
-  void Decode(Int_t value, Int_t& adc, Int_t& count) const;
+  virtual void Copy(TObject& object) const;
+
+  /// Return max value of bincenter
+  Double_t Xmax() const { return fXmax; }
   
-  Int_t Encode(Int_t adc, Int_t count) const;
+  /// Return min value of bincenter
+  Double_t Xmin() const { return fXmin; }
   
-  Int_t Find(Int_t adc) const;
+  /// Number of bits used to code the x-value of the histogram
+  Int_t Nbits() const { return 12; }
   
-  virtual void Copy(TObject& object) const;
-
 private:
-      
-    void Expand();
+  
+  UInt_t Encode(Int_t binCenter, Int_t binContent) const;
+  
+  Double_t DecodeValue(Int_t value) const;
+  
+  Int_t EncodeValue(Double_t value) const;
+  
+  UInt_t GetBin(Int_t i) const;
+  
+  Int_t BinCenter(UInt_t x) const;
+  
+  Int_t BinContent(UInt_t x) const;
+  
+  void Expand();
+  
+  /// Conversion factor to go from float to int value (for bin content)
+  Double_t Factor() const { return fFactor; } 
   
 private:
 
   Int_t fNbins;  ///< number of bins we hold
 
   /// compacted content = (bin,value)
-  Int_t* fArray; //[fNbins] compacted content = (bin,value)
+  UInt_t* fArray; //[fNbins] compacted content = (bin,value)
+
+  Double_t fXmin; ///< min value of bincenter
+  Double_t fXmax; ///< max value of bincenter
+  
+  Double_t fFactor; ///< to go from double to int
   
-  ClassDef(AliMUONSparseHisto,1) // Sparse histogram-like class for ADC distributions
+  ClassDef(AliMUONSparseHisto,2) // Sparse histogram-like class for ADC distributions
 };
 
 #endif