Index: trunk/SophyaLib/HiStats/hisprof.cc
===================================================================
--- trunk/SophyaLib/HiStats/hisprof.cc	(revision 3050)
+++ trunk/SophyaLib/HiStats/hisprof.cc	(revision 3053)
@@ -18,6 +18,6 @@
 */
 HProf::HProf()
-: Histo()
-, SumY(NULL), SumY2(NULL), SumW(NULL), Ok(false), YMin(1.), YMax(-1.), Opt(0)
+: Histo(), mSumY(NULL), mSumY2(NULL), mSumW(NULL)
+, Ok(false), YMin(1.), YMax(-1.), Opt(0)
 {
 }
@@ -32,12 +32,7 @@
 */
 HProf::HProf(r_8 xMin, r_8 xMax, int_4 nBin, r_8 yMin, r_8 yMax)
-: Histo(xMin,xMax,nBin)
-, SumY( (nBin>0) ? new r_8[nBin] : NULL)
-, SumY2((nBin>0) ? new r_8[nBin] : NULL)
-, SumW( (nBin>0) ? new r_8[nBin] : NULL)
-, Ok(false), YMin(yMin), YMax(yMax), Opt(0)
-{
-  Histo::Errors();
-  Zero();
+: Histo(), mSumY(NULL), mSumY2(NULL), mSumW(NULL)
+{
+  CreateOrResize(xMin,xMax,nBin,yMin,yMax);
 }
 
@@ -47,12 +42,7 @@
 */
 HProf::HProf(r_4 xMin, r_4 xMax, int_4 nBin, r_4 yMin, r_4 yMax)
-: Histo((r_8)xMin,(r_8)xMax,nBin)
-, SumY( (nBin>0) ? new r_8[nBin] : NULL)
-, SumY2((nBin>0) ? new r_8[nBin] : NULL)
-, SumW( (nBin>0) ? new r_8[nBin] : NULL)
-, Ok(false), YMin((r_8)yMin), YMax((r_8)yMax), Opt(0)
-{
-  Histo::Errors();
-  Zero();
+: Histo(), mSumY(NULL), mSumY2(NULL), mSumW(NULL)
+{
+  CreateOrResize((r_8)xMin,(r_8)xMax,nBin,(r_8)yMin,(r_8)yMax);
 }
 
@@ -63,13 +53,13 @@
 HProf::HProf(const HProf& H)
 : Histo(H)
-, SumY((H.mBins>0)  ? new r_8[H.mBins] : NULL)
-, SumY2((H.mBins>0) ? new r_8[H.mBins] : NULL)
-, SumW((H.mBins>0)  ? new r_8[H.mBins] : NULL)
+, mSumY((H.mBins>0)  ? new r_8[H.mBins] : NULL)
+, mSumY2((H.mBins>0) ? new r_8[H.mBins] : NULL)
+, mSumW((H.mBins>0)  ? new r_8[H.mBins] : NULL)
 , Ok(H.Ok), YMin(H.YMin), YMax(H.YMax), Opt(H.Opt)
 {
   if(mBins>0) {
-    memcpy(SumY,  H.SumY,  mBins*sizeof(r_8));
-    memcpy(SumY2, H.SumY2, mBins*sizeof(r_8));
-    memcpy(SumW,  H.SumW,  mBins*sizeof(r_8));
+    memcpy(mSumY,  H.mSumY,  mBins*sizeof(r_8));
+    memcpy(mSumY2, H.mSumY2, mBins*sizeof(r_8));
+    memcpy(mSumW,  H.mSumW,  mBins*sizeof(r_8));
   }
   UpdateHisto();
@@ -78,11 +68,35 @@
 /********* Methode *********/
 /*!
+  allocation
+*/
+void HProf::CreateOrResize(r_8 xMin, r_8 xMax, int_4 nBin, r_8 yMin, r_8 yMax)
+{
+  //cout<<"HProf::CreateOrResize()"<<endl;
+  Histo::CreateOrResize(xMin,xMax,nBin);
+  Histo::Errors();
+  if(mSumY !=NULL) {delete[] mSumY;  mSumY = NULL;}
+  if(mSumY2!=NULL) {delete[] mSumY2; mSumY2= NULL;}
+  if(mSumW !=NULL) {delete[] mSumW;  mSumW = NULL;}
+  if(nBin>0) {
+    mSumY  = new r_8[nBin]; memset(mSumY, 0, nBin*sizeof(r_8));
+    mSumY2 = new r_8[nBin]; memset(mSumY2,0, nBin*sizeof(r_8));
+    mSumW  = new r_8[nBin]; memset(mSumW, 0, nBin*sizeof(r_8));
+  }
+  YMin = yMin; YMax = yMax;
+  Ok = false;
+  Opt = 0;
+}
+
+/********* Methode *********/
+/*!
   Des-allocation
 */
 void HProf::Delete()
 {
-  if( SumY  != NULL ) { delete[] SumY;  SumY = NULL;}
-  if( SumY2 != NULL ) { delete[] SumY2; SumY2 = NULL;}
-  if( SumW  != NULL ) { delete[] SumW;  SumW = NULL;}
+  //cout<<"HProf::Delete()"<<endl;
+  Histo::Delete();
+  if(mSumY != NULL) {delete[] mSumY;  mSumY = NULL;}
+  if(mSumY2!= NULL) {delete[] mSumY2; mSumY2 = NULL;}
+  if(mSumW != NULL) {delete[] mSumW;  mSumW = NULL;}
   Ok = false;
 }
@@ -94,5 +108,5 @@
 HProf::~HProf()
 {
-Delete();
+  Delete();
 }
 
@@ -112,9 +126,9 @@
 void HProf::Zero()
 {
-  memset(SumY,  0, mBins*sizeof(r_8));
-  memset(SumY2, 0, mBins*sizeof(r_8));
-  memset(SumW,  0, mBins*sizeof(r_8));
+  Histo::Zero();
+  memset(mSumY,  0, mBins*sizeof(r_8));
+  memset(mSumY2, 0, mBins*sizeof(r_8));
+  memset(mSumW,  0, mBins*sizeof(r_8));
   Ok = false;
-  Histo::Zero();
 }
 
@@ -158,10 +172,10 @@
 r_8 m,e2;
 if(mBins>0) for(int_4 i=0;i<mBins;i++) {
-  if(SumW[i]<=0.) {
+  if(mSumW[i]<=0.) {
     m = e2 = 0.;
   } else {
-    m  = SumY[i]/SumW[i];
-    e2 = SumY2[i]/SumW[i] - m*m;
-    if(Opt) e2 /= SumW[i];
+    m  = mSumY[i]/mSumW[i];
+    e2 = mSumY2[i]/mSumW[i] - m*m;
+    if(Opt) e2 /= mSumW[i];
   }
   mData[i] = m;
@@ -187,7 +201,7 @@
   else {
     Ok = false;
-    SumY[numBin]  += y*w;
-    SumY2[numBin] += y*y*w;
-    SumW[numBin]  += w;
+    mSumY[numBin]  += y*w;
+    mSumY2[numBin] += y*y*w;
+    mSumW[numBin]  += w;
     nHist += w;
     nEntries++;
@@ -206,7 +220,7 @@
   else {
     Ok = false;
-    SumY[numBin]  += y*w;
-    SumY2[numBin] += y*y*w;
-    SumW[numBin]  += w;
+    mSumY[numBin]  += y*w;
+    mSumY2[numBin] += y*y*w;
+    mSumW[numBin]  += w;
     nHist += w;
     nEntries++;
@@ -224,10 +238,10 @@
 Histo *hthis = (Histo *) this;
 *hthis = (Histo) h;
-if(!SumY)  SumY  = new r_8[mBins];
-if(!SumY2) SumY2 = new r_8[mBins];
-if(!SumW)  SumW  = new r_8[mBins];
-memcpy(SumY,  h.SumY,  mBins*sizeof(r_8));
-memcpy(SumY2, h.SumY2, mBins*sizeof(r_8));
-memcpy(SumW,  h.SumW,  mBins*sizeof(r_8));
+if(!mSumY)  mSumY  = new r_8[mBins];
+if(!mSumY2) mSumY2 = new r_8[mBins];
+if(!mSumW)  mSumW  = new r_8[mBins];
+memcpy(mSumY,  h.mSumY,  mBins*sizeof(r_8));
+memcpy(mSumY2, h.mSumY2, mBins*sizeof(r_8));
+memcpy(mSumW,  h.mSumW,  mBins*sizeof(r_8));
 Ok = h.Ok;
 YMin = h.YMin;
@@ -252,7 +266,7 @@
 *hthis += (Histo) a;
 if(mBins>0) for(int_4 i=0;i<mBins;i++) {
-  SumY[i]  += a.SumY[i];
-  SumY2[i] += a.SumY2[i];
-  SumW[i]  += a.SumW[i];
+  mSumY[i]  += a.mSumY[i];
+  mSumY2[i] += a.mSumY2[i];
+  mSumW[i]  += a.mSumW[i];
 }
 updatehisto();
@@ -279,7 +293,7 @@
   // Le nombre de bins est il plus grand ??
   if( mBins > binold ) {
-    delete [] SumY;  SumY  = new r_8[nbinew]; memset(SumY, 0,mBins*sizeof(r_8));
-    delete [] SumY2; SumY2 = new r_8[nbinew]; memset(SumY2,0,mBins*sizeof(r_8));
-    delete [] SumW;  SumW  = new r_8[nbinew]; memset(SumW, 0,mBins*sizeof(r_8));
+    delete [] mSumY;  mSumY  = new r_8[nbinew]; memset(mSumY, 0,mBins*sizeof(r_8));
+    delete [] mSumY2; mSumY2 = new r_8[nbinew]; memset(mSumY2,0,mBins*sizeof(r_8));
+    delete [] mSumW;  mSumW  = new r_8[nbinew]; memset(mSumW, 0,mBins*sizeof(r_8));
   }
 
@@ -294,20 +308,20 @@
     r_8 wY = 0., wY2 = 0., wW = 0.;
     if( ima == imi ) {
-      wY  = H.SumY[imi]  * binWidth/H.binWidth;
-      wY2 = H.SumY2[imi] * binWidth/H.binWidth;
-      wW  = H.SumW[imi]  * binWidth/H.binWidth;
+      wY  = H.mSumY[imi]  * binWidth/H.binWidth;
+      wY2 = H.mSumY2[imi] * binWidth/H.binWidth;
+      wW  = H.mSumW[imi]  * binWidth/H.binWidth;
     } else {
-      wY  += H.SumY[imi]  * (H.BinHighEdge(imi)-xmi)/H.binWidth;
-      wY  += H.SumY[ima]  * (xma -H.BinLowEdge(ima))/H.binWidth;
-      wY2 += H.SumY2[imi] * (H.BinHighEdge(imi)-xmi)/H.binWidth;
-      wY2 += H.SumY2[ima] * (xma -H.BinLowEdge(ima))/H.binWidth;
-      wW  += H.SumW[imi]  * (H.BinHighEdge(imi)-xmi)/H.binWidth;
-      wW  += H.SumW[ima]  * (xma -H.BinLowEdge(ima))/H.binWidth;
+      wY  += H.mSumY[imi]  * (H.BinHighEdge(imi)-xmi)/H.binWidth;
+      wY  += H.mSumY[ima]  * (xma -H.BinLowEdge(ima))/H.binWidth;
+      wY2 += H.mSumY2[imi] * (H.BinHighEdge(imi)-xmi)/H.binWidth;
+      wY2 += H.mSumY2[ima] * (xma -H.BinLowEdge(ima))/H.binWidth;
+      wW  += H.mSumW[imi]  * (H.BinHighEdge(imi)-xmi)/H.binWidth;
+      wW  += H.mSumW[ima]  * (xma -H.BinLowEdge(ima))/H.binWidth;
       if(ima>imi+1) for(int_4 ii=imi+1;ii<ima;ii++)
-	{wY += H.SumY[ii]; wY2 += H.SumY2[ii]; wW += H.SumW[ii];}
+	{wY += H.mSumY[ii]; wY2 += H.mSumY2[ii]; wW += H.mSumW[ii];}
     }
-    SumY[i] += wY; SumY2[i] += wY2; SumW[i] += wW;
-  }
-  // On synchronise les tableaux Sum?? et l'Histogramme
+    mSumY[i] += wY; mSumY2[i] += wY2; mSumW[i] += wW;
+  }
+  // On synchronise les tableaux mSum?? et l'Histogramme
   updatehisto();
 }
@@ -317,4 +331,5 @@
   UpdateHisto();
   Histo::Show(os);
+  os <<"       ymin="<<YMin<<" ymax="<<YMax<<"  opt="<<Opt<< endl;
 }
 
@@ -346,13 +361,14 @@
 // Lecture des donnees propres a l'histogramme de profil.
 is.GetLine(strg,255);
-dobj->SumY  = new r_8[dobj->mBins];
-dobj->SumY2 = new r_8[dobj->mBins];
-dobj->SumW  = new r_8[dobj->mBins];
-is.Get(dobj->SumY,  dobj->mBins);
-is.Get(dobj->SumY2, dobj->mBins);
-is.Get(dobj->SumW,  dobj->mBins);
+dobj->mSumY  = new r_8[dobj->mBins];
+dobj->mSumY2 = new r_8[dobj->mBins];
+dobj->mSumW  = new r_8[dobj->mBins];
+is.Get(dobj->mSumY,  dobj->mBins);
+is.Get(dobj->mSumY2, dobj->mBins);
+is.Get(dobj->mSumW,  dobj->mBins);
 
 // Lecture de l'histogramme
 is >> (Histo&)(*dobj);
+
 return;
 }
@@ -379,11 +395,9 @@
 sprintf(strg,"HProf: SumY SumY2 SumW");
 os.PutLine(strg);
-os.Put(dobj->SumY,  dobj->mBins);
-os.Put(dobj->SumY2, dobj->mBins);
-os.Put(dobj->SumW,  dobj->mBins);
+os.Put(dobj->mSumY,  dobj->mBins);
+os.Put(dobj->mSumY2, dobj->mBins);
+os.Put(dobj->mSumW,  dobj->mBins);
 
 // Ecriture de l'histogramme
-// FIO_Histo fio_h((Histo&)*dobj);
-// fio_h.Write(os);
 os << (Histo&)(*dobj);
 
Index: trunk/SophyaLib/HiStats/hisprof.h
===================================================================
--- trunk/SophyaLib/HiStats/hisprof.h	(revision 3050)
+++ trunk/SophyaLib/HiStats/hisprof.h	(revision 3053)
@@ -56,4 +56,6 @@
                {UpdateHisto();
                 return (mErr2[i]>0.) ? sqrt(mErr2[i]) : 0.;}
+  //! Retourne le carre de la dispersion/erreur du bin i
+  inline r_8 SumW(int_4 i) const {return mSumW[i];}
 
   // Operators
@@ -65,4 +67,5 @@
 
   virtual void Show(ostream& os) const;
+  inline  void Show() const { Show(cout); }
   //! Print, voir detail dans Histo::Print
   inline void Print(int_4 dyn=100,r_8 hmin=1.,r_8 hmax=-1.
@@ -71,10 +74,11 @@
 
 protected:
+  void CreateOrResize(r_8 xMin, r_8 xMax, int_4 nBin, r_8 yMin=1., r_8 yMax=-1.);
   void Delete();
   void updatehisto() const;
 
-  r_8*         SumY;  //!< somme
-  r_8*         SumY2; //!< somme des carres
-  r_8*         SumW;  //!< somme des poids
+  r_8*         mSumY;  //!< somme
+  r_8*         mSumY2; //!< somme des carres
+  r_8*         mSumW;  //!< somme des poids
   mutable bool Ok;    //!< true if update fait
   r_8          YMin;  //!< limite minimum Y pour somme
@@ -83,4 +87,7 @@
 };
 
+/*! Prints histogram information on stream \b s (h.Show(s)) */
+inline ostream& operator << (ostream& s, HProf const & h)
+  {  h.Show(s);  return(s);  }
 
 /*! \ingroup HiStats \fn operator<<(POuttPersist&, HProf)
Index: trunk/SophyaLib/HiStats/histerr.cc
===================================================================
--- trunk/SophyaLib/HiStats/histerr.cc	(revision 3050)
+++ trunk/SophyaLib/HiStats/histerr.cc	(revision 3053)
@@ -17,5 +17,5 @@
 /*! Constructeur par defaut */
 HistoErr::HistoErr(void)
-  : Histo(), mNData(NULL), mCorrel(0)
+: Histo(), mNData(NULL), mCorrel(0)
 {
 }
@@ -24,9 +24,7 @@
 /*! Constructeur d'un histo de nBin bins allant de xMin a xMax */
 HistoErr::HistoErr(r_8 xMin, r_8 xMax, int_4 nBin)
-: Histo(xMin,xMax,nBin), mNData(NULL), mCorrel(0)
-{
- this->Errors();
- allocate_mNData(nBin);
- Zero();
+: Histo(), mNData(NULL)
+{
+  CreateOrResize(xMin,xMax,nBin);
 }
 
@@ -34,8 +32,7 @@
 /*! Constructeur par copie */
 HistoErr::HistoErr(const HistoErr& H)
-: Histo(H), mNData(NULL), mCorrel(H.mCorrel)
-{
- allocate_mNData(H.mBins);
- if(mBins>0) memcpy(mNData,H.mNData,mBins*sizeof(r_8));
+: Histo(H), mNData((H.mBins>0)? new r_8[H.mBins] : NULL), mCorrel(H.mCorrel)
+{
+ if(mNData>0) memcpy(mNData,H.mNData,mBins*sizeof(r_8));
 }
 
@@ -48,10 +45,22 @@
 
 /********* Methode *********/
+/*! Gestion de l'allocation */
+void HistoErr::CreateOrResize(r_8 xMin, r_8 xMax, int_4 nBin)
+{
+  //cout<<"HistoErr::CreateOrResize()"<<endl;
+  Histo::CreateOrResize(xMin,xMax,nBin);
+  Histo::Errors();
+  allocate_mNData(nBin);
+  mCorrel = 0;
+}
+
+/********* Methode *********/
 /*! Allocation du tableau mNData */
 void HistoErr::allocate_mNData(int nbin)
 {
- if(nbin<=0) return;
- if(mNData) {delete [] mNData; mNData=NULL;}
- mNData = new r_8[nbin];
+  if(mNData) {delete [] mNData; mNData=NULL;}
+  if(nbin<=0) return;
+  mNData = new r_8[nbin];
+  memset(mNData,0,nbin*sizeof(r_8));
 }
 
@@ -60,6 +69,8 @@
 void HistoErr::Delete(void)
 {
- Histo::Delete();
- if(mNData) {delete [] mNData; mNData=NULL;}
+  //cout<<"HistoErr::Delete()"<<endl;
+  Histo::Delete();
+  if(mNData) {delete [] mNData; mNData=NULL;}
+  mCorrel = 0;
 }
 
@@ -70,7 +81,7 @@
 void HistoErr::Zero(void)
 {
- Histo::Zero();
- if(mNData) memset(mNData,0,mBins*sizeof(r_8));
- mCorrel = 0;
+  Histo::Zero();
+  if(mNData) memset(mNData,0,mBins*sizeof(r_8));
+  mCorrel = 0;
 }
 
@@ -201,4 +212,14 @@
 }
 
+/********* Methode *********/
+/*!
+  Print info
+*/
+void HistoErr::Show(ostream & os) const
+{
+  Histo::Show(os);
+  os <<"       ncorrel="<<mCorrel<< endl;
+}
+
 ///////////////////////////////////////////////////////////
 // --------------------------------------------------------
Index: trunk/SophyaLib/HiStats/histerr.h
===================================================================
--- trunk/SophyaLib/HiStats/histerr.h	(revision 3050)
+++ trunk/SophyaLib/HiStats/histerr.h	(revision 3053)
@@ -78,6 +78,11 @@
   HistoErr& operator = (const HistoErr& h);
 
+  // Print
+  virtual void Show(ostream& os) const;
+  inline  void Show() const { Show(cout); }
+
 protected:
   void allocate_mNData(int nbin);
+  void CreateOrResize(r_8 xMin, r_8 xMax, int_4 nBin);
   void Delete(void);
 
@@ -85,4 +90,8 @@
   int_4 mCorrel;  //!< Nombre d'appels a ToCorrel(+1) ou FromCorrel(-1)
 };
+
+/*! Prints histogram information on stream \b s (h.Show(s)) */
+inline ostream& operator << (ostream& s, HistoErr const & h)
+  {  h.Show(s);  return(s);  }
 
 /*! \ingroup HiStats \fn operator<<(POuttPersist&,HistoErr)
Index: trunk/SophyaLib/HiStats/histos.cc
===================================================================
--- trunk/SophyaLib/HiStats/histos.cc	(revision 3050)
+++ trunk/SophyaLib/HiStats/histos.cc	(revision 3053)
@@ -1,4 +1,4 @@
 //
-// $Id: histos.cc,v 1.22 2006-08-07 17:38:47 cmv Exp $
+// $Id: histos.cc,v 1.23 2006-08-12 17:29:29 cmv Exp $
 //
 
@@ -22,8 +22,7 @@
 /*! Constructeur par defaut */
 Histo::Histo()
-: mData(NULL), mErr2(NULL),
-  mUnder(0), mOver(0), nHist(0), nEntries(0),
-  mBins(0), mMin(0), mMax(0),
-  binWidth(0)
+: mData(NULL), mErr2(NULL)
+,  mUnder(0.), mOver(0.), nHist(0.), nEntries(0)
+,  mBins(0), mMin(0.), mMax(0.), binWidth(0.)
 {
 }
@@ -32,11 +31,7 @@
 /*! Constructeur d'un histo de nBin bins allant de xMin a xMax */
 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();
+: mData(NULL), mErr2(NULL)
+{
+  CreateOrResize(xMin,xMax,nBin);
 }
 
@@ -44,11 +39,7 @@
 /*! 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();
+: mData(NULL), mErr2(NULL)
+{
+  CreateOrResize((r_8)xMin,(r_8)xMax,nBin);
 }
 
@@ -68,20 +59,35 @@
 
 /********* Methode *********/
+/*! Destructeur */
+Histo::~Histo()
+{
+  Delete();
+}
+
+/********* Methode *********/
+/*! Gestion de l'allocation */
+void Histo::CreateOrResize(r_8 xMin, r_8 xMax, int_4 nBin)
+{
+  //cout<<"Histo::CreateOrResize()"<<endl;
+  if(mData != NULL) {delete[] mData; mData = NULL;}
+  if(mErr2 != NULL) {delete[] mErr2; mErr2 = NULL;}
+  if(nBin>0) {mData = new r_8[nBin]; memset(mData,0,nBin*sizeof(r_8));}
+  mBins = nBin;
+  mMin = xMin; mMax = xMax;
+  binWidth = (nBin>0) ? (mMax-mMin)/nBin : 0.;
+  mUnder = mOver = nHist = 0.;
+  nEntries = 0;
+}
+
+/********* Methode *********/
 /*! Gestion de la des-allocation */
 void Histo::Delete()
 {
-  if( mData != NULL ) { delete[] mData; mData = NULL;}
-  if( mErr2 != NULL ) { delete[] mErr2; mErr2 = NULL;}
-  mUnder = mOver = mMin = mMax = binWidth= 0.;
-  nHist = 0.;
-  mBins = 0;
-  nEntries = 0;
-}
-
-/********* Methode *********/
-/*! Destructeur */
-Histo::~Histo()
-{
-Delete();
+ //cout<<"Histo::Delete()"<<endl;
+ if(mData != NULL) {delete[] mData; mData = NULL;}
+ if(mErr2 != NULL) {delete[] mErr2; mErr2 = NULL;}
+ mUnder = mOver = mMin = mMax = binWidth = nHist = 0.;
+ mBins = 0;
+ nEntries = 0;
 }
 
@@ -94,8 +100,7 @@
   if(mBins<=0 || mData==NULL) return;
   memset(mData,0,mBins*sizeof(r_8));
-  mUnder = mOver = 0;
-  nHist = 0;
+  if(mErr2) memset(mErr2,0, mBins*sizeof(r_8));
+  mUnder = mOver = nHist = 0;
   nEntries = 0;
-  if(mErr2) memset(mErr2, 0, mBins*sizeof(r_8));
 }
 
@@ -106,6 +111,7 @@
 void Histo::Errors()
 {
+ if(mErr2 != NULL) {delete[] mErr2; mErr2 = NULL;}
  if(mBins<=0) return;
- if(mErr2==NULL) mErr2 = new r_8[mBins];
+ mErr2 = new r_8[mBins];
  memset(mErr2,0,mBins*sizeof(r_8));
 }
@@ -141,11 +147,9 @@
   mData = new r_8[h.mBins];
   if(h.mErr2) mErr2 = new r_8[h.mBins];
-  mUnder = h.mUnder;
-  mOver = h.mOver;
+  mUnder = h.mUnder; mOver = h.mOver;
   nHist = h.nHist;
   nEntries = h.nEntries;
   mBins = h.mBins;
-  mMin = h.mMin;
-  mMax = h.mMax;
+  mMin = h.mMin; mMax = h.mMax;
   binWidth = h.binWidth;
   
Index: trunk/SophyaLib/HiStats/histos.h
===================================================================
--- trunk/SophyaLib/HiStats/histos.h	(revision 3050)
+++ trunk/SophyaLib/HiStats/histos.h	(revision 3053)
@@ -1,5 +1,5 @@
 // This may look like C code, but it is really -*- C++ -*-
 //
-// $Id: histos.h,v 1.22 2006-08-11 16:10:13 cmv Exp $
+// $Id: histos.h,v 1.23 2006-08-12 17:29:29 cmv Exp $
 //
 
@@ -158,5 +158,6 @@
   
 protected:
-  void Delete();
+  void CreateOrResize(r_8 xMin, r_8 xMax, int_4 nBin);
+  void Delete(void); // Ne pas passer en "virtual"
 
   r_8*   mData;    //!< donnees
Index: trunk/SophyaLib/HiStats/histos2.cc
===================================================================
--- trunk/SophyaLib/HiStats/histos2.cc	(revision 3050)
+++ trunk/SophyaLib/HiStats/histos2.cc	(revision 3053)
@@ -39,4 +39,18 @@
 
 ///////////////////////////////////////////////////////////////////
+
+/*!
+  Constructeur par defaut.
+*/
+Histo2D::Histo2D()
+: mData(NULL), mErr2(NULL)
+, nHist(0), nEntries(0)
+, mNx(0), mNy(0), mNxy(0), mXmin(0), mXmax(0), mYmin(0), mYmax(0), mWBinx(0), mWBiny(0)
+, mHprojx(NULL), mHprojy(NULL)
+{
+ for(int_4 i=0;i<3;i++) for(int_4 j=0;j<3;j++) mOver[i][j]=0.;
+ mB_s.H = NULL;
+}
+
 /*!
   Createur d'un histogramme 2D ayant nxBin,nyBin bins
@@ -44,15 +58,7 @@
 */
 Histo2D::Histo2D(r_8 xMin,r_8 xMax,int_4 nxBin,r_8 yMin,r_8 yMax,int_4 nyBin)
-      : mData(new r_8[nxBin*nyBin]), mErr2(NULL)
-      , nHist(0), nEntries(0)
-      , mNx(nxBin), mNy(nyBin), mNxy(nxBin*nyBin)
-      , mXmin(xMin), mXmax(xMax), mYmin(yMin), mYmax(yMax)
-      , mWBinx((xMax - xMin)/nxBin), mWBiny((yMax - yMin)/nyBin)
-      , mHprojx(NULL), mHprojy(NULL)
-{
-ASSERT(nxBin>0 && nyBin>0 && xMin<xMax && yMin<yMax);
-for(int_4 i=0;i<3;i++) for(int_4 j=0;j<3;j++) mOver[i][j]=0.;
-Zero();
-mB_s.H = NULL;
+: mData(NULL), mErr2(NULL), mHprojx(NULL), mHprojy(NULL)
+{
+  CreateOrResize(xMin,xMax,nxBin,yMin,yMax,nyBin);
 }
 
@@ -62,15 +68,7 @@
 */
 Histo2D::Histo2D(r_4 xMin,r_4 xMax,int_4 nxBin,r_4 yMin,r_4 yMax,int_4 nyBin)
-      : mData(new r_8[nxBin*nyBin]), mErr2(NULL)
-      , nHist(0), nEntries(0)
-      , mNx(nxBin), mNy(nyBin), mNxy(nxBin*nyBin)
-      , mXmin((r_8)xMin), mXmax((r_8)xMax), mYmin((r_8)yMin), mYmax((r_8)yMax)
-      , mWBinx((xMax - xMin)/nxBin), mWBiny((yMax - yMin)/nyBin)
-      , mHprojx(NULL), mHprojy(NULL)
-{
-ASSERT(nxBin>0 && nyBin>0 && xMin<xMax && yMin<yMax);
-for(int_4 i=0;i<3;i++) for(int_4 j=0;j<3;j++) mOver[i][j]=0.;
-Zero();
-mB_s.H = NULL;
+: mData(NULL), mErr2(NULL), mHprojx(NULL), mHprojy(NULL)
+{
+  CreateOrResize((r_8)xMin,(r_8)xMax,nxBin,(r_8)yMin,(r_8)yMax,nyBin);
 }
 
@@ -142,19 +140,29 @@
 
 /*!
-  Constructeur par defaut.
-*/
-Histo2D::Histo2D()
-      : mData(NULL), mErr2(NULL)
-      , nHist(0), nEntries(0)
-      , mNx(0), mNy(0), mNxy(0)
-      , mXmin(0), mXmax(0), mYmin(0), mYmax(0)
-      , mWBinx(0), mWBiny(0)
-      , mHprojx(NULL), mHprojy(NULL)
-{
-for(int_4 i=0;i<3;i++) for(int_4 j=0;j<3;j++) mOver[i][j]=0.;
-mB_s.H = NULL;
-}
-
-///////////////////////////////////////////////////////////////////
+  Destructeur.
+*/
+Histo2D::~Histo2D()
+{
+  Delete();
+}
+
+///////////////////////////////////////////////////////////////////
+/*!
+  allocation de la place de l'histogramme (fct privee).
+*/
+void Histo2D::CreateOrResize(r_8 xMin,r_8 xMax,int_4 nxBin,r_8 yMin,r_8 yMax,int_4 nyBin)
+{
+ int_8 n = nxBin*nyBin;
+ if(mData!=NULL) {delete[] mData; mData = NULL;}
+ if(n>0) {mData = new r_8[n]; memset(mData, 0, n*sizeof(r_8));}
+ mNx = nxBin; mNy = nyBin; mNxy = nxBin*nyBin;
+ mXmin = xMin; mXmax = xMax; mYmin = yMin; mYmax = yMax;
+ mWBinx = (nxBin>0) ? (xMax - xMin)/nxBin: 0.;
+ mWBiny = (nyBin>0) ? (yMax - yMin)/nyBin: 0.;
+ nHist = 0; nEntries = 0;
+ for(int_4 i=0;i<3;i++) for(int_4 j=0;j<3;j++) mOver[i][j]=0.;
+ mB_s.H = NULL;
+}
+
 /*!
   Desallocation de la place de l'histogramme (fct privee).
@@ -163,5 +171,4 @@
 {
   if( mData != NULL ) { delete[] mData; mData = NULL;}
-
   if( mErr2 != NULL ) { delete[] mErr2; mErr2 = NULL;}
 
@@ -180,13 +187,5 @@
   mWBinx = 0; mWBiny = 0;
   for(int_4 i=0;i<3;i++) for(int_4 j=0;j<3;j++) mOver[i][j]=0.;
-  mB_s.H = NULL;
-}
-
-/*!
-  Destructeur.
-*/
-Histo2D::~Histo2D()
-{
-Delete();
+  mB_s.H = NULL;  // Ne pas faire de delete!
 }
 
@@ -219,8 +218,8 @@
 void Histo2D::Errors()
 {
- if( mNxy > 0 ) {
-   if(mErr2==NULL) mErr2 = new r_8[mNxy];
-   memset(mErr2, 0, mNxy*sizeof(r_8));
- }
+ if(mErr2!=NULL) {delete[] mErr2; mErr2 = NULL;}
+ if(mNxy <= 0) return;
+ mErr2 = new r_8[mNxy];
+ memset(mErr2,0,mNxy*sizeof(r_8));
 }
 
Index: trunk/SophyaLib/HiStats/histos2.h
===================================================================
--- trunk/SophyaLib/HiStats/histos2.h	(revision 3050)
+++ trunk/SophyaLib/HiStats/histos2.h	(revision 3053)
@@ -143,4 +143,5 @@
   // Print et Display ASCII
   virtual void Show(ostream& os) const;
+  inline  void Show() const { Show(cout); }
   inline void  PrintStatus() const { Show(cout); }
   
@@ -211,5 +212,6 @@
 #endif
 
-  void Delete();
+  void CreateOrResize(r_8 xMin,r_8 xMax,int_4 nxBin,r_8 yMin,r_8 yMax,int_4 nyBin);
+  void Delete(void);
 
   r_8*        mData; //!< donnees
Index: trunk/SophyaLib/HiStats/smakefile
===================================================================
--- trunk/SophyaLib/HiStats/smakefile	(revision 3050)
+++ trunk/SophyaLib/HiStats/smakefile	(revision 3053)
@@ -12,6 +12,6 @@
  
 $(SOPHYAOBJP)basedtable.o: basedtable.cc basedtable.h \
-  $(SOPHYAINCP)machdefs.h ntupintf.h \
-  $(SOPHYAINCP)dvlist.h \
+  $(SOPHYAINCP)machdefs.h \
+  ntupintf.h $(SOPHYAINCP)dvlist.h \
   $(SOPHYAINCP)objfio.h \
   $(SOPHYAINCP)machdefs.h \
@@ -40,6 +40,6 @@
  
 $(SOPHYAOBJP)datatable.o: datatable.cc datatable.h basedtable.h \
-  $(SOPHYAINCP)machdefs.h ntupintf.h \
-  $(SOPHYAINCP)dvlist.h \
+  $(SOPHYAINCP)machdefs.h \
+  ntupintf.h $(SOPHYAINCP)dvlist.h \
   $(SOPHYAINCP)objfio.h \
   $(SOPHYAINCP)machdefs.h \
@@ -73,28 +73,29 @@
  
 $(SOPHYAOBJP)fio_dtable.o: fio_dtable.cc datatable.h basedtable.h \
-  $(SOPHYAINCP)machdefs.h ntupintf.h \
-  $(SOPHYAINCP)dvlist.h \
-  $(SOPHYAINCP)objfio.h \
-  $(SOPHYAINCP)machdefs.h \
-  $(SOPHYAINCP)anydataobj.h \
-  $(SOPHYAINCP)ppersist.h \
-  $(SOPHYAINCP)pexceptions.h \
-  $(SOPHYAINCP)gnumd5.h \
-  $(SOPHYAINCP)ppfbinstream.h \
-  $(SOPHYAINCP)rawstream.h \
-  $(SOPHYAINCP)ppfnametag.h \
-  $(SOPHYAINCP)mutyv.h \
-  $(SOPHYAINCP)timestamp.h \
-  $(SOPHYAINCP)segdatablock.h \
-  $(SOPHYAINCP)tvector.h \
-  $(SOPHYAINCP)tmatrix.h \
-  $(SOPHYAINCP)tarray.h \
-  $(SOPHYAINCP)basarr.h \
-  $(SOPHYAINCP)dvlist.h \
-  $(SOPHYAINCP)ndatablock.h \
-  $(SOPHYAINCP)utilarr.h \
-  $(SOPHYAINCP)tmatrix_tsnl.h \
-  $(SOPHYAINCP)tvector_tsnl.h \
-  $(SOPHYAINCP)objfio.h swppfdtable.h \
+  $(SOPHYAINCP)machdefs.h \
+  ntupintf.h $(SOPHYAINCP)dvlist.h \
+  $(SOPHYAINCP)objfio.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)anydataobj.h \
+  $(SOPHYAINCP)ppersist.h \
+  $(SOPHYAINCP)pexceptions.h \
+  $(SOPHYAINCP)gnumd5.h \
+  $(SOPHYAINCP)ppfbinstream.h \
+  $(SOPHYAINCP)rawstream.h \
+  $(SOPHYAINCP)ppfnametag.h \
+  $(SOPHYAINCP)mutyv.h \
+  $(SOPHYAINCP)timestamp.h \
+  $(SOPHYAINCP)segdatablock.h \
+  $(SOPHYAINCP)tvector.h \
+  $(SOPHYAINCP)tmatrix.h \
+  $(SOPHYAINCP)tarray.h \
+  $(SOPHYAINCP)basarr.h \
+  $(SOPHYAINCP)dvlist.h \
+  $(SOPHYAINCP)ndatablock.h \
+  $(SOPHYAINCP)utilarr.h \
+  $(SOPHYAINCP)tmatrix_tsnl.h \
+  $(SOPHYAINCP)tvector_tsnl.h \
+  $(SOPHYAINCP)objfio.h \
+  swppfdtable.h \
   $(SOPHYAINCP)swsegdb.h \
   $(SOPHYAINCP)segdatablock.h \
@@ -109,6 +110,6 @@
 $(SOPHYAOBJP)hisprof.o: hisprof.cc \
   $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h hisprof.h \
-  $(SOPHYAINCP)peida.h \
+  $(SOPHYAINCP)machdefs.h \
+  hisprof.h $(SOPHYAINCP)peida.h \
   $(SOPHYAINCP)machdefs.h \
   $(SOPHYAINCP)utils.h \
@@ -142,18 +143,19 @@
 $(SOPHYAOBJP)histerr.o: histerr.cc \
   $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h histinit.h \
+  $(SOPHYAINCP)machdefs.h \
+  histinit.h \
   $(SOPHYAINCP)ntoolsinit.h \
   $(SOPHYAINCP)tarrinit.h \
   $(SOPHYAINCP)sophyainit.h \
-  $(SOPHYAINCP)machdefs.h histerr.h \
-  $(SOPHYAINCP)objfio.h \
-  $(SOPHYAINCP)anydataobj.h \
-  $(SOPHYAINCP)ppersist.h \
-  $(SOPHYAINCP)pexceptions.h \
-  $(SOPHYAINCP)gnumd5.h \
-  $(SOPHYAINCP)ppfbinstream.h \
-  $(SOPHYAINCP)rawstream.h \
-  $(SOPHYAINCP)ppfnametag.h histos.h \
-  $(SOPHYAINCP)peida.h \
+  $(SOPHYAINCP)machdefs.h \
+  histerr.h $(SOPHYAINCP)objfio.h \
+  $(SOPHYAINCP)anydataobj.h \
+  $(SOPHYAINCP)ppersist.h \
+  $(SOPHYAINCP)pexceptions.h \
+  $(SOPHYAINCP)gnumd5.h \
+  $(SOPHYAINCP)ppfbinstream.h \
+  $(SOPHYAINCP)rawstream.h \
+  $(SOPHYAINCP)ppfnametag.h \
+  histos.h $(SOPHYAINCP)peida.h \
   $(SOPHYAINCP)utils.h \
   $(SOPHYAINCP)perrors.h \
@@ -178,5 +180,6 @@
 $(SOPHYAOBJP)histinit.o: histinit.cc \
   $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h histinit.h \
+  $(SOPHYAINCP)machdefs.h \
+  histinit.h \
   $(SOPHYAINCP)ntoolsinit.h \
   $(SOPHYAINCP)tarrinit.h \
@@ -208,9 +211,11 @@
   $(SOPHYAINCP)tvector_tsnl.h \
   $(SOPHYAINCP)ppersist.h \
-  $(SOPHYAINCP)anydataobj.h histos2.h \
-  $(SOPHYAINCP)utils.h hisprof.h histerr.h \
-  ntuple.h ntupintf.h $(SOPHYAINCP)dvlist.h \
-  xntuple.h datatable.h basedtable.h \
-  $(SOPHYAINCP)segdatablock.h swppfdtable.h \
+  $(SOPHYAINCP)anydataobj.h \
+  histos2.h $(SOPHYAINCP)utils.h \
+  hisprof.h histerr.h ntuple.h ntupintf.h \
+  $(SOPHYAINCP)dvlist.h xntuple.h \
+  datatable.h basedtable.h \
+  $(SOPHYAINCP)segdatablock.h \
+  swppfdtable.h \
   $(SOPHYAINCP)swsegdb.h \
   $(SOPHYAINCP)segdatablock.h \
@@ -222,6 +227,6 @@
 $(SOPHYAOBJP)histos2.o: histos2.cc \
   $(SOPHYAINCP)sopnamsp.h \
-  $(SOPHYAINCP)machdefs.h histos2.h \
-  $(SOPHYAINCP)peida.h \
+  $(SOPHYAINCP)machdefs.h \
+  histos2.h $(SOPHYAINCP)peida.h \
   $(SOPHYAINCP)machdefs.h \
   $(SOPHYAINCP)utils.h \
@@ -253,5 +258,6 @@
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  histos2.cc
  
-$(SOPHYAOBJP)histos.o: histos.cc $(SOPHYAINCP)sopnamsp.h \
+$(SOPHYAOBJP)histos.o: histos.cc \
+  $(SOPHYAINCP)sopnamsp.h \
   $(SOPHYAINCP)machdefs.h histos.h \
   $(SOPHYAINCP)objfio.h \
@@ -290,5 +296,6 @@
  
 $(SOPHYAOBJP)ntupintf.o: ntupintf.cc \
-  $(SOPHYAINCP)sopnamsp.h ntupintf.h \
+  $(SOPHYAINCP)sopnamsp.h \
+  ntupintf.h \
   $(SOPHYAINCP)machdefs.h \
   $(SOPHYAINCP)pexceptions.h \
@@ -296,5 +303,6 @@
 	$(CXXCOMPILE) $(CXXTEMPFLG) -o $@  ntupintf.cc
  
-$(SOPHYAOBJP)ntuple.o: ntuple.cc $(SOPHYAINCP)sopnamsp.h \
+$(SOPHYAOBJP)ntuple.o: ntuple.cc \
+  $(SOPHYAINCP)sopnamsp.h \
   $(SOPHYAINCP)strutil.h \
   $(SOPHYAINCP)perrors.h \
@@ -307,5 +315,6 @@
   $(SOPHYAINCP)ppfbinstream.h \
   $(SOPHYAINCP)rawstream.h \
-  $(SOPHYAINCP)ppfnametag.h ntupintf.h \
+  $(SOPHYAINCP)ppfnametag.h \
+  ntupintf.h \
   $(SOPHYAINCP)machdefs.h \
   $(SOPHYAINCP)ppersist.h \
@@ -317,14 +326,16 @@
  
 $(SOPHYAOBJP)proxtuple.o: proxtuple.cc \
-  $(SOPHYAINCP)sopnamsp.h proxtuple.h \
-  ntuple.h $(SOPHYAINCP)objfio.h \
-  $(SOPHYAINCP)machdefs.h \
-  $(SOPHYAINCP)anydataobj.h \
-  $(SOPHYAINCP)ppersist.h \
-  $(SOPHYAINCP)pexceptions.h \
-  $(SOPHYAINCP)gnumd5.h \
-  $(SOPHYAINCP)ppfbinstream.h \
-  $(SOPHYAINCP)rawstream.h \
-  $(SOPHYAINCP)ppfnametag.h ntupintf.h \
+  $(SOPHYAINCP)sopnamsp.h \
+  proxtuple.h ntuple.h \
+  $(SOPHYAINCP)objfio.h \
+  $(SOPHYAINCP)machdefs.h \
+  $(SOPHYAINCP)anydataobj.h \
+  $(SOPHYAINCP)ppersist.h \
+  $(SOPHYAINCP)pexceptions.h \
+  $(SOPHYAINCP)gnumd5.h \
+  $(SOPHYAINCP)ppfbinstream.h \
+  $(SOPHYAINCP)rawstream.h \
+  $(SOPHYAINCP)ppfnametag.h \
+  ntupintf.h \
   $(SOPHYAINCP)machdefs.h \
   $(SOPHYAINCP)ppersist.h \
@@ -336,6 +347,6 @@
  
 $(SOPHYAOBJP)swppfdtable.o: swppfdtable.cc swppfdtable.h basedtable.h \
-  $(SOPHYAINCP)machdefs.h ntupintf.h \
-  $(SOPHYAINCP)dvlist.h \
+  $(SOPHYAINCP)machdefs.h \
+  ntupintf.h $(SOPHYAINCP)dvlist.h \
   $(SOPHYAINCP)objfio.h \
   $(SOPHYAINCP)machdefs.h \
@@ -380,6 +391,6 @@
   $(SOPHYAINCP)ppersist.h \
   $(SOPHYAINCP)perrors.h xntuple.h \
-  $(SOPHYAINCP)machdefs.h ntupintf.h \
-  $(SOPHYAINCP)dvlist.h \
+  $(SOPHYAINCP)machdefs.h \
+  ntupintf.h $(SOPHYAINCP)dvlist.h \
   $(SOPHYAINCP)objfio.h \
   $(SOPHYAINCP)anydataobj.h \
