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