]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/hough/AliL3HoughMaxFinder.h
Little changes to make g++ version 3.2 compile the hough library.
[u/mrichter/AliRoot.git] / HLT / hough / AliL3HoughMaxFinder.h
1 #ifndef ALIL3_HOUGH_MaxFinder
2 #define ALIL3_HOUGH_MaxFinder
3
4 #include "AliL3RootTypes.h"
5
6 class AliL3Histogram;
7 class AliL3TrackArray;
8 class AliL3HoughTrack;
9 class TNtuple;
10
11 struct AxisWindow
12 {
13   Int_t ymin;
14   Int_t ymax;
15   Int_t xbin;
16   Int_t weight;
17 };
18
19 class AliL3HoughMaxFinder {
20   
21  private:
22
23   Int_t fThreshold;
24   AliL3Histogram *fCurrentHisto;  //!
25   
26   Float_t *fXPeaks; //!
27   Float_t *fYPeaks; //!
28   Int_t *fWeight;   //!
29   Int_t fNPeaks;
30   Int_t fNMax;
31   
32   Char_t fHistoType;
33
34 #ifndef no_root
35   TNtuple *fNtuppel; //!
36 #endif
37
38  public:
39   AliL3HoughMaxFinder(); 
40   AliL3HoughMaxFinder(Char_t *histotype,Int_t nmax,AliL3Histogram *hist=0);
41   virtual ~AliL3HoughMaxFinder();
42   void Reset();
43
44   void CreateNtuppel();
45   void WriteNtuppel(Char_t *filename);
46
47   //Simple maxima finders:
48   void FindAbsMaxima();
49   void FindBigMaxima();
50   void FindMaxima(Double_t grad_x,Double_t grad_y);
51   
52   //More sophisticated peak finders:
53   AliL3TrackArray *LookForPeaks(AliL3Histogram *hist,Int_t nbins);
54   void FindPeak(Int_t t1,Double_t t2,Int_t t3);
55   AliL3HoughTrack *FindPeakLine(Double_t rho,Double_t theta);
56   AliL3HoughTrack *CalculatePeakInWindow(Int_t *maxbin,Int_t t0,Int_t t1,Double_t t2,Int_t t3);
57   void FindPeak1(Int_t y_window=2,Int_t x_bin_sides=1);
58   void SortPeaks(struct AxisWindow **a,Int_t first,Int_t last);
59   Int_t PeakCompare(struct AxisWindow *a,struct AxisWindow *b);
60   
61   //Setters:
62   void SetThreshold(Int_t f) {fThreshold = f;}
63   void SetHistogram(AliL3Histogram *hist) {fCurrentHisto = hist;}
64   
65   //Getters:
66   Float_t GetXPeak(Int_t i);
67   Float_t GetYPeak(Int_t i);
68   Int_t GetWeight(Int_t i);
69   Int_t GetEntries() {return fNPeaks;}
70
71   ClassDef(AliL3HoughMaxFinder,1) //Maximum finder class
72
73 };
74
75 inline Float_t AliL3HoughMaxFinder::GetXPeak(Int_t i)
76 {
77   if(i<0 || i>fNMax)
78     {
79       STDCERR<<"AliL3HoughMaxFinder::GetXPeak : Invalid index "<<i<<STDENDL;
80       return 0;
81     }
82   return fXPeaks[i];
83 }
84
85 inline Float_t AliL3HoughMaxFinder::GetYPeak(Int_t i)
86 {
87   if(i<0 || i>fNMax)
88     {
89       STDCERR<<"AliL3HoughMaxFinder::GetYPeak : Invalid index "<<i<<STDENDL;
90       return 0;
91     }
92   return fYPeaks[i];
93
94 }
95
96 inline Int_t AliL3HoughMaxFinder::GetWeight(Int_t i)
97 {
98   if(i<0 || i>fNMax)
99     {
100       STDCERR<<"AliL3HoughMaxFinder::GetWeight : Invalid index "<<i<<STDENDL;
101       return 0;
102     }
103   return fWeight[i];
104 }
105
106 #endif
107