library: libGeom #include "TGeoTorus.h"

# TGeoTorus

class description - source file - inheritance tree (.ps)

## class TGeoTorus : public TGeoBBox

| Inheritance Chart:

`TObject`

<-

`TNamed`

<-

`TGeoShape`

<-

`TGeoBBox`

<-

`TGeoTorus`

        public:

                              TGeoTorus()
                              TGeoTorus(Double_t r, Double_t rmin, Double_t rmax, Double_t phi1 = 0, Double_t dphi = 360)
                              TGeoTorus(const char* name, Double_t r, Double_t rmin, Double_t rmax, Double_t phi1 = 0, Double_t dphi = 360)
                              TGeoTorus(Double_t* params)
                              TGeoTorus(const TGeoTorus&)
                      virtual ~TGeoTorus()
               static TClass* Class()
                 virtual void ComputeBBox()
                 virtual void ComputeNormal(Double_t* point, Double_t* dir, Double_t* norm)
               virtual Bool_t Contains(Double_t* point) const
                     Double_t Daxis(Double_t* pt, Double_t* dir, Double_t t) const
                     Double_t DDaxis(Double_t* pt, Double_t* dir, Double_t t) const
                     Double_t DDDaxis(Double_t* pt, Double_t* dir, Double_t t) const
                virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
             virtual Double_t DistToIn(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = TGeoShape::Big(), Double_t* safe = 0) const
             virtual Double_t DistToOut(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = TGeoShape::Big(), Double_t* safe = 0) 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 Int_t GetByteCount() const
                     Double_t GetDphi() const
           virtual TGeoShape* GetMakeRuntimeShape(TGeoShape* mother, TGeoMatrix* mat) const
                virtual Int_t GetNmeshVertices() const
                     Double_t GetPhi1() const
                     Double_t GetR() const
                     Double_t GetRmax() const
                     Double_t GetRmin() const
                 virtual void InspectShape() const
              virtual TClass* IsA() const
               virtual Bool_t IsCylType() const
                virtual void* Make3DBuffer(const TGeoVolume* vol) const
                   TGeoTorus& operator=(const TGeoTorus&)
                 virtual void Paint(Option_t* option)
             virtual Double_t Safety(Double_t* point, Bool_t in = kTRUE) const
                 virtual void SetDimensions(Double_t* param)
                 virtual void SetPoints(Double_t* buff) const
                 virtual void SetPoints(Float_t* buff) const
                         void SetTorusDimensions(Double_t r, Double_t rmin, Double_t rmax, Double_t phi1, Double_t dphi)
                 virtual void ShowMembers(TMemberInspector& insp, char* parent)
                 virtual void Sizeof3D() const
                        Int_t SolveCubic(Double_t a, Double_t b, Double_t c, Double_t* x) const
                        Int_t SolveQuartic(Double_t a, Double_t b, Double_t c, Double_t d, Double_t* x) const
                 virtual void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)
                     Double_t ToBoundary(Double_t* pt, Double_t* dir, Double_t r) const

### Data Members

        protected:

          Double_t fR     axial radius
          Double_t fRmin  inner radius
          Double_t fRmax  outer radius
          Double_t fPhi1  starting phi
          Double_t fDphi  phi extent

## Class Description

     TGeoTorus - Torus segment class. A torus has 5 parameters :
                R    - axial radius
                Rmin - inner radius
                Rmax - outer radius
                Phi1 - starting phi
                Dphi - phi extent

    _____________________________________________________________________________

TGeoTorus()

     Default constructor

TGeoTorus(Double_t r, Double_t rmin, Double_t rmax, Double_t phi1, Double_t dphi) :TGeoBBox(0, 0, 0)

     Constructor without name.

TGeoTorus(const char *name, Double_t r, Double_t rmin, Double_t rmax, Double_t phi1, Double_t dphi) :TGeoBBox(name, 0, 0, 0)

     Constructor with name.

