AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONSparseHisto.h
Go to the documentation of this file.
1 #ifndef ALIMUONSPARSEHISTO_H
2 #define ALIMUONSPARSEHISTO_H
3 
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6 
7 // $Id$
8 
13 // Author Laurent Aphecetche, Subatech
14 
15 #ifndef ROOT_TObject
16 # include "TObject.h"
17 #endif
18 
19 class AliMUONSparseHisto : public TObject
20 {
21 public:
22 
23  enum
24  {
25  kUnderflow = BIT(20),
26  kOverflow = BIT(21)
27  };
28 
29  AliMUONSparseHisto(Double_t xmin=0.0, Double_t xmax=4096.0);
32 
33  virtual ~AliMUONSparseHisto();
34 
35  Bool_t Add(const AliMUONSparseHisto& h);
36 
39  Bool_t HasUnderflow() const { return TestBit(kUnderflow); }
40 
43  Bool_t HasOverflow() const { return TestBit(kOverflow); }
44 
45  Int_t Fill(Double_t value);
46 
48  Int_t GetNbins() const { return fNbins; }
49 
50  Double_t GetBinCenter(Int_t bin) const;
51 
52  Int_t GetBinContent(Int_t bin) const;
53 
54  virtual void Print(Option_t* opt="") const;
55 
56  virtual void Clear(Option_t* opt="");
57 
58  Int_t Find(Int_t binCenter) const;
59 
60  virtual void Copy(TObject& object) const;
61 
63  Double_t Xmax() const { return fXmax; }
64 
66  Double_t Xmin() const { return fXmin; }
67 
69  Int_t Nbits() const { return 12; }
70 
71 private:
72 
73  UInt_t Encode(Int_t binCenter, Int_t binContent) const;
74 
75  Double_t DecodeValue(Int_t value) const;
76 
77  Int_t EncodeValue(Double_t value) const;
78 
79  UInt_t GetBin(Int_t i) const;
80 
81  Int_t BinCenter(UInt_t x) const;
82 
83  Int_t BinContent(UInt_t x) const;
84 
85  void Expand();
86 
88  Double_t Factor() const { return fFactor; }
89 
90 private:
91 
92  Int_t fNbins;
93 
95  UInt_t* fArray; //[fNbins] compacted content = (bin,value)
96 
97  Double_t fXmin;
98  Double_t fXmax;
99 
100  Double_t fFactor;
101 
102  ClassDef(AliMUONSparseHisto,2) // Sparse histogram-like class for ADC distributions
103 };
104 
105 #endif
AliMUONSparseHisto & operator=(const AliMUONSparseHisto &rhs)
virtual void Print(Option_t *opt="") const
Bool_t HasOverflow() const
Int_t EncodeValue(Double_t value) const
Int_t GetNbins() const
Return number of bins we hold.
AliMUONSparseHisto(Double_t xmin=0.0, Double_t xmax=4096.0)
Double_t DecodeValue(Int_t value) const
UInt_t * fArray
compacted content = (bin,value)
Double_t Xmax() const
Return max value of bincenter.
Double_t GetBinCenter(Int_t bin) const
Int_t fNbins
number of bins we hold
Double_t fFactor
to go from double to int
Bool_t HasUnderflow() const
virtual void Copy(TObject &object) const
Double_t Factor() const
Conversion factor to go from float to int value (for bin content)
Int_t GetBinContent(Int_t bin) const
Int_t Find(Int_t binCenter) const
Int_t BinContent(UInt_t x) const
Int_t BinCenter(UInt_t x) const
A very memory compact histogram to hold some tracker distributions.
Double_t fXmin
min value of bincenter
Int_t Fill(Double_t value)
UInt_t GetBin(Int_t i) const
UInt_t Encode(Int_t binCenter, Int_t binContent) const
Double_t fXmax
max value of bincenter
Double_t Xmin() const
Return min value of bincenter.
Int_t Nbits() const
Number of bits used to code the x-value of the histogram.
Bool_t Add(const AliMUONSparseHisto &h)
virtual void Clear(Option_t *opt="")