]>
Commit | Line | Data |
---|---|---|
3e87ef69 | 1 | // @(#) $Id$ |
2 | ||
917e711b | 3 | #ifndef ALIL3HISTOGRAM_H |
4 | #define ALIL3HISTOGRAM_H | |
4de874d1 | 5 | |
de3c3890 | 6 | #include "AliL3StandardIncludes.h" |
4de874d1 | 7 | #include "AliL3RootTypes.h" |
146e74d9 | 8 | #include "AliL3StandardIncludes.h" |
237d3f5c | 9 | |
95a00d93 | 10 | #ifdef use_root |
18758be6 | 11 | #include <TH2.h> |
95a00d93 | 12 | #endif |
4cafa5fc | 13 | |
e1842819 | 14 | class AliL3Histogram { |
4de874d1 | 15 | public: |
e06900d5 | 16 | |
4de874d1 | 17 | AliL3Histogram(); |
18758be6 | 18 | AliL3Histogram(Char_t *name,Char_t *id,Int_t nxbin,Double_t xmin,Double_t xmax,Int_t nybin,Double_t ymin,Double_t ymax); |
19 | virtual ~AliL3Histogram(); | |
4de874d1 | 20 | |
18758be6 | 21 | void Reset(); |
6b9816d6 | 22 | virtual void Fill(Double_t x,Double_t y,Int_t weight=1); |
910f8d43 | 23 | virtual void Fill(Double_t x,Int_t ybin,Int_t weight=1); |
24 | virtual void Fill(Int_t xbin,Double_t y,Int_t weight=1); | |
25 | virtual void Fill(Int_t xbin,Int_t ybin,Int_t weight=1); | |
1f1942b8 | 26 | virtual Int_t FindBin(Double_t x,Double_t y) const; |
e81ffe36 | 27 | virtual Int_t FindLabelBin(Double_t x,Double_t y) const; |
1f1942b8 | 28 | virtual Int_t FindXbin(Double_t x) const; |
29 | virtual Int_t FindYbin(Double_t y) const; | |
30 | Int_t GetBin(Int_t xbin,Int_t ybin) const; | |
e81ffe36 | 31 | Int_t GetLabelBin(Int_t xbin,Int_t ybin) const; |
1f1942b8 | 32 | Int_t GetBinContent(Int_t bin) const; |
7a21af2f | 33 | void SetBinContent(Int_t xbin,Int_t ybin,Int_t value); |
34 | void SetBinContent(Int_t bin,Int_t value); | |
18758be6 | 35 | void AddBinContent(Int_t xbin,Int_t ybin,Int_t weight); |
36 | void AddBinContent(Int_t bin,Int_t weight); | |
ca726183 | 37 | void Add(AliL3Histogram *h1,Double_t weight=1); |
e1842819 | 38 | void SetThreshold(Int_t i) {fThreshold = i;} |
7b9d6d4e | 39 | void CreateRootHisto(); |
6b9816d6 | 40 | virtual void Draw(Char_t *option="hist"); |
41 | virtual void Print() {}; | |
4de874d1 | 42 | |
910f8d43 | 43 | friend ofstream& operator<< (ofstream &o, const AliL3Histogram &h); |
1f1942b8 | 44 | |
36d25d02 | 45 | #ifdef use_root |
237d3f5c | 46 | TH2F *GetRootHisto(); |
47 | #else | |
48 | void *GetRootHisto(); | |
36d25d02 | 49 | #endif |
50 | ||
1f1942b8 | 51 | Double_t GetXmin() const {return fXmin;} |
52 | Double_t GetXmax() const {return fXmax;} | |
53 | Double_t GetYmin() const {return fYmin;} | |
54 | Double_t GetYmax() const {return fYmax;} | |
55 | virtual Double_t GetBinCenterX(Int_t xbin) const; | |
56 | virtual Double_t GetBinCenterY(Int_t ybin) const; | |
0bd0c1ef | 57 | Double_t GetPreciseBinCenterX(Float_t xbin) const; |
58 | Double_t GetPreciseBinCenterY(Float_t ybin) const; | |
1f1942b8 | 59 | Double_t GetBinWidthX() const {return fBinwidthX;} |
60 | Double_t GetBinWidthY() const {return fBinwidthY;} | |
61 | Int_t GetFirstXbin() const {return fFirstXbin;} | |
62 | Int_t GetLastXbin() const {return fLastXbin;} | |
63 | Int_t GetFirstYbin() const {return fFirstYbin;} | |
64 | Int_t GetLastYbin() const {return fLastYbin;} | |
65 | Int_t GetNbinsX() const {return fNxbins;} | |
66 | Int_t GetNbinsY() const {return fNybins;} | |
67 | Int_t GetNEntries() const {return fEntries;} | |
917e711b | 68 | |
69 | protected: | |
70 | Int_t *fContent; //! | |
71 | Char_t fName[100]; // Name of the histogram | |
72 | Int_t fNxbins; // Number of bins in the histogram | |
73 | Int_t fNybins; // Number of bins in the histogram | |
74 | Int_t fNcells; // Overall number of bins in the histogram | |
75 | Int_t fEntries; // Number of entries in the histogram | |
76 | Int_t fFirstXbin; // First active bin | |
77 | Int_t fFirstYbin; // First active bin | |
78 | Int_t fLastXbin; // Last active bin | |
79 | Int_t fLastYbin; // Last active bin | |
80 | Int_t fThreshold; // Bin content threshold | |
81 | ||
82 | Double_t fXmin; // Lower limit in X | |
83 | Double_t fYmin; // Lower limit in Y | |
84 | Double_t fXmax; // Upper limit in X | |
85 | Double_t fYmax; // Upper limit in Y | |
86 | ||
87 | #ifdef use_root | |
88 | TH2F *fRootHisto; // Corresponding ROOT histogram | |
89 | #endif | |
90 | ||
91 | private: | |
92 | Double_t fBinwidthX; // Bin width of the Hough space | |
93 | Double_t fBinwidthY; // Bin width of the Hough space | |
e1842819 | 94 | |
b1886074 | 95 | ClassDef(AliL3Histogram,1) //2D histogram class |
18758be6 | 96 | |
4de874d1 | 97 | }; |
98 | ||
237d3f5c | 99 | #ifdef use_root |
100 | inline TH2F *AliL3Histogram::GetRootHisto() | |
101 | { | |
102 | if(!fRootHisto) | |
103 | { | |
e06900d5 | 104 | STDCERR<<"AliL3Histogram::GetRootHisto() : You must first Draw histogram before accessing it"<<STDENDL; |
237d3f5c | 105 | return 0; |
106 | } | |
107 | else | |
108 | return fRootHisto; | |
109 | } | |
110 | #else | |
111 | inline void *AliL3Histogram::GetRootHisto() | |
112 | { | |
e06900d5 | 113 | STDCERR<<"AliL3Histogram::GetRootHisto() : You must compile with ROOT in order to interface the ROOT histogram"<<STDENDL; |
237d3f5c | 114 | return 0; |
115 | } | |
116 | #endif | |
117 | ||
4de874d1 | 118 | #endif |