TGeoTorus(Double_t *param) :TGeoBBox(0, 0, 0)

     Constructor based on an array of parameters.
     param[0] = R
     param[1] = Rmin
     param[2] = Rmax
     param[3] = Phi1
     param[4] = Dphi

void ComputeBBox()

     Compute bounding box of the torus.

void ComputeNormal(Double_t *point, Double_t *dir, Double_t *norm)

     Compute normal to closest surface from POINT.

Bool_t Contains(Double_t *point) const

     Test if point is inside the torus.
     check phi range

Int_t DistancetoPrimitive(Int_t px, Int_t py)

     Compute closest distance from point px,py to each vertex.

Double_t Daxis(Double_t *pt, Double_t *dir, Double_t t) const

     Computes distance to axis of the torus from point pt + t*dir;

Double_t DDaxis(Double_t *pt, Double_t *dir, Double_t t) const

     Computes derivative w.r.t. t of the distance to axis of the torus from point pt + t*dir;

Double_t DDDaxis(Double_t *pt, Double_t *dir, Double_t t) const

     Second derivative of distance to torus axis w.r.t t.

Double_t DistToOut(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 torus.

Double_t DistToIn(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 torus.

TGeoVolume* Divide(TGeoVolume * /*voldiv*/, const char * /*divname*/, Int_t /*iaxis*/, Int_t /*ndiv*/, Double_t /*start*/, Double_t /*step*/)

    --- Divide this torus shape belonging to volume "voldiv" into ndiv volumes
     called divname, from start position with the given step.

const char* GetAxisName(Int_t iaxis) const

     Returns name of axis IAXIS.

Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const

     Get range of shape for a given axis.

void GetBoundingCylinder(Double_t *param) const

    --- Fill vector param[4] with the bounding cylinder parameters. The order
     is the following : Rmin, Rmax, Phi1, Phi2, dZ

TGeoShape* GetMakeRuntimeShape(TGeoShape * /*mother*/, TGeoMatrix * /*mat*/) const

void InspectShape() const

     print shape parameters

void* Make3DBuffer(const TGeoVolume *vol) const

void Paint(Option_t *option)

     paint this shape according to option

Double_t 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.

void SetTorusDimensions(Double_t r, Double_t rmin, Double_t rmax, Double_t phi1, Double_t dphi)

void SetDimensions(Double_t *param)

void SetPoints(Double_t *buff) const

     Create torus mesh points

void SetPoints(Float_t *buff) const

     Create torus mesh points

Int_t GetNmeshVertices() const

     Return number of vertices of the mesh representation

void Sizeof3D() const

     fill size of this 3-D object

Int_t SolveCubic(Double_t a, Double_t b, Double_t c, Double_t *x) const

     Find real solutions of the cubic equation : x^3 + a*x^2 + b*x + c = 0
     Input: a,b,c
     Output: x[3] real solutions
     Returns number of real solutions (1 or 3)

Int_t SolveQuartic(Double_t a, Double_t b, Double_t c, Double_t d, Double_t *x) const

     Find real solutions of the quartic equation : x^3 + a*x^2 + b*x + c = 0
     Input: a,b,c,d
     Output: x[4] - real solutions
     Returns number of real solutions (0 to 4)

Double_t ToBoundary(Double_t *pt, Double_t *dir, Double_t r) const

     Returns distance to the surface or the torus (fR,r) from a point, along
     a direction. Point is close enough to the boundary so that the distance
     to the torus is decreasing while moving along the given direction.

### Inline Functions

                   void ~TGeoTorus()
                  Int_t GetByteCount() const
               Double_t GetR() const
               Double_t GetRmin() const
               Double_t GetRmax() const
               Double_t GetPhi1() const
               Double_t GetDphi() const
                 Bool_t IsCylType() const
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
              TGeoTorus TGeoTorus(const TGeoTorus&)
             TGeoTorus& operator=(const TGeoTorus&)

Author: Andrei Gheata 28/07/03
Last update: root/geom:$Name: $:$Id: TGeoTorus.cxx,v 1.10 2004/06/25 11:59:56 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *