]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/hough/AliL3HoughMaxFinder.h
Corrected index (aplhacxx6)
[u/mrichter/AliRoot.git] / HLT / hough / AliL3HoughMaxFinder.h
index 39ce6364653ef5815e5f6a62011fa896d7b9f48f..fbddc3bba9ac0090248e18dde8ae8c4d53ce44bb 100644 (file)
@@ -1,43 +1,38 @@
 // @(#) $Id$
 
-#ifndef ALIL3_HOUGH_MaxFinder
-#define ALIL3_HOUGH_MaxFinder
+#ifndef ALIL3HOUGHMAXFINDER_H
+#define ALIL3HOUGHMAXFINDER_H
 
 #include "AliL3RootTypes.h"
+#include "AliL3StandardIncludes.h"
 
 class AliL3Histogram;
 class AliL3TrackArray;
 class AliL3HoughTrack;
 class TNtuple;
 
-struct AxisWindow
+struct AliL3AxisWindow
 {
-  Int_t ymin;
-  Int_t ymax;
-  Int_t xbin;
-  Int_t weight;
+  Int_t fYmin; // min Y
+  Int_t fYmax; // max Y
+  Int_t fXbin; // X bin
+  Int_t fWeight; // weight
 };
 
-class AliL3HoughMaxFinder {
-  
- private:
-
-  Int_t fThreshold;
-  AliL3Histogram *fCurrentHisto;  //!
-  
-  Float_t fGradX;
-  Float_t fGradY;
-  Float_t *fXPeaks; //!
-  Float_t *fYPeaks; //!
-  Int_t *fWeight;   //!
-  Int_t fNPeaks;
-  Int_t fNMax;
-  
-  Char_t fHistoType;
+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
+};
 
-#ifndef no_root
-  TNtuple *fNtuppel; //!
-#endif
+class AliL3HoughMaxFinder {
 
  public:
   AliL3HoughMaxFinder(); 
@@ -52,31 +47,73 @@ class AliL3HoughMaxFinder {
   void FindAbsMaxima();
   void FindBigMaxima();
   void FindMaxima(Int_t threshold=0);
-  void FindAdaptedPeaks(Int_t nkappawindow,Float_t cut_ratio);
+  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 y_window=2,Int_t x_bin_sides=1);
-  void SortPeaks(struct AxisWindow **a,Int_t first,Int_t last);
-  Int_t PeakCompare(struct AxisWindow *a,struct AxisWindow *b);
+  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);
-  Float_t GetYPeak(Int_t i);
-  Int_t GetWeight(Int_t i);
-  Int_t GetEntries() {return fNPeaks;}
+  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)
+inline Float_t AliL3HoughMaxFinder::GetXPeak(Int_t i) const
 {
   if(i<0 || i>fNMax)
     {
@@ -86,7 +123,7 @@ inline Float_t AliL3HoughMaxFinder::GetXPeak(Int_t i)
   return fXPeaks[i];
 }
 
-inline Float_t AliL3HoughMaxFinder::GetYPeak(Int_t i)
+inline Float_t AliL3HoughMaxFinder::GetYPeak(Int_t i) const
 {
   if(i<0 || i>fNMax)
     {
@@ -97,7 +134,7 @@ inline Float_t AliL3HoughMaxFinder::GetYPeak(Int_t i)
 
 }
 
-inline Int_t AliL3HoughMaxFinder::GetWeight(Int_t i)
+inline Int_t AliL3HoughMaxFinder::GetWeight(Int_t i) const
 {
   if(i<0 || i>fNMax)
     {
@@ -107,5 +144,25 @@ inline Int_t AliL3HoughMaxFinder::GetWeight(Int_t i)
   return fWeight[i];
 }
 
+inline Int_t AliL3HoughMaxFinder::GetStartEta(Int_t i) const
+{
+  if(i<0 || i>fNMax)
+    {
+      STDCERR<<"AliL3HoughMaxFinder::GetStartEta : Invalid index "<<i<<STDENDL;
+      return 0;
+    }
+  return fSTARTETAPeaks[i];
+}
+
+inline Int_t AliL3HoughMaxFinder::GetEndEta(Int_t i) const
+{
+  if(i<0 || i>fNMax)
+    {
+      STDCERR<<"AliL3HoughMaxFinder::GetStartEta : Invalid index "<<i<<STDENDL;
+      return 0;
+    }
+  return fENDETAPeaks[i];
+}
+
 #endif