ROOT logo
// @(#)root/geom:$Id: TGeoSphere.h 24879 2008-07-18 08:04:40Z brun $
// Author: Andrei Gheata   31/01/02

/*************************************************************************
 * 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.             *
 *************************************************************************/

#ifndef ROOT_TGeoSphere
#define ROOT_TGeoSphere

#ifndef ROOT_TGeoBBox
#include "TGeoBBox.h"
#endif

////////////////////////////////////////////////////////////////////////////
//                                                                        //
// 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               //
//                                                                        //
////////////////////////////////////////////////////////////////////////////

class TGeoSphere : public TGeoBBox
{
protected :
// data members
   Int_t                 fNz;     // number of z planes for drawing
   Int_t                 fNseg;   // number of segments for drawing
   Double_t              fRmin;   // inner radius
   Double_t              fRmax;   // outer radius
   Double_t              fTheta1; // lower theta limit
   Double_t              fTheta2; // higher theta limit
   Double_t              fPhi1;   // lower phi limit
   Double_t              fPhi2;   // higher phi limit
// methods

public:
   // constructors
   TGeoSphere();
   TGeoSphere(Double_t rmin, Double_t rmax, Double_t theta1=0, Double_t theta2=180,
              Double_t phi1=0, Double_t phi2=360);
   TGeoSphere(const char *name, Double_t rmin, Double_t rmax, Double_t theta1=0, Double_t theta2=180,
              Double_t phi1=0, Double_t phi2=360);
   TGeoSphere(Double_t *param, Int_t nparam=6);
   // destructor
   virtual ~TGeoSphere();
   // methods
   virtual Double_t      Capacity() const;
   virtual void          ComputeBBox();
   virtual void          ComputeNormal(Double_t *point, Double_t *dir, Double_t *norm);
   virtual Bool_t        Contains(Double_t *point) const;
   virtual Int_t         DistancetoPrimitive(Int_t px, Int_t py);
   virtual Double_t      DistFromInside(Double_t *point, Double_t *dir, Int_t iact=1, 
                                   Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
   virtual Double_t      DistFromOutside(Double_t *point, Double_t *dir, Int_t iact=1, 
                                   Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
   Double_t              DistToSphere(Double_t *point, Double_t *dir, Double_t rsph, Bool_t check=kTRUE, Bool_t firstcross=kTRUE) const;
   virtual TGeoVolume   *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, 
                                Double_t start, Double_t step);
   virtual const char   *GetAxisName(Int_t iaxis) const;
   virtual Double_t      GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
   virtual void          GetBoundingCylinder(Double_t *param) const;
   virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
   virtual Int_t         GetByteCount() const {return 42;}
   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape * /*mother*/, TGeoMatrix * /*mat*/) const {return 0;}
   virtual void          GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
   virtual Int_t         GetNmeshVertices() const;
   Int_t                 GetNumberOfDivisions() const {return fNseg;}
   virtual Bool_t        GetPointsOnSegments(Int_t /*npoints*/, Double_t * /*array*/) const {return kFALSE;}
   Int_t                 GetNz() const   {return fNz;}
   virtual Double_t      GetRmin() const {return fRmin;}
   virtual Double_t      GetRmax() const {return fRmax;}
   Double_t              GetTheta1() const {return fTheta1;}
   Double_t              GetTheta2() const {return fTheta2;}
   Double_t              GetPhi1() const {return fPhi1;}
   Double_t              GetPhi2() const {return fPhi2;}
   virtual void          InspectShape() const;
   virtual Bool_t        IsCylType() const {return kFALSE;}
   Int_t                 IsOnBoundary(Double_t *point) const;
   Bool_t                IsPointInside(Double_t *point, Bool_t checkR=kTRUE, Bool_t checkTh=kTRUE, Bool_t checkPh=kTRUE) const;
   virtual TBuffer3D    *MakeBuffer3D() const;
   virtual Double_t      Safety(Double_t *point, Bool_t in=kTRUE) const;
   virtual void          SavePrimitive(ostream &out, Option_t *option = "");
   void                  SetSphDimensions(Double_t rmin, Double_t rmax, Double_t theta1,
                                       Double_t theta2, Double_t phi1, Double_t phi2);
   virtual void          SetNumberOfDivisions(Int_t p);
   virtual void          SetDimensions(Double_t *param);
   virtual void          SetPoints(Double_t *points) const;
   virtual void          SetPoints(Float_t *points) const;
   virtual void          SetSegsAndPols(TBuffer3D &buff) const;
   virtual void          Sizeof3D() const;

