Loading...

Searching...

No Matches

Shapes

Shapes are geometrical objects that provide the basic modeling functionality.

- Primitive Shapes
- Navigation Methods Performed By Shapes
- Creating Shapes
- Dividing Shapes
- Parametric Shapes

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:

- Finding out if a point defined in their local frame is contained or not by the shape;
- Computing the distance to enter/exit the shape from a local point, 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.

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

Shapes are named objects and all primitives have constructors like:

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

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.

- Boxes: TGeoBBox class
- Parallelepiped: TGeoPara class
- Trapezoids: TGeoTrd1, TGeoTrd2 classes
- General Trapezoid: TGeoTrap class
- Twisted Trapezoid: TGeoGtra class
- Arbitrary 8 vertices shapes: TGeoArb8 class
- Tubes: TGeoTube class
- Tube Segments: TGeoTubeSeg class
- Cut Tubes: TGeoCtub class
- Elliptical Tubes: TGeoEltu class
- Hyperboloids: TGeoHype class
- Cones: TGeoCone class
- Cone Segments: TGeoConeSeg class
- Sphere: TGeoSphere class
- Torus: TGeoTorus class
- Paraboloid: TGeoParaboloid class
- Polycone: TGeoPcon class
- Polygon: TGeoPgon class
- Polygonal extrusion: TGeoXtru class
- Half Spaces: TGeoHalfSpace class
- Composite Shapes: TGeoCompositeShape class

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:

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 `DZ`

half-lengths a point will be considered inside if:

`-DX <= point[0] <= DX`

`-DY <= point[1] <= DY`

`-DZ <= point[2] <= DZ`

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:

`iact = 0`

computes 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`

computes both safe distance and distance to exiting, ignoring the proposed step;`iact > 2`

computes only the distance to exiting, ignoring anything else

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

state (does not cross shape boundaries). The state of the point has to be properly supplied.

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.

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:

//... (See all specific shape constructors)

void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)

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:

halfY,halfZ);

rmax,halfZ);

// ...(See MakeXXX() utilities in TGeoManager class)

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.

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.

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.

TGeoVolume * Volume(const char *name, const char *shape, Int_t nmed, Float_t *upar, Int_t npar=0)

Create a volume in GEANT3 style.

`name:`

the name of the newly created volume;`shape:`

the type of the associated shape. This has to contain the case-insensitive first 4 letters of the corresponding class name (e.g. "`tubs`" will match **`TGeoTubeSeg`

**, "`bbox`" will match **`TGeoBBox`

**)`nmed:`

the medium number.

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 `dz`

of 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 | 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 | 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 | TGeoVolume |

TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes. More... | |