class TGeoShape: public TNamed

 TGeoShape - Base abstract class for all shapes.



   Shapes are geometrical objects that provide the basic modelling
 functionality. They provide the definition of the LOCAL frame of coordinates,
 with respect to which they are defined. Any implementation of a shape deriving
 from the base TGeoShape class has to provide methods for :
  - finding out if a point defined in their local frame is or not contained
 inside;
  - computing the distance from a local point to getting outside/entering the
 shape, given a known direction;
  - computing the maximum distance in any direction from a local point that
 does NOT result in a boundary crossing of the shape (safe distance);
  - computing the cosines of the normal vector to the crossed shape surface,
 given a starting local point and an ongoing direction.
   All the features above are globally managed by the modeller in order to
 provide navigation functionality. In addition to those, shapes have also to
 implement additional specific abstract methods :
  - computation of the minimal box bounding the shape, given that this box have
 to be aligned with the local coordinates;
  - algorithms for dividing the shape along a given axis and producing resulting
 divisions volumes.

   The modeler currently provides a set of 16 basic shapes, which we will call
 primitives. It also provides a special class allowing the creation of shapes
 made as a result of boolean operations between primitives. These are called
 composite shapes and the composition operation can be recursive (composition
 of composites). This allows the creation of a quite large number of different
 shape topologies and combinations.

   Shapes are named objects and register themselves to the manager class at
 creation time. This is responsible for their final deletion. Shapes
 can be created without name if their retreival by name is no needed. Generally
 shapes are objects that are usefull only at geometry creation stage. The pointer
 to a shape is in fact needed only when referring to a given volume and it is
 always accessible at that level. A shape may be referenced by several volumes,
 therefore its deletion is not possible once volumes were defined based on it.



 Creating shapes

   Shape objects embeed only the minimum set of parameters that are fully
 describing a valid physical shape. For instance, a tube is represented by
 its half length, the minimum radius and the maximum radius. Shapes are used
 togeather with media in order to create volumes, which in their turn
 are the main components of the geometrical tree. A specific shape can be created
 stand-alone :

   TGeoBBox *box = new TGeoBBox("s_box", halfX, halfY, halfZ); // named
   TGeoTube *tub = new TGeoTube(rmin, rmax, halfZ);            // no name
   ...  (see each specific shape constructors)

   Sometimes it is much easier to create a volume having a given shape in one
 step, since shapes are not direcly linked in the geometrical tree but volumes
 are :

   TGeoVolume *vol_box = gGeoManager->MakeBox("BOX_VOL", "mat1", halfX, halfY, halfZ);
   TGeoVolume *vol_tub = gGeoManager->MakeTube("TUB_VOL", "mat2", rmin, rmax, halfZ);
   ...  (see MakeXXX() utilities in TGeoManager class)


 Shape queries

 Note that global queries related to a geometry are handled by the manager class.
 However, shape-related queries might be sometimes usefull.

 A) Bool_t TGeoShape::Contains(Double_t *point[3])
   - this method returns true if POINT is actually inside the shape. The point
 has to be defined in the local shape reference. For instance, for a box having
 DX, DY and DZ half-lengths a point will be considered inside if :
   | -DX <= point[0] <= DX
   | -DY <= point[1] <= DY
   | -DZ <= point[2] <= DZ

 B) Double_t TGeoShape::DistFromInside(Double_t *point[3], Double_t *dir[3],
                                  Int_t iact, Double_t step, Double_t *safe)
   - computes the distance to exiting a shape from a given point INSIDE, along
 a given direction. The direction is given by its director cosines with respect
 to the local shape coordinate system. This method provides additional
 information according the value of IACT input parameter :
   IACT = 0     => compute only safe distance and fill it at the location
                   given by SAFE
   IACT = 1     => a proposed STEP is supplied. The safe distance is computed
                   first. If this is bigger than STEP than the proposed step
                   is approved and returned by the method since it does not
                   cross the shape boundaries. Otherwise, the distance to
                   exiting the shape is computed and returned.
   IACT = 2     => compute both safe distance and distance to exiting, ignoring
                   the proposed step.
   IACT > 2     => compute only the distance to exiting, ignoring anything else.

 C) Double_t TGeoShape::DistFromOutside(Double_t *point[3], Double_t *dir[3],
                                  Int_t iact, Double_t step, Double_t *safe)
   - computes the distance to entering a shape from a given point OUTSIDE. Acts
 in the same way as B).

 D) Double_t Safety(Double_t *point[3], Bool_t inside)

   - compute maximum shift of a point in any direction that does not change its
 INSIDE/OUTSIDE state (does not cross shape boundaries). The state of the point
 have to be properly supplied.

 E) Double_t *Normal(Double_t *point[3], Double_t *dir[3], Bool_t inside)

   - returns director cosines of normal to the crossed shape surface from a
 given point towards a direction. One has to specify if the point is inside
 or outside shape. According to this, the normal will be outwards or inwards
 shape respectively. Normal components are statically stored by shape class,
 so it has to be copied after retreival in a different array.

 Dividing shapes

   Shapes can generally be divided along a given axis. Supported axis are
 X, Y, Z, Rxy, Phi, Rxyz. A given shape cannot be divided however on any axis.
 The general rule is that that divisions are possible on whatever axis that
 produces still known shapes as slices. The division of shapes should not be
 performed by TGeoShape::Divide() calls, but rather by TGeoVolume::Divide().
 The algorithm for dividing a specific shape is known by the shape object, but
 is always invoked in a generic way from the volume level. Details on how to
 do that can be found in TGeoVolume class. One can see how all division options
 are interpreted and which is their result inside specific shape classes.



