1 #ifndef ALIMUONSPARSEHISTO_H
2 #define ALIMUONSPARSEHISTO_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
10 /// \class AliMUONSparseHisto
11 /// \brief A very memory compact histogram to hold some tracker distributions
13 // Author Laurent Aphecetche, Subatech
19 class AliMUONSparseHisto : public TObject
29 AliMUONSparseHisto(Double_t xmin=0.0, Double_t xmax=4096.0);
30 AliMUONSparseHisto(const AliMUONSparseHisto& rhs);
31 AliMUONSparseHisto& operator=(const AliMUONSparseHisto& rhs);
33 virtual ~AliMUONSparseHisto();
35 Bool_t Add(const AliMUONSparseHisto& h);
37 /// Whether this histogram has underflow values
38 /// (no way to know the number of underflow, though)
39 Bool_t HasUnderflow() const { return TestBit(kUnderflow); }
41 /// Whether this histogram has overflow values
42 /// (no way to know the number of underflow, though)
43 Bool_t HasOverflow() const { return TestBit(kOverflow); }
45 Int_t Fill(Double_t value);
47 /// Return number of bins we hold
48 Int_t GetNbins() const { return fNbins; }
50 Double_t GetBinCenter(Int_t bin) const;
52 Int_t GetBinContent(Int_t bin) const;
54 virtual void Print(Option_t* opt="") const;
56 virtual void Clear(Option_t* opt="");
58 Int_t Find(Int_t binCenter) const;
60 virtual void Copy(TObject& object) const;
62 /// Return max value of bincenter
63 Double_t Xmax() const { return fXmax; }
65 /// Return min value of bincenter
66 Double_t Xmin() const { return fXmin; }
68 /// Number of bits used to code the x-value of the histogram
69 Int_t Nbits() const { return 12; }
73 UInt_t Encode(Int_t binCenter, Int_t binContent) const;
75 Double_t DecodeValue(Int_t value) const;
77 Int_t EncodeValue(Double_t value) const;
79 UInt_t GetBin(Int_t i) const;
81 Int_t BinCenter(UInt_t x) const;
83 Int_t BinContent(UInt_t x) const;
87 /// Conversion factor to go from float to int value (for bin content)
88 Double_t Factor() const { return fFactor; }
92 Int_t fNbins; ///< number of bins we hold
94 /// compacted content = (bin,value)
95 UInt_t* fArray; //[fNbins] compacted content = (bin,value)
97 Double_t fXmin; ///< min value of bincenter
98 Double_t fXmax; ///< max value of bincenter
100 Double_t fFactor; ///< to go from double to int
102 ClassDef(AliMUONSparseHisto,2) // Sparse histogram-like class for ADC distributions