]>
Commit | Line | Data |
---|---|---|
a0cef3e1 | 1 | // @(#) $Id: AliHLTHistogram.h,v 1.1 2006/11/30 17:45:43 hristov Exp |
2 | // origin: hough/AliL3Histogram.h,v 1.28 Wed Sep 29 12:01:17 2004 UTC by cvetan | |
3 | ||
4 | #ifndef ALIHLTTPCHISTOGRAM_H | |
5 | #define ALIHLTTPCHISTOGRAM_H | |
6 | ||
7 | #include "AliHLTStdIncludes.h" | |
8 | #include "AliHLTTPCRootTypes.h" | |
9 | ||
a0cef3e1 | 10 | #include <TH2.h> |
a0cef3e1 | 11 | |
12 | class AliHLTTPCHistogram { | |
13 | public: | |
14 | ||
15 | AliHLTTPCHistogram(); | |
16 | AliHLTTPCHistogram(Char_t *name,Char_t *id,Int_t nxbin,Double_t xmin,Double_t xmax,Int_t nybin,Double_t ymin,Double_t ymax); | |
17 | virtual ~AliHLTTPCHistogram(); | |
18 | ||
19 | void Reset(); | |
20 | virtual void Fill(Double_t x,Double_t y,Int_t weight=1); | |
21 | virtual void Fill(Double_t x,Int_t ybin,Int_t weight=1); | |
22 | virtual void Fill(Int_t xbin,Double_t y,Int_t weight=1); | |
23 | virtual void Fill(Int_t xbin,Int_t ybin,Int_t weight=1); | |
24 | virtual Int_t FindBin(Double_t x,Double_t y) const; | |
25 | virtual Int_t FindLabelBin(Double_t x,Double_t y) const; | |
26 | virtual Int_t FindXbin(Double_t x) const; | |
27 | virtual Int_t FindYbin(Double_t y) const; | |
28 | Int_t GetBin(Int_t xbin,Int_t ybin) const; | |
29 | Int_t GetLabelBin(Int_t xbin,Int_t ybin) const; | |
30 | Int_t GetBinContent(Int_t bin) const; | |
31 | void SetBinContent(Int_t xbin,Int_t ybin,Int_t value); | |
32 | void SetBinContent(Int_t bin,Int_t value); | |
33 | void AddBinContent(Int_t xbin,Int_t ybin,Int_t weight); | |
34 | void AddBinContent(Int_t bin,Int_t weight); | |
35 | void Add(AliHLTTPCHistogram *h1,Double_t weight=1); | |
36 | void SetThreshold(Int_t i) {fThreshold = i;} | |
37 | void CreateRootHisto(); | |
38 | virtual void Draw(Char_t *option="hist"); | |
39 | virtual void Print() const {}; | |
40 | ||
41 | friend ofstream& operator<< (ofstream &o, const AliHLTTPCHistogram &h); | |
42 | ||
a0cef3e1 | 43 | TH2F *GetRootHisto(); |
a0cef3e1 | 44 | |
45 | Double_t GetXmin() const {return fXmin;} | |
46 | Double_t GetXmax() const {return fXmax;} | |
47 | Double_t GetYmin() const {return fYmin;} | |
48 | Double_t GetYmax() const {return fYmax;} | |
49 | virtual Double_t GetBinCenterX(Int_t xbin) const; | |
50 | virtual Double_t GetBinCenterY(Int_t ybin) const; | |
51 | Double_t GetPreciseBinCenterX(Float_t xbin) const; | |
52 | Double_t GetPreciseBinCenterY(Float_t ybin) const; | |
53 | Double_t GetBinWidthX() const {return fBinwidthX;} | |
54 | Double_t GetBinWidthY() const {return fBinwidthY;} | |
55 | Int_t GetFirstXbin() const {return fFirstXbin;} | |
56 | Int_t GetLastXbin() const {return fLastXbin;} | |
57 | Int_t GetFirstYbin() const {return fFirstYbin;} | |
58 | Int_t GetLastYbin() const {return fLastYbin;} | |
59 | Int_t GetNbinsX() const {return fNxbins;} | |
60 | Int_t GetNbinsY() const {return fNybins;} | |
61 | Int_t GetNEntries() const {return fEntries;} | |
62 | ||
63 | Int_t *fContent; //! | |
64 | Int_t *GetContentArray() const {return fContent;} | |
65 | ||
66 | protected: | |
67 | Char_t fName[100]; // Name of the histogram | |
68 | Int_t fNxbins; // Number of bins in the histogram | |
69 | Int_t fNybins; // Number of bins in the histogram | |
70 | Int_t fNcells; // Overall number of bins in the histogram | |
71 | Int_t fEntries; // Number of entries in the histogram | |
72 | Int_t fFirstXbin; // First active bin | |
73 | Int_t fFirstYbin; // First active bin | |
74 | Int_t fLastXbin; // Last active bin | |
75 | Int_t fLastYbin; // Last active bin | |
76 | Int_t fThreshold; // Bin content threshold | |
77 | ||
78 | Double_t fXmin; // Lower limit in X | |
79 | Double_t fYmin; // Lower limit in Y | |
80 | Double_t fXmax; // Upper limit in X | |
81 | Double_t fYmax; // Upper limit in Y | |
82 | ||
a0cef3e1 | 83 | TH2F *fRootHisto; // Corresponding ROOT histogram |
a0cef3e1 | 84 | |
85 | private: | |
86 | Double_t fBinwidthX; // Bin width of the Hough space | |
87 | Double_t fBinwidthY; // Bin width of the Hough space | |
88 | ||
89 | ClassDef(AliHLTTPCHistogram,1) //2D histogram class | |
90 | ||
91 | }; | |
92 | ||
a0cef3e1 | 93 | inline TH2F *AliHLTTPCHistogram::GetRootHisto() |
94 | { | |
95 | if(!fRootHisto) | |
96 | { | |
97 | STDCERR<<"AliHLTTPCHistogram::GetRootHisto() : You must first Draw histogram before accessing it"<<STDENDL; | |
98 | return 0; | |
99 | } | |
100 | else | |
101 | return fRootHisto; | |
102 | } | |
a0cef3e1 | 103 | |
104 | #endif |