#ifndef SMOOTH_H
#define SMOOTH_H

#include <vector>
#include <string>
#include "Rtypes.h"
#include "TMatrix.h"
class TH1D;
class TH2D;

class Smooth {

public:

  Smooth();
  Smooth(std::string func,int points,double nmin,double nmax,
	 double min,double max,bool norm);
  virtual ~Smooth();
  inline void SetFunc(const std::string &func) {fFunc=func;}
  inline void SetPoints(const int &points) {fPoints=points;}
  inline void SetMax(const double &max) {fMax=max;}
  inline void SetMin(const double &min) {fMin=min;}
  inline void SetNormMax(const double &max) {fNormMax=max;}
  inline void SetNormMin(const double &min) {fNormMin=min;}
  inline void SetNormalize(const bool &norm) {fNorm=norm;}

  void Initialize();

  double GetArea(const double &center, 
		 const double &low_edge,const double &high_edge,
		 const double &width);
  double GetArea(const double &centerx, const double &centery, 
		 const double &xlow_edge,const double &xhigh_edge,
		 const double &ylow_edge,const double &yhigh_edge,
		 const double &width);
  double GetArea(const double &centerx, const double &centery, 
		 const double &xlow_edge,const double &xhigh_edge,
		 const double &ylow_edge,const double &yhigh_edge,
		 const double &widthx,const double &widthy);
  double GetExactArea(const double &center, 
		      const double &low_edge,const double &high_edge,
		      const double &width);
  void Fill(TH1D* &hist,const double &center,const double &width,
	    const double &weight=1);
  void FillExact(TH1D* &hist,const double &center,const double &width,
		 const double &weight=1);
  void FillExactX(TH2D* &hist,const double &center,const double &y,
		  const double &width,const double &weight=1);
  void FillExact(TH2D* &hist,const double &centerx,const double &centery,
		 const double &width,const double &weight=1);
  void FillExact2(TH2D* &hist,const double &centerx,const double &centery,
		 const double &widthx,const double &widthy,
		 const double &weight=1);
  void FillAllBins(TH1D* &hist,const double &center,const double &width,
	    const double &weight=1);
  void FillAllExactBins(TH1D* &hist,const double &center,
			const double &width,
			const double &weight=1);

  
  
private:
		 
  std::string fFunc;
  int         fPoints; 
  int         fWidthPoints;
  double      fNormMin;
  double      fNormMax;
  double      fMin;
  double      fMax;
  bool        fNorm;
  std::vector<double> fVal;

  ClassDef(Smooth,0);
};
#endif
