Index: trunk/SophyaLib/SkyMap/spherehealpix.cc
===================================================================
--- trunk/SophyaLib/SkyMap/spherehealpix.cc	(revision 2978)
+++ trunk/SophyaLib/SkyMap/spherehealpix.cc	(revision 2985)
@@ -178,5 +178,5 @@
   omeg_ = a.omeg_;
   int k;
-  if (fgring_ != a.fgring_) 
+  if (fgring_ == a.fgring_) 
     for (k=0; k< nPix_; k++) pixels_(k) = a.pixels_(k);
   else {
@@ -359,4 +359,5 @@
       value(kk)= pixels_(kk+iring);
     }
+    PixThetaPhi(iring, theta, FI);
   }
   else {  // NESTED pixelisation scheme
@@ -367,6 +368,7 @@
       value(kk)= pixels_(kkn);
     }
-  }
-  theta= TH;
+    PixThetaPhi(ring2nest(nSide_,iring), theta, FI);    
+  }
+  //  theta= TH;
 }
 /*! \fn void SOPHYA::SphereHEALPix::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const
@@ -422,21 +424,25 @@
   sliceBeginIndex_.ReSize(4*nSide_-1);
   sliceLenght_.ReSize(4*nSide_-1);
-  int sliceIndex;
-  for (sliceIndex=0; sliceIndex<  nSide_-1; sliceIndex++)
-    {
-      sliceBeginIndex_(sliceIndex)  = 2*sliceIndex*(sliceIndex+1);
-      sliceLenght_(sliceIndex) = 4*(sliceIndex+1);
-    }
-  for (sliceIndex= nSide_-1; sliceIndex<  3*nSide_; sliceIndex++)
-    {
-      sliceBeginIndex_(sliceIndex)  = 2*nSide_*(2*sliceIndex-nSide_+1);
-      sliceLenght_(sliceIndex) = 4*nSide_;
-    }
-  for (sliceIndex= 3*nSide_; sliceIndex< 4*nSide_-1; sliceIndex++)
-    {
-      int_4 nc= 4*nSide_-1-sliceIndex;
-      sliceBeginIndex_(sliceIndex)  = nPix_-2*nc*(nc+1); 
-      sliceLenght_(sliceIndex) = 4*nc;
-    }
+  int_4 sliceIndex;
+  int_4 offp = 0;
+  for (sliceIndex=0; sliceIndex<  nSide_-1; sliceIndex++)  {
+    //      sliceBeginIndex_(sliceIndex)  = 2*sliceIndex*(sliceIndex+1);      
+    sliceBeginIndex_(sliceIndex)  = offp;
+    sliceLenght_(sliceIndex) = 4*(sliceIndex+1);
+    offp += sliceLenght_(sliceIndex);
+  }
+  for (sliceIndex= nSide_-1; sliceIndex<  3*nSide_; sliceIndex++)  {
+    //      sliceBeginIndex_(sliceIndex)  = 2*nSide_*(2*sliceIndex-nSide_+1);
+    sliceBeginIndex_(sliceIndex)  = offp;
+    sliceLenght_(sliceIndex) = 4*nSide_;
+    offp += sliceLenght_(sliceIndex);
+  }
+  for (sliceIndex= 3*nSide_; sliceIndex< 4*nSide_-1; sliceIndex++) {
+    int_4 nc= 4*nSide_-1-sliceIndex;
+      //      sliceBeginIndex_(sliceIndex)  = nPix_-2*nc*(nc+1); 
+    sliceBeginIndex_(sliceIndex)  = offp; 
+    sliceLenght_(sliceIndex) = 4*nc;
+    offp += sliceLenght_(sliceIndex);    
+  }
 }
 
@@ -463,36 +469,4 @@
 }
 
-/*! \fn T& SOPHYA::SphereHEALPix::PixValNest(int_4 k)
-
-   \return value of  pixel with "NESTED" index k 
-
-template<class T>
-T& SphereHEALPix<T>::PixValNest(int_4 k)
-
-//--
-{
-  if((k < 0) || (k >= nPix_)) 
-    { 
-      throw RangeCheckError("SphereHEALPix::PIxValNest Pixel index out of range");
-    }
-  return pixels_(nest2ring(nSide_,k));
-}
-*/
-/*!  \fn T const& SOPHYA::SphereHEALPix::PixValNest(int_4 k) const
-
-  \return value of  pixel with "NESTED" index k 
-
-template<class T>
-T const& SphereHEALPix<T>::PixValNest(int_4 k) const
-
-{
-  if((k < 0) || (k >= nPix_)) 
-    { 
-      throw RangeCheckError("SphereHEALPix::PIxValNest Pixel index out of range");
-  }
-  int_4 pix= nest2ring(nSide_,k);
-  return *(pixels_.Data()+pix);
-}
-*/
 
 /*! \fn bool SOPHYA::SphereHEALPix::ContainsSph(double theta, double phi) const
@@ -518,15 +492,4 @@
 }
 
-/*! \fn int_4 SOPHYA::SphereHEALPix::PixIndexSphNest(double theta,double phi) const
-
- \return "NESTED" index of the pixel corresponding to direction (theta, phi).
-
-template<class T>
-int_4 SphereHEALPix<T>::PixIndexSphNest(double theta,double  phi) const
-
-{
-  return ang2pix_nest(nSide_,theta,phi);
-}
-*/
 
 //!  \return (theta,phi) coordinates of middle of  pixel with "RING" index k
@@ -547,15 +510,4 @@
 
 
-
-/*! \fn void SOPHYA::SphereHEALPix::PixThetaPhiNest(int_4 k,double& theta,double& phi) const
-
-  \return (theta,phi) coordinates of middle of  pixel with "NESTED" index k
-template<class T>
-void SphereHEALPix<T>::PixThetaPhiNest(int_4 k,double& theta,double& phi) const
-
-{   
-  pix2ang_nest(nSide_,k,theta,phi);
-}
-*/
 
 //!  Conversion from NESTED index  into RING index 
