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