////////////////////////////////////////////////////////////////////////
// $Id: HoughTrackSR.h,v 1.7 2004/10/30 15:02:35 musser Exp $
//
// HoughTrackSR
//
// Author:  R. Lee 2002.01.18
//
////////////////////////////////////////////////////////////////////////

#ifndef HOUGHTRACKSR_H
#define HOUGHTRACKSR_H

#include <vector>

#include "TObject.h"
#include "TObjArray.h"

using namespace std;

class HoughTrackSR  : public TObject
{

public:

  HoughTrackSR();
  HoughTrackSR(TObjArray candclusterhandlelist);
  HoughTrackSR(const HoughTrackSR &);
  ~HoughTrackSR();

  void SetX0(Double_t);
  void SetZ0(Double_t);
  void SetXRMS(Double_t);
  void SetZRMS(Double_t);

  void SetSlopeMin(Double_t);
  void SetSlopeMax(Double_t);
  void SetInterceptMin(Double_t);
  void SetInterceptMax(Double_t);

  Double_t GetSlopeMin() const;
  Double_t GetSlopeMax() const;
  Double_t GetInterceptMin() const;
  Double_t GetInterceptMax() const;

  Int_t GetNBin() const;
  Int_t GetNPeak() const;

  Int_t GetMaxBin() {return fMaxBin;}
  void SetMaxBin(Int_t i ){fMaxBin = i;} 

  Double_t GetPeakSlope(Int_t = 0) const;
  Double_t GetPeakIntercept(Int_t = 0) const;
  Int_t GetPeakBin(Int_t = 0) const;

  Int_t GetLargestPeakIndex() const;

  void SetPeakMin(Int_t);
  void SetPeakMinFrac(Double_t);
  void SetPeakMinFracZoom(Double_t);
  void SetMinInterBinSize(Double_t);

  void SetClusterList(TObjArray candclusterhandlelist);

  TObjArray Iterate(); // use with caution -- objects in returned TObjArray
                       // are not deleted in ~HoughTrackSR
  void Print(Option_t* option="") const;

private:

  void FillHough();

  Double_t GetSlope(Int_t) const;
  Double_t GetInter(Int_t) const;

  static const Int_t fNBin = 40;
  Int_t fMaxBin;

  Double_t fXZmean[2];
  Double_t fXZrms[2];
  Double_t fSlopeLim[2];
  Double_t fInterLim[2];
  Double_t fDSlope;
  Double_t fDInter;
  TObjArray *fClusterList;

  Int_t fPeakMin;
  Double_t fPeakMinFrac;
  Double_t fPeakMinFracZoom;
  Double_t fMinInterBinSize;

  Int_t fNBinMax;
  Int_t fNBinCut;

  Int_t fHough[fNBin][fNBin];
  Int_t fMaxHoughBin[fNBin][fNBin][2];

  Int_t fNPeak;
  Int_t fNMaxima;

  Bool_t fFillHough;

  vector<Int_t> fMPeak;
  vector<Int_t> fCPeak;
  vector<Int_t> fIPeak;
  vector<Double_t> fSlopePeak;

ClassDef(HoughTrackSR,1)

};


#endif                                                    // HOUGHTRACKSR_H
