]>
Commit | Line | Data |
---|---|---|
3e87ef69 | 1 | // @(#) $Id$ |
2 | ||
4de874d1 | 3 | #ifndef ALIL3_HOUGH_MaxFinder |
4 | #define ALIL3_HOUGH_MaxFinder | |
5 | ||
6 | #include "AliL3RootTypes.h" | |
7 | ||
4cafa5fc | 8 | class AliL3Histogram; |
4de874d1 | 9 | class AliL3TrackArray; |
52a2a604 | 10 | class AliL3HoughTrack; |
208b54c5 | 11 | class TNtuple; |
4de874d1 | 12 | |
4fc9a6a4 | 13 | struct AxisWindow |
14 | { | |
15 | Int_t ymin; | |
16 | Int_t ymax; | |
17 | Int_t xbin; | |
18 | Int_t weight; | |
19 | }; | |
4cafa5fc | 20 | |
95a00d93 | 21 | class AliL3HoughMaxFinder { |
4de874d1 | 22 | |
23 | private: | |
24 | ||
25 | Int_t fThreshold; | |
4fc9a6a4 | 26 | AliL3Histogram *fCurrentHisto; //! |
3fe49b5b | 27 | |
28 | Float_t *fXPeaks; //! | |
29 | Float_t *fYPeaks; //! | |
30 | Int_t *fWeight; //! | |
31 | Int_t fNPeaks; | |
32 | Int_t fNMax; | |
33 | ||
4de874d1 | 34 | Char_t fHistoType; |
35 | ||
2061190a | 36 | #ifndef no_root |
208b54c5 | 37 | TNtuple *fNtuppel; //! |
2061190a | 38 | #endif |
208b54c5 | 39 | |
4de874d1 | 40 | public: |
41 | AliL3HoughMaxFinder(); | |
3fe49b5b | 42 | AliL3HoughMaxFinder(Char_t *histotype,Int_t nmax,AliL3Histogram *hist=0); |
4de874d1 | 43 | virtual ~AliL3HoughMaxFinder(); |
3fe49b5b | 44 | void Reset(); |
2061190a | 45 | |
208b54c5 | 46 | void CreateNtuppel(); |
47 | void WriteNtuppel(Char_t *filename); | |
48 | ||
3fe49b5b | 49 | //Simple maxima finders: |
50 | void FindAbsMaxima(); | |
51 | void FindBigMaxima(); | |
208b54c5 | 52 | void FindMaxima(Double_t grad_x,Double_t grad_y); |
4fc9a6a4 | 53 | |
3fe49b5b | 54 | //More sophisticated peak finders: |
55 | AliL3TrackArray *LookForPeaks(AliL3Histogram *hist,Int_t nbins); | |
7f66cda9 | 56 | void FindPeak(Int_t t1,Double_t t2,Int_t t3); |
4fc9a6a4 | 57 | AliL3HoughTrack *FindPeakLine(Double_t rho,Double_t theta); |
4cafa5fc | 58 | AliL3HoughTrack *CalculatePeakInWindow(Int_t *maxbin,Int_t t0,Int_t t1,Double_t t2,Int_t t3); |
afd8fed4 | 59 | void FindPeak1(Int_t y_window=2,Int_t x_bin_sides=1); |
4fc9a6a4 | 60 | void SortPeaks(struct AxisWindow **a,Int_t first,Int_t last); |
61 | Int_t PeakCompare(struct AxisWindow *a,struct AxisWindow *b); | |
4cafa5fc | 62 | |
3fe49b5b | 63 | //Setters: |
4de874d1 | 64 | void SetThreshold(Int_t f) {fThreshold = f;} |
4cafa5fc | 65 | void SetHistogram(AliL3Histogram *hist) {fCurrentHisto = hist;} |
66 | ||
3fe49b5b | 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 | ||
b1886074 | 73 | ClassDef(AliL3HoughMaxFinder,1) //Maximum finder class |
4de874d1 | 74 | |
75 | }; | |
76 | ||
3fe49b5b | 77 | inline Float_t AliL3HoughMaxFinder::GetXPeak(Int_t i) |
78 | { | |
79 | if(i<0 || i>fNMax) | |
80 | { | |
e06900d5 | 81 | STDCERR<<"AliL3HoughMaxFinder::GetXPeak : Invalid index "<<i<<STDENDL; |
3fe49b5b | 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 | { | |
e06900d5 | 91 | STDCERR<<"AliL3HoughMaxFinder::GetYPeak : Invalid index "<<i<<STDENDL; |
3fe49b5b | 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 | { | |
e06900d5 | 102 | STDCERR<<"AliL3HoughMaxFinder::GetWeight : Invalid index "<<i<<STDENDL; |
3fe49b5b | 103 | return 0; |
104 | } | |
105 | return fWeight[i]; | |
106 | } | |
107 | ||
4de874d1 | 108 | #endif |
2061190a | 109 |