Index: trunk/SophyaLib/HiStats/histos.cc
===================================================================
--- trunk/SophyaLib/HiStats/histos.cc	(revision 1064)
+++ trunk/SophyaLib/HiStats/histos.cc	(revision 1092)
@@ -1,4 +1,4 @@
 //
-// $Id: histos.cc,v 1.9 2000-07-11 18:57:25 ansari Exp $
+// $Id: histos.cc,v 1.10 2000-07-26 13:15:15 ansari Exp $
 //
 
@@ -22,7 +22,7 @@
 /*! Constructeur par defaut */
 Histo::Histo()
-: data(NULL), err2(NULL),
-  under(0), over(0), nHist(0), nEntries(0),
-  bins(0), min(0), max(0),
+: mData(NULL), mErr2(NULL),
+  mUnder(0), mOver(0), nHist(0), nEntries(0),
+  mBins(0), mMin(0), mMax(0),
   binWidth(0)
 {
@@ -32,9 +32,10 @@
 /********* Methode *********/
 /*! Constructeur d'un histo de nBin bins allant de xMin a xMax */
-Histo::Histo(float xMin, float xMax, int nBin)
-: data(new float[nBin]), err2(NULL),
-  under(0), over(0), nHist(0), nEntries(0),
-  bins(nBin), min(xMin), max(xMax),
-  binWidth((max - min)/nBin)
+Histo::Histo(r_8 xMin, r_8 xMax, int_4 nBin)
+: mData((nBin>0) ? new r_8[nBin] : NULL),
+  mErr2(NULL),
+  mUnder(0), mOver(0), nHist(0), nEntries(0),
+  mBins(nBin), mMin(xMin), mMax(xMax),
+  binWidth((nBin>0) ? (mMax-mMin)/nBin : 0)
 {
   Zero();
@@ -43,17 +44,30 @@
 
 /********* Methode *********/
+/*! Constructeur d'un histo de nBin bins allant de xMin a xMax */
+Histo::Histo(r_4 xMin, r_4 xMax, int_4 nBin)
+: mData((nBin>0) ? new r_8[nBin] : NULL),
+  mErr2(NULL),
+  mUnder(0), mOver(0), nHist(0), nEntries(0),
+  mBins(nBin), mMin((r_8)xMin), mMax((r_8)xMax),
+  binWidth((nBin>0) ? (mMax-mMin)/nBin : 0)
+{
+  Zero();
+  END_CONSTRUCTOR
+}
+
+/********* Methode *********/
 /*! Constructeur par copie */
 Histo::Histo(const Histo& H)
-: data((H.bins>0)? new float[H.bins] : NULL),
-  err2(NULL),
-  under(H.under), over(H.over), nHist(H.nHist), nEntries(H.nEntries),
-  bins(H.bins), min(H.min), max(H.max),
+: mData((H.mBins>0)? new r_8[H.mBins] : NULL),
+  mErr2(NULL),
+  mUnder(H.mUnder), mOver(H.mOver), nHist(H.nHist), nEntries(H.nEntries),
+  mBins(H.mBins), mMin(H.mMin), mMax(H.mMax),
   binWidth(H.binWidth)
 {
-  if(bins>0) {
-    memcpy(data, H.data, bins*sizeof(float));
-    if( H.err2 != NULL ) {
-      err2 = new double[bins];
-      memcpy(err2, H.err2, bins*sizeof(double));
+  if(mBins>0) {
+    memcpy(mData, H.mData, mBins*sizeof(r_8));
+    if( H.mErr2 != NULL ) {
+      mErr2 = new r_8[mBins];
+      memcpy(mErr2, H.mErr2, mBins*sizeof(r_8));
     }
   }
@@ -65,9 +79,9 @@
 void Histo::Delete()
 {
-  if( data != NULL ) { delete[] data; data = NULL;}
-  if( err2 != NULL ) { delete[] err2; err2 = NULL;}
-  under = over = min = max = binWidth= 0.;
+  if( mData != NULL ) { delete[] mData; mData = NULL;}
+  if( mErr2 != NULL ) { delete[] mErr2; mErr2 = NULL;}
+  mUnder = mOver = mMin = mMax = binWidth= 0.;
   nHist = 0.;
-  nEntries = bins = 0;
+  nEntries = mBins = 0;
 }
 
@@ -85,10 +99,10 @@
 void Histo::Zero()
 {
-  if(bins<=0) return;
-  memset(data, 0, bins*sizeof(float));
-  under = over = 0;
+  if(mBins<=0) return;
+  memset(mData, 0, mBins*sizeof(r_8));
+  mUnder = mOver = 0;
   nHist = 0;
   nEntries = 0;
-  if( err2 != NULL ) memset(err2, 0, bins*sizeof(double));
+  if( mErr2 != NULL ) memset(mErr2, 0, mBins*sizeof(r_8));
 }
 
@@ -99,7 +113,7 @@
 void Histo::Errors()
 {
- if(bins<=0) return;
- if(err2==NULL) err2 = new double[bins];
- memset(err2, 0, bins*sizeof(double));
+ if(mBins<=0) return;
+ if(mErr2==NULL) mErr2 = new r_8[mBins];
+ memset(mErr2, 0, mBins*sizeof(r_8));
 }
 
@@ -111,21 +125,21 @@
 {
   if(this == &h) return *this;
-  if( h.bins <= 0 ) {Delete(); return *this;}
-  if( h.bins > bins ) Delete();
-  if(!h.err2 && err2 ) { delete [] err2; err2=NULL;}
-  if(!data) data = new float[h.bins];
-  if(h.err2 && !err2 ) err2 = new double[h.bins];
-
-  under = h.under;
-  over = h.over;
+  if( h.mBins <= 0 ) {Delete(); return *this;}
+  if( h.mBins > mBins ) Delete();
+  if(!h.mErr2 && mErr2 ) { delete [] mErr2; mErr2=NULL;}
+  if(!mData) mData = new r_8[h.mBins];
+  if(h.mErr2 && !mErr2 ) mErr2 = new r_8[h.mBins];
+
+  mUnder = h.mUnder;
+  mOver = h.mOver;
   nHist = h.nHist;
   nEntries = h.nEntries;
-  bins = h.bins;
-  min = h.min;
-  max = h.max;
+  mBins = h.mBins;
+  mMin = h.mMin;
+  mMax = h.mMax;
   binWidth = h.binWidth;
   
-  memcpy(data, h.data, bins*sizeof(float));
-  if(err2) memcpy(err2, h.err2, bins*sizeof(double));
+  memcpy(mData, h.mData, mBins*sizeof(r_8));
+  if(mErr2) memcpy(mErr2, h.mErr2, mBins*sizeof(r_8));
 
   return *this;
@@ -136,13 +150,13 @@
   Operateur de multiplication par une constante
 */
-Histo& Histo::operator *= (double b)
-{
-double b2 = b*b;
-for(int i=0;i<bins;i++) {
-  data[i] *= b;
-  if(err2) err2[i] *= b2;
-}
-under *= b;
-over *= b;
+Histo& Histo::operator *= (r_8 b)
+{
+r_8 b2 = b*b;
+for(int_4 i=0;i<mBins;i++) {
+  mData[i] *= b;
+  if(mErr2) mErr2[i] *= b2;
+}
+mUnder *= b;
+mOver *= b;
 nHist *= b;
 
@@ -153,14 +167,14 @@
   Operateur de division par une constante
 */
-Histo& Histo::operator /= (double b)
+Histo& Histo::operator /= (r_8 b)
 {
 if (b==0.) THROW(inconsistentErr);
-double b2 = b*b;
-for(int i=0;i<bins;i++) {
-  data[i] /= b;
-  if(err2) err2[i] /= b2;
-}
-under /= b;
-over /= b;
+r_8 b2 = b*b;
+for(int_4 i=0;i<mBins;i++) {
+  mData[i] /= b;
+  if(mErr2) mErr2[i] /= b2;
+}
+mUnder /= b;
+mOver /= b;
 nHist /= b;
 
@@ -171,10 +185,10 @@
   Operateur d'addition d'une constante
 */
-Histo& Histo::operator += (double b)
-{
-for(int i=0;i<bins;i++) data[i] += b;
-under += b;
-over += b;
-nHist += bins*b;
+Histo& Histo::operator += (r_8 b)
+{
+for(int_4 i=0;i<mBins;i++) mData[i] += b;
+mUnder += b;
+mOver += b;
+nHist += mBins*b;
 
 return *this;
@@ -184,10 +198,10 @@
   Operateur de soustraction d'une constante
 */
-Histo& Histo::operator -= (double b)
-{
-for(int i=0;i<bins;i++) data[i] -= b;
-under -= b;
-over -= b;
-nHist -= bins*b;
+Histo& Histo::operator -= (r_8 b)
+{
+for(int_4 i=0;i<mBins;i++) mData[i] -= b;
+mUnder -= b;
+mOver -= b;
+nHist -= mBins*b;
 
 return *this;
@@ -200,11 +214,11 @@
 Histo& Histo::operator += (const Histo& a)
 {
-if(bins!=a.bins) THROW(sizeMismatchErr);
-for(int i=0;i<bins;i++) {
-  data[i] += a(i);
-  if(err2 && a.err2) err2[i] += a.Error2(i);
-}
-under += a.under;
-over += a.over;
+if(mBins!=a.mBins) THROW(sizeMismatchErr);
+for(int_4 i=0;i<mBins;i++) {
+  mData[i] += a(i);
+  if(mErr2 && a.mErr2) mErr2[i] += a.Error2(i);
+}
+mUnder += a.mUnder;
+mOver += a.mOver;
 nHist += a.nHist;
 nEntries += a.nEntries;
@@ -218,11 +232,11 @@
 Histo& Histo::operator -= (const Histo& a)
 {
-if(bins!=a.bins) THROW(sizeMismatchErr);
-for(int i=0;i<bins;i++) {
-  data[i] -= a(i);
-  if(err2 && a.err2) err2[i] += a.Error2(i);
-}
-under -= a.under;
-over -= a.over;
+if(mBins!=a.mBins) THROW(sizeMismatchErr);
+for(int_4 i=0;i<mBins;i++) {
+  mData[i] -= a(i);
+  if(mErr2 && a.mErr2) mErr2[i] += a.Error2(i);
+}
+mUnder -= a.mUnder;
+mOver -= a.mOver;
 nHist -= a.nHist;
 nEntries += a.nEntries;
@@ -236,14 +250,14 @@
 Histo& Histo::operator *= (const Histo& a)
 {
-if(bins!=a.bins) THROW(sizeMismatchErr);
+if(mBins!=a.mBins) THROW(sizeMismatchErr);
 nHist = 0.;
-for(int i=0;i<bins;i++) {
-  if(err2 && a.err2)
-      err2[i] = a(i)*a(i)*err2[i] + data[i]*data[i]*a.Error2(i);
-  data[i] *= a(i);
-  nHist += data[i];
-}
-under *= a.under;
-over *= a.over;
+for(int_4 i=0;i<mBins;i++) {
+  if(mErr2 && a.mErr2)
+      mErr2[i] = a(i)*a(i)*mErr2[i] + mData[i]*mData[i]*a.Error2(i);
+  mData[i] *= a(i);
+  nHist += mData[i];
+}
+mUnder *= a.mUnder;
+mOver *= a.mOver;
 nEntries += a.nEntries;
 
@@ -256,20 +270,20 @@
 Histo& Histo::operator /= (const Histo& a)
 {
-if(bins!=a.bins) THROW(sizeMismatchErr);
+if(mBins!=a.mBins) THROW(sizeMismatchErr);
 nHist = 0.;
-for(int i=0;i<bins;i++) {
+for(int_4 i=0;i<mBins;i++) {
   if(a(i)==0.) {
-    data[i]=0.;
-    if(err2) err2[i]=0.;
+    mData[i]=0.;
+    if(mErr2) mErr2[i]=0.;
     continue;
   }
-  if(err2 && a.err2)
-      err2[i] = (err2[i] + data[i]/a(i)*data[i]/a(i)*a.Error2(i))
+  if(mErr2 && a.mErr2)
+      mErr2[i] = (mErr2[i] + mData[i]/a(i)*mData[i]/a(i)*a.Error2(i))
                 /(a(i)*a(i));
-  data[i] /= a(i);
-  nHist += data[i];
-}
-if(a.under!=0.) under /= a.under; else under = 0.;
-if(a.over!=0.)  over  /= a.over;  else over  = 0.;
+  mData[i] /= a(i);
+  nHist += mData[i];
+}
+if(a.mUnder!=0.) mUnder /= a.mUnder; else mUnder = 0.;
+if(a.mOver!=0.)  mOver  /= a.mOver;  else mOver  = 0.;
 nEntries += a.nEntries;
 
@@ -283,6 +297,6 @@
 void Histo::GetAbsc(TVector<r_8> &v)
 {
-v.Realloc(bins);
-for(int i=0;i<bins;i++) v(i) = BinLowEdge(i);
+v.Realloc(mBins);
+for(int_4 i=0;i<mBins;i++) v(i) = BinLowEdge(i);
 return;
 }
@@ -293,6 +307,6 @@
 void Histo::GetValue(TVector<r_8> &v)
 {
-v.Realloc(bins);
-for(int i=0;i<bins;i++) v(i) = data[i];
+v.Realloc(mBins);
+for(int_4 i=0;i<mBins;i++) v(i) = mData[i];
 return;
 }
@@ -303,7 +317,7 @@
 void Histo::GetError2(TVector<r_8> &v)
 {
-v.Realloc(bins);
-if(!err2) {for(int i=0;i<bins;i++) v(i) = 0.; return;}
-for(int i=0;i<bins;i++) v(i) = err2[i];
+v.Realloc(mBins);
+if(!mErr2) {for(int_4 i=0;i<mBins;i++) v(i) = 0.; return;}
+for(int_4 i=0;i<mBins;i++) v(i) = mErr2[i];
 return;
 }
@@ -314,7 +328,7 @@
 void Histo::GetError(TVector<r_8> &v)
 {
-v.Realloc(bins);
-if(!err2) {for(int i=0;i<bins;i++) v(i) = 0.; return;}
-for(int i=0;i<bins;i++) v(i) = Error(i);
+v.Realloc(mBins);
+if(!mErr2) {for(int_4 i=0;i<mBins;i++) v(i) = 0.; return;}
+for(int_4 i=0;i<mBins;i++) v(i) = Error(i);
 return;
 }
@@ -324,11 +338,11 @@
   Remplissage du contenu de l'histo avec les valeurs d'un vecteur
 */
-void Histo::PutValue(TVector<r_8> &v, int ierr)
-{
-//if(v.NElts()<(uint_4) bins) THROW(sizeMismatchErr);
-uint_4 n = (v.NElts()<(uint_4) bins) ? v.NElts(): (uint_4) bins;
-if(n>0) for(int i=0;i<n;i++) {
-  data[i] = v(i);
-  if(err2&&ierr) err2[i] = fabs(v(i));
+void Histo::PutValue(TVector<r_8> &v, int_4 ierr)
+{
+//if(v.NElts()<(uint_4) mBins) THROW(sizeMismatchErr);
+uint_4 n = (v.NElts()<(uint_4) mBins) ? v.NElts(): (uint_4) mBins;
+if(n>0) for(uint_4 i=0;i<n;i++) {
+  mData[i] = v(i);
+  if(mErr2&&ierr) mErr2[i] = fabs(v(i));
 }
 return;
@@ -338,11 +352,11 @@
   Addition du contenu de l'histo avec les valeurs d'un vecteur
 */
-void Histo::PutValueAdd(TVector<r_8> &v, int ierr)
-{
-//if(v.NElts()<(uint_4) bins) THROW(sizeMismatchErr);
-uint_4 n = (v.NElts()<(uint_4) bins) ? v.NElts(): (uint_4) bins;
-if(n>0) for(int i=0;i<n;i++) {
-  data[i] += v(i);
-  if(err2 && ierr) err2[i] += fabs(v(i));
+void Histo::PutValueAdd(TVector<r_8> &v, int_4 ierr)
+{
+//if(v.NElts()<(uint_4) mBins) THROW(sizeMismatchErr);
+uint_4 n = (v.NElts()<(uint_4) mBins) ? v.NElts(): (uint_4) mBins;
+if(n>0) for(uint_4 i=0;i<n;i++) {
+  mData[i] += v(i);
+  if(mErr2 && ierr) mErr2[i] += fabs(v(i));
 }
 return;
@@ -354,9 +368,9 @@
 void Histo::PutError2(TVector<r_8> &v)
 {
-//if(v.NElts()<(uint_4) bins) THROW(sizeMismatchErr);
-uint_4 n = (v.NElts()<(uint_4) bins) ? v.NElts(): (uint_4) bins;
+//if(v.NElts()<(uint_4) mBins) THROW(sizeMismatchErr);
+uint_4 n = (v.NElts()<(uint_4) mBins) ? v.NElts(): (uint_4) mBins;
 if(n>0) {
-  if(!err2) Errors();
-  for(int i=0;i<n;i++) err2[i] = v(i);
+  if(!mErr2) Errors();
+  for(uint_4 i=0;i<n;i++) mErr2[i] = v(i);
 }
 return;
@@ -368,9 +382,9 @@
 void Histo::PutError2Add(TVector<r_8> &v)
 {
-//if(v.NElts()<(uint_4) bins) THROW(sizeMismatchErr);
-uint_4 n = (v.NElts()<(uint_4) bins) ? v.NElts(): (uint_4) bins;
+//if(v.NElts()<(uint_4) mBins) THROW(sizeMismatchErr);
+uint_4 n = (v.NElts()<(uint_4) mBins) ? v.NElts(): (uint_4) mBins;
 if(n>0) {
-  if(!err2) Errors();
-  for(int i=0;i<n;i++) if(v(i)>0.) err2[i] += v(i);
+  if(!mErr2) Errors();
+  for(uint_4 i=0;i<n;i++) if(v(i)>0.) mErr2[i] += v(i);
 }
 return;
@@ -382,10 +396,10 @@
 void Histo::PutError(TVector<r_8> &v)
 {
-//if(v.NElts()<(uint_4) bins) THROW(sizeMismatchErr);
-uint_4 n = (v.NElts()<(uint_4) bins) ? v.NElts(): (uint_4) bins;
+//if(v.NElts()<(uint_4) mBins) THROW(sizeMismatchErr);
+uint_4 n = (v.NElts()<(uint_4) mBins) ? v.NElts(): (uint_4) mBins;
 if(n>0) {
-  if(!err2) Errors();
-  for(int i=0;i<n;i++)
-    if(v(i)>0.) err2[i]=v(i)*v(i); else err2[i]=-v(i)*v(i);
+  if(!mErr2) Errors();
+  for(uint_4 i=0;i<n;i++)
+    if(v(i)>0.) mErr2[i]=v(i)*v(i); else mErr2[i]=-v(i)*v(i);
 }
 return;
@@ -396,12 +410,12 @@
   Addition du contenu de l'histo pour abscisse x poids w
 */
-void Histo::Add(float x, float w)
-{
-  int numBin = FindBin(x);
-  if (numBin<0) under += w;
-  else if (numBin>=bins) over += w;
+void Histo::Add(r_8 x, r_8 w)
+{
+  int_4 numBin = FindBin(x);
+  if (numBin<0) mUnder += w;
+  else if (numBin>=mBins) mOver += w;
   else {
-    data[numBin] += w;
-    if(err2!=NULL) err2[numBin] += w*w;
+    mData[numBin] += w;
+    if(mErr2!=NULL) mErr2[numBin] += w*w;
     nHist += w;
     nEntries++;
@@ -413,11 +427,11 @@
   Addition du contenu de l'histo bin numBin poids w
 */
-void Histo::AddBin(int numBin, float w)
-{
-  if (numBin<0) under += w;
-  else if (numBin>=bins) over += w;
+void Histo::AddBin(int_4 numBin, r_8 w)
+{
+  if (numBin<0) mUnder += w;
+  else if (numBin>=mBins) mOver += w;
   else {
-    data[numBin] += w;
-    if(err2!=NULL) err2[numBin] += w*w;
+    mData[numBin] += w;
+    if(mErr2!=NULL) mErr2[numBin] += w*w;
     nHist += w;
     nEntries++;
@@ -429,7 +443,7 @@
   Remplissage du contenu de l'histo pour abscisse x poids w
 */
-void Histo::SetBin(float x, float w)
-{
-  int numBin = FindBin(x);
+void Histo::SetBin(r_8 x, r_8 w)
+{
+  int_4 numBin = FindBin(x);
   SetBin(numBin,w);
 }
@@ -439,11 +453,11 @@
   Remplissage du contenu de l'histo pour numBin poids w
 */
-void Histo::SetBin(int numBin, float w)
-{
-  if (numBin<0) under = w;
-  else if (numBin>=bins) over = w;
+void Histo::SetBin(int_4 numBin, r_8 w)
+{
+  if (numBin<0) mUnder = w;
+  else if (numBin>=mBins) mOver = w;
   else {
-    nHist -= data[numBin];
-    data[numBin] = w;
+    nHist -= mData[numBin];
+    mData[numBin] = w;
     nHist += w;
   }
@@ -454,7 +468,7 @@
   Remplissage des erreurs au carre pour abscisse x
 */
-void Histo::SetErr2(float x, double e2)
-{
-  int numBin = FindBin(x);
+void Histo::SetErr2(r_8 x, r_8 e2)
+{
+  int_4 numBin = FindBin(x);
   SetErr2(numBin,e2);
 }
@@ -464,9 +478,9 @@
   Remplissage des erreurs au carre pour numBin poids
 */
-void Histo::SetErr2(int numBin, double e2)
-{
-  if( err2==NULL) return;
-  if ( numBin<0 || numBin>=bins ) return;
-  err2[numBin] = e2;
+void Histo::SetErr2(int_4 numBin, r_8 e2)
+{
+  if( mErr2==NULL) return;
+  if ( numBin<0 || numBin>=mBins ) return;
+  mErr2[numBin] = e2;
 }
 
@@ -475,7 +489,7 @@
   Remplissage des erreurs pour abscisse x
 */
-void Histo::SetErr(float x, float e)
-{
-SetErr2(x, (double) e*e);
+void Histo::SetErr(r_8 x, r_8 e)
+{
+SetErr2(x,  e*e);
 }
 
@@ -484,7 +498,7 @@
   Remplissage des erreurs pour numBin
 */
-void Histo::SetErr(int numBin, float e)
-{
-SetErr2(numBin, (double) e*e);
+void Histo::SetErr(int_4 numBin, r_8 e)
+{
+SetErr2(numBin,  e*e);
 }
 
@@ -493,11 +507,11 @@
   Numero du bin ayant le contenu maximum
 */
-int Histo::IMax() const
-{
-  int imx=0;
-  if(bins==1) return imx;
-  float mx=data[0];
-  for (int i=1; i<bins; i++)
-    if (data[i]>mx) {imx = i; mx=data[i];}
+int_4 Histo::IMax() const
+{
+  int_4 imx=0;
+  if(mBins==1) return imx;
+  r_8 mx=mData[0];
+  for (int_4 i=1; i<mBins; i++)
+    if (mData[i]>mx) {imx = i; mx=mData[i];}
   return imx;
 }
@@ -507,11 +521,11 @@
   Numero du bin ayant le contenu minimum
 */
-int Histo::IMin() const
-{
-  int imx=0;
-  if(bins==1) return imx;
-  float mx=data[0];
-  for (int i=1; i<bins; i++)
-    if (data[i]<mx) {imx = i; mx=data[i];}
+int_4 Histo::IMin() const
+{
+  int_4 imx=0;
+  if(mBins==1) return imx;
+  r_8 mx=mData[0];
+  for (int_4 i=1; i<mBins; i++)
+    if (mData[i]<mx) {imx = i; mx=mData[i];}
   return imx;
 }
@@ -521,9 +535,9 @@
   Valeur le contenu maximum
 */
-float Histo::VMax() const
-{
-  float mx=data[0];
-  if(bins==1) return mx;
-  for (int i=1;i<bins;i++) if(data[i]>mx) mx=data[i];
+r_8 Histo::VMax() const
+{
+  r_8 mx=mData[0];
+  if(mBins==1) return mx;
+  for (int_4 i=1;i<mBins;i++) if(mData[i]>mx) mx=mData[i];
   return mx;
 }
@@ -533,9 +547,9 @@
   Valeur le contenu minimum
 */
-float Histo::VMin() const
-{
-  float mx=data[0];
-  if(bins==1) return mx;
-  for (int i=1;i<bins;i++) if(data[i]<mx) mx=data[i];
+r_8 Histo::VMin() const
+{
+  r_8 mx=mData[0];
+  if(mBins==1) return mx;
+  for (int_4 i=1;i<mBins;i++) if(mData[i]<mx) mx=mData[i];
   return mx;
 }
@@ -545,14 +559,14 @@
   Valeur moyenne
 */
-float Histo::Mean() const
-{
-  double n = 0;
-  double sx = 0;
-  for (int i=0; i<bins; i++) {
-    double v = (data[i]>=0.) ? data[i] : -data[i];
+r_8 Histo::Mean() const
+{
+  r_8 n = 0;
+  r_8 sx = 0;
+  for (int_4 i=0; i<mBins; i++) {
+    r_8 v = (mData[i]>=0.) ? mData[i] : -mData[i];
     n += v;
     sx += BinCenter(i)*v;
   }
-  if(n>0.) return sx/n; else return min;
+  if(n>0.) return sx/n; else return mMin;
 }
 
@@ -561,11 +575,11 @@
   Valeur du sigma
 */
-float Histo::Sigma() const
-{
-  double n = 0;
-  double sx = 0;
-  double sx2= 0;
-  for (int i=0; i<bins; i++) {
-    double v = (data[i]>=0.) ? data[i] : -data[i];
+r_8 Histo::Sigma() const
+{
+  r_8 n = 0;
+  r_8 sx = 0;
+  r_8 sx2= 0;
+  for (int_4 i=0; i<mBins; i++) {
+    r_8 v = (mData[i]>=0.) ? mData[i] : -mData[i];
     n += v;
     sx += BinCenter(i)*v;
@@ -583,13 +597,13 @@
   Valeur de la moyenne calculee entre les bin il et ih
 */
-float Histo::MeanLH(int il,int ih) const
-{
-  if( ih < il ) { il = 0; ih = bins-1; }
+r_8 Histo::MeanLH(int_4 il,int_4 ih) const
+{
+  if( ih < il ) { il = 0; ih = mBins-1; }
   if( il < 0 ) il = 0;
-  if( ih >= bins ) ih = bins-1;
-  double n = 0;
-  double sx = 0;
-  for (int i=il; i<=ih; i++) {
-    double v = (data[i]>=0.) ? data[i] : -data[i];
+  if( ih >= mBins ) ih = mBins-1;
+  r_8 n = 0;
+  r_8 sx = 0;
+  for (int_4 i=il; i<=ih; i++) {
+    r_8 v = (mData[i]>=0.) ? mData[i] : -mData[i];
     n += v;
     sx += BinCenter(i)*v;
@@ -602,14 +616,14 @@
   Valeur de la moyenne calculee entre les bin il et ih
 */
-float Histo::SigmaLH(int il,int ih) const
-{
-  if( ih < il ) { il = 0; ih = bins - 1; }
+r_8 Histo::SigmaLH(int_4 il,int_4 ih) const
+{
+  if( ih < il ) { il = 0; ih = mBins - 1; }
   if( il < 0 ) il = 0;
-  if( ih >= bins ) ih = bins - 1;
-  double n = 0;
-  double sx = 0;
-  double sx2= 0;
-  for (int i=il; i<=ih; i++) {
-    double v = (data[i]>=0.) ? data[i] : -data[i];
+  if( ih >= mBins ) ih = mBins - 1;
+  r_8 n = 0;
+  r_8 sx = 0;
+  r_8 sx2= 0;
+  for (int_4 i=il; i<=ih; i++) {
+    r_8 v = (mData[i]>=0.) ? mData[i] : -mData[i];
     n += v;
     sx += BinCenter(i)*v;
@@ -626,18 +640,18 @@
   Valeur de la moyenne calculee entre x0-dx et x0+dx
 */
-float Histo::Mean(float x0, float dx) const
-{
-  double sdata = 0;
-  double sx = 0;
-  int iMin = FindBin(x0-dx);
+r_8 Histo::Mean(r_8 x0, r_8 dx) const
+{
+  r_8 sdata = 0;
+  r_8 sx = 0;
+  int_4 iMin = FindBin(x0-dx);
   if (iMin<0) iMin = 0;
-  int iMax = FindBin(x0+dx);
-  if (iMax>bins) iMax=bins;
-  for (int i=iMin; i<iMax; i++) {
-    double v = (data[i]>=0.) ? data[i] : -data[i];
+  int_4 iMax = FindBin(x0+dx);
+  if (iMax>mBins) iMax=mBins;
+  for (int_4 i=iMin; i<iMax; i++) {
+    r_8 v = (mData[i]>=0.) ? mData[i] : -mData[i];
     sx += BinCenter(i)*v;
     sdata += v;
   }
-  if(sdata>0.) return sx/sdata; else return min;
+  if(sdata>0.) return sx/sdata; else return mMin;
 }
 
@@ -646,15 +660,15 @@
   Valeur du sigma calcule entre x0-dx et x0+dx
 */
-float Histo::Sigma(float x0, float dx) const
-{
-  double sx = 0;
-  double sx2= 0;
-  double sdata = 0;
-  int iMin = FindBin(x0-dx);
+r_8 Histo::Sigma(r_8 x0, r_8 dx) const
+{
+  r_8 sx = 0;
+  r_8 sx2= 0;
+  r_8 sdata = 0;
+  int_4 iMin = FindBin(x0-dx);
   if (iMin<0) iMin = 0;
-  int iMax = FindBin(x0+dx);
-  if (iMax>bins) iMax=bins;
-  for (int i=iMin; i<iMax; i++) {
-    double v = (data[i]>=0.) ? data[i] : -data[i];
+  int_4 iMax = FindBin(x0+dx);
+  if (iMax>mBins) iMax=mBins;
+  for (int_4 i=iMin; i<iMax; i++) {
+    r_8 v = (mData[i]>=0.) ? mData[i] : -mData[i];
     sx += BinCenter(i)*v;
     sx2+= BinCenter(i)*BinCenter(i)*v;
@@ -669,13 +683,13 @@
   Valeur de la moyenne et du sigma nettoyes
 */
-float Histo::CleanedMean(float& sigma) const
+r_8 Histo::CleanedMean(r_8& sigma) const
 {
   if (!nHist) return 0;
   // on fait ca de facon bete, on pourra raffiner apres...
-  float x0 = Mean();
-  float s  = Sigma()+binWidth;
+  r_8 x0 = Mean();
+  r_8 s  = Sigma()+binWidth;
   
-  for (int i=0; i<3; i++) {
-    float xx0 = Mean(x0,5*s);
+  for (int_4 i=0; i<3; i++) {
+    r_8 xx0 = Mean(x0,5*s);
     s  = Sigma(x0,5*s)+binWidth;
     x0 = xx0;
@@ -689,8 +703,8 @@
   Valeur de la moyenne nettoyee
 */
-float Histo::CleanedMean() const
+r_8 Histo::CleanedMean() const
 {
   if (!nHist) return 0;
-  float s=0;
+  r_8 s=0;
   return CleanedMean(s);
 }
@@ -700,8 +714,8 @@
   Retourne le nombre de bins non-nul
 */
-int Histo::BinNonNul() const
-{
-int non=0;
-for (int i=0;i<bins;i++) if( data[i] != 0. ) non++;
+int_4 Histo::BinNonNul() const
+{
+int_4 non=0;
+for (int_4 i=0;i<mBins;i++) if( mData[i] != 0. ) non++;
 return non;
 }
@@ -711,9 +725,9 @@
   Retourne le nombre de bins ayant une erreur non-nulle
 */
-int Histo::ErrNonNul() const
-{
-if(err2==NULL) return -1;
-int non=0;
-for (int i=0;i<bins;i++) if( err2[i] != 0. ) non++;
+int_4 Histo::ErrNonNul() const
+{
+if(mErr2==NULL) return -1;
+int_4 non=0;
+for (int_4 i=0;i<mBins;i++) if( mErr2[i] != 0. ) non++;
 return non;
 }
@@ -724,14 +738,14 @@
   entre le bin 0 et ce bin (y compris le contenu de ce bin).
 */
-int Histo::BinPercent(float per) const
-{
-double n = nHist*per;
-double s = 0.;
-int i;
-for(i=0; i<bins; i++ ) {
-  s += data[i];
+int_4 Histo::BinPercent(r_8 per) const
+{
+r_8 n = nHist*per;
+r_8 s = 0.;
+int_4 i;
+for(i=0; i<mBins; i++ ) {
+  s += mData[i];
   if( s >= n ) break;
 }
-if( i == bins ) i = bins-1;
+if( i == mBins ) i = mBins-1;
 return i;
 }
@@ -747,26 +761,26 @@
        imax = bin tel que nombre d'entrees entre I et imax = N2 * per
      Return: <0 si echec
-             min(I-imin,imax-I) si ok
+             mMin(I-imin,imax-I) si ok
   \endverbatim
 */
-int Histo::BinPercent(float x,float per,int& imin,int& imax)
+int_4 Histo::BinPercent(r_8 x,r_8 per,int& imin,int& imax)
 {
 imin = imax = -1;
 if( per <= 0. ) return -1;
 
-int I = FindBin(x);
-if( I<0 || I>=bins ) return -2;
-
-double N1 = 0.; for(int i=0; i<=I;   i++) N1 += data[i]; N1 *= per;
-double N2 = 0.; {for(int i=I; i<bins; i++) N2 += data[i]; N2 *= per;}
-
-double n = 0.;
-for(imin=I; imin>=0; imin--)   { n += data[imin]; if(n>=N1) break; }
+int_4 I = FindBin(x);
+if( I<0 || I>=mBins ) return -2;
+
+r_8 N1 = 0.; for(int_4 i=0; i<=I;   i++) N1 += mData[i]; N1 *= per;
+r_8 N2 = 0.; {for(int_4 i=I; i<mBins; i++) N2 += mData[i]; N2 *= per;}
+
+r_8 n = 0.;
+for(imin=I; imin>=0; imin--)   { n += mData[imin]; if(n>=N1) break; }
 if( imin<0 ) imin = 0;
 // cout<<"I="<<I<<" imin="<<imin<<" n="<<n<<" N1="<<N1<<endl;
 
 n = 0.;
-for(imax=I; imax<bins; imax++) { n += data[imax]; if(n>=N2) break; }
-if( imax>=bins ) imax = bins-1;
+for(imax=I; imax<mBins; imax++) { n += mData[imax]; if(n>=N2) break; }
+if( imax>=mBins ) imax = mBins-1;
 // cout<<"I="<<I<<" imax="<<imax<<" n="<<n<<" N2="<<N2<<endl;
 
@@ -778,9 +792,9 @@
   Idem precedent mais renvoie xmin et xmax
 */
-int Histo::BinPercent(float x,float per,float& xmin,float& xmax)
+int_4 Histo::BinPercent(r_8 x,r_8 per,r_8& xmin,r_8& xmax)
 {
 xmin = xmax = 0.;
-int imin,imax;
-int rc = BinPercent(x,per,imin,imax);
+int_4 imin,imax;
+int_4 rc = BinPercent(x,per,imin,imax);
 if( rc >= 0 ) { xmin = BinLowEdge(imin); xmax = BinHighEdge(imax); }
 return rc;
@@ -792,17 +806,17 @@
   si norm <= 0 : pas de normalisation, integration seule
 */
-void Histo::HInteg(float norm)
-{
-if( bins <= 0 ) return; // createur par default
-if(bins>1)
-  for(int i=1; i<bins; i++) {
-    data[i] += data[i-1];
-    if(err2!=NULL) err2[i] += err2[i-1];
+void Histo::HInteg(r_8 norm)
+{
+if( mBins <= 0 ) return; // createur par default
+if(mBins>1)
+  for(int_4 i=1; i<mBins; i++) {
+    mData[i] += mData[i-1];
+    if(mErr2!=NULL) mErr2[i] += mErr2[i-1];
   }
 if( norm <= 0. ) return;
-norm /= data[bins-1];
-for(int i=0; i<bins; i++) {
-  data[i] *= norm;
-  if(err2!=NULL) err2[i] *= norm*norm;
+norm /= mData[mBins-1];
+for(int_4 i=0; i<mBins; i++) {
+  mData[i] *= norm;
+  if(mErr2!=NULL) mErr2[i] *= norm*norm;
 }
 }
@@ -814,13 +828,13 @@
 void Histo::HDeriv()
 {
-if( bins <= 0 ) return; // createur par default
-if( bins <= 1 ) return;
-float *temp = new float[bins];
-memcpy(temp, data, bins*sizeof(float));
-if(bins>=3) for(int i=1; i<bins-1; i++)
-              temp[i] = (data[i+1]-data[i-1])/(2.*binWidth);
-temp[0] = (data[1]-data[0])/binWidth;
-temp[bins-1] = (data[bins-1]-data[bins-2])/binWidth;
-memcpy(data, temp, bins*sizeof(float));
+if( mBins <= 0 ) return; // createur par default
+if( mBins <= 1 ) return;
+r_8 *temp = new r_8[mBins];
+memcpy(temp, mData, mBins*sizeof(r_8));
+if(mBins>=3) for(int_4 i=1; i<mBins-1; i++)
+              temp[i] = (mData[i+1]-mData[i-1])/(2.*binWidth);
+temp[0] = (mData[1]-mData[0])/binWidth;
+temp[mBins-1] = (mData[mBins-1]-mData[mBins-2])/binWidth;
+memcpy(mData, temp, mBins*sizeof(r_8));
 delete [] temp;
 }
@@ -830,7 +844,7 @@
   Pour rebinner l'histogramme sur nbinew bins
 */
-void Histo::HRebin(int nbinew)
-{
-  if( bins <= 0 ) return; // createur par default
+void Histo::HRebin(int_4 nbinew)
+{
+  if( mBins <= 0 ) return; // createur par default
   if( nbinew <= 0 ) return;
 
@@ -839,31 +853,31 @@
 
   // Le nombre de bins est il plus grand ??
-  if( nbinew > bins ) {
-    delete [] data; data = NULL;
-    data = new float[nbinew];
-    if( err2 != NULL ) {
-      delete [] err2; err2 = NULL;
-      err2 = new double[nbinew];
+  if( nbinew > mBins ) {
+    delete [] mData; mData = NULL;
+    mData = new r_8[nbinew];
+    if( mErr2 != NULL ) {
+      delete [] mErr2; mErr2 = NULL;
+      mErr2 = new r_8[nbinew];
     }
   }
 
   // remise en forme de this
-  bins = nbinew;
+  mBins = nbinew;
   this->Zero();
-  binWidth = (max-min)/bins;
+  binWidth = (mMax-mMin)/mBins;
   // On recopie les parametres qui n'ont pas changes
-  under = H.under;
-  over  = H.over;
+  mUnder = H.mUnder;
+  mOver  = H.mOver;
 
 
   // Remplissage
-  for(int i=0;i<bins;i++) {
-    float xmi = BinLowEdge(i);
-    float xma = BinHighEdge(i);
-    int imi =  H.FindBin(xmi);
+  for(int_4 i=0;i<mBins;i++) {
+    r_8 xmi = BinLowEdge(i);
+    r_8 xma = BinHighEdge(i);
+    int_4 imi =  H.FindBin(xmi);
     if( imi < 0 ) imi = 0;
-    int ima =  H.FindBin(xma);
-    if( ima >= H.bins ) ima = H.bins-1;
-    double w = 0.;
+    int_4 ima =  H.FindBin(xma);
+    if( ima >= H.mBins ) ima = H.mBins-1;
+    r_8 w = 0.;
     if( ima == imi ) {
       w = H(imi) * binWidth/H.binWidth;
@@ -872,7 +886,7 @@
       w += H(ima) * (xma -H.BinLowEdge(ima))/H.binWidth;
       if( ima > imi+1 )
-          for(int ii=imi+1;ii<ima;ii++) w += H(ii);
+          for(int_4 ii=imi+1;ii<ima;ii++) w += H(ii);
     }
-    AddBin(i,(float) w);
+    AddBin(i, w);
   }
 
@@ -887,17 +901,17 @@
   consecutifs, le bin le plus a droite est pris.
 */
-int Histo::MaxiLocal(float& maxi,int& imax,float& maxn,int& imaxn)
-{
-int nml = 0;
+int_4 Histo::MaxiLocal(r_8& maxi,int& imax,r_8& maxn,int& imaxn)
+{
+int_4 nml = 0;
 imax = imaxn = -1;
-maxi = maxn = -1.f;
+maxi = maxn = -1.;
 
 bool up = true;
 bool down = false;
-for(int i=0;i<bins;i++) {
-  if( !up ) if( data[i] > data[i-1] ) up = true;
+for(int_4 i=0;i<mBins;i++) {
+  if( !up ) if( mData[i] > mData[i-1] ) up = true;
   if( up && !down ) {
-    if( i == bins-1 ) down=true;
-      else if( data[i] > data[i+1] ) down=true;
+    if( i == mBins-1 ) down=true;
+      else if( mData[i] > mData[i+1] ) down=true;
   }
 
@@ -906,10 +920,10 @@
     up = down = false;
     if( imax < 0 ) {
-      imax = i; maxi = data[i];
-    } else if( data[i] >= maxi ) {
+      imax = i; maxi = mData[i];
+    } else if( mData[i] >= maxi ) {
       imaxn = imax; maxn = maxi;
-      imax = i; maxi = data[i];
+      imax = i; maxi = mData[i];
     } else {
-      if( imaxn < 0 || data[i] >= maxn ) { imaxn = i; maxn = data[i]; }
+      if( imaxn < 0 || mData[i] >= maxn ) { imaxn = i; maxn = mData[i]; }
     }
   }
@@ -925,5 +939,5 @@
   L'histo est suppose etre remplit de valeurs positives
 */
-float Histo::FitMax(int degree, float frac, int debug) const
+r_8 Histo::FitMax(int_4 degree, r_8 frac, int_4 debug) const
 {
   if (degree < 2 || degree > 3) degree = 3;
@@ -935,7 +949,7 @@
   if (NEntries() < 1) THROW(inconsistentErr);
 
-  int iMax = IMax();
-  float hmax = (*this)(iMax);
-  float xCenter = BinCenter(iMax);
+  int_4 iMax = IMax();
+  r_8 hmax = (*this)(iMax);
+  r_8 xCenter = BinCenter(iMax);
 
   if(debug>1)
@@ -944,17 +958,17 @@
   /* find limits at frac*hmax */
 
-  float limit = frac*hmax;
-
-  volatile int iLow = iMax;
+  r_8 limit = frac*hmax;
+
+  volatile int_4 iLow = iMax;
   while (iLow>0 && (*this)(iLow)>limit) iLow--;
 
-  volatile int iHigh = iMax;
+  volatile int_4 iHigh = iMax;
   while (iHigh<NBins()-1 && (*this)(iHigh)>limit) iHigh++;
 
-  int nLowHigh;
+  int_4 nLowHigh;
   for(;;) {
     nLowHigh = 0;
-    for (int i=iLow; i<=iHigh; i++) if((*this)(i)>0) {
-      if(!err2) nLowHigh++;
+    for (int_4 i=iLow; i<=iHigh; i++) if((*this)(i)>0) {
+      if(!mErr2) nLowHigh++;
         else if(Error2(i)>0.) nLowHigh++;
     }
@@ -977,8 +991,8 @@
   TVector<r_8> e2Fit(nLowHigh);
   TVector<r_8> errcoef(1);
-  int ii = 0;
-  for (int j=iLow; j<=iHigh; j++) {
+  int_4 ii = 0;
+  for (int_4 j=iLow; j<=iHigh; j++) {
     if ((*this)(j)>0) {
-      if(!err2) {
+      if(!mErr2) {
         xFit(ii) = BinCenter(j)-xCenter;
         yFit(ii) = (*this)(j);
@@ -994,5 +1008,5 @@
   }
   if(debug>4) {
-    int k;
+    int_4 k;
     for(k=0;k<nLowHigh;k++) cout<<" "<<xFit(k);  cout<<endl;
     for(k=0;k<nLowHigh;k++) cout<<" "<<yFit(k);  cout<<endl;
@@ -1009,6 +1023,6 @@
   } ENDTRY
 
-  int DPolDeg = pol.Degre();
-  float fd = 0.;
+  int_4 DPolDeg = pol.Degre();
+  r_8 fd = 0.;
 
   if (DPolDeg == 0) {
@@ -1026,11 +1040,11 @@
   } else if (DPolDeg == 1) {
     // on est dans le cas d'un fit de parabole
-    double r=0;
+    r_8 r=0;
     if (pol.Root1(r)==0) THROW(inconsistentErr);
     fd = r + xCenter;
   } else if (DPolDeg == 2) {
     // on est dans le cas d'un fit de cubique
-    double r1=0;
-    double r2=0;
+    r_8 r1=0;
+    r_8 r2=0;
     if (pol.Root2(r1,r2) == 0) THROW(inconsistentErr);
     pol.Derivate();
@@ -1041,6 +1055,6 @@
   }
 
-  if(fd>max) fd = max;
-  if(fd<min) fd = min;
+  if(fd>mMax) fd = mMax;
+  if(fd<mMin) fd = mMin;
 
   if (debug>1)
@@ -1060,7 +1074,7 @@
   L'histo est suppose etre remplit de valeurs positives
 */
-float Histo::FindWidth(float frac, int debug) const
-{
-  float xmax = BinCenter( IMax() );
+r_8 Histo::FindWidth(r_8 frac, int_4 debug) const
+{
+  r_8 xmax = BinCenter( IMax() );
   return FindWidth(xmax,frac,debug);
 }
@@ -1071,5 +1085,5 @@
   L'histo est suppose etre remplit de valeurs positives
 */
-float Histo::FindWidth(float xmax,float frac, int debug) const
+r_8 Histo::FindWidth(r_8 xmax,r_8 frac, int_4 debug) const
 {
   if (frac <= 0 || frac >= 1.) frac = 0.5;
@@ -1085,39 +1099,39 @@
   if (NBins() < 3) THROW(inconsistentErr);
 
-  int iMax = FindBin(xmax);
+  int_4 iMax = FindBin(xmax);
   if (iMax<0 || iMax>=NBins()) THROW(inconsistentErr);
-  float hmax = data[iMax];
-  float limit = frac*hmax;
+  r_8 hmax = mData[iMax];
+  r_8 limit = frac*hmax;
   if (debug > 1)
     cout << "  Max histo[" << iMax << "] = " << hmax
          << ", limite " << limit << endl;
 
-  int iLow = iMax;
-  while (iLow>=0 && data[iLow]>limit) iLow--;
+  int_4 iLow = iMax;
+  while (iLow>=0 && mData[iLow]>limit) iLow--;
   if( iLow < 0 ) iLow = 0;
 
-  int iHigh = iMax;
-  while (iHigh<NBins() && data[iHigh]>limit) iHigh++;
+  int_4 iHigh = iMax;
+  while (iHigh<NBins() && mData[iHigh]>limit) iHigh++;
   if( iHigh >=NBins() ) iHigh = NBins()-1;
 
-  float xlow   = BinCenter(iLow);
-  float ylow   = data[iLow];
-
-  float xlow1=xlow, ylow1=ylow;
+  r_8 xlow   = BinCenter(iLow);
+  r_8 ylow   = mData[iLow];
+
+  r_8 xlow1=xlow, ylow1=ylow;
   if(iLow+1<NBins()) {
     xlow1  = BinCenter(iLow+1);
-    ylow1  = data[iLow+1];
-  }
-
-  float xhigh  = BinCenter(iHigh);
-  float yhigh  = data[iHigh];
-
-  float xhigh1=xhigh, yhigh1=yhigh;
+    ylow1  = mData[iLow+1];
+  }
+
+  r_8 xhigh  = BinCenter(iHigh);
+  r_8 yhigh  = mData[iHigh];
+
+  r_8 xhigh1=xhigh, yhigh1=yhigh;
   if(iHigh-1>=0) {
     xhigh1 = BinCenter(iHigh-1);
-    yhigh1 = data[iHigh-1];
-  }
-
-  float xlpred,xhpred,wd;
+    yhigh1 = mData[iHigh-1];
+  }
+
+  r_8 xlpred,xhpred,wd;
 
   if(ylow1>ylow) {
@@ -1148,7 +1162,7 @@
   Cf suivant mais im est le bin du maximum de l'histo
 */
-int Histo::EstimeMax(float& xm,int SzPav)
-{
-int im = IMax();
+int_4 Histo::EstimeMax(r_8& xm,int_4 SzPav)
+{
+int_4 im = IMax();
 return EstimeMax(im,xm,SzPav);
 }
@@ -1166,17 +1180,17 @@
   \endverbatim
 */
-int Histo::EstimeMax(int& im,float& xm,int SzPav)
+int_4 Histo::EstimeMax(int& im,r_8& xm,int_4 SzPav)
 {
 xm = 0;
 if( SzPav <= 0 ) return -1;
-if( im < 0 || im >= bins ) return -1;
+if( im < 0 || im >= mBins ) return -1;
 
 if( SzPav%2 == 0 ) SzPav++;
 SzPav = (SzPav-1)/2;
 
-int rc = 0;
-double dxm = 0, wx = 0;
-for(int i=im-SzPav;i<=im+SzPav;i++) {
-  if( i<0 || i>= bins ) {rc=1; continue;}
+int_4 rc = 0;
+r_8 dxm = 0, wx = 0;
+for(int_4 i=im-SzPav;i<=im+SzPav;i++) {
+  if( i<0 || i>= mBins ) {rc=1; continue;}
   dxm += BinCenter(i) * (*this)(i);
   wx  += (*this)(i);
@@ -1198,24 +1212,24 @@
   et a droite (widthD)
 */
-void Histo::EstimeWidthS(float frac,float& widthG,float& widthD)
-{
-int i;
+void Histo::EstimeWidthS(r_8 frac,r_8& widthG,r_8& widthD)
+{
+int_4 i;
 widthG = widthD = -1.;
-if( bins<=1 || frac<=0. || frac>=1. ) return;
-
-int imax = 0;
-float maxi = data[0];
-for(i=1;i<bins;i++) if(data[i]>maxi) {imax=i; maxi=data[i];}
-float xmax = BinCenter(imax);
-float maxf = maxi * frac;
+if( mBins<=1 || frac<=0. || frac>=1. ) return;
+
+int_4 imax = 0;
+r_8 maxi = mData[0];
+for(i=1;i<mBins;i++) if(mData[i]>maxi) {imax=i; maxi=mData[i];}
+r_8 xmax = BinCenter(imax);
+r_8 maxf = maxi * frac;
 
 // recherche du sigma a gauche
 widthG = 0.;
-for(i=imax;i>=0;i--) if( data[i] <= maxf ) break;
+for(i=imax;i>=0;i--) if( mData[i] <= maxf ) break;
 if(i<0) i=0;
 if(i<imax) {
-  if( data[i+1] != data[i] ) {
+  if( mData[i+1] != mData[i] ) {
     widthG = BinCenter(i) + binWidth
-           * (maxf-data[i])/(data[i+1]-data[i]);
+           * (maxf-mData[i])/(mData[i+1]-mData[i]);
     widthG = xmax - widthG;
   } else widthG = xmax - BinCenter(i);
@@ -1224,10 +1238,10 @@
 // recherche du sigma a droite
 widthD = 0.;
-for(i=imax;i<bins;i++) if( data[i] <= maxf ) break;
-if(i>=bins) i=bins-1;
+for(i=imax;i<mBins;i++) if( mData[i] <= maxf ) break;
+if(i>=mBins) i=mBins-1;
 if(i>imax) {
-  if( data[i] != data[i-1] ) {
+  if( mData[i] != mData[i-1] ) {
     widthD = BinCenter(i) - binWidth
-           * (maxf-data[i])/(data[i-1]-data[i]);
+           * (maxf-mData[i])/(mData[i-1]-mData[i]);
     widthD -= xmax;
   } else widthD = BinCenter(i) - xmax;
@@ -1257,5 +1271,5 @@
   \endverbatim
 */
-int  Histo::Fit(GeneralFit& gfit,unsigned short typ_err)
+int_4  Histo::Fit(GeneralFit& gfit,unsigned short typ_err)
 {
 if(NBins()<=0) return -1000;
@@ -1264,9 +1278,9 @@
 GeneralFitData mydata(1,NBins());
 
-for(int i=0;i<NBins();i++) {
-  double x = (double) BinCenter(i);
-  double f = (double) (*this)(i);
-  double saf = sqrt(fabs((double) f)); if(saf<1.) saf=1.;
-  double e=0.;
+for(int_4 i=0;i<NBins();i++) {
+  r_8 x =  BinCenter(i);
+  r_8 f =  (*this)(i);
+  r_8 saf = sqrt(fabs( f)); if(saf<1.) saf=1.;
+  r_8 e=0.;
   if(typ_err==0)      {if(HasErrors()) e=Error(i); else e=1.;}
   else if(typ_err==1) {if(HasErrors()) e=Error(i); else e=saf;}
@@ -1295,7 +1309,7 @@
 TVector<r_8> par = gfit.GetParm();
 Histo h(*this);
-for(int i=0;i<NBins();i++) {
-  double x = (double) BinCenter(i);
-  h(i) -= (float) f->Value(&x,par.Data());
+for(int_4 i=0;i<NBins();i++) {
+  r_8 x =  BinCenter(i);
+  h(i) -=  f->Value(&x,par.Data());
 }
 return h;
@@ -1314,7 +1328,7 @@
 TVector<r_8> par = gfit.GetParm();
 Histo h(*this);
-for(int i=0;i<NBins();i++) {
-  double x = (double) BinCenter(i);
-  h(i) = (float) f->Value(&x,par.Data());
+for(int_4 i=0;i<NBins();i++) {
+  r_8 x =  BinCenter(i);
+  h(i) =  f->Value(&x,par.Data());
 }
 return h;
@@ -1334,20 +1348,20 @@
           sinon : hmin hmax
       pflag < 0 : on imprime les informations (nbin,min,...) sans l'histogramme
-            = 0 : on imprime  "BinCenter(i) data[i]"  (note "... ...")
+            = 0 : on imprime  "BinCenter(i) mData[i]"  (note "... ...")
             bit 0 on : (v=1): numero_bin "... ..."
             bit 1 on : (v=2): "... ..." erreur
   \endverbatim
 */
-void Histo::PrintF(FILE * fp, int hdyn,float hmin, float hmax,int pflag,
-	      int il, int ih)
+void Histo::PrintF(FILE * fp, int_4 hdyn,r_8 hmin, r_8 hmax,int_4 pflag,
+	      int_4 il, int_4 ih)
 {
  
- if( il > ih ) { il = 0; ih = bins-1; }
+ if( il > ih ) { il = 0; ih = mBins-1; }
  if( il < 0 ) il = 0;
- if( ih >= bins ) ih = bins-1;
-
- double dhmin = (double) hmin;
- double dhmax = (double) hmax;
- double hb,hbmn,hbmx;
+ if( ih >= mBins ) ih = mBins-1;
+
+ r_8 dhmin =  hmin;
+ r_8 dhmax =  hmax;
+ r_8 hb,hbmn,hbmx;
 
  if(hdyn==0) hdyn = 100;
@@ -1355,7 +1369,7 @@
  cout << "~Histo::Print  "
       << " nHist=" << nHist << "  nEntries=" << nEntries
-      << "  under=" << under << "  over=" << over << endl;
- cout << "       bins=" << bins
-      << "  min=" << min << "  max=" << max
+      << "  mUnder=" << mUnder << "  mOver=" << mOver << endl;
+ cout << "       mBins=" << mBins
+      << "  min=" << mMin << "  mMax=" << mMax
       << "  binWidth=" << binWidth << endl;
  cout << "       mean=" << Mean() << " r.m.s=" << Sigma() 
@@ -1364,12 +1378,12 @@
  if(hdyn<0 || pflag<0 ) return;
 
- if(dhmax<=dhmin) { if(hmin != 0.) dhmin = (double) VMin(); else dhmin=0.;
-                  dhmax = (double) VMax(); }
+ if(dhmax<=dhmin) { if(hmin != 0.) dhmin =  VMin(); else dhmin=0.;
+                  dhmax =  VMax(); }
  if(dhmin>dhmax) return;
  if(dhmin==dhmax) {dhmin -= 1.; dhmax += 1.;}
- double wb = (dhmax-dhmin) / (double) hdyn;
+ r_8 wb = (dhmax-dhmin) /  hdyn;
 
  // determination de la position de la valeur zero
- int i0 = (int)(-dhmin/wb);
+ int_4 i0 = (int_4)(-dhmin/wb);
 
  // si le zero est dans la dynamique,
@@ -1389,6 +1403,6 @@
        dhmax -= hbmx;
      }
-     wb = (dhmax-dhmin) / (double) hdyn;
-     i0 = (int)(-dhmin/wb);
+     wb = (dhmax-dhmin) /  hdyn;
+     i0 = (int_4)(-dhmin/wb);
    }
  }
@@ -1401,18 +1415,18 @@
 
  // premiere ligne
- {for(int i=0;i<hdyn;i++) s[i] = '=';}
+ {for(int_4 i=0;i<hdyn;i++) s[i] = '=';}
  if( 0 <= i0 && i0 < hdyn ) s[i0] = '0';
  if(pflag&1) fprintf( fp, "====");
  fprintf( fp, "======================");
- if(pflag&2 && err2!=NULL) fprintf( fp, "===========");
+ if(pflag&2 && mErr2!=NULL) fprintf( fp, "===========");
  fprintf( fp, "==%s\n",s);
 
  // histogramme
- {for(int i=il;i<=ih;i++) {
-   for(int k=0;k<hdyn;k++) s[k] = ' ';
+ {for(int_4 i=il;i<=ih;i++) {
+   for(int_4 k=0;k<hdyn;k++) s[k] = ' ';
    hb = (*this)(i);
 
    //choix du bin (hdyn bin entre [dhmin,dhmax[
-   int ii = (int)( (hb-dhmin)/wb );
+   int_4 ii = (int_4)( (hb-dhmin)/wb );
    if(ii<0) ii = 0; else if(ii>=hdyn) ii = hdyn-1;
 
@@ -1424,24 +1438,24 @@
    if(i0<0) {
      // courbe entierement positive
-     for(int k=0;k<=ii;k++) s[k] = 'X';
+     for(int_4 k=0;k<=ii;k++) s[k] = 'X';
    } else if(i0>=hdyn) {
      // courbe entierement negative
-     for(int k=hdyn-1;k>=ii;k--) s[k] = 'X';
+     for(int_4 k=hdyn-1;k>=ii;k--) s[k] = 'X';
    } else {
      // courbe positive et negative
      s[i0] = '|';
-     if(ii>i0)        for(int k=i0+1;k<=ii;k++) s[k] = 'X';
-       else if(ii<i0) for(int k=ii;k<i0;k++)    s[k] = 'X';
+     if(ii>i0)        for(int_4 k=i0+1;k<=ii;k++) s[k] = 'X';
+       else if(ii<i0) for(int_4 k=ii;k<i0;k++)    s[k] = 'X';
           else s[ii] = 'X';
    }
 
    // valeur a mettre dans le bin le plus haut/bas
-   int ib;
-   if(hb>0.) ib = (int)( 10.*(hb-hbmn)/(hbmx-hbmn) );
-     else if(hb<0.) ib = (int)( 10.*(hbmx-hb)/(hbmx-hbmn) );
+   int_4 ib;
+   if(hb>0.) ib = (int_4)( 10.*(hb-hbmn)/(hbmx-hbmn) );
+     else if(hb<0.) ib = (int_4)( 10.*(hbmx-hb)/(hbmx-hbmn) );
        else ib = -1;
    if(ib==-1) s[ii] = '|';
      else if(ib==0) s[ii] = '.';
-       else if(ib>0 && ib<10) s[ii] = (char)((int) '0' + ib);
+       else if(ib>0 && ib<10) s[ii] = (char)((int_4) '0' + ib);
 
    // traitement des saturations +/-
@@ -1451,39 +1465,39 @@
    if(pflag&1) fprintf( fp, "%3d ",i);
    fprintf( fp, "%10.4g %10.4g ",BinCenter(i),hb);
-   if(pflag&2 && err2!=NULL) fprintf( fp, "%10.4g ",Error(i));
+   if(pflag&2 && mErr2!=NULL) fprintf( fp, "%10.4g ",Error(i));
    fprintf( fp, "= %s\n",s);
  }}
 
  // derniere ligne
- for(int i=0;i<hdyn;i++) s[i] = '=';
+ for(int_4 i=0;i<hdyn;i++) s[i] = '=';
  if( 0 <= i0 && i0 < hdyn ) s[i0] = '0';
  if(pflag&1) fprintf( fp, "====");
  fprintf( fp, "======================");
- if(pflag&2 && err2!=NULL) fprintf( fp, "===========");
+ if(pflag&2 && mErr2!=NULL) fprintf( fp, "===========");
  fprintf( fp, "==%s\n",s);
 
  // valeur basse des bins (sur ["ndig-1" digits + signe] =  ndig char (>=3))
- const int ndig = 7;
+ const int_4 ndig = 7;
  char sn[2*ndig+10];
  hb = ( fabs(dhmin) > fabs(dhmax) ) ? fabs(dhmin) : fabs(dhmax);
- int n;
- if( hb > 0. ) n = (int)(log10(hb*1.00000001)); else n = 1;
- double scaledig = pow(10.,(double) ndig-2);
- double expo = scaledig/pow(10.,(double) n);
+ int_4 n;
+ if( hb > 0. ) n = (int_4)(log10(hb*1.00000001)); else n = 1;
+ r_8 scaledig = pow(10.,(r_8) ndig-2);
+ r_8 expo = scaledig/pow(10.,(r_8) n);
  // cout <<"n="<<n<<" hb="<<hb<<" scaledig="<<scaledig<<" expo="<<expo<<endl;
- for(int k=0;k<ndig;k++) {
-   for(int i=0;i<hdyn;i++) s[i] = ' ';
-   {for(int i=0;i<hdyn;i++) {
-     n = (int)( (dhmin + i*wb)*expo );
-     for(int j=0;j<2*ndig+10;j++) sn[j] = ' ';
+ for(int_4 k=0;k<ndig;k++) {
+   for(int_4 i=0;i<hdyn;i++) s[i] = ' ';
+   {for(int_4 i=0;i<hdyn;i++) {
+     n = (int_4)( (dhmin + i*wb)*expo );
+     for(int_4 j=0;j<2*ndig+10;j++) sn[j] = ' ';
      sprintf(sn,"%d%c",n,'\0');
      strip(sn,'B',' ');
      // cout <<"n="<<n<<" sn=("<<sn<<")  l="<<strlen(sn)<<" k="<<k;
-     if( (int) strlen(sn) > k ) s[i] = sn[k];
+     if( (int_4) strlen(sn) > k ) s[i] = sn[k];
      // cout <<"  s=("<<s<<")"<<endl;
    }}
    if(pflag&1) fprintf( fp, "    ");
    fprintf( fp, "                      ");
-   if(pflag&2 && err2!=NULL) fprintf( fp, "           ");
+   if(pflag&2 && mErr2!=NULL) fprintf( fp, "           ");
    fprintf( fp, "  %s\n",s);
  }
@@ -1497,6 +1511,6 @@
   Impression de l'histogramme sur stdout
 */
-void Histo::Print(int hdyn,float hmin, float hmax,int pflag,
-	     int il, int ih)
+void Histo::Print(int_4 hdyn,r_8 hmin, r_8 hmax,int_4 pflag,
+	     int_4 il, int_4 ih)
 {
  Histo::PrintF(stdout, hdyn, hmin, hmax, pflag, il, ih);
@@ -1523,5 +1537,5 @@
 
 // Lecture des valeurs
-is.Get(dobj->bins);
+is.Get(dobj->mBins);
 is.Get(dobj->nEntries);
 int_4 errok;
@@ -1529,21 +1543,21 @@
 
 is.Get(dobj->binWidth);
-is.Get(dobj->min);
-is.Get(dobj->max);
-is.Get(dobj->under);
-is.Get(dobj->over);
+is.Get(dobj->mMin);
+is.Get(dobj->mMax);
+is.Get(dobj->mUnder);
+is.Get(dobj->mOver);
 
 is.Get(dobj->nHist);
 
 // Lecture des donnees Histo 1D
-dobj->data = new float[dobj->bins];
+dobj->mData = new r_8[dobj->mBins];
 is.GetLine(strg, 255);
-is.Get(dobj->data, dobj->bins);
+is.Get(dobj->mData, dobj->mBins);
 
 // Lecture des erreurs
 if(errok) {
   is.GetLine(strg, 255);
-  dobj->err2 = new double[dobj->bins];
-  is.Get(dobj->err2, dobj->bins);
+  dobj->mErr2 = new r_8[dobj->mBins];
+  is.Get(dobj->mErr2, dobj->mBins);
 }
 
@@ -1557,37 +1571,37 @@
 
 // Que faut-il ecrire?
-int_4 errok = (dobj->err2) ? 1 : 0;
+int_4 errok = (dobj->mErr2) ? 1 : 0;
 
 // Ecriture entete pour identifier facilement
-sprintf(strg,"bins=%6d  NEnt=%15d  errok=%1d",dobj->bins,dobj->nEntries,errok);
+sprintf(strg,"mBins=%6d  NEnt=%15d  errok=%1d",dobj->mBins,dobj->nEntries,errok);
 os.PutLine(strg);
-sprintf(strg,"binw=%g  min=%g max=%g",dobj->binWidth,dobj->min,dobj->max);
+sprintf(strg,"binw=%g  mMin=%g mMax=%g",dobj->binWidth,dobj->mMin,dobj->mMax);
 os.PutLine(strg);
-sprintf(strg, "under=%g over=%g nHist=%g",dobj->under,dobj->over,dobj->nHist);
+sprintf(strg, "mUnder=%g mOver=%g nHist=%g",dobj->mUnder,dobj->mOver,dobj->nHist);
 os.PutLine(strg);
 
 // Ecriture des valeurs
-os.Put(dobj->bins);
+os.Put(dobj->mBins);
 os.Put(dobj->nEntries);
 os.Put(errok);
 
 os.Put(dobj->binWidth);
-os.Put(dobj->min);
-os.Put(dobj->max);
-os.Put(dobj->under);
-os.Put(dobj->over);
+os.Put(dobj->mMin);
+os.Put(dobj->mMax);
+os.Put(dobj->mUnder);
+os.Put(dobj->mOver);
 
 os.Put(dobj->nHist);
 
 // Ecriture des donnees Histo 1D
-sprintf(strg,"Histo: Tableau des donnees %d",dobj->bins);
+sprintf(strg,"Histo: Tableau des donnees %d",dobj->mBins);
 os.PutLine(strg);
-os.Put(dobj->data, dobj->bins);
+os.Put(dobj->mData, dobj->mBins);
 
 // Ecriture des erreurs
 if(errok) {
-  sprintf(strg,"Histo: Tableau des erreurs %d",dobj->bins);
+  sprintf(strg,"Histo: Tableau des erreurs %d",dobj->mBins);
   os.PutLine(strg);
-  os.Put(dobj->err2, dobj->bins);
+  os.Put(dobj->mErr2, dobj->mBins);
 }
 
