]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/hough/AliHLTHoughMaxFinder.h
New class AliESDEvent, backward compatibility with the old AliESD (Christian)
[u/mrichter/AliRoot.git] / HLT / hough / AliHLTHoughMaxFinder.h
CommitLineData
3e87ef69 1// @(#) $Id$
2
917e711b 3#ifndef ALIL3HOUGHMAXFINDER_H
4#define ALIL3HOUGHMAXFINDER_H
4de874d1 5
4aa41877 6#include "AliHLTRootTypes.h"
7#include "AliHLTStandardIncludes.h"
4de874d1 8
4aa41877 9class AliHLTHistogram;
10class AliHLTTrackArray;
11class AliHLTHoughTrack;
208b54c5 12class TNtuple;
4de874d1 13
4aa41877 14struct AliHLTAxisWindow
4fc9a6a4 15{
917e711b 16 Int_t fYmin; // min Y
17 Int_t fYmax; // max Y
18 Int_t fXbin; // X bin
19 Int_t fWeight; // weight
4fc9a6a4 20};
4cafa5fc 21
4aa41877 22struct AliHLTPre2DPeak
1e75562a 23{
24 Float_t fX; // X coordinate of the preak
25 Float_t fY; // Y coordinate of the preak
26 Float_t fSizeX; // Size of the peak
27 Float_t fSizeY; // Size of the peak
28 Int_t fStartX; // Start position of the peak
29 Int_t fStartY; // Start position of the peak
30 Int_t fEndX; // End position of the peak
31 Int_t fEndY; // End position of the peak
32 Float_t fWeight; // Weight assigned to the peak
33};
34
4aa41877 35class AliHLTHoughMaxFinder {
208b54c5 36
4de874d1 37 public:
4aa41877 38 AliHLTHoughMaxFinder();
39 AliHLTHoughMaxFinder(Char_t *histotype,Int_t nmax,AliHLTHistogram *hist=0);
40 virtual ~AliHLTHoughMaxFinder();
3fe49b5b 41 void Reset();
2061190a 42
208b54c5 43 void CreateNtuppel();
44 void WriteNtuppel(Char_t *filename);
45
3fe49b5b 46 //Simple maxima finders:
47 void FindAbsMaxima();
48 void FindBigMaxima();
b2a02bce 49 void FindMaxima(Int_t threshold=0);
917e711b 50 void FindAdaptedPeaks(Int_t nkappawindow,Float_t cutratio);
0bd0c1ef 51 //Peak finder for HoughTransformerRow
52 void FindAdaptedRowPeaks(Int_t kappawindow,Int_t xsize,Int_t ysize);
3fe49b5b 53 //More sophisticated peak finders:
7f66cda9 54 void FindPeak(Int_t t1,Double_t t2,Int_t t3);
917e711b 55 void FindPeak1(Int_t ywindow=2,Int_t xbinsides=1);
4aa41877 56 void SortPeaks(struct AliHLTAxisWindow **a,Int_t first,Int_t last);
57 Int_t PeakCompare(struct AliHLTAxisWindow *a,struct AliHLTAxisWindow *b) const;
4cafa5fc 58
3fe49b5b 59 //Setters:
b2a02bce 60 void SetGradient(Float_t x,Float_t y) {fGradX=x; fGradY=y;}
4de874d1 61 void SetThreshold(Int_t f) {fThreshold = f;}
4aa41877 62 void SetHistogram(AliHLTHistogram *hist) {fCurrentHisto = hist;}
1e75562a 63 void SetTrackLUTs(UChar_t *tracknrows, UChar_t *trackfirstrow, UChar_t *tracklastrow, UChar_t *nextrow) {fTrackNRows = tracknrows; fTrackFirstRow = trackfirstrow; fTrackLastRow = tracklastrow; fNextRow = nextrow;}
de3c3890 64 void SetEtaSlice(Int_t etaslice) {fCurrentEtaSlice = etaslice;}
4cafa5fc 65
3fe49b5b 66 //Getters:
917e711b 67 Float_t GetXPeak(Int_t i) const;
68 Float_t GetYPeak(Int_t i) const;
69 Float_t GetXPeakSize(Int_t i) const;
70 Float_t GetYPeakSize(Int_t i) const;
71 Int_t GetWeight(Int_t i) const;
72 Int_t GetStartEta(Int_t i) const;
73 Int_t GetEndEta(Int_t i) const;
74 Int_t GetEntries() const {return fNPeaks;}
1e75562a 75
4aa41877 76 //Method for merging of peaks produced by AliHLTHoughTransfromerRow
77 Bool_t MergeRowPeaks(AliHLTPre2DPeak *maxima1, AliHLTPre2DPeak *maxima2,Float_t distance);
917e711b 78
79 private:
80
81 Int_t fThreshold; // Threshold for Peak Finder
82 Int_t fCurrentEtaSlice; // Current eta slice being processed
4aa41877 83 AliHLTHistogram *fCurrentHisto; //!
a8ffd46b 84
85 UChar_t *fTrackNRows; //!
86 UChar_t *fTrackFirstRow; //!
87 UChar_t *fTrackLastRow; //!
1e75562a 88 UChar_t *fNextRow; //!
917e711b 89
90 Float_t fGradX; // Gradient threshold inside Peak Finder
91 Float_t fGradY; // Gradient threshold inside Peak Finder
92 Float_t *fXPeaks; //!
93 Float_t *fYPeaks; //!
94 Int_t *fSTARTXPeaks; //!
95 Int_t *fSTARTYPeaks; //!
96 Int_t *fENDXPeaks; //!
97 Int_t *fENDYPeaks; //!
98 Int_t *fSTARTETAPeaks; //!
99 Int_t *fENDETAPeaks; //!
100 Int_t *fWeight; //!
101 Int_t fN1PeaksPrevEtaSlice; // Index of the first peak in the previous eta slice
102 Int_t fN2PeaksPrevEtaSlice; // Index of the last peak in the previous eta slice
103 Int_t fNPeaks; // Index of the last accumulated peak
104 Int_t fNMax; // Maximum allowed number of peaks
105
106 Char_t fHistoType; // Histogram type
107
108#ifndef no_root
109 TNtuple *fNtuppel; //!
110#endif
3fe49b5b 111
4aa41877 112 ClassDef(AliHLTHoughMaxFinder,1) //Maximum finder class
4de874d1 113
114};
115
4aa41877 116typedef AliHLTHoughMaxFinder AliL3HoughMaxFinder; // for backward compatibility
117
118inline Float_t AliHLTHoughMaxFinder::GetXPeak(Int_t i) const
3fe49b5b 119{
120 if(i<0 || i>fNMax)
121 {
4aa41877 122 STDCERR<<"AliHLTHoughMaxFinder::GetXPeak : Invalid index "<<i<<STDENDL;
3fe49b5b 123 return 0;
124 }
125 return fXPeaks[i];
126}
127
4aa41877 128inline Float_t AliHLTHoughMaxFinder::GetYPeak(Int_t i) const
3fe49b5b 129{
130 if(i<0 || i>fNMax)
131 {
4aa41877 132 STDCERR<<"AliHLTHoughMaxFinder::GetYPeak : Invalid index "<<i<<STDENDL;
3fe49b5b 133 return 0;
134 }
135 return fYPeaks[i];
136
137}
138
4aa41877 139inline Int_t AliHLTHoughMaxFinder::GetWeight(Int_t i) const
3fe49b5b 140{
141 if(i<0 || i>fNMax)
142 {
4aa41877 143 STDCERR<<"AliHLTHoughMaxFinder::GetWeight : Invalid index "<<i<<STDENDL;
3fe49b5b 144 return 0;
145 }
146 return fWeight[i];
147}
148
4aa41877 149inline Int_t AliHLTHoughMaxFinder::GetStartEta(Int_t i) const
de3c3890 150{
151 if(i<0 || i>fNMax)
152 {
4aa41877 153 STDCERR<<"AliHLTHoughMaxFinder::GetStartEta : Invalid index "<<i<<STDENDL;
de3c3890 154 return 0;
155 }
156 return fSTARTETAPeaks[i];
157}
158
4aa41877 159inline Int_t AliHLTHoughMaxFinder::GetEndEta(Int_t i) const
de3c3890 160{
161 if(i<0 || i>fNMax)
162 {
4aa41877 163 STDCERR<<"AliHLTHoughMaxFinder::GetStartEta : Invalid index "<<i<<STDENDL;
de3c3890 164 return 0;
165 }
166 return fENDETAPeaks[i];
167}
168
4de874d1 169#endif
2061190a 170