/* */

Function Members (Methods)

 
    This is an abstract class, constructors will not be documented.
    Look at the header to check for available constructors.

public:
virtual~TGeoShape()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
static Double_tBig()
virtual voidTObject::Browse(TBrowser* b)
virtual Double_tCapacity() const
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidComputeBBox()
virtual voidComputeNormal(Double_t* point, Double_t* dir, Double_t* norm)
virtual Bool_tContains(Double_t* point) const
virtual voidTNamed::Copy(TObject& named) const
virtual Bool_tCouldBeCrossed(Double_t* point, Double_t* dir) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
virtual Double_tDistFromInside(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = TGeoShape::Big(), Double_t* safe = 0) const
virtual Double_tDistFromOutside(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = TGeoShape::Big(), Double_t* safe = 0) const
static Double_tDistToPhiMin(Double_t* point, Double_t* dir, Double_t s1, Double_t c1, Double_t s2, Double_t c2, Double_t sm, Double_t cm, Bool_t in = kTRUE)
virtual TGeoVolume*Divide(TGeoVolume* voldiv, const char* divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
virtual voidDraw(Option_t* option = "")MENU
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual const char*GetAxisName(Int_t iaxis) const
virtual Double_tGetAxisRange(Int_t iaxis, Double_t& xlo, Double_t& xhi) const
virtual voidGetBoundingCylinder(Double_t* param) const
virtual const TBuffer3D&GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
virtual Int_tGetByteCount() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Int_tGetFittingBox(const TGeoBBox* parambox, TGeoMatrix* mat, Double_t& dx, Double_t& dy, Double_t& dz) const
virtual const char*TObject::GetIconName() const
Int_tGetId() const
virtual TGeoShape*GetMakeRuntimeShape(TGeoShape* mother, TGeoMatrix* mat) const
virtual voidGetMeshNumbers(Int_t&, Int_t&, Int_t&) const
virtual const char*GetName() const
virtual Int_tGetNmeshVertices() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
char*GetPointerName() const
virtual const char*TNamed::GetTitle() const
static TGeoMatrix*GetTransform()
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
virtual voidInspectShape() const
voidTObject::InvertBit(UInt_t f)
voidInvertShapeBit(UInt_t f)
virtual TClass*IsA() const
static Bool_tIsCloseToPhi(Double_t epsil, Double_t* point, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
virtual Bool_tIsComposite() const
static Bool_tIsCrossingSemiplane(Double_t* point, Double_t* dir, Double_t cphi, Double_t sphi, Double_t& snext, Double_t& rxy)
virtual Bool_tIsCylType() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
static Bool_tIsInPhiRange(Double_t* point, Double_t phi1, Double_t phi2)
Bool_tTObject::IsOnHeap() const
virtual Bool_tIsReflected() const
Bool_tIsRunTimeShape() const
virtual Bool_tTNamed::IsSortable() const
Bool_tIsValid() const
virtual Bool_tIsValidBox() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
virtual TBuffer3D*MakeBuffer3D() const
voidTObject::MayNotUse(const char* method) const
static voidNormalPhi(Double_t* point, Double_t* dir, Double_t* norm, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TGeoShape&operator=(const TGeoShape&)
virtual voidPaint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
voidResetShapeBit(UInt_t f)
virtual Double_tSafety(Double_t* point, Bool_t in = kTRUE) const
static Double_tSafetyPhi(Double_t* point, Bool_t in, Double_t phi1, Double_t phi2)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidSetDimensions(Double_t* param)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetId(Int_t id)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetPoints(Double_t* points) const
virtual voidSetPoints(Float_t* points) const
voidSetRuntime(Bool_t flag = kTRUE)
virtual voidSetSegsAndPols(TBuffer3D& buff) const
voidSetShapeBit(UInt_t f)
voidSetShapeBit(UInt_t f, Bool_t set)
virtual voidTNamed::SetTitle(const char* title = "")MENU
static voidSetTransform(TGeoMatrix* matrix)
virtual voidTObject::SetUniqueID(UInt_t uid)
Int_tShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidSizeof3D() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
Bool_tTestShapeBit(UInt_t f) const
Int_tTestShapeBits(UInt_t f) const
static Double_tTolerance()
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
virtual voidFillBuffer3D(TBuffer3D& buffer, Int_t reqSections, Bool_t localFrame) const
Int_tGetBasicColor() const
voidTObject::MakeZombie()
voidSetOnBoundary(Bool_t)
voidTransformPoints(Double_t* points, UInt_t NbPoints) const

Data Members

public:
enum EShapeType { kBitMask32
kGeoNoShape
kGeoBad
kGeoRSeg
kGeoPhiSeg
kGeoThetaSeg
kGeoVisX
kGeoVisY
kGeoVisZ
kGeoRunTimeShape
kGeoInvalidShape
kGeoTorus
kGeoBox
kGeoPara
kGeoSph
kGeoTube
kGeoTubeSeg
kGeoCone
kGeoConeSeg
kGeoPcon
kGeoPgon
kGeoArb8
kGeoEltu
kGeoTrap
kGeoCtub
kGeoTrd1
kGeoTrd2
kGeoComb
kGeoClosedShape
kGeoXtru
kGeoParaboloid
kGeoHalfSpace
kGeoHype
kGeoSavePrimitive
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TStringTNamed::fNameobject identifier
UInt_tfShapeBitsshape bits
Int_tfShapeIdshape id
TStringTNamed::fTitleobject title
private:
static TGeoMatrix*fgTransformcurrent transformation matrix that applies to shape

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

~TGeoShape()
 Destructor
const char * GetName()
 Get the shape name.
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
 Returns distance to shape primitive mesh.
Bool_t IsCloseToPhi(Double_t epsil, Double_t* point, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
 True if point is closer than epsil to one of the phi planes defined by c1,s1 or c2,s2
Bool_t IsInPhiRange(Double_t* point, Double_t phi1, Double_t phi2)
 Static method to check if a point is in the phi range (phi1, phi2) [degrees]
Bool_t IsCrossingSemiplane(Double_t* point, Double_t* dir, Double_t cphi, Double_t sphi, Double_t& snext, Double_t& rxy)
 Compute distance from POINT to semiplane defined by PHI angle along DIR. Computes
 also radius at crossing point. This might be negative in case the crossing is
 on the other side of the semiplane.
Double_t DistToPhiMin(Double_t* point, Double_t* dir, Double_t s1, Double_t c1, Double_t s2, Double_t c2, Double_t sm, Double_t cm, Bool_t in = kTRUE)
 compute distance from point (inside phi) to both phi planes. Return minimum.
void NormalPhi(Double_t* point, Double_t* dir, Double_t* norm, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
 Static method to compute normal to phi planes.
Double_t SafetyPhi(Double_t* point, Bool_t in, Double_t phi1, Double_t phi2)
 Static method to compute safety w.r.t a phi corner defined by cosines/sines
 of the angles phi1, phi2.
void SetShapeBit(UInt_t f, Bool_t set)
 Equivalent of TObject::SetBit.
TGeoMatrix * GetTransform()
 Returns current transformation matrix that applies to shape.
void SetTransform(TGeoMatrix* matrix)
 Set current transformation matrix that applies to shape.
void TransformPoints(Double_t* points, UInt_t NbPoints) const
 Tranform a set of points (LocalToMaster)
void FillBuffer3D(TBuffer3D& buffer, Int_t reqSections, Bool_t localFrame) const
 Fill the supplied buffer, with sections in desired frame
 See TBuffer3D.h for explanation of sections, frame etc.
Int_t GetBasicColor()
 Get the basic color (0-7).
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
 Stub implementation to avoid forcing implementation at this stage
char * GetPointerName()
 Provide a pointer name containing uid.
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
 Execute mouse actions on this shape.
void Draw(Option_t* option = "")
 Draw this shape.
void Paint(Option_t* option = "")
 Paint this shape.
void SetOnBoundary(Bool_t )
{;}
Double_t Big()
 methods
{return 1.E30;}
Double_t Tolerance()
{return 1.E-10;}
Double_t Capacity()
void ComputeBBox()
void ComputeNormal(Double_t* point, Double_t* dir, Double_t* norm)
Bool_t Contains(Double_t* point) const
Bool_t CouldBeCrossed(Double_t* point, Double_t* dir) const
Int_t DistancetoPrimitive(Int_t px, Int_t py)
Double_t DistFromInside(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = TGeoShape::Big(), Double_t* safe = 0) const
TGeoVolume * Divide(TGeoVolume* voldiv, const char* divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
const char * GetAxisName(Int_t iaxis) const
Double_t GetAxisRange(Int_t iaxis, Double_t& xlo, Double_t& xhi) const
void GetBoundingCylinder(Double_t* param) const
Int_t GetByteCount()
Int_t GetFittingBox(const TGeoBBox* parambox, TGeoMatrix* mat, Double_t& dx, Double_t& dy, Double_t& dz) const
Int_t GetId()
{return fShapeId;}
TGeoShape * GetMakeRuntimeShape(TGeoShape* mother, TGeoMatrix* mat) const
void GetMeshNumbers(Int_t& , Int_t& , Int_t& ) const
{;}
Int_t GetNmeshVertices()
{return 0;}
Bool_t IsComposite()
{return kFALSE;}
Bool_t IsCylType()
Bool_t IsReflected()
{return kFALSE;}
Bool_t IsRunTimeShape()
{return TestShapeBit(kGeoRunTimeShape);}
Bool_t IsValid()
{return !TestShapeBit(kGeoInvalidShape);}
Bool_t IsValidBox()
void InspectShape()
TBuffer3D * MakeBuffer3D()
{return 0;}
Double_t Safety(Double_t* point, Bool_t in = kTRUE) const
void SetDimensions(Double_t* param)
void SetId(Int_t id)
{fShapeId = id;}
void SetPoints(Double_t *points)
void SetPoints(Float_t *points)
void SetSegsAndPols(TBuffer3D& buff) const
void SetRuntime(Bool_t flag = kTRUE)
{SetShapeBit(kGeoRunTimeShape, flag);}
void Sizeof3D()
void SetShapeBit(UInt_t f, Bool_t set)
----- bit manipulation
void ResetShapeBit(UInt_t f)
{ fShapeBits &= ~(f & kBitMask32); }
Bool_t TestShapeBit(UInt_t f) const
{ return (Bool_t) ((fShapeBits & f) != 0); }
Int_t TestShapeBits(UInt_t f) const
{ return (Int_t) (fShapeBits & f); }
void InvertShapeBit(UInt_t f)
{ fShapeBits ^= f & kBitMask32; }

Author: Andrei Gheata 31/01/02
Last change: root/geom:$Id: TGeoShape.h 21425 2007-12-17 15:59:27Z brun $
Last generated: 2008-06-25 08:45
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.