ROOT logo
// @(#)root/geom:$Id: TGeoSphere.cxx 27731 2009-03-09 17:40:56Z brun $
// Author: Andrei Gheata   31/01/02
// TGeoSphere::Contains() DistFromOutside/Out() implemented by Mihaela Gheata

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//_____________________________________________________________________________
// TGeoSphere - spherical shell class. It takes 6 parameters : 
//           - inner and outer radius Rmin, Rmax
//           - the theta limits Tmin, Tmax
//           - the phi limits Pmin, Pmax (the sector in phi is considered
//             starting from Pmin to Pmax counter-clockwise
//
//_____________________________________________________________________________
//Begin_Html
/*
<img src="gif/t_sphere.gif">
*/
//End_Html

#include "Riostream.h"

#include "TGeoCone.h"
#include "TGeoManager.h"
#include "TGeoVolume.h"
#include "TVirtualGeoPainter.h"
#include "TGeoSphere.h"
#include "TVirtualPad.h"
#include "TBuffer3D.h"
#include "TBuffer3DTypes.h"
#include "TMath.h"

ClassImp(TGeoSphere)
   
//_____________________________________________________________________________
TGeoSphere::TGeoSphere()
{
// Default constructor
   SetShapeBit(TGeoShape::kGeoSph);
   fNz = 0;
   fNseg = 0;
   fRmin = 0.0;
   fRmax = 0.0;
   fTheta1 = 0.0;
   fTheta2 = 180.0;
   fPhi1 = 0.0;
   fPhi2 = 360.0;
}   

//_____________________________________________________________________________
TGeoSphere::TGeoSphere(Double_t rmin, Double_t rmax, Double_t theta1,
                       Double_t theta2, Double_t phi1, Double_t phi2)
           :TGeoBBox(0, 0, 0)
{
// Default constructor specifying minimum and maximum radius
   SetShapeBit(TGeoShape::kGeoSph);
   SetSphDimensions(rmin, rmax, theta1, theta2, phi1, phi2);
   ComputeBBox();
   SetNumberOfDivisions(20);
}

//_____________________________________________________________________________
TGeoSphere::TGeoSphere(const char *name, Double_t rmin, Double_t rmax, Double_t theta1,
                       Double_t theta2, Double_t phi1, Double_t phi2)
           :TGeoBBox(name, 0, 0, 0)
{
// Default constructor specifying minimum and maximum radius
   SetShapeBit(TGeoShape::kGeoSph);
   SetSphDimensions(rmin, rmax, theta1, theta2, phi1, phi2);
   ComputeBBox();
   SetNumberOfDivisions(20);
}

//_____________________________________________________________________________
TGeoSphere::TGeoSphere(Double_t *param, Int_t /*nparam*/)
           :TGeoBBox(0, 0, 0)
{
// Default constructor specifying minimum and maximum radius
// param[0] = Rmin
// param[1] = Rmax
   SetShapeBit(TGeoShape::kGeoSph);
   SetDimensions(param);
   ComputeBBox();
   SetNumberOfDivisions(20);
}

//_____________________________________________________________________________
TGeoSphere::~TGeoSphere()
{
// destructor
}

//_____________________________________________________________________________
Double_t TGeoSphere::Capacity() const
{
// Computes capacity of the shape in [length^3]
   Double_t th1 = fTheta1*TMath::DegToRad();
   Double_t th2 = fTheta2*TMath::DegToRad();
   Double_t ph1 = fPhi1*TMath::DegToRad();
   Double_t ph2 = fPhi2*TMath::DegToRad();
   Double_t capacity = (1./3.)*(fRmax*fRmax*fRmax-fRmin*fRmin*fRmin)*
                       TMath::Abs(TMath::Cos(th1)-TMath::Cos(th2))*
                       TMath::Abs(ph2-ph1);
   return capacity;
}                       

//_____________________________________________________________________________   
void TGeoSphere::ComputeBBox()
{
// compute bounding box of the sphere
//   Double_t xmin, xmax, ymin, ymax, zmin, zmax;
   if (TGeoShape::IsSameWithinTolerance(TMath::Abs(fTheta2-fTheta1),180)) {
      if (TGeoShape::IsSameWithinTolerance(TMath::Abs(fPhi2-fPhi1),360)) {
         TGeoBBox::SetBoxDimensions(fRmax, fRmax, fRmax);
         memset(fOrigin, 0, 3*sizeof(Double_t));
         return;
      }
   }   
   Double_t st1 = TMath::Sin(fTheta1*TMath::DegToRad());
   Double_t st2 = TMath::Sin(fTheta2*TMath::DegToRad());
   Double_t r1min, r1max, r2min, r2max, rmin, rmax;
   r1min = TMath::Min(fRmax*st1, fRmax*st2);
   r1max = TMath::Max(fRmax*st1, fRmax*st2);
   r2min = TMath::Min(fRmin*st1, fRmin*st2);
   r2max = TMath::Max(fRmin*st1, fRmin*st2);
   if (((fTheta1<=90) && (fTheta2>=90)) || ((fTheta2<=90) && (fTheta1>=90))) {
      r1max = fRmax;
      r2max = fRmin;
   }
   rmin = TMath::Min(r1min, r2min);
   rmax = TMath::Max(r1max, r2max);

   Double_t xc[4];
   Double_t yc[4];
   xc[0] = rmax*TMath::Cos(fPhi1*TMath::DegToRad());
   yc[0] = rmax*TMath::Sin(fPhi1*TMath::DegToRad());
   xc[1] = rmax*TMath::Cos(fPhi2*TMath::DegToRad());
   yc[1] = rmax*TMath::Sin(fPhi2*TMath::DegToRad());
   xc[2] = rmin*TMath::Cos(fPhi1*TMath::DegToRad());
   yc[2] = rmin*TMath::Sin(fPhi1*TMath::DegToRad());
   xc[3] = rmin*TMath::Cos(fPhi2*TMath::DegToRad());
   yc[3] = rmin*TMath::Sin(fPhi2*TMath::DegToRad());

   Double_t xmin = xc[TMath::LocMin(4, &xc[0])];
   Double_t xmax = xc[TMath::LocMax(4, &xc[0])]; 
   Double_t ymin = yc[TMath::LocMin(4, &yc[0])]; 
   Double_t ymax = yc[TMath::LocMax(4, &yc[0])];
   Double_t dp = fPhi2-fPhi1;
   if (dp<0) dp+=360;
   Double_t ddp = -fPhi1;
   if (ddp<0) ddp+= 360;
   if (ddp>360) ddp-=360;
   if (ddp<=dp) xmax = rmax;
   ddp = 90-fPhi1;
   if (ddp<0) ddp+= 360;
   if (ddp>360) ddp-=360;
   if (ddp<=dp) ymax = rmax;
   ddp = 180-fPhi1;
   if (ddp<0) ddp+= 360;
   if (ddp>360) ddp-=360;
   if (ddp<=dp) xmin = -rmax;
   ddp = 270-fPhi1;
   if (ddp<0) ddp+= 360;
   if (ddp>360) ddp-=360;
   if (ddp<=dp) ymin = -rmax;
   xc[0] = fRmax*TMath::Cos(fTheta1*TMath::DegToRad());  
   xc[1] = fRmax*TMath::Cos(fTheta2*TMath::DegToRad());  
   xc[2] = fRmin*TMath::Cos(fTheta1*TMath::DegToRad());  
   xc[3] = fRmin*TMath::Cos(fTheta2*TMath::DegToRad());  
   Double_t zmin = xc[TMath::LocMin(4, &xc[0])];
   Double_t zmax = xc[TMath::LocMax(4, &xc[0])]; 


   fOrigin[0] = (xmax+xmin)/2;
   fOrigin[1] = (ymax+ymin)/2;
   fOrigin[2] = (zmax+zmin)/2;;
   fDX = (xmax-xmin)/2;
   fDY = (ymax-ymin)/2;
   fDZ = (zmax-zmin)/2;
}   

//_____________________________________________________________________________   
void TGeoSphere::ComputeNormal(Double_t *point, Double_t *dir, Double_t *norm)
{
// Compute normal to closest surface from POINT. 
   Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
   Double_t r2 = rxy2+point[2]*point[2];
   Double_t r=TMath::Sqrt(r2);
   Bool_t rzero=kFALSE;
   if (r<=1E-20) rzero=kTRUE;
   //localize theta
   Double_t phi=0;
   Double_t th=0.;
   if (!rzero) th = TMath::ACos(point[2]/r);
 
   //localize phi
   phi=TMath::ATan2(point[1], point[0]);

   Double_t saf[4];
   saf[0]=(TGeoShape::IsSameWithinTolerance(fRmin,0) && !TestShapeBit(kGeoThetaSeg) && !TestShapeBit(kGeoPhiSeg))?TGeoShape::Big():TMath::Abs(r-fRmin);
   saf[1]=TMath::Abs(fRmax-r);
   saf[2]=saf[3]= TGeoShape::Big();
   if (TestShapeBit(kGeoThetaSeg)) {
      if (fTheta1>0) {
         saf[2] = r*TMath::Abs(TMath::Sin(th-fTheta1*TMath::DegToRad()));
      }
      if (fTheta2<180) {
         saf[3] = r*TMath::Abs(TMath::Sin(fTheta2*TMath::DegToRad()-th));
      }    
   }
   Int_t i = TMath::LocMin(4,saf);
   if (TestShapeBit(kGeoPhiSeg)) {
      Double_t c1 = TMath::Cos(fPhi1*TMath::DegToRad());
      Double_t s1 = TMath::Sin(fPhi1*TMath::DegToRad());
      Double_t c2 = TMath::Cos(fPhi2*TMath::DegToRad());
      Double_t s2 = TMath::Sin(fPhi2*TMath::DegToRad());
      if (TGeoShape::IsCloseToPhi(saf[i], point,c1,s1,c2,s2)) {
         TGeoShape::NormalPhi(point,dir,norm,c1,s1,c2,s2);
         return;
      }   
   }  
   if (i>1) {
      if (i==2) th=(fTheta1<90)?(fTheta1+90):(fTheta1-90);
      else      th=(fTheta2<90)?(fTheta2+90):(fTheta2-90);
      th *= TMath::DegToRad();
   }
      
   norm[0] = TMath::Sin(th)*TMath::Cos(phi);
   norm[1] = TMath::Sin(th)*TMath::Sin(phi);
   norm[2] = TMath::Cos(th);
   if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
      norm[0] = -norm[0];
      norm[1] = -norm[1];
      norm[2] = -norm[2];
   }             
}

//_____________________________________________________________________________
Int_t TGeoSphere::IsOnBoundary(Double_t *point) const
{
// Check if a point in local sphere coordinates is close to a boundary within
// shape tolerance. Return values:
//   0 - not close to boundary
//   1 - close to Rmin boundary
//   2 - close to Rmax boundary
//   3,4 - close to phi1/phi2 boundary
//   5,6 - close to theta1/theta2 boundary
   Int_t icode = 0;
   Double_t tol = TGeoShape::Tolerance();
   Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
   Double_t drsqout = r2-fRmax*fRmax;
   // Test if point is on fRmax boundary
   if (TMath::Abs(drsqout)<2.*fRmax*tol) return 2;
   Double_t drsqin = r2;
   // Test if point is on fRmin boundary
   if (TestShapeBit(kGeoRSeg)) {
      drsqin -= fRmin*fRmin;
      if (TMath::Abs(drsqin)<2.*fRmin*tol) return 1;
   } 
   if (TestShapeBit(kGeoPhiSeg)) { 
      Double_t phi = TMath::ATan2(point[1], point[0]);
      if (phi<0) phi+=2*TMath::Pi();
      Double_t phi1 = fPhi1*TMath::DegToRad();
      Double_t phi2 = fPhi2*TMath::DegToRad();
      Double_t ddp = phi-phi1;
      if (r2*ddp*ddp < tol*tol) return 3;
      ddp = phi - phi2;
      if (r2*ddp*ddp < tol*tol) return 4;
   }   
   if (TestShapeBit(kGeoThetaSeg)) { 
      Double_t r = TMath::Sqrt(r2);
      Double_t theta = TMath::ACos(point[2]/r2);
      Double_t theta1 = fTheta1*TMath::DegToRad();
      Double_t theta2 = fTheta2*TMath::DegToRad();
      Double_t ddt;
      if (fTheta1>0) {
         ddt = TMath::Abs(theta-theta1);
         if (r*ddt < tol) return 5;
      }
      if (fTheta2<180) {
         ddt = TMath::Abs(theta-theta2);
         if (r*ddt < tol) return 6;
      }   
   }
   return icode;
}      

//_____________________________________________________________________________
Bool_t TGeoSphere::IsPointInside(Double_t *point, Bool_t checkR, Bool_t checkTh, Bool_t checkPh) const
{
// Check if a point is inside radius/theta/phi ranges for the spherical sector.
   Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
   if (checkR) {
      if (TestShapeBit(kGeoRSeg) && (r2<fRmin*fRmin)) return kFALSE;
      if (r2>fRmax*fRmax) return kFALSE;
   }
   if (r2<1E-20) return kTRUE;
   if (checkPh && TestShapeBit(kGeoPhiSeg)) {
      Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
      while (phi < fPhi1) phi+=360.;
      Double_t dphi = fPhi2 -fPhi1;
      Double_t ddp = phi - fPhi1;
      if (ddp > dphi) return kFALSE;    
   }
   if (checkTh && TestShapeBit(kGeoThetaSeg)) {
      r2=TMath::Sqrt(r2);
      // check theta range
      Double_t theta = TMath::ACos(point[2]/r2)*TMath::RadToDeg();
      if ((theta<fTheta1) || (theta>fTheta2)) return kFALSE;
   }      
   return kTRUE;
}

//_____________________________________________________________________________
Bool_t TGeoSphere::Contains(Double_t *point) const
{
// test if point is inside this sphere
   // check Rmin<=R<=Rmax
   Double_t r2=point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
   if (TestShapeBit(kGeoRSeg) && (r2<fRmin*fRmin)) return kFALSE;
   if (r2>fRmax*fRmax) return kFALSE;
   if (r2<1E-20) return kTRUE;
   // check phi range
   if (TestShapeBit(kGeoPhiSeg)) {
      Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
      if (phi < 0 ) phi+=360.;
      Double_t dphi = fPhi2 -fPhi1;
      if (dphi < 0) dphi+=360.;
      Double_t ddp = phi - fPhi1;
      if (ddp < 0) ddp += 360.;
      if (ddp > dphi) return kFALSE;    
   }
   if (TestShapeBit(kGeoThetaSeg)) {
      r2=TMath::Sqrt(r2);
      // check theta range
      Double_t theta = TMath::ACos(point[2]/r2)*TMath::RadToDeg();
      if ((theta<fTheta1) || (theta>fTheta2)) return kFALSE;
   }      
   return kTRUE;
}

//_____________________________________________________________________________
Int_t TGeoSphere::DistancetoPrimitive(Int_t px, Int_t py)
{
// compute closest distance from point px,py to each corner
   Int_t n = fNseg+1;
   Int_t nz = fNz+1;
   const Int_t numPoints = 2*n*nz;
   return ShapeDistancetoPrimitive(numPoints, px, py);
}

