Added support for NEWIO, merged cern-hlt tree, updated to latest track candidate...
[u/mrichter/AliRoot.git] / HLT / hough / AliL3HoughMaxFinder.h
CommitLineData
3e87ef69 1// @(#) $Id$
2
4de874d1 3#ifndef ALIL3_HOUGH_MaxFinder
4#define ALIL3_HOUGH_MaxFinder
5
6#include "AliL3RootTypes.h"
7
4cafa5fc 8class AliL3Histogram;
4de874d1 9class AliL3TrackArray;
52a2a604 10class AliL3HoughTrack;
208b54c5 11class TNtuple;
4de874d1 12
4fc9a6a4 13struct AxisWindow
14{
15 Int_t ymin;
16 Int_t ymax;
17 Int_t xbin;
18 Int_t weight;
19};
4cafa5fc 20
95a00d93 21class AliL3HoughMaxFinder {
4de874d1 22
23 private:
24
25 Int_t fThreshold;
4fc9a6a4 26 AliL3Histogram *fCurrentHisto; //!
3fe49b5b 27
b2a02bce 28 Float_t fGradX;
29 Float_t fGradY;
3fe49b5b 30 Float_t *fXPeaks; //!
31 Float_t *fYPeaks; //!
32 Int_t *fWeight; //!
33 Int_t fNPeaks;
34 Int_t fNMax;
35
4de874d1 36 Char_t fHistoType;
37
2061190a 38#ifndef no_root
208b54c5 39 TNtuple *fNtuppel; //!
2061190a 40#endif
208b54c5 41
4de874d1 42 public:
43 AliL3HoughMaxFinder();
3fe49b5b 44 AliL3HoughMaxFinder(Char_t *histotype,Int_t nmax,AliL3Histogram *hist=0);
4de874d1 45 virtual ~AliL3HoughMaxFinder();
3fe49b5b 46 void Reset();
2061190a 47
208b54c5 48 void CreateNtuppel();
49 void WriteNtuppel(Char_t *filename);
50
3fe49b5b 51 //Simple maxima finders:
52 void FindAbsMaxima();
53 void FindBigMaxima();
b2a02bce 54 void FindMaxima(Int_t threshold=0);
55 void FindAdaptedPeaks(Int_t nkappawindow);
3fe49b5b 56 //More sophisticated peak finders:
7f66cda9 57 void FindPeak(Int_t t1,Double_t t2,Int_t t3);
afd8fed4 58 void FindPeak1(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:
b2a02bce 63 void SetGradient(Float_t x,Float_t y) {fGradX=x; fGradY=y;}
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 77inline 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
87inline 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
98inline 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