]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/hough/AliL3HoughMaxFinder.h
Worked over Makefiles for standalone HLT version, no changes when you compile with...
[u/mrichter/AliRoot.git] / HLT / hough / AliL3HoughMaxFinder.h
1 // @(#) $Id$
2
3 #ifndef ALIL3HOUGHMAXFINDER_H
4 #define ALIL3HOUGHMAXFINDER_H
5
6 #include "AliL3RootTypes.h"
7 #include "AliL3StandardIncludes.h"
8
9 class AliL3Histogram;
10 class AliL3TrackArray;
11 class AliL3HoughTrack;
12 class TNtuple;
13
14 struct AliL3AxisWindow
15 {
16   Int_t fYmin; // min Y
17   Int_t fYmax; // max Y
18   Int_t fXbin; // X bin
19   Int_t fWeight; // weight
20 };
21
22 class AliL3HoughMaxFinder {
23
24  public:
25   AliL3HoughMaxFinder(); 
26   AliL3HoughMaxFinder(Char_t *histotype,Int_t nmax,AliL3Histogram *hist=0);
27   virtual ~AliL3HoughMaxFinder();
28   void Reset();
29
30   void CreateNtuppel();
31   void WriteNtuppel(Char_t *filename);
32
33   //Simple maxima finders:
34   void FindAbsMaxima();
35   void FindBigMaxima();
36   void FindMaxima(Int_t threshold=0);
37   void FindAdaptedPeaks(Int_t nkappawindow,Float_t cutratio);
38   //Peak finder for HoughTransformerRow
39   void FindAdaptedRowPeaks(Int_t kappawindow,Int_t xsize,Int_t ysize);
40   //More sophisticated peak finders:
41   void FindPeak(Int_t t1,Double_t t2,Int_t t3);
42   void FindPeak1(Int_t ywindow=2,Int_t xbinsides=1);
43   void SortPeaks(struct AliL3AxisWindow **a,Int_t first,Int_t last);
44   Int_t PeakCompare(struct AliL3AxisWindow *a,struct AliL3AxisWindow *b) const;
45   
46   //Setters:
47   void SetGradient(Float_t x,Float_t y) {fGradX=x; fGradY=y;}
48   void SetThreshold(Int_t f) {fThreshold = f;}
49   void SetHistogram(AliL3Histogram *hist) {fCurrentHisto = hist;}
50   void SetEtaSlice(Int_t etaslice) {fCurrentEtaSlice = etaslice;}
51   
52   //Getters:
53   Float_t GetXPeak(Int_t i) const;
54   Float_t GetYPeak(Int_t i) const;
55   Float_t GetXPeakSize(Int_t i) const;
56   Float_t GetYPeakSize(Int_t i) const;
57   Int_t GetWeight(Int_t i) const;
58   Int_t GetStartEta(Int_t i) const;
59   Int_t GetEndEta(Int_t i) const;
60   Int_t GetEntries() const {return fNPeaks;}
61   
62  private:
63
64   Int_t fThreshold; // Threshold for Peak Finder
65   Int_t fCurrentEtaSlice; // Current eta slice being processed
66   AliL3Histogram *fCurrentHisto;  //!
67   
68   Float_t fGradX; // Gradient threshold inside Peak Finder 
69   Float_t fGradY; // Gradient threshold inside Peak Finder 
70   Float_t *fXPeaks; //!
71   Float_t *fYPeaks; //!
72   Int_t *fSTARTXPeaks; //!
73   Int_t *fSTARTYPeaks; //!
74   Int_t *fENDXPeaks; //!
75   Int_t *fENDYPeaks; //!
76   Int_t *fSTARTETAPeaks; //!
77   Int_t *fENDETAPeaks; //!
78   Int_t *fWeight;   //!
79   Int_t fN1PeaksPrevEtaSlice; // Index of the first peak in the previous eta slice
80   Int_t fN2PeaksPrevEtaSlice; // Index of the  last peak in the previous eta slice
81   Int_t fNPeaks; // Index of the last accumulated peak
82   Int_t fNMax; // Maximum allowed number of peaks
83   
84   Char_t fHistoType; // Histogram type
85
86 #ifndef no_root
87   TNtuple *fNtuppel; //!
88 #endif
89
90   ClassDef(AliL3HoughMaxFinder,1) //Maximum finder class
91
92 };
93
94 inline Float_t AliL3HoughMaxFinder::GetXPeak(Int_t i) const
95 {
96   if(i<0 || i>fNMax)
97     {
98       STDCERR<<"AliL3HoughMaxFinder::GetXPeak : Invalid index "<<i<<STDENDL;
99       return 0;
100     }
101   return fXPeaks[i];
102 }
103
104 inline Float_t AliL3HoughMaxFinder::GetYPeak(Int_t i) const
105 {
106   if(i<0 || i>fNMax)
107     {
108       STDCERR<<"AliL3HoughMaxFinder::GetYPeak : Invalid index "<<i<<STDENDL;
109       return 0;
110     }
111   return fYPeaks[i];
112
113 }
114
115 inline Int_t AliL3HoughMaxFinder::GetWeight(Int_t i) const
116 {
117   if(i<0 || i>fNMax)
118     {
119       STDCERR<<"AliL3HoughMaxFinder::GetWeight : Invalid index "<<i<<STDENDL;
120       return 0;
121     }
122   return fWeight[i];
123 }
124
125 inline Int_t AliL3HoughMaxFinder::GetStartEta(Int_t i) const
126 {
127   if(i<0 || i>fNMax)
128     {
129       STDCERR<<"AliL3HoughMaxFinder::GetStartEta : Invalid index "<<i<<STDENDL;
130       return 0;
131     }
132   return fSTARTETAPeaks[i];
133 }
134
135 inline Int_t AliL3HoughMaxFinder::GetEndEta(Int_t i) const
136 {
137   if(i<0 || i>fNMax)
138     {
139       STDCERR<<"AliL3HoughMaxFinder::GetStartEta : Invalid index "<<i<<STDENDL;
140       return 0;
141     }
142   return fENDETAPeaks[i];
143 }
144
145 #endif
146