]>
Commit | Line | Data |
---|---|---|
8741815f | 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 | ||
9 | /// \ingroup graphics | |
10 | /// \class AliMUONSparseHisto | |
10eb3d17 | 11 | /// \brief A very memory compact histogram to hold some tracker distributions |
8741815f | 12 | /// |
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: | |
10eb3d17 | 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); | |
8741815f | 30 | AliMUONSparseHisto(const AliMUONSparseHisto& rhs); |
31 | AliMUONSparseHisto& operator=(const AliMUONSparseHisto& rhs); | |
32 | ||
33 | virtual ~AliMUONSparseHisto(); | |
34 | ||
cf71107e | 35 | /// Whether this histogram has underflow values |
36 | /// (no way to know the number of underflow, though) | |
10eb3d17 | 37 | Bool_t HasUnderflow() const { return TestBit(kUnderflow); } |
38 | ||
cf71107e | 39 | /// Whether this histogram has overflow values |
40 | /// (no way to know the number of underflow, though) | |
10eb3d17 | 41 | Bool_t HasOverflow() const { return TestBit(kOverflow); } |
42 | ||
43 | Int_t Fill(Double_t value); | |
8741815f | 44 | |
45 | /// Return number of bins we hold | |
46 | Int_t GetNbins() const { return fNbins; } | |
10eb3d17 | 47 | |
48 | Double_t GetBinCenter(Int_t bin) const; | |
8741815f | 49 | |
50 | Int_t GetBinContent(Int_t bin) const; | |
51 | ||
52 | virtual void Print(Option_t* opt="") const; | |
53 | ||
54 | virtual void Clear(Option_t* opt=""); | |
10eb3d17 | 55 | |
56 | Int_t Find(Int_t binCenter) const; | |
8741815f | 57 | |
10eb3d17 | 58 | virtual void Copy(TObject& object) const; |
59 | ||
60 | /// Return max value of bincenter | |
61 | Double_t Xmax() const { return fXmax; } | |
8741815f | 62 | |
10eb3d17 | 63 | /// Return min value of bincenter |
64 | Double_t Xmin() const { return fXmin; } | |
8741815f | 65 | |
cf71107e | 66 | /// Number of bits used to code the x-value of the histogram |
10eb3d17 | 67 | Int_t Nbits() const { return 12; } |
8741815f | 68 | |
8741815f | 69 | private: |
10eb3d17 | 70 | |
71 | UInt_t Encode(Int_t binCenter, Int_t binContent) const; | |
72 | ||
73 | Double_t DecodeValue(Int_t value) const; | |
74 | ||
75 | Int_t EncodeValue(Double_t value) const; | |
76 | ||
77 | UInt_t GetBin(Int_t i) const; | |
78 | ||
79 | Int_t BinCenter(UInt_t x) const; | |
80 | ||
81 | Int_t BinContent(UInt_t x) const; | |
82 | ||
83 | void Expand(); | |
84 | ||
cf71107e | 85 | /// Conversion factor to go from float to int value (for bin content) |
10eb3d17 | 86 | Double_t Factor() const { return fFactor; } |
8741815f | 87 | |
88 | private: | |
89 | ||
90 | Int_t fNbins; ///< number of bins we hold | |
91 | ||
92 | /// compacted content = (bin,value) | |
10eb3d17 | 93 | UInt_t* fArray; //[fNbins] compacted content = (bin,value) |
94 | ||
95 | Double_t fXmin; ///< min value of bincenter | |
96 | Double_t fXmax; ///< max value of bincenter | |
97 | ||
98 | Double_t fFactor; ///< to go from double to int | |
8741815f | 99 | |
10eb3d17 | 100 | ClassDef(AliMUONSparseHisto,2) // Sparse histogram-like class for ADC distributions |
8741815f | 101 | }; |
102 | ||
103 | #endif |