Index: /trunk/SophyaLib/SkyMap/HEALPixUtils.cc
===================================================================
--- /trunk/SophyaLib/SkyMap/HEALPixUtils.cc	(revision 1953)
+++ /trunk/SophyaLib/SkyMap/HEALPixUtils.cc	(revision 1954)
@@ -175,11 +175,13 @@
   
   if(  nside<1 ||  nside>ns_max ) {
-    cout << "nside out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix::nest2ring nside(=%d) out of range ", nside);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
   npix = 12 *  nside* nside;
   if( ipnest<0 || ipnest>npix-1 ) {
-    cout << "ipnest out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix::nest2ring ipnest(=%d) out of range ", ipnest);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
 
@@ -261,11 +263,13 @@
   
   if( nside<1 || nside>ns_max ) {
-    cout << "nside out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix::ring2nest nside(=%d) out of range ", nside);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
   npix = 12 * nside*nside;
   if( ipring<0 || ipring>npix-1 ) {
-    cout << "ipring out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix::ring2nest ipring(=%d) out of range ", ipring);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
   
@@ -364,11 +368,13 @@
 
   if( nside<1 || nside>ns_max ) {
-    cout << "nside out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix::ang2pix_ring nside(=%d) out of range ", nside);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
 
   if( theta<0. || theta>Pi) {
-    cout << "theta out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix::ang2pix_ring theta(=%g) out of range ", theta);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
 
@@ -447,10 +453,12 @@
   
   if( nside<1 || nside>ns_max ) {
-    cout << "nside out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix:::ang2pix_nest nside(=%d) out of range ", nside);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
   if( theta<0 || theta>Pi ) {
-    cout << "theta out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix:::ang2pix_nest theta(=%g) out of range ", theta);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
   z  = cos(theta);
@@ -531,11 +539,13 @@
   
   if( nside<1 || nside>ns_max ) {
-    cout << "nside out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix::pix2ang_ring nside(=%d) out of range ", nside);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
   npix = 12*nside*nside;      // ! total number of points
   if( ipix<0 || ipix>npix-1 ) {
-    cout << "ipix out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix::pix2ang_ring ipix(=%d) out of range ", ipix);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
   
@@ -609,11 +619,13 @@
   
   if( nside<1 || nside>ns_max ) {
-    cout << "nside out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix::pix2ang_nest nside(=%d) out of range ", nside);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
   npix = 12 * nside*nside;
   if( ipix<0 || ipix>npix-1 ) {
-    cout << "ipix out of range" << endl;
-    exit(0);
+    char buff[64];
+    sprintf(buff,"HEALPix::pix2ang_nest ipix(=%d) out of range ", ipix);
+    throw RangeCheckError(PExcLongMessage(buff));
   }
   
Index: /trunk/SophyaLib/SkyMap/fiospherehealpix.cc
===================================================================
--- /trunk/SophyaLib/SkyMap/fiospherehealpix.cc	(revision 1953)
+++ /trunk/SophyaLib/SkyMap/fiospherehealpix.cc	(revision 1954)
@@ -4,4 +4,6 @@
 #include "pexceptions.h"
 #include "fiondblock.h"
+#include "datatype.h"
+#include <typeinfo>
 
 //*******************************************************************
@@ -55,5 +57,10 @@
 {
   SphereHEALPix<T> * po = dynamic_cast< SphereHEALPix<T> * >(&o);
-  if (po == NULL) return;
+  if (po == NULL) { 
+    char buff[160];
+    sprintf(buff,"FIO_SphereHEALPix<%s>::SetDataObj(%s) - Object type error ! ",
+	    DataTypeInfo<T>::getTypeName().c_str(), typeid(o).name());
+    throw TypeMismatchExc(PExcLongMessage(buff));
+  }
   if (ownobj && dobj_) delete dobj_;
   dobj_ = po; ownobj = false;
@@ -93,5 +100,5 @@
   is.GetR8(Omega);
   dobj_->setParameters(nSide,nPix, Omega);
-
+  cout << " DBG-FIO_SphereHEALPix<T> nSide=" << nSide << " nPix=" << nPix << endl;
 // On lit les DataBlocks;
   FIO_NDataBlock<T> fio_nd(&dobj_->pixels_);
@@ -101,4 +108,7 @@
   FIO_NDataBlock<int_4> fio_ndi2(&dobj_->sliceLenght_);
   fio_ndi2.Read(is);
+
+  cout << " DBG-2 SizeIndex()= " << dobj_->SizeIndex() 
+       << " NbPixels()= " << dobj_->NbPixels() << endl;
 }
  
