Index: trunk/SophyaLib/HiStats/histos.h
===================================================================
--- trunk/SophyaLib/HiStats/histos.h	(revision 1089)
+++ trunk/SophyaLib/HiStats/histos.h	(revision 1092)
@@ -1,5 +1,5 @@
 // This may look like C code, but it is really -*- C++ -*-
 //
-// $Id: histos.h,v 1.10 2000-07-25 10:20:43 ansari Exp $
+// $Id: histos.h,v 1.11 2000-07-26 13:15:15 ansari Exp $
 //
 
@@ -26,5 +26,6 @@
   // CREATOR / DESTRUCTOR
   Histo();
-  Histo(float xMin, float xMax, int nBin=100);
+  Histo(r_8 xMin, r_8 xMax, int_4 nBin=100);
+  Histo(r_4 xMin, r_4 xMax, int_4 nBin=100);
   Histo(const Histo& H);
   virtual ~Histo();
@@ -35,20 +36,20 @@
   // UPDATING or SETTING
   void Zero();
-  void Add(float x, float w = 1.);
-  void AddBin(int numBin, float w = 1.);
-  void SetBin(float x, float w = 1.);
-  void SetBin(int numBin, float w = 1.);
-  void SetErr2(float x, double e2);
-  void SetErr2(int numBin, double e2);
-  void SetErr(float x, float e);
-  void SetErr(int numBin, float e);
+  void Add(r_8 x, r_8 w = 1.);
+  void AddBin(int_4 numBin, r_8 w = 1.);
+  void SetBin(r_8 x, r_8 w = 1.);
+  void SetBin(int_4 numBin, r_8 w = 1.);
+  void SetErr2(r_8 x, r_8 e2);
+  void SetErr2(int_4 numBin, r_8 e2);
+  void SetErr(r_8 x, r_8 e);
+  void SetErr(int_4 numBin, r_8 e);
   virtual inline void UpdateHisto() const { return;}
 
   // Operators
   Histo& operator = (const Histo& h);
-  Histo& operator *= (double b);
-  Histo& operator /= (double b);
-  Histo& operator += (double b);
-  Histo& operator -= (double b);
+  Histo& operator *= (r_8 b);
+  Histo& operator /= (r_8 b);
+  Histo& operator += (r_8 b);
+  Histo& operator -= (r_8 b);
   Histo& operator += (const Histo& a);
   Histo& operator -= (const Histo& a);
@@ -61,6 +62,6 @@
   void GetError2(TVector<r_8>& v);
   void GetError(TVector<r_8>& v);
-  void PutValue(TVector<r_8>& v, int ierr=0);
-  void PutValueAdd(TVector<r_8> &v, int ierr=0);
+  void PutValue(TVector<r_8>& v, int_4 ierr=0);
+  void PutValueAdd(TVector<r_8> &v, int_4 ierr=0);
   void PutError2(TVector<r_8>& v);
   void PutError2Add(TVector<r_8>& v);
@@ -69,102 +70,102 @@
   // INLINES
   //! Retourne l'abscisse minimum
-  inline float XMin() const {return min;}
+  inline r_8 XMin() const {return mMin;}
   //! Retourne l'abscisse maximum
-  inline float XMax() const {return max;}
+  inline r_8 XMax() const {return mMax;}
   //! Retourne le nombre de bins
-  inline int_4 NBins() const {return bins;}
+  inline int_4 NBins() const {return mBins;}
   //! Retourne la largeur du bin
-  inline float BinWidth() const {return binWidth;}
+  inline r_8 BinWidth() const {return binWidth;}
   //! Retourne le pointeur sur le tableaux des contenus
-  inline float* Bins() const {return data;}
+  inline r_8* Bins() const {return mData;}
   //! Retourne le contenu du bin i
-  inline float operator()(int i) const  {return data[i];}
+  inline r_8 operator()(int_4 i) const  {return mData[i];}
   //! Remplit le contenu du bin i
-  inline float& operator()(int i) {return data[i];}
+  inline r_8& operator()(int_4 i) {return mData[i];}
   //! retourne "true" si il y a des erreurs stoquees
   inline bool HasErrors()
-         {if(err2) return true; else return false;}
+         {if(mErr2) return true; else return false;}
   //! Retourne l'erreur du bin i
-  inline float Error(int i) const
-         {if(err2) {if(err2[i]>0.) return sqrt(err2[i]); else return 0.;}
+  inline r_8 Error(int_4 i) const
+         {if(mErr2) {if(mErr2[i]>0.) return sqrt(mErr2[i]); else return 0.;}
                     else return 0.;}
   //! Retourne l'erreur au carre du bin i
-  inline double Error2(int i) const
-         {if(err2) return err2[i]; else return 0.;}
+  inline r_8 Error2(int_4 i) const
+         {if(mErr2) return mErr2[i]; else return 0.;}
   //! Remplit l'erreur au carre du bin i
-  inline double& Error2(int i) {return err2[i];}
+  inline r_8& Error2(int_4 i) {return mErr2[i];}
   //! Retourne la somme ponderee
-  inline float NData() const            {return (float) nHist;}
+  inline r_8 NData() const            {return nHist;}
   //! Retourne le nombre d'entrees
-  inline float NEntries() const         {return nEntries;}
+  inline r_8 NEntries() const         {return nEntries;}
   //! Retourne le nombre d'overflow
-  inline float NOver() const            {return over;}
+  inline r_8 NOver() const            {return mOver;}
   //! Retourne le nombre d'underflow
-  inline float NUnder() const           {return under;}
+  inline r_8 NUnder() const           {return mUnder;}
 
   //! Retourne l'abscisse du bord inferieur du bin i
-  inline float BinLowEdge(int i)  const {return min + i*binWidth;}
+  inline r_8 BinLowEdge(int_4 i)  const {return mMin + i*binWidth;}
   //! Retourne l'abscisse du centre du bin i
-  inline float BinCenter(int i)   const {return min + (i+0.5)*binWidth;}
+  inline r_8 BinCenter(int_4 i)   const {return mMin + (i+0.5)*binWidth;}
   //! Retourne l'abscisse du bord superieur du bin i
-  inline float BinHighEdge(int i) const {return min + (i+1)*binWidth;} 
+  inline r_8 BinHighEdge(int_4 i) const {return mMin + (i+1)*binWidth;} 
   //! Retourne le numero du bin contenant l'abscisse x
-  inline int_4 FindBin(float x) const   
-         {return (int_4) floorf((x - min) / binWidth);}
+  inline int_4 FindBin(r_8 x) const   
+         {return (int_4) floor((x - mMin) / binWidth);}
 
   // Info, statistique et calculs sur les histogrammes
-  int       BinNonNul() const;
-  int       ErrNonNul() const;
-  int       IMax() const;
-  int       IMin() const;
-  float     VMax() const;
-  float     VMin() const;
-  float     Mean() const;
-  float     Sigma() const;
-  float     MeanLH(int il,int ih) const;
-  float     SigmaLH(int il,int ih) const;
-  float     Mean(float x0, float dx) const;
-  float     Sigma(float x0, float dx) const;
-  float     CleanedMean() const;
-  float     CleanedMean(float& sigma) const;
-  int       BinPercent(float per) const;
-  int       BinPercent(float x,float per,int& imin,int& imax);
-  int       BinPercent(float x,float per,float& xmin,float& xmax);
-  void      HInteg(float norm = 0.);
+  int_4     BinNonNul() const;
+  int_4     ErrNonNul() const;
+  int_4     IMax() const;
+  int_4     IMin() const;
+  r_8       VMax() const;
+  r_8       VMin() const;
+  r_8       Mean() const;
+  r_8       Sigma() const;
+  r_8       MeanLH(int_4 il,int_4 ih) const;
+  r_8       SigmaLH(int_4 il,int_4 ih) const;
+  r_8       Mean(r_8 x0, r_8 dx) const;
+  r_8       Sigma(r_8 x0, r_8 dx) const;
+  r_8       CleanedMean() const;
+  r_8       CleanedMean(r_8& sigma) const;
+  int_4     BinPercent(r_8 per) const;
+  int_4     BinPercent(r_8 x,r_8 per,int_4& imin,int_4& imax);
+  int_4     BinPercent(r_8 x,r_8 per,r_8& xmin,r_8& xmax);
+  void      HInteg(r_8 norm = 0.);
   void      HDeriv();
-  virtual void HRebin(int nbinew);
-
-  int       MaxiLocal(float& maxi,int& imax,float& maxn,int& imaxn);
-  float     FitMax(int degree=2, float frac=0.5f, int debug=0) const;
-  float     FindWidth(float xmax,float frac=0.5f, int debug=0) const;
-  float     FindWidth(float frac=0.5f, int debug=0) const;
-  int       EstimeMax(float& xm,int SzPav = 3);
-  int       EstimeMax(int& im,float& xm,int SzPav = 3);
-  void      EstimeWidthS(float frac,float& widthG,float& widthD);
+  virtual void HRebin(int_4 nbinew);
+
+  int_4     MaxiLocal(r_8& maxi,int_4& imax,r_8& maxn,int_4& imaxn);
+  r_8       FitMax(int_4 degree=2, r_8 frac=0.5f, int_4 debug=0) const;
+  r_8       FindWidth(r_8 xmax,r_8 frac=0.5f, int_4 debug=0) const;
+  r_8       FindWidth(r_8 frac=0.5f, int_4 debug=0) const;
+  int_4     EstimeMax(r_8& xm,int_4 SzPav = 3);
+  int_4     EstimeMax(int_4& im,r_8& xm,int_4 SzPav = 3);
+  void      EstimeWidthS(r_8 frac,r_8& widthG,r_8& widthD);
 
   // Fit
-  int    Fit(GeneralFit& gfit,unsigned short typ_err=0);
+  int_4  Fit(GeneralFit& gfit,unsigned short typ_err=0);
   Histo  FitResidus(GeneralFit& gfit);
   Histo  FitFunction(GeneralFit& gfit);
 
   // Print et Display ASCII
-  void PrintF(FILE * fp, int dyn = 100, float hmin = 1., float hmax = -1.,
-		      int pflag = 0, int il = 1, int ih = -1);
-  void Print(int dyn = 100, float hmin = 1., float hmax = -1.,
-		     int pflag = 0, int il = 1, int ih = -1);
+  void PrintF(FILE * fp, int_4 dyn = 100, r_8 hmin = 1., r_8 hmax = -1.,
+		      int_4 pflag = 0, int_4 il = 1, int_4 ih = -1);
+  void Print(int_4 dyn = 100, r_8 hmin = 1., r_8 hmax = -1.,
+		     int_4 pflag = 0, int_4 il = 1, int_4 ih = -1);
 
 protected:
   void Delete();
 
-  float*    data;     //!< donnees
-  double*   err2;	   //!< erreurs carrees
-  float     under;    //!< underflow
-  float     over;     //!< overflow
-  double    nHist;    //!< somme ponderee des entrees
-  int_4     nEntries; //!< nombre d'entrees
-  int_4     bins;     //!< nombre de bins
-  float     min;      //!< abscisse minimum
-  float     max;      //!< abscisse maximum
-  float     binWidth; //!< largeur du bin
+  r_8*   mData;    //!< donnees
+  r_8*   mErr2;	   //!< erreurs carrees
+  r_8    mUnder;   //!< underflow
+  r_8    mOver;    //!< overflow
+  r_8    nHist;    //!< somme ponderee des entrees
+  int_4  nEntries; //!< nombre d'entrees
+  int_4  mBins;    //!< nombre de bins
+  r_8    mMin;     //!< abscisse minimum
+  r_8    mMax;     //!< abscisse maximum
+  r_8    binWidth; //!< largeur du bin
 };
 
@@ -182,7 +183,7 @@
 // ObjFileIO<Histo>
 
-/*! \ingroup HiStats \fn operator*(const Histo&,double)
+/*! \ingroup HiStats \fn operator*(const Histo&,r_8)
   \brief Operateur H2 = H1 * b */
-inline Histo operator * (const Histo& a, double b)
+inline Histo operator * (const Histo& a, r_8 b)
 {
   Histo result(a);
@@ -190,7 +191,7 @@
 }
 
-/*! \ingroup HiStats \fn operator*(double,const Histo&)
+/*! \ingroup HiStats \fn operator*(r_8,const Histo&)
   \brief Operateur H2 = b * H1 */
-inline Histo operator * (double b, const Histo& a)
+inline Histo operator * (r_8 b, const Histo& a)
 {
   Histo result(a);
@@ -198,7 +199,7 @@
 }
 
-/*! \ingroup HiStats \fn operator/(const Histo&,double)
+/*! \ingroup HiStats \fn operator/(const Histo&,r_8)
   \brief Operateur H2 = H1 / b */
-inline Histo operator / (const Histo& a, double b)
+inline Histo operator / (const Histo& a, r_8 b)
 {
   Histo result(a);
@@ -206,7 +207,7 @@
 }
 
-/*! \ingroup HiStats \fn operator+(const Histo&,double)
+/*! \ingroup HiStats \fn operator+(const Histo&,r_8)
   \brief Operateur H2 = H1 + b */
-inline Histo operator + (const Histo& a, double b)
+inline Histo operator + (const Histo& a, r_8 b)
 {
   Histo result(a);
@@ -214,7 +215,7 @@
 }
 
-/*! \ingroup HiStats \fn operator+(double,const Histo&)
+/*! \ingroup HiStats \fn operator+(r_8,const Histo&)
   \brief Operateur H2 = b + H1 */
-inline Histo operator + (double b, const Histo& a)
+inline Histo operator + (r_8 b, const Histo& a)
 {
   Histo result(a);
@@ -222,7 +223,7 @@
 }
 
-/*! \ingroup HiStats \fn operator-(const Histo&,double)
+/*! \ingroup HiStats \fn operator-(const Histo&,r_8)
   \brief Operateur H2 = H1 - b */
-inline Histo operator - (const Histo& a, double b)
+inline Histo operator - (const Histo& a, r_8 b)
 {
   Histo result(a);
@@ -230,7 +231,7 @@
 }
 
-/*! \ingroup HiStats \fn operator-(double,const Histo&)
+/*! \ingroup HiStats \fn operator-(r_8,const Histo&)
   \brief Operateur H2 = b - H1 */
-inline Histo operator - (double b, const Histo& a)
+inline Histo operator - (r_8 b, const Histo& a)
 {
   Histo result(a);
