Index: trunk/SophyaLib/SkyMap/spherehealpix.cc
===================================================================
--- trunk/SophyaLib/SkyMap/spherehealpix.cc	(revision 2885)
+++ trunk/SophyaLib/SkyMap/spherehealpix.cc	(revision 2960)
@@ -28,5 +28,5 @@
 
 \verbatim
-
+    Adapted from :
     -----------------------------------------------------------------------
      version 0.8.2  Aug97 TAC  Eric Hivon, Kris Gorski
@@ -84,28 +84,13 @@
 
 {
-
-  if(m <= 0 || m > 8192) 
-    {
-      cout << "SphereHEALPix : m hors bornes [0,8192], m= " << m << endl;
-      throw RangeCheckError("SphereHEALPix<T>::SphereHEALPix() - Out of bound nside (< 8192)!");
-    }
-  // verifier que m est une puissance de deux 
-  int x= m;
-  while(x%2 == 0) x/=2;
-  if(x != 1) 
-    {  
-      cout<<"SphereHEALPix: m doit etre une puissance de deux, m= "<<m<<endl;
-      throw ParmError("SphereHEALPix<T>::SphereHEALPix() - nside != 2^n !");
-    }
   InitNul();
   Pixelize(m);
   SetThetaSlices();
 }
-//++
+//!    Copy constructor
 template<class T>
 SphereHEALPix<T>::SphereHEALPix(const SphereHEALPix<T>& s, bool share)
   : pixels_(s.pixels_, share), sliceBeginIndex_(s.sliceBeginIndex_, share), 
 				sliceLenght_(s.sliceLenght_, share)
-//    copy constructor
 //--
 {
@@ -214,5 +199,5 @@
 
 /*!  \fn   void SOPHYA::SphereHEALPix::Resize(int_4 m)
-  \param <m>   "nside" of the Gorski algorithm
+  \param <m>   "nside" of the HEALPix algorithm
 
   The total number of pixels will be Npix =  12*nside**2
@@ -225,29 +210,33 @@
 
 {
+  if ((m <= 0 && nSide_ > 0))  {
+    cout << "SphereHEALPix<T>::Resize(m) with m<=0, NOT resized" << endl;
+    return;
+  }
+  InitNul();
+  Pixelize(m);
+  SetThetaSlices();
+}
+
+template<class T>
+void  SphereHEALPix<T>::Pixelize( int_4 m) 
+
+//    prépare la pixelisation Gorski (m a la même signification 
+//    que pour le constructeur)
+//
+//    
+{
   if (m<=0 || m> 8192) {
-    cout << "SphereHEALPix : m hors bornes [0,8192], m= " << m << endl;
-    exit(1);
+    cout << "SphereHEALPix<T>::Pixelize() m=" << m <<" out of range [0,8192]" << endl;
+    throw ParmError("SphereHEALPix<T>::Pixelize() m out of range");
   }
   // verifier que m est une puissance de deux 
   int x= m;
   while (x%2==0) x/=2;
-  if(x != 1) 
-    {  
-      cout<<"SphereHEALPix: m doit etre une puissance de deux, m= "<<m<<endl;
-      exit(1);
-    }
-  InitNul();
-  Pixelize(m);
-  SetThetaSlices();
-}
-
-template<class T>
-void  SphereHEALPix<T>::Pixelize( int_4 m) 
-
-//    prépare la pixelisation Gorski (m a la même signification 
-//    que pour le constructeur)
-//
-//    
-{
+  if(x != 1) {  
+    cout << "SphereHEALPix<T>::Pixelize() m=" << m << " != 2^n " << endl;
+    throw ParmError("SphereHEALPix<T>::Pixelize() m!=2^n");
+  }
+
   // On memorise les arguments d'appel
   nSide_= m;  
Index: trunk/SophyaLib/SkyMap/spherethetaphi.cc
===================================================================
--- trunk/SophyaLib/SkyMap/spherethetaphi.cc	(revision 2885)
+++ trunk/SophyaLib/SkyMap/spherethetaphi.cc	(revision 2960)
@@ -60,11 +60,11 @@
 /* --Methode-- */
 
-//++
+/*!  
+  \brief Constructor with specification of number of slices (in a hemisphere)
+  \param m is the number of slices in theta on an hemisphere (the polar cap
+  forms the first slice).
+*/
 template <class T>
 SphereThetaPhi<T>::SphereThetaPhi(int_4 m)
-
-//    m is the number of slices in theta on an hemisphere (the polar cap
-//    forms the first slice).
-//--
 {
   InitNul();
@@ -72,4 +72,5 @@
 }
 
+//! Copy constructor (shares the pixel data if share==true) 
 template <class T>
 SphereThetaPhi<T>::SphereThetaPhi(const SphereThetaPhi<T>& s, bool share)
@@ -84,4 +85,5 @@
 }
 
