]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/hough/AliL3Histogram.h
Moved to hlt-cern branch, containing fixes since August 03 and upcoming changes for...
[u/mrichter/AliRoot.git] / HLT / hough / AliL3Histogram.h
1 // @(#) $Id$
2
3 #ifndef ALIL3_HISTOGRAM
4 #define ALIL3_HISTOGRAM
5
6 #include "AliL3RootTypes.h"
7
8 #ifdef use_root
9 #include <TH2.h>
10 #endif
11
12 class AliL3Histogram {
13   
14  private:
15   Double_t fBinwidthX;
16   Double_t fBinwidthY;
17   
18  protected:
19   Int_t *fContent; //!
20   Char_t fName[100];
21   Int_t fNxbins;
22   Int_t fNybins;
23   Int_t fNcells;
24   Int_t fEntries;
25   Int_t fFirstXbin;
26   Int_t fFirstYbin;
27   Int_t fLastXbin;
28   Int_t fLastYbin;
29   Int_t fThreshold;
30
31   Double_t fXmin;
32   Double_t fYmin;
33   Double_t fXmax;
34   Double_t fYmax;
35
36 #ifdef use_root
37   TH2F *fRootHisto;
38 #endif  
39   
40  public:
41
42   AliL3Histogram();
43   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);
44   virtual ~AliL3Histogram();
45   
46   void Reset();
47   virtual void Fill(Double_t x,Double_t y,Int_t weight=1);
48   virtual Int_t FindBin(Double_t x,Double_t y);
49   virtual Int_t FindXbin(Double_t x);
50   virtual Int_t FindYbin(Double_t y);
51   Int_t GetBin(Int_t xbin,Int_t ybin);
52   Int_t GetBinContent(Int_t bin);
53   void SetBinContent(Int_t xbin,Int_t ybin,Int_t value);
54   void SetBinContent(Int_t bin,Int_t value);
55   void AddBinContent(Int_t xbin,Int_t ybin,Int_t weight);
56   void AddBinContent(Int_t bin,Int_t weight);
57   void Add(AliL3Histogram *h1,Double_t weight=1);
58   void SetThreshold(Int_t i) {fThreshold = i;}
59   void CreateRootHisto();
60   virtual void Draw(Char_t *option="hist");
61   virtual void Print() {};
62
63 #ifdef use_root
64   TH2F *GetRootHisto();
65 #else
66   void *GetRootHisto();
67 #endif
68     
69   Double_t GetXmin() {return fXmin;}
70   Double_t GetXmax() {return fXmax;}
71   Double_t GetYmin() {return fYmin;}
72   Double_t GetYmax() {return fYmax;}
73   virtual Double_t GetBinCenterX(Int_t xbin);
74   virtual Double_t GetBinCenterY(Int_t ybin);
75   Int_t GetFirstXbin() {return fFirstXbin;}
76   Int_t GetLastXbin() {return fLastXbin;}
77   Int_t GetFirstYbin() {return fFirstYbin;}
78   Int_t GetLastYbin() {return fLastYbin;}
79   Int_t GetNbinsX() {return fNxbins;}
80   Int_t GetNbinsY() {return fNybins;}
81   Int_t GetNEntries() {return fEntries;}
82   
83   ClassDef(AliL3Histogram,1) //2D histogram class
84     
85 };
86
87 #ifdef use_root
88 inline TH2F *AliL3Histogram::GetRootHisto()
89 {
90   if(!fRootHisto)
91     {
92       STDCERR<<"AliL3Histogram::GetRootHisto() : You must first Draw histogram before accessing it"<<STDENDL;
93       return 0;
94     }
95   else
96     return fRootHisto;
97 }
98 #else
99 inline void *AliL3Histogram::GetRootHisto()
100 {
101   STDCERR<<"AliL3Histogram::GetRootHisto() : You must compile with ROOT in order to interface the ROOT histogram"<<STDENDL;
102   return 0;
103 }
104 #endif
105
106 #endif