   ClassDef(TGeoSphere, 1)         // sphere class
};

#endif
 TGeoSphere.h:1
 TGeoSphere.h:2
 TGeoSphere.h:3
 TGeoSphere.h:4
 TGeoSphere.h:5
 TGeoSphere.h:6
 TGeoSphere.h:7
 TGeoSphere.h:8
 TGeoSphere.h:9
 TGeoSphere.h:10
 TGeoSphere.h:11
 TGeoSphere.h:12
 TGeoSphere.h:13
 TGeoSphere.h:14
 TGeoSphere.h:15
 TGeoSphere.h:16
 TGeoSphere.h:17
 TGeoSphere.h:18
 TGeoSphere.h:19
 TGeoSphere.h:20
 TGeoSphere.h:21
 TGeoSphere.h:22
 TGeoSphere.h:23
 TGeoSphere.h:24
 TGeoSphere.h:25
 TGeoSphere.h:26
 TGeoSphere.h:27
 TGeoSphere.h:28
 TGeoSphere.h:29
 TGeoSphere.h:30
 TGeoSphere.h:31
 TGeoSphere.h:32
 TGeoSphere.h:33
 TGeoSphere.h:34
 TGeoSphere.h:35
 TGeoSphere.h:36
 TGeoSphere.h:37
 TGeoSphere.h:38
 TGeoSphere.h:39
 TGeoSphere.h:40
 TGeoSphere.h:41
 TGeoSphere.h:42
 TGeoSphere.h:43
 TGeoSphere.h:44
 TGeoSphere.h:45
 TGeoSphere.h:46
 TGeoSphere.h:47
 TGeoSphere.h:48
 TGeoSphere.h:49
 TGeoSphere.h:50
 TGeoSphere.h:51
 TGeoSphere.h:52
 TGeoSphere.h:53
 TGeoSphere.h:54
 TGeoSphere.h:55
 TGeoSphere.h:56
 TGeoSphere.h:57
 TGeoSphere.h:58
 TGeoSphere.h:59
 TGeoSphere.h:60
 TGeoSphere.h:61
 TGeoSphere.h:62
 TGeoSphere.h:63
 TGeoSphere.h:64
 TGeoSphere.h:65
 TGeoSphere.h:66
 TGeoSphere.h:67
 TGeoSphere.h:68
 TGeoSphere.h:69
 TGeoSphere.h:70
 TGeoSphere.h:71
 TGeoSphere.h:72
 TGeoSphere.h:73
 TGeoSphere.h:74
 TGeoSphere.h:75
 TGeoSphere.h:76
 TGeoSphere.h:77
 TGeoSphere.h:78
 TGeoSphere.h:79
 TGeoSphere.h:80
 TGeoSphere.h:81
 TGeoSphere.h:82
 TGeoSphere.h:83
 TGeoSphere.h:84
 TGeoSphere.h:85
 TGeoSphere.h:86
 TGeoSphere.h:87
 TGeoSphere.h:88
 TGeoSphere.h:89
 TGeoSphere.h:90
 TGeoSphere.h:91
 TGeoSphere.h:92
 TGeoSphere.h:93
 TGeoSphere.h:94
 TGeoSphere.h:95
 TGeoSphere.h:96
 TGeoSphere.h:97
 TGeoSphere.h:98
 TGeoSphere.h:99
 TGeoSphere.h:100
 TGeoSphere.h:101
 TGeoSphere.h:102