]>
Commit | Line | Data |
---|---|---|
18758be6 | 1 | #ifndef ALIL3_HISTOGRAM |
2 | #define ALIL3_HISTOGRAM | |
4de874d1 | 3 | |
237d3f5c | 4 | #include <stream.h> |
4de874d1 | 5 | #include "AliL3RootTypes.h" |
237d3f5c | 6 | |
95a00d93 | 7 | #ifdef use_root |
18758be6 | 8 | #include <TH2.h> |
95a00d93 | 9 | #endif |
4cafa5fc | 10 | |
e1842819 | 11 | class AliL3Histogram { |
4de874d1 | 12 | |
6b9816d6 | 13 | protected: |
18758be6 | 14 | |
cfc41e5b | 15 | Int_t *fContent; //! |
18758be6 | 16 | Char_t fName[100]; |
17 | Int_t fNxbins; | |
18 | Int_t fNybins; | |
19 | Int_t fNcells; | |
20 | Int_t fEntries; | |
4cafa5fc | 21 | Int_t fFirstXbin; |
22 | Int_t fFirstYbin; | |
23 | Int_t fLastXbin; | |
24 | Int_t fLastYbin; | |
e1842819 | 25 | Int_t fThreshold; |
4cafa5fc | 26 | |
18758be6 | 27 | Double_t fXmin; |
28 | Double_t fYmin; | |
29 | Double_t fXmax; | |
30 | Double_t fYmax; | |
6b9816d6 | 31 | |
36d25d02 | 32 | #ifdef use_root |
4cafa5fc | 33 | TH2F *fRootHisto; |
36d25d02 | 34 | #endif |
6b9816d6 | 35 | |
4de874d1 | 36 | public: |
37 | AliL3Histogram(); | |
18758be6 | 38 | 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); |
39 | virtual ~AliL3Histogram(); | |
4de874d1 | 40 | |
18758be6 | 41 | void Reset(); |
6b9816d6 | 42 | virtual void Fill(Double_t x,Double_t y,Int_t weight=1); |
43 | virtual Int_t FindBin(Double_t x,Double_t y); | |
44 | virtual Int_t FindXbin(Double_t x); | |
45 | virtual Int_t FindYbin(Double_t y); | |
4cafa5fc | 46 | Int_t GetBin(Int_t xbin,Int_t ybin); |
cfc41e5b | 47 | Int_t GetBinContent(Int_t bin); |
7a21af2f | 48 | void SetBinContent(Int_t xbin,Int_t ybin,Int_t value); |
49 | void SetBinContent(Int_t bin,Int_t value); | |
18758be6 | 50 | void AddBinContent(Int_t xbin,Int_t ybin,Int_t weight); |
51 | void AddBinContent(Int_t bin,Int_t weight); | |
ca726183 | 52 | void Add(AliL3Histogram *h1,Double_t weight=1); |
e1842819 | 53 | void SetThreshold(Int_t i) {fThreshold = i;} |
7b9d6d4e | 54 | void CreateRootHisto(); |
6b9816d6 | 55 | virtual void Draw(Char_t *option="hist"); |
56 | virtual void Print() {}; | |
4de874d1 | 57 | |
36d25d02 | 58 | #ifdef use_root |
237d3f5c | 59 | TH2F *GetRootHisto(); |
60 | #else | |
61 | void *GetRootHisto(); | |
36d25d02 | 62 | #endif |
63 | ||
18758be6 | 64 | Double_t GetXmin() {return fXmin;} |
65 | Double_t GetXmax() {return fXmax;} | |
66 | Double_t GetYmin() {return fYmin;} | |
ca726183 | 67 | Double_t GetYmax() {return fYmax;} |
6b9816d6 | 68 | virtual Double_t GetBinCenterX(Int_t xbin); |
69 | virtual Double_t GetBinCenterY(Int_t ybin); | |
4cafa5fc | 70 | Int_t GetFirstXbin() {return fFirstXbin;} |
71 | Int_t GetLastXbin() {return fLastXbin;} | |
72 | Int_t GetFirstYbin() {return fFirstYbin;} | |
73 | Int_t GetLastYbin() {return fLastYbin;} | |
74 | Int_t GetNbinsX() {return fNxbins;} | |
75 | Int_t GetNbinsY() {return fNybins;} | |
18758be6 | 76 | Int_t GetNEntries() {return fEntries;} |
e1842819 | 77 | |
78 | ||
b1886074 | 79 | ClassDef(AliL3Histogram,1) //2D histogram class |
18758be6 | 80 | |
4de874d1 | 81 | }; |
82 | ||
237d3f5c | 83 | #ifdef use_root |
84 | inline TH2F *AliL3Histogram::GetRootHisto() | |
85 | { | |
86 | if(!fRootHisto) | |
87 | { | |
88 | cerr<<"AliL3Histogram::GetRootHisto() : You must first Draw histogram before accessing it"<<endl; | |
89 | return 0; | |
90 | } | |
91 | else | |
92 | return fRootHisto; | |
93 | } | |
94 | #else | |
95 | inline void *AliL3Histogram::GetRootHisto() | |
96 | { | |
97 | cerr<<"AliL3Histogram::GetRootHisto() : You must compile with ROOT in order to interface the ROOT histogram"<<endl; | |
98 | return 0; | |
99 | } | |
100 | #endif | |
101 | ||
4de874d1 | 102 | #endif |