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