// @(#) $Id$ #ifndef ALIL3HOUGHMAXFINDER_H #define ALIL3HOUGHMAXFINDER_H #include "AliL3RootTypes.h" #include "AliL3StandardIncludes.h" class AliL3Histogram; class AliL3TrackArray; class AliL3HoughTrack; class TNtuple; struct AliL3AxisWindow { Int_t fYmin; // min Y Int_t fYmax; // max Y Int_t fXbin; // X bin Int_t fWeight; // weight }; struct AliL3Pre2DPeak { Float_t fX; // X coordinate of the preak Float_t fY; // Y coordinate of the preak Float_t fSizeX; // Size of the peak Float_t fSizeY; // Size of the peak Int_t fStartX; // Start position of the peak Int_t fStartY; // Start position of the peak Int_t fEndX; // End position of the peak Int_t fEndY; // End position of the peak Float_t fWeight; // Weight assigned to the peak }; class AliL3HoughMaxFinder { public: AliL3HoughMaxFinder(); AliL3HoughMaxFinder(Char_t *histotype,Int_t nmax,AliL3Histogram *hist=0); virtual ~AliL3HoughMaxFinder(); void Reset(); void CreateNtuppel(); void WriteNtuppel(Char_t *filename); //Simple maxima finders: void FindAbsMaxima(); void FindBigMaxima(); void FindMaxima(Int_t threshold=0); void FindAdaptedPeaks(Int_t nkappawindow,Float_t cutratio); //Peak finder for HoughTransformerRow void FindAdaptedRowPeaks(Int_t kappawindow,Int_t xsize,Int_t ysize); //More sophisticated peak finders: void FindPeak(Int_t t1,Double_t t2,Int_t t3); void FindPeak1(Int_t ywindow=2,Int_t xbinsides=1); void SortPeaks(struct AliL3AxisWindow **a,Int_t first,Int_t last); Int_t PeakCompare(struct AliL3AxisWindow *a,struct AliL3AxisWindow *b) const; //Setters: void SetGradient(Float_t x,Float_t y) {fGradX=x; fGradY=y;} void SetThreshold(Int_t f) {fThreshold = f;} void SetHistogram(AliL3Histogram *hist) {fCurrentHisto = hist;} void SetTrackLUTs(UChar_t *tracknrows, UChar_t *trackfirstrow, UChar_t *tracklastrow, UChar_t *nextrow) {fTrackNRows = tracknrows; fTrackFirstRow = trackfirstrow; fTrackLastRow = tracklastrow; fNextRow = nextrow;} void SetEtaSlice(Int_t etaslice) {fCurrentEtaSlice = etaslice;} //Getters: Float_t GetXPeak(Int_t i) const; Float_t GetYPeak(Int_t i) const; Float_t GetXPeakSize(Int_t i) const; Float_t GetYPeakSize(Int_t i) const; Int_t GetWeight(Int_t i) const; Int_t GetStartEta(Int_t i) const; Int_t GetEndEta(Int_t i) const; Int_t GetEntries() const {return fNPeaks;} //Method for merging of peaks produced by AliL3HoughTransfromerRow Bool_t MergeRowPeaks(AliL3Pre2DPeak *maxima1, AliL3Pre2DPeak *maxima2,Float_t distance); private: Int_t fThreshold; // Threshold for Peak Finder Int_t fCurrentEtaSlice; // Current eta slice being processed AliL3Histogram *fCurrentHisto; //! UChar_t *fTrackNRows; //! UChar_t *fTrackFirstRow; //! UChar_t *fTrackLastRow; //! UChar_t *fNextRow; //! Float_t fGradX; // Gradient threshold inside Peak Finder Float_t fGradY; // Gradient threshold inside Peak Finder Float_t *fXPeaks; //! Float_t *fYPeaks; //! Int_t *fSTARTXPeaks; //! Int_t *fSTARTYPeaks; //! Int_t *fENDXPeaks; //! Int_t *fENDYPeaks; //! Int_t *fSTARTETAPeaks; //! Int_t *fENDETAPeaks; //! Int_t *fWeight; //! Int_t fN1PeaksPrevEtaSlice; // Index of the first peak in the previous eta slice Int_t fN2PeaksPrevEtaSlice; // Index of the last peak in the previous eta slice Int_t fNPeaks; // Index of the last accumulated peak Int_t fNMax; // Maximum allowed number of peaks Char_t fHistoType; // Histogram type #ifndef no_root TNtuple *fNtuppel; //! #endif ClassDef(AliL3HoughMaxFinder,1) //Maximum finder class }; inline Float_t AliL3HoughMaxFinder::GetXPeak(Int_t i) const { if(i<0 || i>fNMax) { STDCERR<<"AliL3HoughMaxFinder::GetXPeak : Invalid index "<fNMax) { STDCERR<<"AliL3HoughMaxFinder::GetYPeak : Invalid index "<fNMax) { STDCERR<<"AliL3HoughMaxFinder::GetWeight : Invalid index "<fNMax) { STDCERR<<"AliL3HoughMaxFinder::GetStartEta : Invalid index "<fNMax) { STDCERR<<"AliL3HoughMaxFinder::GetStartEta : Invalid index "<