+//! Copy constructor (shares the pixel data)
 template <class T>
 SphereThetaPhi<T>::SphereThetaPhi(const SphereThetaPhi<T>& s)
@@ -105,7 +107,4 @@
 {}
 
-//++
-// Titre	Public Méthods
-//--
 template <class T>
 void SphereThetaPhi<T>::InitNul()
@@ -118,14 +117,17 @@
 
 
-//++
+//!   re-pixelize the sphere if (m > 0) 
 template <class T>
 void SphereThetaPhi<T>::Resize(int_4 m)
-//   re-pixelize the sphere
-//--
-{
+{
+  if ((m <= 0) && (NTheta_ > 0) ) {
+    cout << "SphereThetaPhi<T>::Resize(m) with m<=0 - NOT resized" << endl;
+    return;
+  }
   InitNul();
   Pixelize(m);
 }
 
+//! Clone or share the SphereThetaPhi object \b a
 template<class T>
 void  SphereThetaPhi<T>::CloneOrShare(const  SphereThetaPhi<T>& a)
@@ -142,4 +144,5 @@
   if (a.mInfo_) this->mInfo_ = new DVList(*(a.mInfo_));
 }
+//! Share the pixel data with object \b a
 template<class T>
 void  SphereThetaPhi<T>::Share(const  SphereThetaPhi<T>& a)
@@ -158,4 +161,5 @@
 
 ////////////////////////// methodes de copie/share
+//! Perform data copy or shares the data 
 template<class T>
 SphereThetaPhi<T>& SphereThetaPhi<T>::Set(const SphereThetaPhi<T>& a)
@@ -176,4 +180,5 @@
 }
 
+//! Perform data copy or shares the data 
 template<class T>
 SphereThetaPhi<T>& SphereThetaPhi<T>::CopyElt(const SphereThetaPhi<T>& a)
@@ -197,10 +202,7 @@
 
 /* --Methode-- */
-//++
+//!    Return total number of pixels 
 template <class T>
 int_4 SphereThetaPhi<T>::NbPixels() const
