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