Index: trunk/SophyaPI/PI/parradapter.cc
===================================================================
--- trunk/SophyaPI/PI/parradapter.cc	(revision 140)
+++ trunk/SophyaPI/PI/parradapter.cc	(revision 204)
@@ -22,5 +22,5 @@
 
 /* --Methode-- */
-void P1DArrayAdapter::DefineXCoordinate(float x0, float dx)
+void P1DArrayAdapter::DefineXCoordinate(double x0, double dx)
 {
 mOx = x0;  mDx = dx;
@@ -28,5 +28,5 @@
 
 /* --Methode-- */
-float P1DArrayAdapter::X(int i)
+double P1DArrayAdapter::X(int i)
 {
 return(mOx+mDx*i);
@@ -60,5 +60,5 @@
 
 /* --Methode-- */
-void P2DArrayAdapter::DefineXYCoordinates(float x0, float y0, float dx, float dy)
+void P2DArrayAdapter::DefineXYCoordinates(double x0, double y0, double dx, double dy)
 {
 mOx = x0;   mOy = y0;
@@ -67,5 +67,5 @@
 
 /* --Methode-- */
-void P2DArrayAdapter::XYfromxy(int ix, int iy, float& x, float& y)
+void P2DArrayAdapter::XYfromxy(int ix, int iy, double& x, double& y)
 {
 x = mOx+ix*mDx;
@@ -74,5 +74,5 @@
 
 /* --Methode-- */
-int P2DArrayAdapter::CheckDyn(float& min, float& max, float& moy, float& sig, int& nbnul, int& nbsat, int vit)
+int P2DArrayAdapter::CheckDyn(double& min, double& max, double& moy, double& sig, int& nbnul, int& nbsat, int vit)
 {
 // TIMEF ; 
@@ -85,7 +85,7 @@
 
 if (min >= max) { min = -9.e19; max = 9.e19; }
-float minpix = max;
-float maxpix = min; 
-float pixv;
+double minpix = max;
+double maxpix = min; 
+double pixv;
 // printf("DEBUG_CHECKDYN-IN %d - %g %g ", vit, min, max);
 
@@ -130,5 +130,5 @@
 
 /* --Methode-- */
-void P2DArrayAdapter::ComputeLut_PicHisto(float& min, float& max, int nbsig, float fracmax)
+void P2DArrayAdapter::ComputeLut_PicHisto(double& min, double& max, int nbsig, double fracmax)
 {
 // TIMEF ; 
@@ -143,17 +143,20 @@
 
 //  Variable decrivant l'histogramme 
-float minhis, maxhis, binwidth;
+double minhis, maxhis, binwidth;
 int under,over,tothis;
 int *phis;
 int *q;
 
-float MINDYNAMIC = 1.e-5;          /* Gamme dynamique minimale (MaxAff-MinAff)*/
-float FRACPIC =	0.6065;            /*  Valeur de exp(-0.5)   */
-
-
-int nbnul, nbsat, nok;
-float moy, sig;
-if ( min >= (max-MINDYNAMIC) ) nok = CheckDyn(min, max, moy, sig, nbnul, nbsat);
-if (nok < 1) { min=0.; max = 1.; return; }
+double MINDYNAMIC = 1.e-8;          /* Gamme dynamique minimale (MaxAff-MinAff)*/
+double FRACPIC = 0.6065;            /*  Valeur de exp(-0.5)   */
+
+
+
+if ( min >= (max-MINDYNAMIC) ) { 
+  int nbnul, nbsat, nok;
+  double moy, sig; 
+  nok = CheckDyn(min, max, moy, sig, nbnul, nbsat, vitesse);
+  if (nok < 1) { min=0.; max = 1.;  return; }
+  }
 if ( min >= (max-MINDYNAMIC) )  max = min+MINDYNAMIC;
 minhis = min;
@@ -164,4 +167,5 @@
   maxhis = nbin*binwidth + minhis;
   }
+// printf("DEBUG nbin minhis maxhis binwidth = %d %g %g %g \n", nbin, minhis, maxhis, binwidth);
 
 /* allocation dynamique de memoire et mise a zero de l'histogramme */
@@ -202,5 +206,5 @@
 
 /*   On va chercher le sigma du fond  SigmaLeft, SigmaRight */
-int hmin = (int) ( (float)(hmax) * FRACPIC ) ;
+int hmin = (int) ( (double)(hmax) * FRACPIC ) ;
 
 int sigr = 0;
@@ -215,7 +219,7 @@
 if (nbsig < 0)  {  /*   On considere le cas ou NbSigmas est negatif   */
   if ( (bin = binmax+nbsig*sigl) < 0 )  bin = 0;
-  min = minhis + (float)bin*binwidth;
+  min = minhis + (double)bin*binwidth;
   if ( (bin = binmax-nbsig*sigr) >= nbin ) bin = nbin-1;
-  max = minhis + (float)bin*binwidth;
+  max = minhis + (double)bin*binwidth;
   if (max < (min+MINDYNAMIC))  max = min+MINDYNAMIC;
   delete[] phis;  return; 
@@ -235,5 +239,5 @@
 int nbpix = 0;
 for( q = phis+bin ; q < phis+nbin ; q++)  nbpix += (*q);
-nbpix = (int_4)((float)nbpix * fracmax);
+nbpix = (int_4)((double)nbpix * fracmax);
 int nbpix2 = 0; q = phis+bin; 
 int k = bin;
@@ -241,5 +245,5 @@
   { nbpix2 += (*q); k++; q++; }
 
-max = minhis + (float)k*binwidth;
+max = minhis + (double)k*binwidth;
 delete[] phis;
 if (max < (min+MINDYNAMIC))  max = min+MINDYNAMIC;
@@ -258,5 +262,5 @@
 int npx, npy, nppx, nppy, nszp, oszp;
 int i,j,k,l;
-float vpx;
+double vpx;
 
 
@@ -310,5 +314,5 @@
     }
   else if (zm < -1) {       // Compression 
-    float fv = (float)(zmm*zmm); 
+    double fv = (double)(zmm*zmm); 
     for(j=ofy; j<ofy+npy; j+=zmm)
       for(i=ofx; i<ofx+npx; i+=zmm) {
@@ -341,5 +345,5 @@
     }
   else if (zm < -1) {       // Compression 
-    float fv = (float)(zmm*zmm); 
+    double fv = (double)(zmm*zmm); 
     for(j=ofy; j<ofy+npy; j+=zmm)
       for(i=ofx; i<ofx+npx; i+=zmm) {
