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