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