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