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