Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches

Shapes are geometrical objects that provide the basic modeling functionality.

The "shapes" provide the definition of the local coordinate system of the volume. Any volume must have a shape. Any shape recognized by the modeller has to derive from the base **TGeoShape** class, providing methods for:

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:

The modeller currently provides a set of 20 basic shapes, which we will call primitives. It also provides a special class allowing the creation of shapes as a result of Boolean operations between primitives. These are called composite shapes and the composition operation can be recursive (combined composites). This allows the creation of a quite large number of different shape topologies and combinations. You can have a look and run the tutorial: geodemo.C

Primitive Shapes - the general inheritance scheme

Shapes are named objects and all primitives have constructors like:

TGeoXXX(const char *name,<type> param1,<type> param2, ...);
TGeoXXX(<type> param1,<type> param2, ...);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110

Naming shape primitive is mandatory only for the primitives used in Boolean composites (see "Composite Shapes"). For the sake of simplicity, we will describe only the constructors in the second form.

Primitive Shapes

Navigation Methods Performed By Shapes

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 retrieval by name is no needed. Generally shapes are objects that are useful 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. Several volumes may reference a single shape; therefore its deletion is not possible once volumes were defined based on it.

The navigation features related for instance to tracking particles are performed in the following way: Each shape implement its specific algorithms for all required tasks in its local reference system. Note that the manager class handles global queries related to geometry. However, shape-related queries might be sometimes useful:

bool Bool_t
Definition RtypesCore.h:63
double Double_t
Definition RtypesCore.h:59
virtual Bool_t Contains(const Double_t *point) const =0

The method above returns kTRUE if the point *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 DZhalf-lengths a point will be considered inside if:

-DX <= point[0] <= DX

-DY <= point[1] <= DY

-DZ <= point[2] <= DZ

Double_t *dir[3], Int_t iact,Double_t step,Double_t *safe);
int Int_t
Definition RtypesCore.h:45
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const =0

The method computes the distance to exiting a shape from a given point inside, along a given direction. This 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:

Double_t *dir[3],Int_t iact,Double_t step,Double_t *safe);
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const =0

This method computes the distance to entering a shape from a given point outside. It acts in the same way as the previous method.

virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const =0

This computes the maximum shift of a point in any direction that does not change its inside/outsidestate (does not cross shape boundaries). The state of the point has to be properly supplied.

Double_t *dir[3],Double_t *norm[3]);
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)=0

The method above computes the director cosines of normal to the crossed shape surface from a given point towards direction. This is filled into the norm array, supplied by the user. The normal vector is always chosen such that its dot product with the direction is positive defined.

Creating Shapes

Shape objects embeds only the minimum set of parameters that are fully describing a valid physical shape. For instance, the half-length, the minimum and maximum radius represent a tube. Shapes are used together 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 all specific shape constructors)
Box class.
Definition TGeoBBox.h:18
Cylindrical tube class.
Definition TGeoTube.h:18
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1

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

TGeoVolume *vol_box = gGeoManager->MakeBox("BOX_VOL",pmed,halfX,
halfY,halfZ);
TGeoVolume *vol_tub = gGeoManager->MakeTube("TUB_VOL",pmed,rmin,
rmax,halfZ);
// ...(See MakeXXX() utilities in TGeoManager class)
R__EXTERN TGeoManager * gGeoManager
TGeoVolume * MakeTube(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
TGeoVolume * MakeBox(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz)
Make in one step a volume pointing to a box shape with given medium.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:49

Dividing Shapes

Shapes can generally be divided along a given axis. Supported axes 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 are performed by the call TGeoShape::Divide(), but this operation can be done only via TGeoVolume::Divide() method. In other words, 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 the paragraph ‘Dividing volumes'. One can see how all division options are interpreted and which their result inside specific shape classes is.

Parametric Shapes

Shapes generally have a set of parameters that is well defined at build time. In fact, when the final geometrical hierarchy is assembled and the geometry is closed, all constituent shapes MUST**have well defined and valid parameters. In order to ease-up geometry creation, some parameterizations are however allowed.

For instance let's suppose that we need to define several volumes having exactly the same properties but different sizes. A way to do this would be to create as many different volumes and shapes. The modeller allows however the definition of a single volume having undefined shape parameters.

TGeoManager::Volume(const char *name,const char *shape,Int_t nmed);
TGeoVolume * Volume(const char *name, const char *shape, Int_t nmed, Float_t *upar, Int_t npar=0)
Create a volume in GEANT3 style.

This will create a special volume that will not be directly used in the geometry, but whenever positioned will require a list of actual parameters for the current shape that will be created in this process. Such volumes having shape parameters known only when used have to be positioned only with **TGeoManager::Node() method (see ‘Creating and Positioning Volumes').**

Other case when shape parameterizations are quite useful is scaling geometry structures. Imagine that we would like to enlarge/shrink a detector structure on one or more axes. This happens quite often in real life and is handled by "fitting mother" parameters. This is accomplished by defining shapes with one or more invalid (negative) parameters. For instance, defining a box having dx=10., dy=10., and dz=-1 will not generate an error but will be interpreted in a different way: A special volume **TGeoVolumeMulti** will be created. Whenever positioned inside a mother volume, this will create a normal **TGeoVolume** object having as shape a box with dz fitting the corresponding dzof the mother shape. Generally, this type of parameterization is used when positioning volumes in containers having a matching shape, but it works also for most reasonable combinations.

Modules

 Tubes
 
 Cones
 
 Trapezoids
 

Classes

class  TGeoBBox
 Box class. More...
 
class  TGeoCompositeShape
 Composite shapes are Boolean combinations of two or more shape components. More...
 
class  TGeoHalfSpace
 A half space is limited just by a plane, defined by a point and the normal direction. More...
 
class  TGeoHelix
 Class representing a helix curve. More...
 
class  TGeoHype
 A hyperboloid is represented as a solid limited by two planes perpendicular to the Z axis (top and bottom planes) and two hyperbolic surfaces of revolution about Z axis (inner and outer surfaces). More...
 
class  TGeoPara
 Parallelepiped class. More...
 
class  TGeoParaboloid
 A paraboloid is defined by the revolution surface generated by a parabola and is bounded by two planes perpendicular to Z axis. More...
 
class  TGeoPcon
 A polycone is represented by a sequence of tubes/cones, glued together at defined Z planes. More...
 
class  TGeoPgon
 Polygons are defined in the same way as polycones, the difference being just that the segments between consecutive Z planes are regular polygons. More...
 
class  TGeoPolygon
 An arbitrary polygon defined by vertices. More...
 
class  TGeoShape
 Base abstract class for all shapes. More...
 
class  TGeoShapeAssembly
 The shape encapsulating an assembly (union) of volumes. More...
 
class  TGeoSphere
 TGeoSphere are not just balls having internal and external radii, but sectors of a sphere having defined theta and phi ranges. More...
 
class  TGeoTorus
 The torus is defined by its axial radius, its inner and outer radius. More...
 
class  TGeoVolume
 TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes. More...
 
class  TGeoXtru
 A TGeoXtru shape is represented by the extrusion of an arbitrary polygon with fixed outline between several Z sections. More...