-
-//    Return total number of pixels 
-//--
 {
   return(NPix_);
@@ -208,10 +210,7 @@
 
 /* --Methode-- */
-//++
+//!    Return value of pixel with index k
 template <class T>
 T& SphereThetaPhi<T>::PixVal(int_4 k)
-
-//    Return value of pixel with index k
-//--
 {
   if((k < 0) || (k >= NPix_)) 
@@ -222,10 +221,7 @@
 }
 
-//++
+//!    Return value of pixel with index k
 template <class T>
 T const& SphereThetaPhi<T>::PixVal(int_4 k) const
-
-//    Return value of pixel with index k
-//--
 {
   if((k < 0) || (k >= NPix_)) 
@@ -237,8 +233,7 @@
 
 /* --Methode-- */
-//++
+//! Return true if teta,phi in map  
 template <class T>
 bool SphereThetaPhi<T>::ContainsSph(double /*theta*/, double /*phi*/) const
-//--
 {
   return(true);
@@ -246,11 +241,7 @@
 
 /* --Methode-- */
-//++
+//!    Return index of the pixel corresponding to direction (theta, phi).
 template <class T>
 int_4 SphereThetaPhi<T>::PixIndexSph(double theta, double phi) const
-
-//    Return index of the pixel corresponding to 
-//    direction (theta, phi).
-//--
 {
   double dphi;
@@ -275,10 +266,7 @@
 
 /* --Methode-- */
-//++
+//!   Return (theta,phi) coordinates of middle of  pixel with  index k
 template <class T>
 void SphereThetaPhi<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const
-
-//   Return (theta,phi) coordinates of middle of  pixel with  index k
-//--
 {
   int i; 
@@ -302,4 +290,5 @@
 }
 
+//! Setting pixel values to a constant 
 template <class T>
 T SphereThetaPhi<T>::SetPixels(T v)
@@ -309,13 +298,13 @@
 }
 
-//++
+/*!
+  \brief Pixel Solid angle  (steradians)
+  All the pixels have the same solid angle. The dummy argument is
+  for compatibility with eventual pixelizations which would not 
+  fulfil this requirement.
+*/
 template <class T>
 double SphereThetaPhi<T>::PixSolAngle(int_4 /*dummy*/) const
 
-//    Pixel Solid angle  (steradians)
-//    All the pixels have the same solid angle. The dummy argument is
-//    for compatibility with eventual pixelizations which would not 
-//    fulfil this requirement.
-//--
 {
   return Omega_;
@@ -323,10 +312,7 @@
 
 /* --Methode-- */
-//++
+//!   Return values of theta,phi which limit the pixel with  index k
 template <class T>
 void SphereThetaPhi<T>::Limits(int_4 k,double& tetMin,double& tetMax,double& phiMin,double& phiMax) 
-
-//   Return values of theta,phi which limit the pixel with  index k
-//--
   {
   int j;
@@ -376,10 +362,7 @@
 
 /* --Methode-- */
-//++
+//!    Return number of theta-slices on the sphere
 template <class T>
 uint_4 SphereThetaPhi<T>::NbThetaSlices() const
-
-//    Return number of theta-slices on the sphere
-//--
 {
   if (NTheta_<=0) 
@@ -391,10 +374,7 @@
 
 /* --Methode-- */
-//++
+//!    Return number of pixels along the phi-direction of the kt-th slice
 template <class T>
 int_4 SphereThetaPhi<T>::NPhi(int_4 kt) const
-
-//    Return number of pixels in phi-direction of the kt-th slice
-//-- 
 {
   int nbpix;  
@@ -414,10 +394,7 @@
 
 /* --Methode-- */
-//++
+//!    Return  theta values which limit the slice kt
 template <class T>
 void SphereThetaPhi<T>::Theta(int_4 kt,double& tetMin,double& tetMax) 
-
-//    Return  theta values which limit the slice kt
-//--
 {
   bool fgzn= false;
@@ -446,10 +423,7 @@
 
 /* --Methode-- */
-//++
+//!   Return values of phi which limit the jp-th pixel of the kt-th slice
 template <class T>
 void SphereThetaPhi<T>::Phi(int_4 kt,int_4 jp,double& phiMin,double& phiMax) 
-
-//   Return values of phi which limit the jp-th pixel of the kt-th slice
-//--
 {
   // verification
@@ -477,10 +451,7 @@
 
 /* --Methode-- */
-//++
+//!    Return pixel index  with sequence index jp in the slice kt 
 template <class T>
 int_4 SphereThetaPhi<T>::Index(int_4 kt,int_4 jp) const
-
-//    Return pixel index  with sequence index jp in the slice kt 
-//--
 {
   int k;
@@ -510,10 +481,7 @@
 
 /* --Methode-- */
-//++
+//!    Return indices kt (theta) and jp (phi) of  pixel with index k
 template <class T>
 void SphereThetaPhi<T>::ThetaPhiIndex(int_4 k,int_4& kt,int_4& jp) 
-
-//    Return indices kt (theta) and jp (phi) of  pixel with index k
-//--
 {
   bool fgzn= false;  
@@ -538,18 +506,19 @@
   else jp= k-TNphi_(i);  
 }
-//++
+/*!
+  \brief achieve the splitting into pixels 
+  m has the same signification as for the constructor
+  
+  Each theta-slice of the north hemisphere will be spitted starting f
+  from  phi=0 ...
+  
+  South hemisphere is scanned in the same direction according to phi
+  and from equator to the pole (the pixel following the last one of
+  the slice closest to the equator with z>0, is the pixel with lowest 
+  phi of the slice closest of the equator with z<0).
+*/
 template <class T>
 void  SphereThetaPhi<T>::Pixelize(int_4 m) 
 
-//    achieve the splitting into pixels (m has the same signification 
-//    as for the constructor)
-//
-//    Each theta-slice of the north hemisphere will be spitted starting f
-//    from  phi=0 ...
-//
-//    South hemisphere is scanned in the same direction according to phi
-//    and from equator to the pole (the pixel following the last one of
-//    the slice closest to the equator with z>0, is the pixel with lowest 
-//    phi of the slice closest of the equator with z<0).
 //--
 {
@@ -557,7 +526,7 @@
   
   // Decodage et controle des arguments d'appel :
-  // au moins 2 et au plus 16384 bandes d'un hemisphere en theta
+  // au moins 2 et au plus 524288 bandes d'un hemisphere en theta
   if (m < 2) m = 2;
-  if (m > 16384) m = 16384;
+  if (m > 524288) m = 524288;
   
   // On memorise les arguments d'appel
@@ -623,13 +592,14 @@
 }
 
-//++
+
+/*!    
+  \brief return a Theta slice information
+  For a theta-slice with index 'index', return : 
+  the corresponding "theta" 
+  a vector containing the phi's of the pixels of the slice
+  a vector containing the corresponding values of pixels 
+*/
 template <class T>
 void SphereThetaPhi<T>::GetThetaSlice(int_4 index,r_8& theta, TVector<r_8>& phi, TVector<T>& value) const 
-
-//    For a theta-slice with index 'index', return : 
-//    the corresponding "theta" 
-//    a vector containing the phi's of the pixels of the slice
-//    a vector containing the corresponding values of pixels 
-//--
 
 {
@@ -656,15 +626,15 @@
 }
 
-//++
+/*
+  \brief return information on a theta slice 
+  For a theta-slice with index 'index', return : 
+  the corresponding "theta" 
+  the corresponding "phi" for first pixel of the slice 
+  a vector containing the indices of the pixels of the slice
+  (equally distributed in phi)
+  a vector containing the corresponding values of pixels 
+*/
 template <class T>
 void SphereThetaPhi<T>::GetThetaSlice(int_4 index,r_8& theta, r_8& phi0,TVector<int_4>& pixelIndices, TVector<T>& value) const 
-
-//    For a theta-slice with index 'index', return : 
-//    the corresponding "theta" 
-//    the corresponding "phi" for first pixel of the slice 
-//    a vector containing the indices of the pixels of the slice
-//    (equally distributed in phi)
-//    a vector containing the corresponding values of pixels 
-//--
 
 {
Index: trunk/SophyaLib/SkyMap/spherethetaphi.h
===================================================================
--- trunk/SophyaLib/SkyMap/spherethetaphi.h	(revision 2885)
+++ trunk/SophyaLib/SkyMap/spherethetaphi.h	(revision 2960)
@@ -21,14 +21,4 @@
 
 // ***************** Class SphereThetaPhi *****************************
-/*!    sphere splitted with respect to theta, phi : each hemisphere is 
-    splitted into (m-1) parallels (equator does not enter into account).
-   This operation defines m slices, each of which is splitted into 
-    equidistant meridians. This splitting is realized in such a way that 
-    all pixels have the same area and are as square as possible.
-
-    One begins with the hemisphere with positive z, starting from the pole
-    toward the equator. The first pixel is the polar cap ; it is circular
-    and centered on theta=0. 
-*/
 template <class T>
 class SphereThetaPhi : public SphericalMap<T>
@@ -38,8 +28,4 @@
 
 SphereThetaPhi();
-/*!    m is the number of slices in theta on an hemisphere (the polar cap
-   forms the first slice).
-    pet is a dummy parameter at the moment. 
-*/
 SphereThetaPhi(int_4 m);
 SphereThetaPhi(const SphereThetaPhi<T>& s, bool share);
@@ -68,9 +54,7 @@
 
 /* retourne le nombre de pixels */ 
-/*!    Return total number of pixels  */
 virtual int_4 NbPixels() const;
 
 /* retourne la valeur du pixel d'indice k */ 
-/*!    Return value of pixel with index k */
 virtual T&       PixVal(int_4 k);
 virtual T const& PixVal(int_4 k) const;
@@ -83,29 +67,24 @@
 
 /* retourne les coordonnees Spheriques du centre du pixel d'indice k */ 
-/*!   Return (theta,phi) coordinates of middle of  pixel with  index k */
 virtual void PixThetaPhi(int_4 k, double& theta, double& phi) const;
 
-/*! Setting pixel values to a constant */
+/* Setting pixel values to a constant */
 virtual T SetPixels(T v);
 
 /* retourne/fixe l'angle Solide de Pixel   (steradians) */ 
-/*!   Pixel Solid angle  (steradians)
-
-    All the pixels have the same solid angle. The dummy argument is
-   for compatibility with eventual pixelizations which would not 
-    fulfil this requirement.
-*/
 virtual double PixSolAngle(int_4 dummy=0) const;
  
 /* retourne/fixe la valeur du parametre de decoupage m */ 
+//! Return the pixelisation parameter (number of slices in a hemisphere)
 inline virtual int_4 SizeIndex() const { return( NTheta_); }
 
 /*  Acces to the DataBlock  */
+//! Acces to the pixel data NDataBlock<T> object
 inline       NDataBlock<T>& DataBlock()       {return pixels_;}
+//! Acces to the pixel data NDataBlock<T> object (const version)
 inline const NDataBlock<T>& DataBlock() const {return pixels_;}
 
 // ------------- Specific methods  ----------------------
 
-/*!   re-pixelize the sphere */
 virtual void Resize(int_4 m);
 
@@ -117,5 +96,5 @@
 
 /* Nombre de tranches en theta */ 
-/*!    Return number of theta-slices on the sphere */
+/*    Return number of theta-slices on the sphere */
 uint_4 NbThetaSlices() const;
 
@@ -125,10 +104,8 @@
 /* Renvoie dans t1,t2 les valeurs respectives de theta min et theta max  */
 /* de la tranche d'indice kt  */ 
-/*!    Return  theta values which limit the slice kt */
 void Theta(int_4 kt, double& t1, double& t2);
 
 /* Renvoie dans p1,p2 les valeurs phimin et phimax du pixel d'indice jp  */
 /* dans la tranche d'indice kt  */ 
-/*!   Return values of phi which limit the jp-th pixel of the kt-th slice */
 void Phi(int_4 kt, int_4 jp, double& p1, double& p2);
 
@@ -138,46 +115,13 @@
 
 /* Indice kt de la tranche et indice jp du pixel d'indice k  */ 
-/*!    Return indices kt (theta) and jp (phi) of  pixel with index k */
 void ThetaPhiIndex(int_4 k,int_4& kt,int_4& jp);
 
-/*!    achieve the splitting into pixels (m has the same signification 
-    as for the constructor)
-
-    Each theta-slice of the north hemisphere will be spitted starting f
-    from  phi=0 ...
-
-    South hemisphere is scanned in the same direction according to phi
-    and from equator to the pole (the pixel following the last one of
-    the slice closest to the equator with z>0, is the pixel with lowest 
-    phi of the slice closest of the equator with z<0).
-*/
 void Pixelize(int_4); 
 
-/*!   For a theta-slice with index 'index', return : 
-
-   the corresponding "theta" 
-
-    a vector containing the phi's of the pixels of the slice
-
-    a vector containing the corresponding values of pixels 
-*/
 virtual void GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const; 
-
-/*!   For a theta-slice with index 'index', return : 
-
-   the corresponding "theta" 
-
-   the corresponding "phi" for first pixel of the slice 
-
-    a vector containing indices of the pixels of the slice
-
-   (equally distributed in phi)
-
-    a vector containing the corresponding values of pixels 
-*/
 virtual void GetThetaSlice(int_4 index, r_8& theta, r_8& phi0,TVector<int_4>& pixelIndices, TVector<T>& value) const ;
 
 
-/* impression */ 
+//! ASCII dump (print) of the pixel map
 void print(ostream& os) const;
 
@@ -331,6 +275,5 @@
 inline SphereThetaPhi<T> operator - (const SphereThetaPhi<T>& a,const SphereThetaPhi<T>& b)
     { SphereThetaPhi<T> result; result.SetTemp(true); 
-    if (b.IsTemp())  { result.Share(b); result.SubElt(a, true); }
-    else { result.CloneOrShare(a); result.SubElt(b); }
+    result.CloneOrShare(a); result.SubElt(b); 
     return result; }
 