//_____________________________________________________________________________
Double_t TGeoSphere::DistFromOutside(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const
{
// compute distance from outside point to surface of the sphere
// Check if the bounding box is crossed within the requested distance
   Double_t sdist = TGeoBBox::DistFromOutside(point,dir, fDX, fDY, fDZ, fOrigin, step);
   if (sdist>=step) return TGeoShape::Big();
   Double_t saf[6];
   Double_t r1,r2,z1,z2,dz,si,ci;
   Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
   Double_t rxy = TMath::Sqrt(rxy2);
   r2 = rxy2+point[2]*point[2];
   Double_t r=TMath::Sqrt(r2);
   Bool_t rzero=kFALSE;
   Double_t phi=0;
   if (r<1E-20) rzero=kTRUE;
   //localize theta
   Double_t th=0.;
   if (TestShapeBit(kGeoThetaSeg) && (!rzero)) {
      th = TMath::ACos(point[2]/r)*TMath::RadToDeg();
   }
   //localize phi
   if (TestShapeBit(kGeoPhiSeg)) {
      phi=TMath::ATan2(point[1], point[0])*TMath::RadToDeg();
      if (phi<0) phi+=360.;
   }   
   if (iact<3 && safe) {
      saf[0]=(r<fRmin)?fRmin-r:TGeoShape::Big();
      saf[1]=(r>fRmax)?(r-fRmax):TGeoShape::Big();
      saf[2]=saf[3]=saf[4]=saf[5]= TGeoShape::Big();
      if (TestShapeBit(kGeoThetaSeg)) {
         if (th < fTheta1) {
            saf[2] = r*TMath::Sin((fTheta1-th)*TMath::DegToRad());
         }    
         if (th > fTheta2) {
            saf[3] = r*TMath::Sin((th-fTheta2)*TMath::DegToRad());
         }
      }
      if (TestShapeBit(kGeoPhiSeg)) {
         Double_t dph1=phi-fPhi1;
         if (dph1<0) dph1+=360.;
         if (dph1<=90.) saf[4]=rxy*TMath::Sin(dph1*TMath::DegToRad());
         Double_t dph2=fPhi2-phi;
         if (dph2<0) dph2+=360.;
         if (dph2>90.) saf[5]=rxy*TMath::Sin(dph2*TMath::DegToRad());
      }
      *safe = saf[TMath::LocMin(6, &saf[0])];
      if (iact==0) return TGeoShape::Big();
      if (iact==1 && step<*safe) return TGeoShape::Big();
   }
   // compute distance to shape
   // first check if any crossing at all
   Double_t snxt = TGeoShape::Big();
   Double_t rdotn = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
   Bool_t fullsph = (!TestShapeBit(kGeoThetaSeg) && !TestShapeBit(kGeoPhiSeg))?kTRUE:kFALSE;
   if (r>fRmax) {
      Double_t b = rdotn;
      Double_t c = r2-fRmax*fRmax;
      Double_t d=b*b-c;
      if (d<0) return TGeoShape::Big();
   }
   if (fullsph) {
      Bool_t inrmax = kFALSE;
      Bool_t inrmin = kFALSE;
      if (r<=fRmax+TGeoShape::Tolerance()) inrmax = kTRUE;
      if (r>=fRmin-TGeoShape::Tolerance()) inrmin = kTRUE;
      if (inrmax && inrmin) {
         if ((fRmax-r) < (r-fRmin)) {
         // close to Rmax
            if (rdotn>=0) return TGeoShape::Big();
            return 0.0; // already in
         }
         // close to Rmin
         if (TGeoShape::IsSameWithinTolerance(fRmin,0) || rdotn>=0) return 0.0;
         // check second crossing of Rmin
         return DistToSphere(point, dir, fRmin, kFALSE, kFALSE);
      }
   }   
   
   // do rmin, rmax,  checking phi and theta ranges
   if (r<fRmin) {
      // check first cross of rmin
      snxt = DistToSphere(point, dir, fRmin, kTRUE);
      if (snxt<1E20) return snxt;
   } else {
      if (r>fRmax) {      
         // point outside rmax, check first cross of rmax
         snxt = DistToSphere(point, dir, fRmax, kTRUE);
         if (snxt<1E20) return snxt;
         // now check second crossing of rmin
         if (fRmin>0) snxt = DistToSphere(point, dir, fRmin, kTRUE, kFALSE);
      } else {
         // point between rmin and rmax, check second cross of rmin
         if (fRmin>0) snxt = DistToSphere(point, dir, fRmin, kTRUE, kFALSE);
      } 
   }       
   // check theta conical surfaces
   Double_t ptnew[3];
   Double_t b,delta, znew;
   Double_t snext = snxt;
   Double_t st1=TGeoShape::Big(), st2=TGeoShape::Big();
   if (TestShapeBit(kGeoThetaSeg)) {
      if (fTheta1>0) {
         if (TGeoShape::IsSameWithinTolerance(fTheta1,90)) {
         // surface is a plane
            if (point[2]*dir[2]<0) {
               snxt = -point[2]/dir[2];
               ptnew[0] = point[0]+snxt*dir[0];
               ptnew[1] = point[1]+snxt*dir[1];
               ptnew[2] = 0;
               // check range
               if (IsPointInside(&ptnew[0], kTRUE, kFALSE, kTRUE)) return TMath::Min(snxt,snext);
            }       
         } else {
            si = TMath::Sin(fTheta1*TMath::DegToRad());
            ci = TMath::Cos(fTheta1*TMath::DegToRad());
            if (ci>0) {
               r1 = fRmin*si;
               z1 = fRmin*ci;
               r2 = fRmax*si;
               z2 = fRmax*ci;
            } else {   
               r1 = fRmax*si;
               z1 = fRmax*ci;
               r2 = fRmin*si;
               z2 = fRmin*ci;
            }
            dz = 0.5*(z2-z1);
            ptnew[0] = point[0];
            ptnew[1] = point[1];
            ptnew[2] = point[2]-0.5*(z1+z2);
            if (TestShapeBit(kGeoPhiSeg)) {
               st1 = TGeoConeSeg::DistToCons(point, dir, r1, z1, r2, z2, fPhi1, fPhi2); 
            } else {
               TGeoCone::DistToCone(ptnew, dir, dz, r1, r2, b, delta);
               if (delta>0) {
                  st1 = -b-delta;
                  znew = ptnew[2]+st1*dir[2];
                  if (st1<0 || TMath::Abs(znew)>dz) {
                     st1 = -b+delta; 
                     znew = ptnew[2]+st1*dir[2];
                     if (st1<0 || TMath::Abs(znew)>dz) st1=TGeoShape::Big();
                  } 
               }     
            }
         }       
      }
      
      if (fTheta2<180) {
         if (TGeoShape::IsSameWithinTolerance(fTheta2,90)) {
            // surface is a plane
            if (point[2]*dir[2]<0) {
               snxt = -point[2]/dir[2];
               ptnew[0] = point[0]+snxt*dir[0];
               ptnew[1] = point[1]+snxt*dir[1];
               ptnew[2] = 0;
               // check range
               if (IsPointInside(&ptnew[0], kTRUE, kFALSE, kTRUE)) return TMath::Min(snxt,snext);
            }       
         } else {
            si = TMath::Sin(fTheta2*TMath::DegToRad());
            ci = TMath::Cos(fTheta2*TMath::DegToRad());
            if (ci>0) {
               r1 = fRmin*si;
               z1 = fRmin*ci;
               r2 = fRmax*si;
               z2 = fRmax*ci;
            } else {   
               r1 = fRmax*si;
               z1 = fRmax*ci;
               r2 = fRmin*si;
               z2 = fRmin*ci;
            }
            dz = 0.5*(z2-z1);
            ptnew[0] = point[0];
            ptnew[1] = point[1];
            ptnew[2] = point[2]-0.5*(z1+z2);
            if (TestShapeBit(kGeoPhiSeg)) {
               st2 = TGeoConeSeg::DistToCons(point, dir, r1, z1, r2, z2, fPhi1, fPhi2); 
            } else {
               TGeoCone::DistToCone(ptnew, dir, dz, r1, r2, b, delta);
               if (delta>0) {
                  st2 = -b-delta;
                  znew = ptnew[2]+st2*dir[2];
                  if (st2<0 || TMath::Abs(znew)>dz) {
                     st2 = -b+delta; 
                     znew = ptnew[2]+st2*dir[2];
                     if (st2<0 || TMath::Abs(znew)>dz) st2=TGeoShape::Big();
                  }   
               }    
            }
         }
      }
   }
   snxt = TMath::Min(st1, st2);
   snxt = TMath::Min(snxt,snext);
//   if (snxt<1E20) return snxt;       
   if (TestShapeBit(kGeoPhiSeg)) {
      Double_t s1 = TMath::Sin(fPhi1*TMath::DegToRad());
      Double_t c1 = TMath::Cos(fPhi1*TMath::DegToRad());
      Double_t s2 = TMath::Sin(fPhi2*TMath::DegToRad());
      Double_t c2 = TMath::Cos(fPhi2*TMath::DegToRad());
      Double_t phim = 0.5*(fPhi1+fPhi2);
      Double_t sm = TMath::Sin(phim*TMath::DegToRad());
      Double_t cm = TMath::Cos(phim*TMath::DegToRad());
      Double_t sfi1=TGeoShape::Big();
      Double_t sfi2=TGeoShape::Big();
      Double_t s=0;
      Double_t safety, un;
      safety = point[0]*s1-point[1]*c1;
      if (safety>0) {
         un = dir[0]*s1-dir[1]*c1;
         if (un<0) {
            s=-safety/un;
            ptnew[0] = point[0]+s*dir[0];
            ptnew[1] = point[1]+s*dir[1];
            ptnew[2] = point[2]+s*dir[2];
            if ((ptnew[1]*cm-ptnew[0]*sm)<=0) {
               sfi1=s;
               if (IsPointInside(&ptnew[0], kTRUE, kTRUE, kFALSE) && sfi1<snxt) return sfi1;
            }
         }       
      }
      safety = -point[0]*s2+point[1]*c2;
      if (safety>0) {
         un = -dir[0]*s2+dir[1]*c2;    
         if (un<0) {
            s=-safety/un;
            ptnew[0] = point[0]+s*dir[0];
            ptnew[1] = point[1]+s*dir[1];
            ptnew[2] = point[2]+s*dir[2];
            if ((ptnew[1]*cm-ptnew[0]*sm)>=0) {
               sfi2=s;
               if (IsPointInside(&ptnew[0], kTRUE, kTRUE, kFALSE) && sfi2<snxt) return sfi2;
            }   
         }   
      }
   }      
   return snxt;            
}   

//_____________________________________________________________________________
Double_t TGeoSphere::DistFromInside(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const
{
// compute distance from inside point to surface of the sphere
   Double_t saf[6];
   Double_t rxy2 = point[0]*point[0]+point[1]*point[1];
   Double_t rxy = TMath::Sqrt(rxy2);
   Double_t rad2 = rxy2+point[2]*point[2];
   Double_t r=TMath::Sqrt(rad2);
   Bool_t rzero=kFALSE;
   if (r<=1E-20) rzero=kTRUE;
   //localize theta
   Double_t phi=0;;
   Double_t th=0.;
   if (TestShapeBit(kGeoThetaSeg) && (!rzero)) {
      th = TMath::ACos(point[2]/r)*TMath::RadToDeg();
   }
   //localize phi
   if (TestShapeBit(kGeoPhiSeg)) {
      phi=TMath::ATan2(point[1], point[0])*TMath::RadToDeg();
      if (phi<0) phi+=360.;
   }   
   if (iact<3 && safe) {
      saf[0]=(TGeoShape::IsSameWithinTolerance(fRmin,0))?TGeoShape::Big():r-fRmin;
      saf[1]=fRmax-r;
      saf[2]=saf[3]=saf[4]=saf[5]= TGeoShape::Big();
      if (TestShapeBit(kGeoThetaSeg)) {
         if (fTheta1>0) {
            saf[2] = r*TMath::Sin((th-fTheta1)*TMath::DegToRad());
         }
         if (fTheta2<180) {
            saf[3] = r*TMath::Sin((fTheta2-th)*TMath::DegToRad());
         }    
      }
      if (TestShapeBit(kGeoPhiSeg)) {
         Double_t dph1=phi-fPhi1;
         if (dph1<0) dph1+=360.;
         if (dph1<=90.) saf[4]=rxy*TMath::Sin(dph1*TMath::DegToRad());
         Double_t dph2=fPhi2-phi;
         if (dph2<0) dph2+=360.;
         if (dph2<=90.) saf[5]=rxy*TMath::Sin(dph2*TMath::DegToRad());
      }
      *safe = saf[TMath::LocMin(6, &saf[0])];
      if (iact==0) return TGeoShape::Big();
      if (iact==1 && step<*safe) return TGeoShape::Big();
   }
   // compute distance to shape
   Double_t snxt = TGeoShape::Big();
   if (rzero) {
//      gGeoManager->SetNormalChecked(1.);
      return fRmax;
   }
   // first do rmin, rmax
   Double_t b,delta, znew;
   Double_t rdotn = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
   Double_t sn1 = TGeoShape::Big();
   // Inner sphere
   if (fRmin>0) {
      // Protection in case point is actually outside the sphere
      if (r <= fRmin+TGeoShape::Tolerance()) {
         if (rdotn<0) return 0.0;
      } else {
         if (rdotn<0) sn1 = DistToSphere(point, dir, fRmin, kFALSE);
      }
   }      
   Double_t sn2 = TGeoShape::Big();
   // Outer sphere
   if (r >= fRmax-TGeoShape::Tolerance()) {
      if (rdotn>=0) return 0.0;
   }   
   sn2 = DistToSphere(point, dir, fRmax, kFALSE);
   Double_t sr = TMath::Min(sn1, sn2);
   // check theta conical surfaces
   sn1 = TGeoShape::Big();
   sn2 = TGeoShape::Big();
   if (TestShapeBit(kGeoThetaSeg)) {
      if (TGeoShape::IsSameWithinTolerance(fTheta1,90)) {
      // surface is a plane
         if (point[2]*dir[2]<0)  sn1 = -point[2]/dir[2];
      } else {
         if (fTheta1>0) {
            Double_t r1,r2,z1,z2,dz,ptnew[3];
            Double_t si = TMath::Sin(fTheta1*TMath::DegToRad());
            Double_t ci = TMath::Cos(fTheta1*TMath::DegToRad());
            if (ci>0) {
               r1 = fRmin*si;
               z1 = fRmin*ci;
               r2 = fRmax*si;
               z2 = fRmax*ci;
            } else {   
               r1 = fRmax*si;
               z1 = fRmax*ci;
               r2 = fRmin*si;
               z2 = fRmin*ci;
            }
            dz = 0.5*(z2-z1);
            ptnew[0] = point[0];
            ptnew[1] = point[1];
            ptnew[2] = point[2]-0.5*(z1+z2);             
            if (TestShapeBit(kGeoPhiSeg)) {
               sn1 = TGeoConeSeg::DistToCons(point, dir, r1, z1, r2, z2, fPhi1, fPhi2); 
            } else {
               TGeoCone::DistToCone(ptnew, dir, dz, r1, r2, b, delta);
               if (delta>0) {
                  sn1 = -b-delta;
                  znew = ptnew[2]+sn1*dir[2];
                  if (sn1<0 || TMath::Abs(znew)>dz) {
                     sn1 = -b+delta; 
                     znew = ptnew[2]+sn1*dir[2];
                     if (sn1<0 || TMath::Abs(znew)>dz) sn1=TGeoShape::Big();
                  } 
               }     
            }
         }        
      }
      if (TGeoShape::IsSameWithinTolerance(fTheta2,90)) {
         // surface is a plane
         if (point[2]*dir[2]<0)  sn1 = -point[2]/dir[2];
      } else {
         if (fTheta2<180) {
            Double_t r1,r2,z1,z2,dz,ptnew[3];
            Double_t si = TMath::Sin(fTheta2*TMath::DegToRad());
            Double_t ci = TMath::Cos(fTheta2*TMath::DegToRad());
            if (ci>0) {
               r1 = fRmin*si;
               z1 = fRmin*ci;
               r2 = fRmax*si;
               z2 = fRmax*ci;
            } else {   
               r1 = fRmax*si;
               z1 = fRmax*ci;
               r2 = fRmin*si;
               z2 = fRmin*ci;
            }
            dz = 0.5*(z2-z1);
            ptnew[0] = point[0];
            ptnew[1] = point[1];
            ptnew[2] = point[2]-0.5*(z1+z2);             
            if (TestShapeBit(kGeoPhiSeg)) {
               sn2 = TGeoConeSeg::DistToCons(point, dir, r1, z1, r2, z2, fPhi1, fPhi2); 
            } else {
               TGeoCone::DistToCone(ptnew, dir, dz, r1, r2, b, delta);
               if (delta>0) {
                  sn2 = -b-delta;
                  znew = ptnew[2]+sn2*dir[2];
                  if (sn2<0 || TMath::Abs(znew)>dz) {
                     sn2 = -b+delta; 
                     znew = ptnew[2]+sn2*dir[2];
                     if (sn2<0 || TMath::Abs(znew)>dz) sn2=TGeoShape::Big();
                  } 
               }     
            }
         }        
      }
   }
   Double_t st = TMath::Min(sn1,sn2);       
   Double_t sp = TGeoShape::Big();
   if (TestShapeBit(kGeoPhiSeg)) {
      Double_t s1 = TMath::Sin(fPhi1*TMath::DegToRad());
      Double_t c1 = TMath::Cos(fPhi1*TMath::DegToRad());
      Double_t s2 = TMath::Sin(fPhi2*TMath::DegToRad());
      Double_t c2 = TMath::Cos(fPhi2*TMath::DegToRad());
      Double_t phim = 0.5*(fPhi1+fPhi2);
      Double_t sm = TMath::Sin(phim*TMath::DegToRad());
      Double_t cm = TMath::Cos(phim*TMath::DegToRad());
      sp = TGeoShape::DistToPhiMin(point, dir, s1, c1, s2, c2, sm, cm);
   }      
   snxt = TMath::Min(sr, st);
   snxt = TMath::Min(snxt, sp);
   return snxt;            
}   

//_____________________________________________________________________________
Double_t TGeoSphere::DistToSphere(Double_t *point, Double_t *dir, Double_t rsph, Bool_t check, Bool_t firstcross) const
{
// compute distance to sphere of radius rsph. Direction has to be a unit vector
   if (rsph<=0) return TGeoShape::Big();
   Double_t s=TGeoShape::Big();
   Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
   Double_t b = point[0]*dir[0]+point[1]*dir[1]+point[2]*dir[2];
   Double_t c = r2-rsph*rsph;
   Bool_t in = (c<=0)?kTRUE:kFALSE;
   Double_t d;
   
   d=b*b-c;
   if (d<0) return TGeoShape::Big();
   Double_t pt[3];
   Int_t i;
   d = TMath::Sqrt(d);
   if (in) {
      s=-b+d;
   } else {
      s = (firstcross)?(-b-d):(-b+d);
   }            
   if (s<0) return TGeoShape::Big();
   if (!check) return s;
   for (i=0; i<3; i++) pt[i]=point[i]+s*dir[i];
   // check theta and phi ranges
   if (IsPointInside(&pt[0], kFALSE)) return s;
   return TGeoShape::Big();
}

//_____________________________________________________________________________
TGeoVolume *TGeoSphere::Divide(TGeoVolume * /*voldiv*/, const char * /*divname*/, Int_t /*iaxis*/, Int_t /*ndiv*/,
                               Double_t /*start*/, Double_t /*step*/) 
{
// Divide all range of iaxis in range/step cells 
   Error("Divide", "Division of a sphere not implemented");
   return 0;
}      

//_____________________________________________________________________________
const char *TGeoSphere::GetAxisName(Int_t iaxis) const
{
// Returns name of axis IAXIS.
   switch (iaxis) {
      case 1:
         return "R";
      case 2:
         return "THETA";
      case 3:
         return "PHI";
      default:
         return "UNDEFINED";
   }
}   

//_____________________________________________________________________________
Double_t TGeoSphere::GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
{
// Get range of shape for a given axis.
   xlo = 0;
   xhi = 0;
   Double_t dx = 0;
   switch (iaxis) {
      case 1:
         xlo = fRmin;
         xhi = fRmax;
         dx = xhi-xlo;
         return dx;
      case 2:
         xlo = fPhi1;
         xhi = fPhi2;
         dx = xhi-xlo;
         return dx;
      case 3:
         xlo = fTheta1;
         xhi = fTheta2;
         dx = xhi-xlo;
         return dx;
   }
   return dx;
}         

//_____________________________________________________________________________
void TGeoSphere::GetBoundingCylinder(Double_t *param) const
{
//--- Fill vector param[4] with the bounding cylinder parameters. The order
// is the following : Rmin, Rmax, Phi1, Phi2
   Double_t smin = TMath::Sin(fTheta1*TMath::DegToRad());
   Double_t smax = TMath::Sin(fTheta2*TMath::DegToRad());
   if (smin>smax) {
      Double_t a = smin;
      smin = smax;
      smax = a;
   }   
   param[0] = fRmin*smin; // Rmin
   param[0] *= param[0];
   if (((90.-fTheta1)*(fTheta2-90.))>=0) smax = 1.;
   param[1] = fRmax*smax; // Rmax
   param[1] *= param[1];
   param[2] = (fPhi1<0)?(fPhi1+360.):fPhi1; // Phi1
   param[3] = fPhi2;
   if (TGeoShape::IsSameWithinTolerance(param[3]-param[2],360)) {         // Phi2
      param[2] = 0.;
      param[3] = 360.;
   }   
   while (param[3]<param[2]) param[3]+=360.;
}

//_____________________________________________________________________________
void TGeoSphere::InspectShape() const
{
// print shape parameters
   printf("*** Shape %s: TGeoSphere ***\n", GetName());
   printf("    Rmin = %11.5f\n", fRmin);
   printf("    Rmax = %11.5f\n", fRmax);
   printf("    Th1  = %11.5f\n", fTheta1);
   printf("    Th2  = %11.5f\n", fTheta2);
   printf("    Ph1  = %11.5f\n", fPhi1);
   printf("    Ph2  = %11.5f\n", fPhi2);
   printf(" Bounding box:\n");
   TGeoBBox::InspectShape();
}

//_____________________________________________________________________________
TBuffer3D *TGeoSphere::MakeBuffer3D() const
{ 
   // Creates a TBuffer3D describing *this* shape.
   // Coordinates are in local reference frame.

   Bool_t full = kTRUE;
   if (TestShapeBit(kGeoThetaSeg) || TestShapeBit(kGeoPhiSeg)) full = kFALSE;
   Int_t ncenter = 1;
   if (full || TestShapeBit(kGeoRSeg)) ncenter = 0;
   Int_t nup = (fTheta1>0)?0:1;
   Int_t ndown = (fTheta2<180)?0:1;
   // number of different latitudes, excluding 0 and 180 degrees
   Int_t nlat = fNz+1-(nup+ndown);
   // number of different longitudes
   Int_t nlong = fNseg;
   if (TestShapeBit(kGeoPhiSeg)) nlong++;

   Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
   if (TestShapeBit(kGeoRSeg)) nbPnts *= 2;

   Int_t nbSegs = nlat*fNseg + (nlat-1+nup+ndown)*nlong; // outer sphere
   if (TestShapeBit(kGeoRSeg)) nbSegs *= 2; // inner sphere
   if (TestShapeBit(kGeoPhiSeg)) nbSegs += 2*nlat+nup+ndown; // 2 phi planes
   nbSegs += nlong * (2-nup - ndown);  // connecting cones
      
   Int_t nbPols = fNz*fNseg; // outer
   if (TestShapeBit(kGeoRSeg)) nbPols *=2;  // inner
   if (TestShapeBit(kGeoPhiSeg)) nbPols += 2*fNz; // 2 phi planes
   nbPols += (2-nup-ndown)*fNseg; // connecting

   TBuffer3D* buff = new TBuffer3D(TBuffer3DTypes::kGeneric,
                                   nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols);

   if (buff)
   {
      SetPoints(buff->fPnts);
      SetSegsAndPols(*buff);
   }

   return buff; 
}

//_____________________________________________________________________________
void TGeoSphere::SetSegsAndPols(TBuffer3D & buff) const
{
// Fill TBuffer3D structure for segments and polygons.
   Bool_t full = kTRUE;
   if (TestShapeBit(kGeoThetaSeg) || TestShapeBit(kGeoPhiSeg)) full = kFALSE;
   Int_t ncenter = 1;
   if (full || TestShapeBit(kGeoRSeg)) ncenter = 0;
   Int_t nup = (fTheta1>0)?0:1;
   Int_t ndown = (fTheta2<180)?0:1;
   // number of different latitudes, excluding 0 and 180 degrees
   Int_t nlat = fNz+1-(nup+ndown);
   // number of different longitudes
   Int_t nlong = fNseg;
   if (TestShapeBit(kGeoPhiSeg)) nlong++;

   Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
   if (TestShapeBit(kGeoRSeg)) nbPnts *= 2;

   Int_t nbSegs = nlat*fNseg + (nlat-1+nup+ndown)*nlong; // outer sphere
   if (TestShapeBit(kGeoRSeg)) nbSegs *= 2; // inner sphere
   if (TestShapeBit(kGeoPhiSeg)) nbSegs += 2*nlat+nup+ndown; // 2 phi planes
   nbSegs += nlong * (2-nup - ndown);  // connecting cones
      
   Int_t nbPols = fNz*fNseg; // outer
   if (TestShapeBit(kGeoRSeg)) nbPols *=2;  // inner
   if (TestShapeBit(kGeoPhiSeg)) nbPols += 2*fNz; // 2 phi planes
   nbPols += (2-nup-ndown)*fNseg; // connecting

   Int_t c = GetBasicColor();
   Int_t i, j;
   Int_t indx;
   indx = 0;
   // outside sphere
   // loop all segments on latitudes (except 0 and 180 degrees)
   // [0, nlat*fNseg)
   Int_t indpar = 0;
   for (i=0; i<nlat; i++) {
      for (j=0; j<fNseg; j++) {
         buff.fSegs[indx++]   = c;
         buff.fSegs[indx++] = i*nlong+j;
         buff.fSegs[indx++] = i*nlong+(j+1)%nlong;
      }
   }
   // loop all segments on longitudes
   // nlat*fNseg + [0, (nlat-1)*nlong)
   Int_t indlong = indpar + nlat*fNseg;
   for (i=0; i<nlat-1; i++) {
      for (j=0; j<nlong; j++) {
         buff.fSegs[indx++]   = c;
         buff.fSegs[indx++] = i*nlong+j;
         buff.fSegs[indx++] = (i+1)*nlong+j;
      }
   }
   Int_t indup = indlong + (nlat-1)*nlong;
   // extra longitudes on top
   // nlat*fNseg+(nlat-1)*nlong + [0, nlong)
   if (nup) {
      Int_t indpup = nlat*nlong;
      for (j=0; j<nlong; j++) {
         buff.fSegs[indx++]   = c;
         buff.fSegs[indx++] = j;
         buff.fSegs[indx++] = indpup;
      }   
   }      
   Int_t inddown = indup + nup*nlong;
   // extra longitudes on bottom
   // nlat*fNseg+(nlat+nup-1)*nlong + [0, nlong)
   if (ndown) {
      Int_t indpdown = nlat*nlong+nup;
      for (j=0; j<nlong; j++) {
         buff.fSegs[indx++]   = c;
         buff.fSegs[indx++] = (nlat-1)*nlong+j;
         buff.fSegs[indx++] = indpdown;
      }   
   }      
   Int_t indparin = inddown + ndown*nlong;
   Int_t indlongin = indparin;
   Int_t indupin = indparin;
   Int_t inddownin = indparin;
   Int_t indphi = indparin;
   // inner sphere
   Int_t indptin = nlat*nlong + nup + ndown;
   Int_t iptcenter = indptin;
   // nlat*fNseg+(nlat+nup+ndown-1)*nlong
   if (TestShapeBit(kGeoRSeg)) {
      indlongin = indparin + nlat*fNseg;
      indupin   = indlongin + (nlat-1)*nlong;
      inddownin = indupin + nup*nlong;
      // loop all segments on latitudes (except 0 and 180 degrees)
      // indsegin + [0, nlat*fNseg)
      for (i=0; i<nlat; i++) {
         for (j=0; j<fNseg; j++) {
            buff.fSegs[indx++]   = c+1;
            buff.fSegs[indx++] = indptin + i*nlong+j;
            buff.fSegs[indx++] = indptin + i*nlong+(j+1)%nlong;
         }
      }
      // loop all segments on longitudes
      // indsegin + nlat*fNseg + [0, (nlat-1)*nlong)
      for (i=0; i<nlat-1; i++) {
         for (j=0; j<nlong; j++) {
            buff.fSegs[indx++]   = c+1;
            buff.fSegs[indx++] = indptin + i*nlong+j;
            buff.fSegs[indx++] = indptin + (i+1)*nlong+j;
         }
      }
      // extra longitudes on top
      // indsegin + nlat*fNseg+(nlat-1)*nlong + [0, nlong)
      if (nup) {
         Int_t indupltop = indptin + nlat*nlong;
         for (j=0; j<nlong; j++) {
            buff.fSegs[indx++]   = c+1;
            buff.fSegs[indx++] = indptin + j;
            buff.fSegs[indx++] = indupltop;
         }   
      }      
      // extra longitudes on bottom
      // indsegin + nlat*fNseg+(nlat+nup-1)*nlong + [0, nlong)
      if (ndown) {
         Int_t indpdown = indptin + nlat*nlong+nup;
         for (j=0; j<nlong; j++) {
            buff.fSegs[indx++]   = c+1;
            buff.fSegs[indx++] = indptin + (nlat-1)*nlong+j;
            buff.fSegs[indx++] = indpdown;
         }   
      }      
      indphi = inddownin + ndown*nlong;
   }
   Int_t indtheta = indphi; 
   // Segments on phi planes
   if (TestShapeBit(kGeoPhiSeg)) {
      indtheta += 2*nlat + nup + ndown;
      for (j=0; j<nlat; j++) {
         buff.fSegs[indx++]   = c+2;
         buff.fSegs[indx++] = j*nlong;
         if (TestShapeBit(kGeoRSeg)) buff.fSegs[indx++] = indptin + j*nlong;
         else buff.fSegs[indx++] = iptcenter;
      }
      for (j=0; j<nlat; j++) {
         buff.fSegs[indx++]   = c+2;
         buff.fSegs[indx++] = (j+1)*nlong-1;
         if (TestShapeBit(kGeoRSeg)) buff.fSegs[indx++] = indptin + (j+1)*nlong-1;
         else buff.fSegs[indx++] = iptcenter;
      }
      if (nup) {
         buff.fSegs[indx++]   = c+2;
         buff.fSegs[indx++] = nlat*nlong;
         if (TestShapeBit(kGeoRSeg)) buff.fSegs[indx++] = indptin + nlat*nlong;
         else buff.fSegs[indx++] = iptcenter;
      }   
      if (ndown) {
         buff.fSegs[indx++]   = c+2;
         buff.fSegs[indx++] = nlat*nlong+nup;
         if (TestShapeBit(kGeoRSeg)) buff.fSegs[indx++] = indptin + nlat*nlong+nup;
         else buff.fSegs[indx++] = iptcenter;
      }   
   }
   // Segments on cones
   if (!nup) {   
      for (j=0; j<nlong; j++) {
         buff.fSegs[indx++]   = c+2;
         buff.fSegs[indx++] = j;
         if (TestShapeBit(kGeoRSeg)) buff.fSegs[indx++] = indptin + j;
         else buff.fSegs[indx++] = iptcenter;
      }
   }     
   if (!ndown) {   
      for (j=0; j<nlong; j++) {
         buff.fSegs[indx++]   = c+2;
         buff.fSegs[indx++] = (nlat-1)*nlong + j;
         if (TestShapeBit(kGeoRSeg)) buff.fSegs[indx++] = indptin + (nlat-1)*nlong +j;
         else buff.fSegs[indx++] = iptcenter;
      }
   }     
   
   indx = 0;
   // Fill polygons for outside sphere (except 0/180)
   for (i=0; i<nlat-1; i++) {
      for (j=0; j<fNseg; j++) {
         buff.fPols[indx++] = c;   
         buff.fPols[indx++] = 4;
         buff.fPols[indx++] = indpar+i*fNseg+j;
         buff.fPols[indx++] = indlong+i*nlong+(j+1)%nlong;
         buff.fPols[indx++] = indpar+(i+1)*fNseg+j;
         buff.fPols[indx++] = indlong+i*nlong+j;
      }
   }      
   // upper
   if (nup) {
      for (j=0; j<fNseg; j++) {
         buff.fPols[indx++] = c;   
         buff.fPols[indx++] = 3;
         buff.fPols[indx++] = indup + j;
         buff.fPols[indx++] = indup + (j+1)%nlong;
         buff.fPols[indx++] = indpar + j;
      }      
   }
   // lower
   if (ndown) {
      for (j=0; j<fNseg; j++) {
         buff.fPols[indx++] = c;   
         buff.fPols[indx++] = 3;
         buff.fPols[indx++] = inddown + j;
         buff.fPols[indx++] = indpar + (nlat-1)*fNseg + j;
         buff.fPols[indx++] = inddown + (j+1)%nlong;
      }      
   }
   // Fill polygons for inside sphere (except 0/180)

   if (TestShapeBit(kGeoRSeg)) {
      for (i=0; i<nlat-1; i++) {
         for (j=0; j<fNseg; j++) {
            buff.fPols[indx++] = c+1;   
            buff.fPols[indx++] = 4;
            buff.fPols[indx++] = indparin+i*fNseg+j;
            buff.fPols[indx++] = indlongin+i*nlong+j;
            buff.fPols[indx++] = indparin+(i+1)*fNseg+j;
            buff.fPols[indx++] = indlongin+i*nlong+(j+1)%nlong;
         }
      }
      // upper
      if (nup) {
         for (j=0; j<fNseg; j++) {
            buff.fPols[indx++] = c+1;   
            buff.fPols[indx++] = 3;
            buff.fPols[indx++] = indupin + j;
            buff.fPols[indx++] = indparin + j;
            buff.fPols[indx++] = indupin + (j+1)%nlong;
         }      
      }
      // lower
      if (ndown) {
         for (j=0; j<fNseg; j++) {
            buff.fPols[indx++] = c+1;   
            buff.fPols[indx++] = 3;
            buff.fPols[indx++] = inddownin + j;
            buff.fPols[indx++] = inddownin + (j+1)%nlong;
            buff.fPols[indx++] = indparin + (nlat-1)*fNseg + j;
         }      
      }
   }         
   // Polygons on phi planes
   if (TestShapeBit(kGeoPhiSeg)) {
      for (i=0; i<nlat-1; i++) {
         buff.fPols[indx++]   = c+2;
         if (TestShapeBit(kGeoRSeg)) {
            buff.fPols[indx++] = 4;
            buff.fPols[indx++] = indlong + i*nlong;
            buff.fPols[indx++] = indphi + i + 1;
            buff.fPols[indx++] = indlongin + i*nlong;
            buff.fPols[indx++] = indphi + i;
         } else {
            buff.fPols[indx++] = 3;  
            buff.fPols[indx++] = indlong + i*nlong;
            buff.fPols[indx++] = indphi + i + 1;
            buff.fPols[indx++] = indphi + i;
         }
      }      
      for (i=0; i<nlat-1; i++) {
         buff.fPols[indx++]   = c+2;
         if (TestShapeBit(kGeoRSeg)) {
            buff.fPols[indx++] = 4;
            buff.fPols[indx++] = indlong + (i+1)*nlong-1;
            buff.fPols[indx++] = indphi + nlat + i;
            buff.fPols[indx++] = indlongin + (i+1)*nlong-1;
            buff.fPols[indx++] = indphi + nlat + i + 1;
         } else {
            buff.fPols[indx++] = 3;  
            buff.fPols[indx++] = indlong + (i+1)*nlong-1;
            buff.fPols[indx++] = indphi + nlat + i;
            buff.fPols[indx++] = indphi + nlat + i + 1;
         }
      }      
      if (nup) {
         buff.fPols[indx++]   = c+2;
         if (TestShapeBit(kGeoRSeg)) {
            buff.fPols[indx++] = 4;
            buff.fPols[indx++] = indup;
            buff.fPols[indx++] = indphi;
            buff.fPols[indx++] = indupin;
            buff.fPols[indx++] = indphi + 2*nlat;
         } else {
            buff.fPols[indx++] = 3;
            buff.fPols[indx++] = indup;  
            buff.fPols[indx++] = indphi;
            buff.fPols[indx++] = indphi + 2*nlat;
         }                      
         buff.fPols[indx++]   = c+2;
         if (TestShapeBit(kGeoRSeg)) {
            buff.fPols[indx++] = 4;
            buff.fPols[indx++] = indup+nlong-1;
            buff.fPols[indx++] = indphi + 2*nlat;
            buff.fPols[indx++] = indupin+nlong-1;
            buff.fPols[indx++] = indphi + nlat;
         } else {
            buff.fPols[indx++] = 3;
            buff.fPols[indx++] = indup+nlong-1;  
            buff.fPols[indx++] = indphi + 2*nlat;
            buff.fPols[indx++] = indphi + nlat;
         }                      
      }
      if (ndown) {
         buff.fPols[indx++]   = c+2;
         if (TestShapeBit(kGeoRSeg)) {
            buff.fPols[indx++] = 4;
            buff.fPols[indx++] = inddown;
            buff.fPols[indx++] = indphi + 2*nlat + nup;
            buff.fPols[indx++] = inddownin;
            buff.fPols[indx++] = indphi + nlat-1;
         } else {
            buff.fPols[indx++] = 3;
            buff.fPols[indx++] = inddown;  
            buff.fPols[indx++] = indphi + 2*nlat + nup;
            buff.fPols[indx++] = indphi + nlat-1;
         }                      
         buff.fPols[indx++]   = c+2;
         if (TestShapeBit(kGeoRSeg)) {
            buff.fPols[indx++] = 4;
            buff.fPols[indx++] = inddown+nlong-1;
            buff.fPols[indx++] = indphi + 2*nlat-1;
            buff.fPols[indx++] = inddownin+nlong-1;
            buff.fPols[indx++] = indphi + 2*nlat+nup;
         } else {
            buff.fPols[indx++] = 3;
            buff.fPols[indx++] = inddown+nlong-1;  
            buff.fPols[indx++] = indphi + 2*nlat-1;
            buff.fPols[indx++] = indphi + 2*nlat+nup;
         } 
      }
   }                           
   // Polygons on cones
   if (!nup) {
      for (j=0; j<fNseg; j++) {
         buff.fPols[indx++] = c+2;
         if (TestShapeBit(kGeoRSeg)) {
            buff.fPols[indx++] = 4;
            buff.fPols[indx++] = indpar+j;
            buff.fPols[indx++] = indtheta + j;
            buff.fPols[indx++] = indparin + j;
            buff.fPols[indx++] = indtheta + (j+1)%nlong;            
         } else {
            buff.fPols[indx++] = 3;
            buff.fPols[indx++] = indpar+j;
            buff.fPols[indx++] = indtheta + j;
            buff.fPols[indx++] = indtheta + (j+1)%nlong;            
         }
      }   
   }
   if (!ndown) {
      for (j=0; j<fNseg; j++) {
         buff.fPols[indx++] = c+2;
         if (TestShapeBit(kGeoRSeg)) {
            buff.fPols[indx++] = 4;
            buff.fPols[indx++] = indpar+(nlat-1)*fNseg+j;
            buff.fPols[indx++] = indtheta + (1-nup)*nlong +(j+1)%nlong;            
            buff.fPols[indx++] = indparin + (nlat-1)*fNseg + j;
            buff.fPols[indx++] = indtheta + (1-nup)*nlong + j;
         } else {
            buff.fPols[indx++] = 3;
            buff.fPols[indx++] = indpar+(nlat-1)*fNseg+j;
            buff.fPols[indx++] = indtheta + (1-nup)*nlong +(j+1)%nlong;            
            buff.fPols[indx++] = indtheta + (1-nup)*nlong + j;
         }
      }   
   }
}   
   
//_____________________________________________________________________________
Double_t TGeoSphere::Safety(Double_t *point, Bool_t in) const
{
// computes the closest distance from given point to this shape, according
// to option. The matching point on the shape is stored in spoint.
   Double_t r2 = point[0]*point[0]+point[1]*point[1]+point[2]*point[2];
   Double_t r=TMath::Sqrt(r2);
   Bool_t rzero=kFALSE;
   if (r<=1E-20) rzero=kTRUE;
   //localize theta
   Double_t th=0.;
   if (TestShapeBit(kGeoThetaSeg) && (!rzero)) {
      th = TMath::ACos(point[2]/r)*TMath::RadToDeg();
   }
   Double_t saf[4];
   saf[0]=(TGeoShape::IsSameWithinTolerance(fRmin,0) && !TestShapeBit(kGeoThetaSeg) && !TestShapeBit(kGeoPhiSeg))?TGeoShape::Big():r-fRmin;
   saf[1]=fRmax-r;
   saf[2]=saf[3]= TGeoShape::Big();
   if (TestShapeBit(kGeoThetaSeg)) {
      if (fTheta1>0)    saf[2] = r*TMath::Sin((th-fTheta1)*TMath::DegToRad());
      if (fTheta2<180)  saf[3] = r*TMath::Sin((fTheta2-th)*TMath::DegToRad());
   }
   Double_t safphi = TGeoShape::Big();
   Double_t safe = TGeoShape::Big();
   if (TestShapeBit(kGeoPhiSeg)) safphi = TGeoShape::SafetyPhi(point,in,fPhi1,fPhi2);
   if (in) {
      safe = saf[TMath::LocMin(4,saf)];
      return TMath::Min(safe,safphi);
   }   
   for (Int_t i=0; i<4; i++) saf[i]=-saf[i];
   safe = saf[TMath::LocMax(4, saf)];
   if (TestShapeBit(kGeoPhiSeg)) return TMath::Max(safe, safphi);
   return safe;
}

//_____________________________________________________________________________
void TGeoSphere::SavePrimitive(ostream &out, Option_t * /*option*/ /*= ""*/)
{
// Save a primitive as a C++ statement(s) on output stream "out".
   if (TObject::TestBit(kGeoSavePrimitive)) return;
   out << "   // Shape: " << GetName() << " type: " << ClassName() << endl;
   out << "   rmin   = " << fRmin << ";" << endl;
   out << "   rmax   = " << fRmax << ";" << endl;
   out << "   theta1 = " << fTheta1<< ";" << endl;
   out << "   theta2 = " << fTheta2 << ";" << endl;
   out << "   phi1   = " << fPhi1 << ";" << endl;
   out << "   phi2   = " << fPhi2 << ";" << endl;
   out << "   TGeoShape *" << GetPointerName() << " = new TGeoSphere(\"" << GetName() << "\",rmin,rmax,theta1, theta2,phi1,phi2);" << endl;
   TObject::SetBit(TGeoShape::kGeoSavePrimitive);   
}

//_____________________________________________________________________________
void TGeoSphere::SetSphDimensions(Double_t rmin, Double_t rmax, Double_t theta1,
                               Double_t theta2, Double_t phi1, Double_t phi2)
{
// Set spherical segment dimensions.
   if (rmin >= rmax) {
      Error("SetDimensions", "invalid parameters rmin/rmax");
      return;
   }
   fRmin = rmin;
   fRmax = rmax;
   if (rmin>0) SetShapeBit(kGeoRSeg);
   if (theta1 >= theta2 || theta1<0 || theta1>180 || theta2>180) {
      Error("SetDimensions", "invalid parameters theta1/theta2");
      return;
   }
   fTheta1 = theta1;
   fTheta2 = theta2;
   if ((theta2-theta1)<180.) SetShapeBit(kGeoThetaSeg);
   fPhi1 = phi1;
   if (phi1<0) fPhi1+=360.;
   fPhi2 = phi2;
   while (fPhi2<fPhi1) fPhi2+=360.;
   if (!TGeoShape::IsSameWithinTolerance(TMath::Abs(phi2-phi1),360)) SetShapeBit(kGeoPhiSeg);
}   

//_____________________________________________________________________________
void TGeoSphere::SetDimensions(Double_t *param)
{
// Set dimensions of the spherical segment starting from a list of parameters.
   Double_t rmin = param[0];
   Double_t rmax = param[1];
   Double_t theta1 = 0;
   Double_t theta2 = 180.;
   Double_t phi1 = 0;
   Double_t phi2 = 360.;
//   if (nparam > 2) theta1 = param[2];
//   if (nparam > 3) theta2 = param[3];
//   if (nparam > 4) phi1   = param[4];
//   if (nparam > 5) phi2   = param[5];
   SetSphDimensions(rmin, rmax, theta1, theta2, phi1, phi2);
}   

//_____________________________________________________________________________
void TGeoSphere::SetNumberOfDivisions(Int_t p)
{
// Set the number of divisions of mesh circles keeping aspect ratio.
   fNseg = p;
   Double_t dphi = fPhi2 - fPhi1;
   if (dphi<0) dphi+=360;
   Double_t dtheta = TMath::Abs(fTheta2-fTheta1);
   fNz = Int_t(fNseg*dtheta/dphi) +1;
   if (fNz<2) fNz=2;
}

//_____________________________________________________________________________
void TGeoSphere::SetPoints(Double_t *points) const
{
// create sphere mesh points
   if (!points) {
      Error("SetPoints", "Input array is NULL");
      return;
   }   
   Bool_t full = kTRUE;
   if (TestShapeBit(kGeoThetaSeg) || TestShapeBit(kGeoPhiSeg)) full = kFALSE;
   Int_t ncenter = 1;
   if (full || TestShapeBit(kGeoRSeg)) ncenter = 0;
   Int_t nup = (fTheta1>0)?0:1;
   Int_t ndown = (fTheta2<180)?0:1;
   // number of different latitudes, excluding 0 and 180 degrees
   Int_t nlat = fNz+1-(nup+ndown);
   // number of different longitudes
   Int_t nlong = fNseg;
   if (TestShapeBit(kGeoPhiSeg)) nlong++;
   // total number of points on mesh is:
   //    nlat*nlong + nup + ndown + ncenter;    // in case rmin=0
   //   2*(nlat*nlong + nup + ndown);           // in case rmin>0
   Int_t i,j ;
   Double_t phi1 = fPhi1*TMath::DegToRad();
   Double_t phi2 = fPhi2*TMath::DegToRad();
   Double_t dphi = (phi2-phi1)/fNseg;
   Double_t theta1 = fTheta1*TMath::DegToRad();
   Double_t theta2 = fTheta2*TMath::DegToRad();
   Double_t dtheta = (theta2-theta1)/fNz;
   Double_t z,zi,theta,phi,cphi,sphi;
   Int_t indx=0;
   // FILL ALL POINTS ON OUTER SPHERE
   // (nlat * nlong) points
   // loop all latitudes except 0/180 degrees (nlat times)
   // ilat = [0,nlat]   jlong = [0,nlong]
   // Index(ilat, jlong) = 3*(ilat*nlat + jlong)
   for (i = 0; i < nlat; i++) {
      theta = theta1+(nup+i)*dtheta;
      z =  fRmax * TMath::Cos(theta);
      zi = fRmax * TMath::Sin(theta);
      // loop all different longitudes (nlong times)
      for (j = 0; j < nlong; j++) {
         phi = phi1+j*dphi;
         cphi = TMath::Cos(phi);
         sphi = TMath::Sin(phi);
         points[indx++] = zi * cphi;
         points[indx++] = zi * sphi;
         points[indx++] = z;
      }
   }
   // upper/lower points (if they exist) for outer sphere
   if (nup) {
      // ind_up = 3*nlat*nlong
      points[indx++] = 0.;
      points[indx++] = 0.;
      points[indx++] = fRmax;
   }   
   if (ndown) {
      // ind_down = 3*(nlat*nlong+nup)
      points[indx++] = 0.;
      points[indx++] = 0.;
      points[indx++] = -fRmax;
   }   
   // do the same for inner sphere if it exist
   // Start_index = 3*(nlat*nlong + nup + ndown)
   if (TestShapeBit(kGeoRSeg)) {
   // Index(ilat, jlong) = start_index + 3*(ilat*nlat + jlong)
      for (i = 0; i < nlat; i++) {
         theta = theta1+(nup+i)*dtheta;
         z =  fRmin * TMath::Cos(theta);
         zi = fRmin * TMath::Sin(theta);
         // loop all different longitudes (nlong times)
         for (j = 0; j < nlong; j++) {
            phi = phi1+j*dphi;
            cphi = TMath::Cos(phi);
            sphi = TMath::Sin(phi);
            points[indx++] = zi * cphi;
            points[indx++] = zi * sphi;
            points[indx++] = z;
         }
      }
      // upper/lower points (if they exist) for inner sphere
      if (nup) {
      // ind_up = start_index + 3*nlat*nlong
         points[indx++] = 0.;
         points[indx++] = 0.;
         points[indx++] = fRmin;
      }   
      if (ndown) {
      // ind_down = start_index + 3*(nlat*nlong+nup)
         points[indx++] = 0.;
         points[indx++] = 0.;
         points[indx++] = -fRmin;
      }   
   }
   // Add center of sphere if needed
   if (ncenter) {
      // ind_center = 6*(nlat*nlong + nup + ndown)
      points[indx++] = 0.;
      points[indx++] = 0.;
      points[indx++] = 0.;
   }   
}

//_____________________________________________________________________________
void TGeoSphere::SetPoints(Float_t *points) const
{
// create sphere mesh points
   if (!points) {
      Error("SetPoints", "Input array is NULL");
      return;
   }   
   Bool_t full = kTRUE;
   if (TestShapeBit(kGeoThetaSeg) || TestShapeBit(kGeoPhiSeg)) full = kFALSE;
   Int_t ncenter = 1;
   if (full || TestShapeBit(kGeoRSeg)) ncenter = 0;
   Int_t nup = (fTheta1>0)?0:1;
   Int_t ndown = (fTheta2<180)?0:1;
   // number of different latitudes, excluding 0 and 180 degrees
   Int_t nlat = fNz+1-(nup+ndown);
   // number of different longitudes
   Int_t nlong = fNseg;
   if (TestShapeBit(kGeoPhiSeg)) nlong++;
   // total number of points on mesh is:
   //    nlat*nlong + nup + ndown + ncenter;    // in case rmin=0
   //   2*(nlat*nlong + nup + ndown);           // in case rmin>0
   Int_t i,j ;
   Double_t phi1 = fPhi1*TMath::DegToRad();
   Double_t phi2 = fPhi2*TMath::DegToRad();
   Double_t dphi = (phi2-phi1)/fNseg;
   Double_t theta1 = fTheta1*TMath::DegToRad();
   Double_t theta2 = fTheta2*TMath::DegToRad();
   Double_t dtheta = (theta2-theta1)/fNz;
   Double_t z,zi,theta,phi,cphi,sphi;
   Int_t indx=0;
   // FILL ALL POINTS ON OUTER SPHERE
   // (nlat * nlong) points
   // loop all latitudes except 0/180 degrees (nlat times)
   // ilat = [0,nlat]   jlong = [0,nlong]
   // Index(ilat, jlong) = 3*(ilat*nlat + jlong)
   for (i = 0; i < nlat; i++) {
      theta = theta1+(nup+i)*dtheta;
      z =  fRmax * TMath::Cos(theta);
      zi = fRmax * TMath::Sin(theta);
      // loop all different longitudes (nlong times)
      for (j = 0; j < nlong; j++) {
         phi = phi1+j*dphi;
         cphi = TMath::Cos(phi);
         sphi = TMath::Sin(phi);
         points[indx++] = zi * cphi;
         points[indx++] = zi * sphi;
         points[indx++] = z;
      }
   }
   // upper/lower points (if they exist) for outer sphere
   if (nup) {
      // ind_up = 3*nlat*nlong
      points[indx++] = 0.;
      points[indx++] = 0.;
      points[indx++] = fRmax;
   }   
   if (ndown) {
      // ind_down = 3*(nlat*nlong+nup)
      points[indx++] = 0.;
      points[indx++] = 0.;
      points[indx++] = -fRmax;
   }   
   // do the same for inner sphere if it exist
   // Start_index = 3*(nlat*nlong + nup + ndown)
   if (TestShapeBit(kGeoRSeg)) {
   // Index(ilat, jlong) = start_index + 3*(ilat*nlat + jlong)
      for (i = 0; i < nlat; i++) {
         theta = theta1+(nup+i)*dtheta;
         z =  fRmin * TMath::Cos(theta);
         zi = fRmin * TMath::Sin(theta);
         // loop all different longitudes (nlong times)
         for (j = 0; j < nlong; j++) {
            phi = phi1+j*dphi;
            cphi = TMath::Cos(phi);
            sphi = TMath::Sin(phi);
            points[indx++] = zi * cphi;
            points[indx++] = zi * sphi;
            points[indx++] = z;
         }
      }
      // upper/lower points (if they exist) for inner sphere
      if (nup) {
      // ind_up = start_index + 3*nlat*nlong
         points[indx++] = 0.;
         points[indx++] = 0.;
         points[indx++] = fRmin;
      }   
      if (ndown) {
      // ind_down = start_index + 3*(nlat*nlong+nup)
         points[indx++] = 0.;
         points[indx++] = 0.;
         points[indx++] = -fRmin;
      }   
   }
   // Add center of sphere if needed
   if (ncenter) {
      // ind_center = 6*(nlat*nlong + nup + ndown)
      points[indx++] = 0.;
      points[indx++] = 0.;
      points[indx++] = 0.;
   }   
}

//_____________________________________________________________________________
void TGeoSphere::GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
{
// Returns numbers of vertices, segments and polygons composing the shape mesh.
   TGeoSphere * localThis = const_cast<TGeoSphere *>(this);
   localThis->SetNumberOfDivisions(gGeoManager->GetNsegments());
   Bool_t full = kTRUE;
   if (TestShapeBit(kGeoThetaSeg) || TestShapeBit(kGeoPhiSeg)) full = kFALSE;
   Int_t ncenter = 1;
   if (full || TestShapeBit(kGeoRSeg)) ncenter = 0;
   Int_t nup = (fTheta1>0)?0:1;
   Int_t ndown = (fTheta2<180)?0:1;
   // number of different latitudes, excluding 0 and 180 degrees
   Int_t nlat = fNz+1-(nup+ndown);
   // number of different longitudes
   Int_t nlong = fNseg;
   if (TestShapeBit(kGeoPhiSeg)) nlong++;

   nvert = nlat*nlong+nup+ndown+ncenter;
   if (TestShapeBit(kGeoRSeg)) nvert *= 2;

   nsegs = nlat*fNseg + (nlat-1+nup+ndown)*nlong; // outer sphere
   if (TestShapeBit(kGeoRSeg)) nsegs *= 2; // inner sphere
   if (TestShapeBit(kGeoPhiSeg)) nsegs += 2*nlat+nup+ndown; // 2 phi planes
   nsegs += nlong * (2-nup - ndown);  // connecting cones
      
   npols = fNz*fNseg; // outer
   if (TestShapeBit(kGeoRSeg)) npols *=2;  // inner
   if (TestShapeBit(kGeoPhiSeg)) npols += 2*fNz; // 2 phi planes
   npols += (2-nup-ndown)*fNseg; // connecting
}

//_____________________________________________________________________________
Int_t TGeoSphere::GetNmeshVertices() const
{
// Return number of vertices of the mesh representation
   Bool_t full = kTRUE;
   if (TestShapeBit(kGeoThetaSeg) || TestShapeBit(kGeoPhiSeg)) full = kFALSE;
   Int_t ncenter = 1;
   if (full || TestShapeBit(kGeoRSeg)) ncenter = 0;
   Int_t nup = (fTheta1>0)?0:1;
   Int_t ndown = (fTheta2<180)?0:1;
   // number of different latitudes, excluding 0 and 180 degrees
   Int_t nlat = fNz+1-(nup+ndown);
   // number of different longitudes
   Int_t nlong = fNseg;
   if (TestShapeBit(kGeoPhiSeg)) nlong++;
   // total number of points on mesh is:
   //    nlat*nlong + nup + ndown + ncenter;    // in case rmin=0
   //   2*(nlat*nlong + nup + ndown);           // in case rmin>0
   Int_t numPoints = 0;
   if (TestShapeBit(kGeoRSeg)) numPoints = 2*(nlat*nlong+nup+ndown);
   else numPoints = nlat*nlong+nup+ndown+ncenter;
   return numPoints;
}

//_____________________________________________________________________________
void TGeoSphere::Sizeof3D() const
{
///// obsolete - to be removed
}

//_____________________________________________________________________________
const TBuffer3D & TGeoSphere::GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
{
// Fills a static 3D buffer and returns a reference.
   static TBuffer3DSphere buffer;

   TGeoBBox::FillBuffer3D(buffer, reqSections, localFrame);

   if (reqSections & TBuffer3D::kShapeSpecific) {
      buffer.fRadiusInner  = fRmin;
      buffer.fRadiusOuter  = fRmax;
      buffer.fThetaMin     = fTheta1;
      buffer.fThetaMax     = fTheta2;
      buffer.fPhiMin       = fPhi1;
      buffer.fPhiMax       = fPhi2;
      buffer.SetSectionsValid(TBuffer3D::kShapeSpecific);
   }
   if (reqSections & TBuffer3D::kRawSizes) {
      // We want FillBuffer to be const
      TGeoSphere * localThis = const_cast<TGeoSphere *>(this);
      localThis->SetNumberOfDivisions(gGeoManager->GetNsegments());

      Bool_t full = kTRUE;
      if (TestShapeBit(kGeoThetaSeg) || TestShapeBit(kGeoPhiSeg)) full = kFALSE;
      Int_t ncenter = 1;
      if (full || TestShapeBit(kGeoRSeg)) ncenter = 0;
      Int_t nup = (fTheta1>0)?0:1;
      Int_t ndown = (fTheta2<180)?0:1;
      // number of different latitudes, excluding 0 and 180 degrees
      Int_t nlat = fNz+1-(nup+ndown);
      // number of different longitudes
      Int_t nlong = fNseg;
      if (TestShapeBit(kGeoPhiSeg)) nlong++;

      Int_t nbPnts = nlat*nlong+nup+ndown+ncenter;
      if (TestShapeBit(kGeoRSeg)) nbPnts *= 2;

      Int_t nbSegs = nlat*fNseg + (nlat-1+nup+ndown)*nlong; // outer sphere
      if (TestShapeBit(kGeoRSeg)) nbSegs *= 2; // inner sphere
      if (TestShapeBit(kGeoPhiSeg)) nbSegs += 2*nlat+nup+ndown; // 2 phi planes
      nbSegs += nlong * (2-nup - ndown);  // connecting cones
      
      Int_t nbPols = fNz*fNseg; // outer
      if (TestShapeBit(kGeoRSeg)) nbPols *=2;  // inner
      if (TestShapeBit(kGeoPhiSeg)) nbPols += 2*fNz; // 2 phi planes
      nbPols += (2-nup-ndown)*fNseg; // connecting
      
      if (buffer.SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
         buffer.SetSectionsValid(TBuffer3D::kRawSizes);
      }
   }
   if ((reqSections & TBuffer3D::kRaw) && buffer.SectionsValid(TBuffer3D::kRawSizes)) {
      SetPoints(buffer.fPnts);
      if (!buffer.fLocalFrame) {
         TransformPoints(buffer.fPnts, buffer.NbPnts());
      }
      SetSegsAndPols(buffer);  
      buffer.SetSectionsValid(TBuffer3D::kRaw);
   }
      
   return buffer;
}
 TGeoSphere.cxx:1
 TGeoSphere.cxx:2
 TGeoSphere.cxx:3
 TGeoSphere.cxx:4
 TGeoSphere.cxx:5
 TGeoSphere.cxx:6
 TGeoSphere.cxx:7
 TGeoSphere.cxx:8
 TGeoSphere.cxx:9
 TGeoSphere.cxx:10
 TGeoSphere.cxx:11
 TGeoSphere.cxx:12
 TGeoSphere.cxx:13
 TGeoSphere.cxx:14
 TGeoSphere.cxx:15
 TGeoSphere.cxx:16
 TGeoSphere.cxx:17
 TGeoSphere.cxx:18
 TGeoSphere.cxx:19
 TGeoSphere.cxx:20
 TGeoSphere.cxx:21
 TGeoSphere.cxx:22
 TGeoSphere.cxx:23
 TGeoSphere.cxx:24
 TGeoSphere.cxx:25
 TGeoSphere.cxx:26
 TGeoSphere.cxx:27
 TGeoSphere.cxx:28
 TGeoSphere.cxx:29
 TGeoSphere.cxx:30
 TGeoSphere.cxx:31
 TGeoSphere.cxx:32
 TGeoSphere.cxx:33
 TGeoSphere.cxx:34
 TGeoSphere.cxx:35
 TGeoSphere.cxx:36
 TGeoSphere.cxx:37
 TGeoSphere.cxx:38
 TGeoSphere.cxx:39
 TGeoSphere.cxx:40
 TGeoSphere.cxx:41
 TGeoSphere.cxx:42
 TGeoSphere.cxx:43
 TGeoSphere.cxx:44
 TGeoSphere.cxx:45
 TGeoSphere.cxx:46
 TGeoSphere.cxx:47
 TGeoSphere.cxx:48
 TGeoSphere.cxx:49
 TGeoSphere.cxx:50
 TGeoSphere.cxx:51
 TGeoSphere.cxx:52
 TGeoSphere.cxx:53
 TGeoSphere.cxx:54
 TGeoSphere.cxx:55
 TGeoSphere.cxx:56
 TGeoSphere.cxx:57
 TGeoSphere.cxx:58
 TGeoSphere.cxx:59
 TGeoSphere.cxx:60
 TGeoSphere.cxx:61
 TGeoSphere.cxx:62
 TGeoSphere.cxx:63
 TGeoSphere.cxx:64
 TGeoSphere.cxx:65
 TGeoSphere.cxx:66
 TGeoSphere.cxx:67
 TGeoSphere.cxx:68
 TGeoSphere.cxx:69
 TGeoSphere.cxx:70
 TGeoSphere.cxx:71
 TGeoSphere.cxx:72
 TGeoSphere.cxx:73
 TGeoSphere.cxx:74
 TGeoSphere.cxx:75
 TGeoSphere.cxx:76
 TGeoSphere.cxx:77
 TGeoSphere.cxx:78
 TGeoSphere.cxx:79
 TGeoSphere.cxx:80
 TGeoSphere.cxx:81
 TGeoSphere.cxx:82
 TGeoSphere.cxx:83
 TGeoSphere.cxx:84
 TGeoSphere.cxx:85
 TGeoSphere.cxx:86
 TGeoSphere.cxx:87
 TGeoSphere.cxx:88
 TGeoSphere.cxx:89
 TGeoSphere.cxx:90
 TGeoSphere.cxx:91
 TGeoSphere.cxx:92
 TGeoSphere.cxx:93
 TGeoSphere.cxx:94
 TGeoSphere.cxx:95
 TGeoSphere.cxx:96
 TGeoSphere.cxx:97
 TGeoSphere.cxx:98
 TGeoSphere.cxx:99
 TGeoSphere.cxx:100
 TGeoSphere.cxx:101
 TGeoSphere.cxx:102
 TGeoSphere.cxx:103
 TGeoSphere.cxx:104
 TGeoSphere.cxx:105
 TGeoSphere.cxx:106
 TGeoSphere.cxx:107
 TGeoSphere.cxx:108
 TGeoSphere.cxx:109
 TGeoSphere.cxx:110
 TGeoSphere.cxx:111
 TGeoSphere.cxx:112
 TGeoSphere.cxx:113
 TGeoSphere.cxx:114
 TGeoSphere.cxx:115
 TGeoSphere.cxx:116
 TGeoSphere.cxx:117
 TGeoSphere.cxx:118
 TGeoSphere.cxx:119
 TGeoSphere.cxx:120
 TGeoSphere.cxx:121
 TGeoSphere.cxx:122
 TGeoSphere.cxx:123
 TGeoSphere.cxx:124
 TGeoSphere.cxx:125
 TGeoSphere.cxx:126
 TGeoSphere.cxx:127
 TGeoSphere.cxx:128
 TGeoSphere.cxx:129
 TGeoSphere.cxx:130
 TGeoSphere.cxx:131
 TGeoSphere.cxx:132
 TGeoSphere.cxx:133
 TGeoSphere.cxx:134
 TGeoSphere.cxx:135
 TGeoSphere.cxx:136
 TGeoSphere.cxx:137
 TGeoSphere.cxx:138
 TGeoSphere.cxx:139
 TGeoSphere.cxx:140
 TGeoSphere.cxx:141
 TGeoSphere.cxx:142
 TGeoSphere.cxx:143
 TGeoSphere.cxx:144
 TGeoSphere.cxx:145
 TGeoSphere.cxx:146
 TGeoSphere.cxx:147
 TGeoSphere.cxx:148
 TGeoSphere.cxx:149
 TGeoSphere.cxx:150
 TGeoSphere.cxx:151
 TGeoSphere.cxx:152
 TGeoSphere.cxx:153
 TGeoSphere.cxx:154
 TGeoSphere.cxx:155
 TGeoSphere.cxx:156
 TGeoSphere.cxx:157
 TGeoSphere.cxx:158
 TGeoSphere.cxx:159
 TGeoSphere.cxx:160
 TGeoSphere.cxx:161
 TGeoSphere.cxx:162
 TGeoSphere.cxx:163
 TGeoSphere.cxx:164
 TGeoSphere.cxx:165
 TGeoSphere.cxx:166
 TGeoSphere.cxx:167
 TGeoSphere.cxx:168
 TGeoSphere.cxx:169
 TGeoSphere.cxx:170
 TGeoSphere.cxx:171
 TGeoSphere.cxx:172
 TGeoSphere.cxx:173
 TGeoSphere.cxx:174
 TGeoSphere.cxx:175
 TGeoSphere.cxx:176
 TGeoSphere.cxx:177
 TGeoSphere.cxx:178
 TGeoSphere.cxx:179
 TGeoSphere.cxx:180
 TGeoSphere.cxx:181
 TGeoSphere.cxx:182
 TGeoSphere.cxx:183
 TGeoSphere.cxx:184
 TGeoSphere.cxx:185
 TGeoSphere.cxx:186
 TGeoSphere.cxx:187
 TGeoSphere.cxx:188
 TGeoSphere.cxx:189
 TGeoSphere.cxx:190
 TGeoSphere.cxx:191
 TGeoSphere.cxx:192
 TGeoSphere.cxx:193
 TGeoSphere.cxx:194
 TGeoSphere.cxx:195
 TGeoSphere.cxx:196
 TGeoSphere.cxx:197
 TGeoSphere.cxx:198
 TGeoSphere.cxx:199
 TGeoSphere.cxx:200
 TGeoSphere.cxx:201
 TGeoSphere.cxx:202
 TGeoSphere.cxx:203
 TGeoSphere.cxx:204
 TGeoSphere.cxx:205
 TGeoSphere.cxx:206
 TGeoSphere.cxx:207
 TGeoSphere.cxx:208
 TGeoSphere.cxx:209
 TGeoSphere.cxx:210
 TGeoSphere.cxx:211
 TGeoSphere.cxx:212
 TGeoSphere.cxx:213
 TGeoSphere.cxx:214
 TGeoSphere.cxx:215
 TGeoSphere.cxx:216
 TGeoSphere.cxx:217
 TGeoSphere.cxx:218
 TGeoSphere.cxx:219
 TGeoSphere.cxx:220
 TGeoSphere.cxx:221
 TGeoSphere.cxx:222
 TGeoSphere.cxx:223
 TGeoSphere.cxx:224
 TGeoSphere.cxx:225
 TGeoSphere.cxx:226
 TGeoSphere.cxx:227
 TGeoSphere.cxx:228
 TGeoSphere.cxx:229
 TGeoSphere.cxx:230
 TGeoSphere.cxx:231
 TGeoSphere.cxx:232
 TGeoSphere.cxx:233
 TGeoSphere.cxx:234
 TGeoSphere.cxx:235
 TGeoSphere.cxx:236
 TGeoSphere.cxx:237
 TGeoSphere.cxx:238
 TGeoSphere.cxx:239
 TGeoSphere.cxx:240
 TGeoSphere.cxx:241
 TGeoSphere.cxx:242
 TGeoSphere.cxx:243
 TGeoSphere.cxx:244
 TGeoSphere.cxx:245
 TGeoSphere.cxx:246
 TGeoSphere.cxx:247
 TGeoSphere.cxx:248
 TGeoSphere.cxx:249
 TGeoSphere.cxx:250
 TGeoSphere.cxx:251
 TGeoSphere.cxx:252
 TGeoSphere.cxx:253
 TGeoSphere.cxx:254
 TGeoSphere.cxx:255
 TGeoSphere.cxx:256
 TGeoSphere.cxx:257
 TGeoSphere.cxx:258
 TGeoSphere.cxx:259
 TGeoSphere.cxx:260
 TGeoSphere.cxx:261
 TGeoSphere.cxx:262
 TGeoSphere.cxx:263
 TGeoSphere.cxx:264
 TGeoSphere.cxx:265
 TGeoSphere.cxx:266
 TGeoSphere.cxx:267
 TGeoSphere.cxx:268
 TGeoSphere.cxx:269
 TGeoSphere.cxx:270
 TGeoSphere.cxx:271
 TGeoSphere.cxx:272
 TGeoSphere.cxx:273
 TGeoSphere.cxx:274
 TGeoSphere.cxx:275
 TGeoSphere.cxx:276
 TGeoSphere.cxx:277
 TGeoSphere.cxx:278
 TGeoSphere.cxx:279
 TGeoSphere.cxx:280
 TGeoSphere.cxx:281
 TGeoSphere.cxx:282
 TGeoSphere.cxx:283
 TGeoSphere.cxx:284
 TGeoSphere.cxx:285
 TGeoSphere.cxx:286
 TGeoSphere.cxx:287
 TGeoSphere.cxx:288
 TGeoSphere.cxx:289
 TGeoSphere.cxx:290
 TGeoSphere.cxx:291
 TGeoSphere.cxx:292
 TGeoSphere.cxx:293
 TGeoSphere.cxx:294
 TGeoSphere.cxx:295
 TGeoSphere.cxx:296
 TGeoSphere.cxx:297
 TGeoSphere.cxx:298
 TGeoSphere.cxx:299
 TGeoSphere.cxx:300
 TGeoSphere.cxx:301
 TGeoSphere.cxx:302
 TGeoSphere.cxx:303
 TGeoSphere.cxx:304
 TGeoSphere.cxx:305
 TGeoSphere.cxx:306
 TGeoSphere.cxx:307
 TGeoSphere.cxx:308
 TGeoSphere.cxx:309
 TGeoSphere.cxx:310
 TGeoSphere.cxx:311
 TGeoSphere.cxx:312
 TGeoSphere.cxx:313
 TGeoSphere.cxx:314
 TGeoSphere.cxx:315
 TGeoSphere.cxx:316
 TGeoSphere.cxx:317
 TGeoSphere.cxx:318
 TGeoSphere.cxx:319
 TGeoSphere.cxx:320
 TGeoSphere.cxx:321
 TGeoSphere.cxx:322
 TGeoSphere.cxx:323
 TGeoSphere.cxx:324
 TGeoSphere.cxx:325
 TGeoSphere.cxx:326
 TGeoSphere.cxx:327
 TGeoSphere.cxx:328
 TGeoSphere.cxx:329
 TGeoSphere.cxx:330
 TGeoSphere.cxx:331
 TGeoSphere.cxx:332
 TGeoSphere.cxx:333
 TGeoSphere.cxx:334
 TGeoSphere.cxx:335
 TGeoSphere.cxx:336
 TGeoSphere.cxx:337
 TGeoSphere.cxx:338
 TGeoSphere.cxx:339
 TGeoSphere.cxx:340
 TGeoSphere.cxx:341
 TGeoSphere.cxx:342
 TGeoSphere.cxx:343
 TGeoSphere.cxx:344
 TGeoSphere.cxx:345
 TGeoSphere.cxx:346
 TGeoSphere.cxx:347
 TGeoSphere.cxx:348
 TGeoSphere.cxx:349
 TGeoSphere.cxx:350
 TGeoSphere.cxx:351
 TGeoSphere.cxx:352
 TGeoSphere.cxx:353
 TGeoSphere.cxx:354
 TGeoSphere.cxx:355
 TGeoSphere.cxx:356
 TGeoSphere.cxx:357
 TGeoSphere.cxx:358
 TGeoSphere.cxx:359
 TGeoSphere.cxx:360
 TGeoSphere.cxx:361
 TGeoSphere.cxx:362
 TGeoSphere.cxx:363
 TGeoSphere.cxx:364
 TGeoSphere.cxx:365
 TGeoSphere.cxx:366
 TGeoSphere.cxx:367
 TGeoSphere.cxx:368
 TGeoSphere.cxx:369
 TGeoSphere.cxx:370
 TGeoSphere.cxx:371
 TGeoSphere.cxx:372
 TGeoSphere.cxx:373
 TGeoSphere.cxx:374
 TGeoSphere.cxx:375
 TGeoSphere.cxx:376
 TGeoSphere.cxx:377
 TGeoSphere.cxx:378
 TGeoSphere.cxx:379
 TGeoSphere.cxx:380
 TGeoSphere.cxx:381
 TGeoSphere.cxx:382
 TGeoSphere.cxx:383
 TGeoSphere.cxx:384
 TGeoSphere.cxx:385
 TGeoSphere.cxx:386
 TGeoSphere.cxx:387
 TGeoSphere.cxx:388
 TGeoSphere.cxx:389
 TGeoSphere.cxx:390
 TGeoSphere.cxx:391
 TGeoSphere.cxx:392
 TGeoSphere.cxx:393
 TGeoSphere.cxx:394
 TGeoSphere.cxx:395
 TGeoSphere.cxx:396
 TGeoSphere.cxx:397
 TGeoSphere.cxx:398
 TGeoSphere.cxx:399
 TGeoSphere.cxx:400
 TGeoSphere.cxx:401
 TGeoSphere.cxx:402
 TGeoSphere.cxx:403
 TGeoSphere.cxx:404
 TGeoSphere.cxx:405
 TGeoSphere.cxx:406
 TGeoSphere.cxx:407
 TGeoSphere.cxx:408
 TGeoSphere.cxx:409
 TGeoSphere.cxx:410
 TGeoSphere.cxx:411
 TGeoSphere.cxx:412
 TGeoSphere.cxx:413
 TGeoSphere.cxx:414
 TGeoSphere.cxx:415
 TGeoSphere.cxx:416
 TGeoSphere.cxx:417
 TGeoSphere.cxx:418
 TGeoSphere.cxx:419
 TGeoSphere.cxx:420
 TGeoSphere.cxx:421
 TGeoSphere.cxx:422
 TGeoSphere.cxx:423
 TGeoSphere.cxx:424
 TGeoSphere.cxx:425
 TGeoSphere.cxx:426
 TGeoSphere.cxx:427
 TGeoSphere.cxx:428
 TGeoSphere.cxx:429
 TGeoSphere.cxx:430
 TGeoSphere.cxx:431
 TGeoSphere.cxx:432
 TGeoSphere.cxx:433
 TGeoSphere.cxx:434
 TGeoSphere.cxx:435
 TGeoSphere.cxx:436
 TGeoSphere.cxx:437
 TGeoSphere.cxx:438
 TGeoSphere.cxx:439
 TGeoSphere.cxx:440
 TGeoSphere.cxx:441
 TGeoSphere.cxx:442
 TGeoSphere.cxx:443
 TGeoSphere.cxx:444
 TGeoSphere.cxx:445
 TGeoSphere.cxx:446
 TGeoSphere.cxx:447
 TGeoSphere.cxx:448
 TGeoSphere.cxx:449
 TGeoSphere.cxx:450
 TGeoSphere.cxx:451
 TGeoSphere.cxx:452
 TGeoSphere.cxx:453
 TGeoSphere.cxx:454
 TGeoSphere.cxx:455
 TGeoSphere.cxx:456
 TGeoSphere.cxx:457
 TGeoSphere.cxx:458
 TGeoSphere.cxx:459
 TGeoSphere.cxx:460
 TGeoSphere.cxx:461
 TGeoSphere.cxx:462
 TGeoSphere.cxx:463
 TGeoSphere.cxx:464
 TGeoSphere.cxx:465
 TGeoSphere.cxx:466
 TGeoSphere.cxx:467
 TGeoSphere.cxx:468
 TGeoSphere.cxx:469
 TGeoSphere.cxx:470
 TGeoSphere.cxx:471
 TGeoSphere.cxx:472
 TGeoSphere.cxx:473
 TGeoSphere.cxx:474
 TGeoSphere.cxx:475
 TGeoSphere.cxx:476
 TGeoSphere.cxx:477
 TGeoSphere.cxx:478
 TGeoSphere.cxx:479
 TGeoSphere.cxx:480
 TGeoSphere.cxx:481
 TGeoSphere.cxx:482
 TGeoSphere.cxx:483
 TGeoSphere.cxx:484
 TGeoSphere.cxx:485
 TGeoSphere.cxx:486
 TGeoSphere.cxx:487
 TGeoSphere.cxx:488
 TGeoSphere.cxx:489
 TGeoSphere.cxx:490
 TGeoSphere.cxx:491
 TGeoSphere.cxx:492
 TGeoSphere.cxx:493
 TGeoSphere.cxx:494
 TGeoSphere.cxx:495
 TGeoSphere.cxx:496
 TGeoSphere.cxx:497
 TGeoSphere.cxx:498
 TGeoSphere.cxx:499
 TGeoSphere.cxx:500
 TGeoSphere.cxx:501
 TGeoSphere.cxx:502
 TGeoSphere.cxx:503
 TGeoSphere.cxx:504
 TGeoSphere.cxx:505
 TGeoSphere.cxx:506
 TGeoSphere.cxx:507
 TGeoSphere.cxx:508
 TGeoSphere.cxx:509
 TGeoSphere.cxx:510
 TGeoSphere.cxx:511
 TGeoSphere.cxx:512
 TGeoSphere.cxx:513
 TGeoSphere.cxx:514
 TGeoSphere.cxx:515
 TGeoSphere.cxx:516
 TGeoSphere.cxx:517
 TGeoSphere.cxx:518
 TGeoSphere.cxx:519
 TGeoSphere.cxx:520
 TGeoSphere.cxx:521
 TGeoSphere.cxx:522
 TGeoSphere.cxx:523
 TGeoSphere.cxx:524
 TGeoSphere.cxx:525
 TGeoSphere.cxx:526
 TGeoSphere.cxx:527
 TGeoSphere.cxx:528
 TGeoSphere.cxx:529
 TGeoSphere.cxx:530
 TGeoSphere.cxx:531
 TGeoSphere.cxx:532
 TGeoSphere.cxx:533
 TGeoSphere.cxx:534
 TGeoSphere.cxx:535
 TGeoSphere.cxx:536
 TGeoSphere.cxx:537
 TGeoSphere.cxx:538
 TGeoSphere.cxx:539
 TGeoSphere.cxx:540
 TGeoSphere.cxx:541
 TGeoSphere.cxx:542
 TGeoSphere.cxx:543
 TGeoSphere.cxx:544
 TGeoSphere.cxx:545
 TGeoSphere.cxx:546
 TGeoSphere.cxx:547
 TGeoSphere.cxx:548
 TGeoSphere.cxx:549
 TGeoSphere.cxx:550
 TGeoSphere.cxx:551
 TGeoSphere.cxx:552
 TGeoSphere.cxx:553
 TGeoSphere.cxx:554
 TGeoSphere.cxx:555
 TGeoSphere.cxx:556
 TGeoSphere.cxx:557
 TGeoSphere.cxx:558
 TGeoSphere.cxx:559
 TGeoSphere.cxx:560
 TGeoSphere.cxx:561
 TGeoSphere.cxx:562
 TGeoSphere.cxx:563
 TGeoSphere.cxx:564
 TGeoSphere.cxx:565
 TGeoSphere.cxx:566
 TGeoSphere.cxx:567
 TGeoSphere.cxx:568
 TGeoSphere.cxx:569
 TGeoSphere.cxx:570
 TGeoSphere.cxx:571
 TGeoSphere.cxx:572
 TGeoSphere.cxx:573
 TGeoSphere.cxx:574
 TGeoSphere.cxx:575
 TGeoSphere.cxx:576
 TGeoSphere.cxx:577
 TGeoSphere.cxx:578
 TGeoSphere.cxx:579
 TGeoSphere.cxx:580
 TGeoSphere.cxx:581
 TGeoSphere.cxx:582
 TGeoSphere.cxx:583
 TGeoSphere.cxx:584
 TGeoSphere.cxx:585
 TGeoSphere.cxx:586
 TGeoSphere.cxx:587
 TGeoSphere.cxx:588
 TGeoSphere.cxx:589
 TGeoSphere.cxx:590
 TGeoSphere.cxx:591
 TGeoSphere.cxx:592
 TGeoSphere.cxx:593
 TGeoSphere.cxx:594
 TGeoSphere.cxx:595
 TGeoSphere.cxx:596
 TGeoSphere.cxx:597
 TGeoSphere.cxx:598
 TGeoSphere.cxx:599
 TGeoSphere.cxx:600
 TGeoSphere.cxx:601
 TGeoSphere.cxx:602
 TGeoSphere.cxx:603
 TGeoSphere.cxx:604
 TGeoSphere.cxx:605
 TGeoSphere.cxx:606
 TGeoSphere.cxx:607
 TGeoSphere.cxx:608
 TGeoSphere.cxx:609
 TGeoSphere.cxx:610
 TGeoSphere.cxx:611
 TGeoSphere.cxx:612
 TGeoSphere.cxx:613
 TGeoSphere.cxx:614
 TGeoSphere.cxx:615
 TGeoSphere.cxx:616
 TGeoSphere.cxx:617
 TGeoSphere.cxx:618
 TGeoSphere.cxx:619
 TGeoSphere.cxx:620
 TGeoSphere.cxx:621
 TGeoSphere.cxx:622
 TGeoSphere.cxx:623
 TGeoSphere.cxx:624
 TGeoSphere.cxx:625
 TGeoSphere.cxx:626
 TGeoSphere.cxx:627
 TGeoSphere.cxx:628
 TGeoSphere.cxx:629
 TGeoSphere.cxx:630
 TGeoSphere.cxx:631
 TGeoSphere.cxx:632
 TGeoSphere.cxx:633
 TGeoSphere.cxx:634
 TGeoSphere.cxx:635
 TGeoSphere.cxx:636
 TGeoSphere.cxx:637
 TGeoSphere.cxx:638
 TGeoSphere.cxx:639
 TGeoSphere.cxx:640
 TGeoSphere.cxx:641
 TGeoSphere.cxx:642
 TGeoSphere.cxx:643
 TGeoSphere.cxx:644
 TGeoSphere.cxx:645
 TGeoSphere.cxx:646
 TGeoSphere.cxx:647
 TGeoSphere.cxx:648
 TGeoSphere.cxx:649
 TGeoSphere.cxx:650
 TGeoSphere.cxx:651
 TGeoSphere.cxx:652
 TGeoSphere.cxx:653
 TGeoSphere.cxx:654
 TGeoSphere.cxx:655
 TGeoSphere.cxx:656
 TGeoSphere.cxx:657
 TGeoSphere.cxx:658
 TGeoSphere.cxx:659
 TGeoSphere.cxx:660
 TGeoSphere.cxx:661
 TGeoSphere.cxx:662
 TGeoSphere.cxx:663
 TGeoSphere.cxx:664
 TGeoSphere.cxx:665
 TGeoSphere.cxx:666
 TGeoSphere.cxx:667
 TGeoSphere.cxx:668
 TGeoSphere.cxx:669
 TGeoSphere.cxx:670
 TGeoSphere.cxx:671
 TGeoSphere.cxx:672
 TGeoSphere.cxx:673
 TGeoSphere.cxx:674
 TGeoSphere.cxx:675
 TGeoSphere.cxx:676
 TGeoSphere.cxx:677
 TGeoSphere.cxx:678
 TGeoSphere.cxx:679
 TGeoSphere.cxx:680
 TGeoSphere.cxx:681
 TGeoSphere.cxx:682
 TGeoSphere.cxx:683
 TGeoSphere.cxx:684
 TGeoSphere.cxx:685
 TGeoSphere.cxx:686
 TGeoSphere.cxx:687
 TGeoSphere.cxx:688
 TGeoSphere.cxx:689
 TGeoSphere.cxx:690
 TGeoSphere.cxx:691
 TGeoSphere.cxx:692
 TGeoSphere.cxx:693
 TGeoSphere.cxx:694
 TGeoSphere.cxx:695
 TGeoSphere.cxx:696
 TGeoSphere.cxx:697
 TGeoSphere.cxx:698
 TGeoSphere.cxx:699
 TGeoSphere.cxx:700
 TGeoSphere.cxx:701
 TGeoSphere.cxx:702
 TGeoSphere.cxx:703
 TGeoSphere.cxx:704
 TGeoSphere.cxx:705
 TGeoSphere.cxx:706
 TGeoSphere.cxx:707
 TGeoSphere.cxx:708
 TGeoSphere.cxx:709
 TGeoSphere.cxx:710
 TGeoSphere.cxx:711
 TGeoSphere.cxx:712
 TGeoSphere.cxx:713
 TGeoSphere.cxx:714
 TGeoSphere.cxx:715
 TGeoSphere.cxx:716
 TGeoSphere.cxx:717
 TGeoSphere.cxx:718
 TGeoSphere.cxx:719
 TGeoSphere.cxx:720
 TGeoSphere.cxx:721
 TGeoSphere.cxx:722
 TGeoSphere.cxx:723
 TGeoSphere.cxx:724
 TGeoSphere.cxx:725
 TGeoSphere.cxx:726
 TGeoSphere.cxx:727
 TGeoSphere.cxx:728
 TGeoSphere.cxx:729
 TGeoSphere.cxx:730
 TGeoSphere.cxx:731
 TGeoSphere.cxx:732
 TGeoSphere.cxx:733
 TGeoSphere.cxx:734
 TGeoSphere.cxx:735
 TGeoSphere.cxx:736
 TGeoSphere.cxx:737
 TGeoSphere.cxx:738
 TGeoSphere.cxx:739
 TGeoSphere.cxx:740
 TGeoSphere.cxx:741
 TGeoSphere.cxx:742
 TGeoSphere.cxx:743
 TGeoSphere.cxx:744
 TGeoSphere.cxx:745
 TGeoSphere.cxx:746
 TGeoSphere.cxx:747
 TGeoSphere.cxx:748
 TGeoSphere.cxx:749
 TGeoSphere.cxx:750
 TGeoSphere.cxx:751
 TGeoSphere.cxx:752
 TGeoSphere.cxx:753
 TGeoSphere.cxx:754
 TGeoSphere.cxx:755
 TGeoSphere.cxx:756
 TGeoSphere.cxx:757
 TGeoSphere.cxx:758
 TGeoSphere.cxx:759
 TGeoSphere.cxx:760
 TGeoSphere.cxx:761
 TGeoSphere.cxx:762
 TGeoSphere.cxx:763
 TGeoSphere.cxx:764
 TGeoSphere.cxx:765
 TGeoSphere.cxx:766
 TGeoSphere.cxx:767
 TGeoSphere.cxx:768
 TGeoSphere.cxx:769
 TGeoSphere.cxx:770
 TGeoSphere.cxx:771
 TGeoSphere.cxx:772
 TGeoSphere.cxx:773
 TGeoSphere.cxx:774
 TGeoSphere.cxx:775
 TGeoSphere.cxx:776
 TGeoSphere.cxx:777
 TGeoSphere.cxx:778
 TGeoSphere.cxx:779
 TGeoSphere.cxx:780
 TGeoSphere.cxx:781
 TGeoSphere.cxx:782
 TGeoSphere.cxx:783
 TGeoSphere.cxx:784
 TGeoSphere.cxx:785
 TGeoSphere.cxx:786
 TGeoSphere.cxx:787
 TGeoSphere.cxx:788
 TGeoSphere.cxx:789
 TGeoSphere.cxx:790
 TGeoSphere.cxx:791
 TGeoSphere.cxx:792
 TGeoSphere.cxx:793
 TGeoSphere.cxx:794
 TGeoSphere.cxx:795
 TGeoSphere.cxx:796
 TGeoSphere.cxx:797
 TGeoSphere.cxx:798
 TGeoSphere.cxx:799
 TGeoSphere.cxx:800
 TGeoSphere.cxx:801
 TGeoSphere.cxx:802
 TGeoSphere.cxx:803
 TGeoSphere.cxx:804
 TGeoSphere.cxx:805
 TGeoSphere.cxx:806
 TGeoSphere.cxx:807
 TGeoSphere.cxx:808
 TGeoSphere.cxx:809
 TGeoSphere.cxx:810
 TGeoSphere.cxx:811
 TGeoSphere.cxx:812
 TGeoSphere.cxx:813
 TGeoSphere.cxx:814
 TGeoSphere.cxx:815
 TGeoSphere.cxx:816
 TGeoSphere.cxx:817
 TGeoSphere.cxx:818
 TGeoSphere.cxx:819
 TGeoSphere.cxx:820
 TGeoSphere.cxx:821
 TGeoSphere.cxx:822
 TGeoSphere.cxx:823
 TGeoSphere.cxx:824
 TGeoSphere.cxx:825
 TGeoSphere.cxx:826
 TGeoSphere.cxx:827
 TGeoSphere.cxx:828
 TGeoSphere.cxx:829
 TGeoSphere.cxx:830
 TGeoSphere.cxx:831
 TGeoSphere.cxx:832
 TGeoSphere.cxx:833
 TGeoSphere.cxx:834
 TGeoSphere.cxx:835
 TGeoSphere.cxx:836
 TGeoSphere.cxx:837
 TGeoSphere.cxx:838
 TGeoSphere.cxx:839
 TGeoSphere.cxx:840
 TGeoSphere.cxx:841
 TGeoSphere.cxx:842
 TGeoSphere.cxx:843
 TGeoSphere.cxx:844
 TGeoSphere.cxx:845
 TGeoSphere.cxx:846
 TGeoSphere.cxx:847
 TGeoSphere.cxx:848
 TGeoSphere.cxx:849
 TGeoSphere.cxx:850
 TGeoSphere.cxx:851
 TGeoSphere.cxx:852
 TGeoSphere.cxx:853
 TGeoSphere.cxx:854
 TGeoSphere.cxx:855
 TGeoSphere.cxx:856
 TGeoSphere.cxx:857
 TGeoSphere.cxx:858
 TGeoSphere.cxx:859
 TGeoSphere.cxx:860
 TGeoSphere.cxx:861
 TGeoSphere.cxx:862
 TGeoSphere.cxx:863
 TGeoSphere.cxx:864
 TGeoSphere.cxx:865
 TGeoSphere.cxx:866
 TGeoSphere.cxx:867
 TGeoSphere.cxx:868
 TGeoSphere.cxx:869
 TGeoSphere.cxx:870
 TGeoSphere.cxx:871
 TGeoSphere.cxx:872
 TGeoSphere.cxx:873
 TGeoSphere.cxx:874
 TGeoSphere.cxx:875
 TGeoSphere.cxx:876
 TGeoSphere.cxx:877
 TGeoSphere.cxx:878
 TGeoSphere.cxx:879
 TGeoSphere.cxx:880
 TGeoSphere.cxx:881
 TGeoSphere.cxx:882
 TGeoSphere.cxx:883
 TGeoSphere.cxx:884
 TGeoSphere.cxx:885
 TGeoSphere.cxx:886
 TGeoSphere.cxx:887
 TGeoSphere.cxx:888
 TGeoSphere.cxx:889
 TGeoSphere.cxx:890
 TGeoSphere.cxx:891
 TGeoSphere.cxx:892
 TGeoSphere.cxx:893
 TGeoSphere.cxx:894
 TGeoSphere.cxx:895
 TGeoSphere.cxx:896
 TGeoSphere.cxx:897
 TGeoSphere.cxx:898
 TGeoSphere.cxx:899
 TGeoSphere.cxx:900
 TGeoSphere.cxx:901
 TGeoSphere.cxx:902
 TGeoSphere.cxx:903
 TGeoSphere.cxx:904
 TGeoSphere.cxx:905
 TGeoSphere.cxx:906
 TGeoSphere.cxx:907
 TGeoSphere.cxx:908
 TGeoSphere.cxx:909
 TGeoSphere.cxx:910
 TGeoSphere.cxx:911
 TGeoSphere.cxx:912
 TGeoSphere.cxx:913
 TGeoSphere.cxx:914
 TGeoSphere.cxx:915
 TGeoSphere.cxx:916
 TGeoSphere.cxx:917
 TGeoSphere.cxx:918
 TGeoSphere.cxx:919
 TGeoSphere.cxx:920
 TGeoSphere.cxx:921
 TGeoSphere.cxx:922
 TGeoSphere.cxx:923
 TGeoSphere.cxx:924
 TGeoSphere.cxx:925
 TGeoSphere.cxx:926
 TGeoSphere.cxx:927
 TGeoSphere.cxx:928
 TGeoSphere.cxx:929
 TGeoSphere.cxx:930
 TGeoSphere.cxx:931
 TGeoSphere.cxx:932
 TGeoSphere.cxx:933
 TGeoSphere.cxx:934
 TGeoSphere.cxx:935
 TGeoSphere.cxx:936
 TGeoSphere.cxx:937
 TGeoSphere.cxx:938
 TGeoSphere.cxx:939
 TGeoSphere.cxx:940
 TGeoSphere.cxx:941
 TGeoSphere.cxx:942
 TGeoSphere.cxx:943
 TGeoSphere.cxx:944
 TGeoSphere.cxx:945
 TGeoSphere.cxx:946
 TGeoSphere.cxx:947
 TGeoSphere.cxx:948
 TGeoSphere.cxx:949
 TGeoSphere.cxx:950
 TGeoSphere.cxx:951
 TGeoSphere.cxx:952
 TGeoSphere.cxx:953
 TGeoSphere.cxx:954
 TGeoSphere.cxx:955
 TGeoSphere.cxx:956
 TGeoSphere.cxx:957
 TGeoSphere.cxx:958
 TGeoSphere.cxx:959
 TGeoSphere.cxx:960
 TGeoSphere.cxx:961
 TGeoSphere.cxx:962
 TGeoSphere.cxx:963
 TGeoSphere.cxx:964
 TGeoSphere.cxx:965
 TGeoSphere.cxx:966
 TGeoSphere.cxx:967
 TGeoSphere.cxx:968
 TGeoSphere.cxx:969
 TGeoSphere.cxx:970
 TGeoSphere.cxx:971
 TGeoSphere.cxx:972
 TGeoSphere.cxx:973
 TGeoSphere.cxx:974
 TGeoSphere.cxx:975
 TGeoSphere.cxx:976
 TGeoSphere.cxx:977
 TGeoSphere.cxx:978
 TGeoSphere.cxx:979
 TGeoSphere.cxx:980
 TGeoSphere.cxx:981
 TGeoSphere.cxx:982
 TGeoSphere.cxx:983
 TGeoSphere.cxx:984
 TGeoSphere.cxx:985
 TGeoSphere.cxx:986
 TGeoSphere.cxx:987
 TGeoSphere.cxx:988
 TGeoSphere.cxx:989
 TGeoSphere.cxx:990
 TGeoSphere.cxx:991
 TGeoSphere.cxx:992
 TGeoSphere.cxx:993
 TGeoSphere.cxx:994
 TGeoSphere.cxx:995
 TGeoSphere.cxx:996
 TGeoSphere.cxx:997
 TGeoSphere.cxx:998
 TGeoSphere.cxx:999
 TGeoSphere.cxx:1000
 TGeoSphere.cxx:1001
 TGeoSphere.cxx:1002
 TGeoSphere.cxx:1003
 TGeoSphere.cxx:1004
 TGeoSphere.cxx:1005
 TGeoSphere.cxx:1006
 TGeoSphere.cxx:1007
 TGeoSphere.cxx:1008
 TGeoSphere.cxx:1009
 TGeoSphere.cxx:1010
 TGeoSphere.cxx:1011
 TGeoSphere.cxx:1012
 TGeoSphere.cxx:1013
 TGeoSphere.cxx:1014
 TGeoSphere.cxx:1015
 TGeoSphere.cxx:1016
 TGeoSphere.cxx:1017
 TGeoSphere.cxx:1018
 TGeoSphere.cxx:1019
 TGeoSphere.cxx:1020
 TGeoSphere.cxx:1021
 TGeoSphere.cxx:1022
 TGeoSphere.cxx:1023
 TGeoSphere.cxx:1024
 TGeoSphere.cxx:1025
 TGeoSphere.cxx:1026
 TGeoSphere.cxx:1027
 TGeoSphere.cxx:1028
 TGeoSphere.cxx:1029
 TGeoSphere.cxx:1030
 TGeoSphere.cxx:1031
 TGeoSphere.cxx:1032
 TGeoSphere.cxx:1033
 TGeoSphere.cxx:1034
 TGeoSphere.cxx:1035
 TGeoSphere.cxx:1036
 TGeoSphere.cxx:1037
 TGeoSphere.cxx:1038
 TGeoSphere.cxx:1039
 TGeoSphere.cxx:1040
 TGeoSphere.cxx:1041
 TGeoSphere.cxx:1042
 TGeoSphere.cxx:1043
 TGeoSphere.cxx:1044
 TGeoSphere.cxx:1045
 TGeoSphere.cxx:1046
 TGeoSphere.cxx:1047
 TGeoSphere.cxx:1048
 TGeoSphere.cxx:1049
 TGeoSphere.cxx:1050
 TGeoSphere.cxx:1051
 TGeoSphere.cxx:1052
 TGeoSphere.cxx:1053
 TGeoSphere.cxx:1054
 TGeoSphere.cxx:1055
 TGeoSphere.cxx:1056
 TGeoSphere.cxx:1057
 TGeoSphere.cxx:1058
 TGeoSphere.cxx:1059
 TGeoSphere.cxx:1060
 TGeoSphere.cxx:1061
 TGeoSphere.cxx:1062
 TGeoSphere.cxx:1063
 TGeoSphere.cxx:1064
 TGeoSphere.cxx:1065
 TGeoSphere.cxx:1066
 TGeoSphere.cxx:1067
 TGeoSphere.cxx:1068
 TGeoSphere.cxx:1069
 TGeoSphere.cxx:1070
 TGeoSphere.cxx:1071
 TGeoSphere.cxx:1072
 TGeoSphere.cxx:1073
 TGeoSphere.cxx:1074
 TGeoSphere.cxx:1075
 TGeoSphere.cxx:1076
 TGeoSphere.cxx:1077
 TGeoSphere.cxx:1078
 TGeoSphere.cxx:1079
 TGeoSphere.cxx:1080
 TGeoSphere.cxx:1081
 TGeoSphere.cxx:1082
 TGeoSphere.cxx:1083
 TGeoSphere.cxx:1084
 TGeoSphere.cxx:1085
 TGeoSphere.cxx:1086
 TGeoSphere.cxx:1087
 TGeoSphere.cxx:1088
 TGeoSphere.cxx:1089
 TGeoSphere.cxx:1090
 TGeoSphere.cxx:1091
 TGeoSphere.cxx:1092
 TGeoSphere.cxx:1093
 TGeoSphere.cxx:1094
 TGeoSphere.cxx:1095
 TGeoSphere.cxx:1096
 TGeoSphere.cxx:1097
 TGeoSphere.cxx:1098
 TGeoSphere.cxx:1099
 TGeoSphere.cxx:1100
 TGeoSphere.cxx:1101
 TGeoSphere.cxx:1102
 TGeoSphere.cxx:1103
 TGeoSphere.cxx:1104
 TGeoSphere.cxx:1105
 TGeoSphere.cxx:1106
 TGeoSphere.cxx:1107
 TGeoSphere.cxx:1108
 TGeoSphere.cxx:1109
 TGeoSphere.cxx:1110
 TGeoSphere.cxx:1111
 TGeoSphere.cxx:1112
 TGeoSphere.cxx:1113
 TGeoSphere.cxx:1114
 TGeoSphere.cxx:1115
 TGeoSphere.cxx:1116
 TGeoSphere.cxx:1117
 TGeoSphere.cxx:1118
 TGeoSphere.cxx:1119
 TGeoSphere.cxx:1120
 TGeoSphere.cxx:1121
 TGeoSphere.cxx:1122
 TGeoSphere.cxx:1123
 TGeoSphere.cxx:1124
 TGeoSphere.cxx:1125
 TGeoSphere.cxx:1126
 TGeoSphere.cxx:1127
 TGeoSphere.cxx:1128
 TGeoSphere.cxx:1129
 TGeoSphere.cxx:1130
 TGeoSphere.cxx:1131
 TGeoSphere.cxx:1132
 TGeoSphere.cxx:1133
 TGeoSphere.cxx:1134
 TGeoSphere.cxx:1135
 TGeoSphere.cxx:1136
 TGeoSphere.cxx:1137
 TGeoSphere.cxx:1138
 TGeoSphere.cxx:1139
 TGeoSphere.cxx:1140
 TGeoSphere.cxx:1141
 TGeoSphere.cxx:1142
 TGeoSphere.cxx:1143
 TGeoSphere.cxx:1144
 TGeoSphere.cxx:1145
 TGeoSphere.cxx:1146
 TGeoSphere.cxx:1147
 TGeoSphere.cxx:1148
 TGeoSphere.cxx:1149
 TGeoSphere.cxx:1150
 TGeoSphere.cxx:1151
 TGeoSphere.cxx:1152
 TGeoSphere.cxx:1153
 TGeoSphere.cxx:1154
 TGeoSphere.cxx:1155
 TGeoSphere.cxx:1156
 TGeoSphere.cxx:1157
 TGeoSphere.cxx:1158
 TGeoSphere.cxx:1159
 TGeoSphere.cxx:1160
 TGeoSphere.cxx:1161
 TGeoSphere.cxx:1162
 TGeoSphere.cxx:1163
 TGeoSphere.cxx:1164
 TGeoSphere.cxx:1165
 TGeoSphere.cxx:1166
 TGeoSphere.cxx:1167
 TGeoSphere.cxx:1168
 TGeoSphere.cxx:1169
 TGeoSphere.cxx:1170
 TGeoSphere.cxx:1171
 TGeoSphere.cxx:1172
 TGeoSphere.cxx:1173
 TGeoSphere.cxx:1174
 TGeoSphere.cxx:1175
 TGeoSphere.cxx:1176
 TGeoSphere.cxx:1177
 TGeoSphere.cxx:1178
 TGeoSphere.cxx:1179
 TGeoSphere.cxx:1180
 TGeoSphere.cxx:1181
 TGeoSphere.cxx:1182
 TGeoSphere.cxx:1183
 TGeoSphere.cxx:1184
 TGeoSphere.cxx:1185
 TGeoSphere.cxx:1186
 TGeoSphere.cxx:1187
 TGeoSphere.cxx:1188
 TGeoSphere.cxx:1189
 TGeoSphere.cxx:1190
 TGeoSphere.cxx:1191
 TGeoSphere.cxx:1192
 TGeoSphere.cxx:1193
 TGeoSphere.cxx:1194
 TGeoSphere.cxx:1195
 TGeoSphere.cxx:1196
 TGeoSphere.cxx:1197
 TGeoSphere.cxx:1198
 TGeoSphere.cxx:1199
 TGeoSphere.cxx:1200
 TGeoSphere.cxx:1201
 TGeoSphere.cxx:1202
 TGeoSphere.cxx:1203
 TGeoSphere.cxx:1204
 TGeoSphere.cxx:1205
 TGeoSphere.cxx:1206
 TGeoSphere.cxx:1207
 TGeoSphere.cxx:1208
 TGeoSphere.cxx:1209
 TGeoSphere.cxx:1210
 TGeoSphere.cxx:1211
 TGeoSphere.cxx:1212
 TGeoSphere.cxx:1213
 TGeoSphere.cxx:1214
 TGeoSphere.cxx:1215
 TGeoSphere.cxx:1216
 TGeoSphere.cxx:1217
 TGeoSphere.cxx:1218
 TGeoSphere.cxx:1219
 TGeoSphere.cxx:1220
 TGeoSphere.cxx:1221
 TGeoSphere.cxx:1222
 TGeoSphere.cxx:1223
 TGeoSphere.cxx:1224
 TGeoSphere.cxx:1225
 TGeoSphere.cxx:1226
 TGeoSphere.cxx:1227
 TGeoSphere.cxx:1228
 TGeoSphere.cxx:1229
 TGeoSphere.cxx:1230
 TGeoSphere.cxx:1231
 TGeoSphere.cxx:1232
 TGeoSphere.cxx:1233
 TGeoSphere.cxx:1234
 TGeoSphere.cxx:1235
 TGeoSphere.cxx:1236
 TGeoSphere.cxx:1237
 TGeoSphere.cxx:1238
 TGeoSphere.cxx:1239
 TGeoSphere.cxx:1240
 TGeoSphere.cxx:1241
 TGeoSphere.cxx:1242
 TGeoSphere.cxx:1243
 TGeoSphere.cxx:1244
 TGeoSphere.cxx:1245
 TGeoSphere.cxx:1246
 TGeoSphere.cxx:1247
 TGeoSphere.cxx:1248
 TGeoSphere.cxx:1249
 TGeoSphere.cxx:1250
 TGeoSphere.cxx:1251
 TGeoSphere.cxx:1252
 TGeoSphere.cxx:1253
 TGeoSphere.cxx:1254
 TGeoSphere.cxx:1255
 TGeoSphere.cxx:1256
 TGeoSphere.cxx:1257
 TGeoSphere.cxx:1258
 TGeoSphere.cxx:1259
 TGeoSphere.cxx:1260
 TGeoSphere.cxx:1261
 TGeoSphere.cxx:1262
 TGeoSphere.cxx:1263
 TGeoSphere.cxx:1264
 TGeoSphere.cxx:1265
 TGeoSphere.cxx:1266
 TGeoSphere.cxx:1267
 TGeoSphere.cxx:1268
 TGeoSphere.cxx:1269
 TGeoSphere.cxx:1270
 TGeoSphere.cxx:1271
 TGeoSphere.cxx:1272
 TGeoSphere.cxx:1273
 TGeoSphere.cxx:1274
 TGeoSphere.cxx:1275
 TGeoSphere.cxx:1276
 TGeoSphere.cxx:1277
 TGeoSphere.cxx:1278
 TGeoSphere.cxx:1279
 TGeoSphere.cxx:1280
 TGeoSphere.cxx:1281
 TGeoSphere.cxx:1282
 TGeoSphere.cxx:1283
 TGeoSphere.cxx:1284
 TGeoSphere.cxx:1285
 TGeoSphere.cxx:1286
 TGeoSphere.cxx:1287
 TGeoSphere.cxx:1288
 TGeoSphere.cxx:1289
 TGeoSphere.cxx:1290
 TGeoSphere.cxx:1291
 TGeoSphere.cxx:1292
 TGeoSphere.cxx:1293
 TGeoSphere.cxx:1294
 TGeoSphere.cxx:1295
 TGeoSphere.cxx:1296
 TGeoSphere.cxx:1297
 TGeoSphere.cxx:1298
 TGeoSphere.cxx:1299
 TGeoSphere.cxx:1300
 TGeoSphere.cxx:1301
 TGeoSphere.cxx:1302
 TGeoSphere.cxx:1303
 TGeoSphere.cxx:1304
 TGeoSphere.cxx:1305
 TGeoSphere.cxx:1306
 TGeoSphere.cxx:1307
 TGeoSphere.cxx:1308
 TGeoSphere.cxx:1309
 TGeoSphere.cxx:1310
 TGeoSphere.cxx:1311
 TGeoSphere.cxx:1312
 TGeoSphere.cxx:1313
 TGeoSphere.cxx:1314
 TGeoSphere.cxx:1315
 TGeoSphere.cxx:1316
 TGeoSphere.cxx:1317
 TGeoSphere.cxx:1318
 TGeoSphere.cxx:1319
 TGeoSphere.cxx:1320
 TGeoSphere.cxx:1321
 TGeoSphere.cxx:1322
 TGeoSphere.cxx:1323
 TGeoSphere.cxx:1324
 TGeoSphere.cxx:1325
 TGeoSphere.cxx:1326
 TGeoSphere.cxx:1327
 TGeoSphere.cxx:1328
 TGeoSphere.cxx:1329
 TGeoSphere.cxx:1330
 TGeoSphere.cxx:1331
 TGeoSphere.cxx:1332
 TGeoSphere.cxx:1333
 TGeoSphere.cxx:1334
 TGeoSphere.cxx:1335
 TGeoSphere.cxx:1336
 TGeoSphere.cxx:1337
 TGeoSphere.cxx:1338
 TGeoSphere.cxx:1339
 TGeoSphere.cxx:1340
 TGeoSphere.cxx:1341
 TGeoSphere.cxx:1342
 TGeoSphere.cxx:1343
 TGeoSphere.cxx:1344
 TGeoSphere.cxx:1345
 TGeoSphere.cxx:1346
 TGeoSphere.cxx:1347
 TGeoSphere.cxx:1348
 TGeoSphere.cxx:1349
 TGeoSphere.cxx:1350
 TGeoSphere.cxx:1351
 TGeoSphere.cxx:1352
 TGeoSphere.cxx:1353
 TGeoSphere.cxx:1354
 TGeoSphere.cxx:1355
 TGeoSphere.cxx:1356
 TGeoSphere.cxx:1357
 TGeoSphere.cxx:1358
 TGeoSphere.cxx:1359
 TGeoSphere.cxx:1360
 TGeoSphere.cxx:1361
 TGeoSphere.cxx:1362
 TGeoSphere.cxx:1363
 TGeoSphere.cxx:1364
 TGeoSphere.cxx:1365
 TGeoSphere.cxx:1366
 TGeoSphere.cxx:1367
 TGeoSphere.cxx:1368
 TGeoSphere.cxx:1369
 TGeoSphere.cxx:1370
 TGeoSphere.cxx:1371
 TGeoSphere.cxx:1372
 TGeoSphere.cxx:1373
 TGeoSphere.cxx:1374
 TGeoSphere.cxx:1375
 TGeoSphere.cxx:1376
 TGeoSphere.cxx:1377
 TGeoSphere.cxx:1378
 TGeoSphere.cxx:1379
 TGeoSphere.cxx:1380
 TGeoSphere.cxx:1381
 TGeoSphere.cxx:1382
 TGeoSphere.cxx:1383
 TGeoSphere.cxx:1384
 TGeoSphere.cxx:1385
 TGeoSphere.cxx:1386
 TGeoSphere.cxx:1387
 TGeoSphere.cxx:1388
 TGeoSphere.cxx:1389
 TGeoSphere.cxx:1390
 TGeoSphere.cxx:1391
 TGeoSphere.cxx:1392
 TGeoSphere.cxx:1393
 TGeoSphere.cxx:1394
 TGeoSphere.cxx:1395
 TGeoSphere.cxx:1396
 TGeoSphere.cxx:1397
 TGeoSphere.cxx:1398
 TGeoSphere.cxx:1399
 TGeoSphere.cxx:1400
 TGeoSphere.cxx:1401
 TGeoSphere.cxx:1402
 TGeoSphere.cxx:1403
 TGeoSphere.cxx:1404
 TGeoSphere.cxx:1405
 TGeoSphere.cxx:1406
 TGeoSphere.cxx:1407
 TGeoSphere.cxx:1408
 TGeoSphere.cxx:1409
 TGeoSphere.cxx:1410
 TGeoSphere.cxx:1411
 TGeoSphere.cxx:1412
 TGeoSphere.cxx:1413
 TGeoSphere.cxx:1414
 TGeoSphere.cxx:1415
 TGeoSphere.cxx:1416
 TGeoSphere.cxx:1417
 TGeoSphere.cxx:1418
 TGeoSphere.cxx:1419
 TGeoSphere.cxx:1420
 TGeoSphere.cxx:1421
 TGeoSphere.cxx:1422
 TGeoSphere.cxx:1423
 TGeoSphere.cxx:1424
 TGeoSphere.cxx:1425
 TGeoSphere.cxx:1426
 TGeoSphere.cxx:1427
 TGeoSphere.cxx:1428
 TGeoSphere.cxx:1429
 TGeoSphere.cxx:1430
 TGeoSphere.cxx:1431
 TGeoSphere.cxx:1432
 TGeoSphere.cxx:1433
 TGeoSphere.cxx:1434
 TGeoSphere.cxx:1435
 TGeoSphere.cxx:1436
 TGeoSphere.cxx:1437
 TGeoSphere.cxx:1438
 TGeoSphere.cxx:1439
 TGeoSphere.cxx:1440
 TGeoSphere.cxx:1441
 TGeoSphere.cxx:1442
 TGeoSphere.cxx:1443
 TGeoSphere.cxx:1444
 TGeoSphere.cxx:1445
 TGeoSphere.cxx:1446
 TGeoSphere.cxx:1447
 TGeoSphere.cxx:1448
 TGeoSphere.cxx:1449
 TGeoSphere.cxx:1450
 TGeoSphere.cxx:1451
 TGeoSphere.cxx:1452
 TGeoSphere.cxx:1453
 TGeoSphere.cxx:1454
 TGeoSphere.cxx:1455
 TGeoSphere.cxx:1456
 TGeoSphere.cxx:1457
 TGeoSphere.cxx:1458
 TGeoSphere.cxx:1459
 TGeoSphere.cxx:1460
 TGeoSphere.cxx:1461
 TGeoSphere.cxx:1462
 TGeoSphere.cxx:1463
 TGeoSphere.cxx:1464
 TGeoSphere.cxx:1465
 TGeoSphere.cxx:1466
 TGeoSphere.cxx:1467
 TGeoSphere.cxx:1468
 TGeoSphere.cxx:1469
 TGeoSphere.cxx:1470
 TGeoSphere.cxx:1471
 TGeoSphere.cxx:1472
 TGeoSphere.cxx:1473
 TGeoSphere.cxx:1474
 TGeoSphere.cxx:1475
 TGeoSphere.cxx:1476
 TGeoSphere.cxx:1477
 TGeoSphere.cxx:1478
 TGeoSphere.cxx:1479
 TGeoSphere.cxx:1480
 TGeoSphere.cxx:1481
 TGeoSphere.cxx:1482
 TGeoSphere.cxx:1483
 TGeoSphere.cxx:1484
 TGeoSphere.cxx:1485
 TGeoSphere.cxx:1486
 TGeoSphere.cxx:1487
 TGeoSphere.cxx:1488
 TGeoSphere.cxx:1489
 TGeoSphere.cxx:1490
 TGeoSphere.cxx:1491
 TGeoSphere.cxx:1492
 TGeoSphere.cxx:1493
 TGeoSphere.cxx:1494
 TGeoSphere.cxx:1495
 TGeoSphere.cxx:1496
 TGeoSphere.cxx:1497
 TGeoSphere.cxx:1498
 TGeoSphere.cxx:1499
 TGeoSphere.cxx:1500
 TGeoSphere.cxx:1501
 TGeoSphere.cxx:1502
 TGeoSphere.cxx:1503
 TGeoSphere.cxx:1504
 TGeoSphere.cxx:1505
 TGeoSphere.cxx:1506
 TGeoSphere.cxx:1507
 TGeoSphere.cxx:1508
 TGeoSphere.cxx:1509
 TGeoSphere.cxx:1510
 TGeoSphere.cxx:1511
 TGeoSphere.cxx:1512
 TGeoSphere.cxx:1513
 TGeoSphere.cxx:1514
 TGeoSphere.cxx:1515
 TGeoSphere.cxx:1516
 TGeoSphere.cxx:1517
 TGeoSphere.cxx:1518
 TGeoSphere.cxx:1519
 TGeoSphere.cxx:1520
 TGeoSphere.cxx:1521
 TGeoSphere.cxx:1522
 TGeoSphere.cxx:1523
 TGeoSphere.cxx:1524
 TGeoSphere.cxx:1525
 TGeoSphere.cxx:1526
 TGeoSphere.cxx:1527
 TGeoSphere.cxx:1528
 TGeoSphere.cxx:1529
 TGeoSphere.cxx:1530
 TGeoSphere.cxx:1531
 TGeoSphere.cxx:1532
 TGeoSphere.cxx:1533
 TGeoSphere.cxx:1534
 TGeoSphere.cxx:1535
 TGeoSphere.cxx:1536
 TGeoSphere.cxx:1537
 TGeoSphere.cxx:1538
 TGeoSphere.cxx:1539
 TGeoSphere.cxx:1540
 TGeoSphere.cxx:1541
 TGeoSphere.cxx:1542
 TGeoSphere.cxx:1543
 TGeoSphere.cxx:1544
 TGeoSphere.cxx:1545
 TGeoSphere.cxx:1546
 TGeoSphere.cxx:1547
 TGeoSphere.cxx:1548
 TGeoSphere.cxx:1549
 TGeoSphere.cxx:1550
 TGeoSphere.cxx:1551
 TGeoSphere.cxx:1552
 TGeoSphere.cxx:1553
 TGeoSphere.cxx:1554
 TGeoSphere.cxx:1555
 TGeoSphere.cxx:1556
 TGeoSphere.cxx:1557
 TGeoSphere.cxx:1558
 TGeoSphere.cxx:1559
 TGeoSphere.cxx:1560
 TGeoSphere.cxx:1561
 TGeoSphere.cxx:1562
 TGeoSphere.cxx:1563
 TGeoSphere.cxx:1564
 TGeoSphere.cxx:1565
 TGeoSphere.cxx:1566
 TGeoSphere.cxx:1567
 TGeoSphere.cxx:1568
 TGeoSphere.cxx:1569
 TGeoSphere.cxx:1570
 TGeoSphere.cxx:1571
 TGeoSphere.cxx:1572
 TGeoSphere.cxx:1573
 TGeoSphere.cxx:1574
 TGeoSphere.cxx:1575
 TGeoSphere.cxx:1576
 TGeoSphere.cxx:1577
 TGeoSphere.cxx:1578
 TGeoSphere.cxx:1579
 TGeoSphere.cxx:1580
 TGeoSphere.cxx:1581
 TGeoSphere.cxx:1582
 TGeoSphere.cxx:1583
 TGeoSphere.cxx:1584
 TGeoSphere.cxx:1585
 TGeoSphere.cxx:1586
 TGeoSphere.cxx:1587
 TGeoSphere.cxx:1588
 TGeoSphere.cxx:1589
 TGeoSphere.cxx:1590
 TGeoSphere.cxx:1591
 TGeoSphere.cxx:1592
 TGeoSphere.cxx:1593
 TGeoSphere.cxx:1594
 TGeoSphere.cxx:1595
 TGeoSphere.cxx:1596
 TGeoSphere.cxx:1597
 TGeoSphere.cxx:1598
 TGeoSphere.cxx:1599
 TGeoSphere.cxx:1600
 TGeoSphere.cxx:1601
 TGeoSphere.cxx:1602
 TGeoSphere.cxx:1603
 TGeoSphere.cxx:1604
 TGeoSphere.cxx:1605
 TGeoSphere.cxx:1606
 TGeoSphere.cxx:1607
 TGeoSphere.cxx:1608
 TGeoSphere.cxx:1609
 TGeoSphere.cxx:1610
 TGeoSphere.cxx:1611
 TGeoSphere.cxx:1612
 TGeoSphere.cxx:1613
 TGeoSphere.cxx:1614
 TGeoSphere.cxx:1615
 TGeoSphere.cxx:1616
 TGeoSphere.cxx:1617
 TGeoSphere.cxx:1618
 TGeoSphere.cxx:1619
 TGeoSphere.cxx:1620
 TGeoSphere.cxx:1621
 TGeoSphere.cxx:1622
 TGeoSphere.cxx:1623
 TGeoSphere.cxx:1624
 TGeoSphere.cxx:1625
 TGeoSphere.cxx:1626
 TGeoSphere.cxx:1627
 TGeoSphere.cxx:1628
 TGeoSphere.cxx:1629
 TGeoSphere.cxx:1630
 TGeoSphere.cxx:1631
 TGeoSphere.cxx:1632
 TGeoSphere.cxx:1633
 TGeoSphere.cxx:1634
 TGeoSphere.cxx:1635
 TGeoSphere.cxx:1636
 TGeoSphere.cxx:1637
 TGeoSphere.cxx:1638
 TGeoSphere.cxx:1639
 TGeoSphere.cxx:1640
 TGeoSphere.cxx:1641
 TGeoSphere.cxx:1642
 TGeoSphere.cxx:1643
 TGeoSphere.cxx:1644
 TGeoSphere.cxx:1645
 TGeoSphere.cxx:1646
 TGeoSphere.cxx:1647
 TGeoSphere.cxx:1648
 TGeoSphere.cxx:1649
 TGeoSphere.cxx:1650
 TGeoSphere.cxx:1651
 TGeoSphere.cxx:1652
 TGeoSphere.cxx:1653
 TGeoSphere.cxx:1654
 TGeoSphere.cxx:1655
 TGeoSphere.cxx:1656
 TGeoSphere.cxx:1657
 TGeoSphere.cxx:1658
 TGeoSphere.cxx:1659
 TGeoSphere.cxx:1660
 TGeoSphere.cxx:1661
 TGeoSphere.cxx:1662
 TGeoSphere.cxx:1663
 TGeoSphere.cxx:1664
 TGeoSphere.cxx:1665
 TGeoSphere.cxx:1666
 TGeoSphere.cxx:1667
 TGeoSphere.cxx:1668
 TGeoSphere.cxx:1669
 TGeoSphere.cxx:1670
 TGeoSphere.cxx:1671
 TGeoSphere.cxx:1672
 TGeoSphere.cxx:1673
 TGeoSphere.cxx:1674
 TGeoSphere.cxx:1675
 TGeoSphere.cxx:1676
 TGeoSphere.cxx:1677
 TGeoSphere.cxx:1678
 TGeoSphere.cxx:1679
 TGeoSphere.cxx:1680
 TGeoSphere.cxx:1681
 TGeoSphere.cxx:1682
 TGeoSphere.cxx:1683
 TGeoSphere.cxx:1684
 TGeoSphere.cxx:1685
 TGeoSphere.cxx:1686
 TGeoSphere.cxx:1687
 TGeoSphere.cxx:1688
 TGeoSphere.cxx:1689
 TGeoSphere.cxx:1690
 TGeoSphere.cxx:1691
 TGeoSphere.cxx:1692
 TGeoSphere.cxx:1693
 TGeoSphere.cxx:1694
 TGeoSphere.cxx:1695
 TGeoSphere.cxx:1696
 TGeoSphere.cxx:1697
 TGeoSphere.cxx:1698
 TGeoSphere.cxx:1699
 TGeoSphere.cxx:1700
 TGeoSphere.cxx:1701
 TGeoSphere.cxx:1702
 TGeoSphere.cxx:1703
 TGeoSphere.cxx:1704
 TGeoSphere.cxx:1705
 TGeoSphere.cxx:1706
 TGeoSphere.cxx:1707
 TGeoSphere.cxx:1708
 TGeoSphere.cxx:1709
 TGeoSphere.cxx:1710
 TGeoSphere.cxx:1711
 TGeoSphere.cxx:1712
 TGeoSphere.cxx:1713
 TGeoSphere.cxx:1714
 TGeoSphere.cxx:1715
 TGeoSphere.cxx:1716
 TGeoSphere.cxx:1717
 TGeoSphere.cxx:1718
 TGeoSphere.cxx:1719
 TGeoSphere.cxx:1720
 TGeoSphere.cxx:1721
 TGeoSphere.cxx:1722
 TGeoSphere.cxx:1723
 TGeoSphere.cxx:1724
 TGeoSphere.cxx:1725
 TGeoSphere.cxx:1726
 TGeoSphere.cxx:1727
 TGeoSphere.cxx:1728
 TGeoSphere.cxx:1729
 TGeoSphere.cxx:1730
 TGeoSphere.cxx:1731
 TGeoSphere.cxx:1732
 TGeoSphere.cxx:1733
 TGeoSphere.cxx:1734
 TGeoSphere.cxx:1735
 TGeoSphere.cxx:1736
 TGeoSphere.cxx:1737
 TGeoSphere.cxx:1738
 TGeoSphere.cxx:1739
 TGeoSphere.cxx:1740
 TGeoSphere.cxx:1741
 TGeoSphere.cxx:1742