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