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