]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/hough/AliL3HoughMaxFinder.h
cluster information
[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 *fXPeaks; //!
29   Float_t *fYPeaks; //!
30   Int_t *fWeight;   //!
31   Int_t fNPeaks;
32   Int_t fNMax;
33   
34   Char_t fHistoType;
35
36 #ifndef no_root
37   TNtuple *fNtuppel; //!
38 #endif
39
40  public:
41   AliL3HoughMaxFinder(); 
42   AliL3HoughMaxFinder(Char_t *histotype,Int_t nmax,AliL3Histogram *hist=0);
43   virtual ~AliL3HoughMaxFinder();
44   void Reset();
45
46   void CreateNtuppel();
47   void WriteNtuppel(Char_t *filename);
48
49   //Simple maxima finders:
50   void FindAbsMaxima();
51   void FindBigMaxima();
52   void FindMaxima(Double_t grad_x,Double_t grad_y);
53   
54   //More sophisticated peak finders:
55   AliL3TrackArray *LookForPeaks(AliL3Histogram *hist,Int_t nbins);
56   void FindPeak(Int_t t1,Double_t t2,Int_t t3);
57   AliL3HoughTrack *FindPeakLine(Double_t rho,Double_t theta);
58   AliL3HoughTrack *CalculatePeakInWindow(Int_t *maxbin,Int_t t0,Int_t t1,Double_t t2,Int_t t3);
59   void FindPeak1(Int_t y_window=2,Int_t x_bin_sides=1);
60   void SortPeaks(struct AxisWindow **a,Int_t first,Int_t last);
61   Int_t PeakCompare(struct AxisWindow *a,struct AxisWindow *b);
62   
63   //Setters:
64   void SetThreshold(Int_t f) {fThreshold = f;}
65   void SetHistogram(AliL3Histogram *hist) {fCurrentHisto = hist;}
66   
67   //Getters:
68   Float_t GetXPeak(Int_t i);
69   Float_t GetYPeak(Int_t i);
70   Int_t GetWeight(Int_t i);
71   Int_t GetEntries() {return fNPeaks;}
72
73   ClassDef(AliL3HoughMaxFinder,1) //Maximum finder class
74
75 };
76
77 inline Float_t AliL3HoughMaxFinder::GetXPeak(Int_t i)
78 {
79   if(i<0 || i>fNMax)
80     {
81       STDCERR<<"AliL3HoughMaxFinder::GetXPeak : Invalid index "<<i<<STDENDL;
82       return 0;
83     }
84   return fXPeaks[i];
85 }
86
87 inline Float_t AliL3HoughMaxFinder::GetYPeak(Int_t i)
88 {
89   if(i<0 || i>fNMax)
90     {
91       STDCERR<<"AliL3HoughMaxFinder::GetYPeak : Invalid index "<<i<<STDENDL;
92       return 0;
93     }
94   return fYPeaks[i];
95
96 }
97
98 inline Int_t AliL3HoughMaxFinder::GetWeight(Int_t i)
99 {
100   if(i<0 || i>fNMax)
101     {
102       STDCERR<<"AliL3HoughMaxFinder::GetWeight : Invalid index "<<i<<STDENDL;
103       return 0;
104     }
105   return fWeight[i];
106 }
107
108 #endif
109