Introduction to the Geometry package

+-------------+                                               +----------##
| Geant 3.15  |               GEANT User's Guide              | GEOM001  ##
+-------------+                                               +----------##
                                   

Author(s) : F.Bruyant Submitted: 01.10.84 Origin : R. Brun, F.Bruyant, A.McPherson Revised: 13.05.92

The geometry package

The geometry package has two main functions:

  1. define, during the initialisation of the program, the geometry in which the particles will be tracked,
  2. communicate, during the event processing phase, to the tracking routines the information for the transport of the particles in the geometry which has been defined.

    The present section reviews the concepts of the geometry package and explains how the geometrical information should be provided by the user. It is important to point out that, once the geometry has been defined, the tracking of particles through the different volumes proceeds without any intervention from the user [TRAK].

    The connection between the geometry and tracking packages is established by the subroutines GMEDIA/GTMEDI, GNEXT and GINVOL which answer respectively the questions:

    1. In which medium is a given point ?
    2. What is the path length to the next medium ?
    3. Is a given point still in the current medium ?

    The routines GTMEDI, GTNEXT are used in a dynamic context, at tracking time, when the a priori knowledge of the track direction can be used to save time.

    The volume definition

    Experimental setups, as complex as the LEPThe Large Electron Positron collider in operation at CERN. detectors, can be described rather accurately through the definition of a set of basic VOLUMES. Each VOLUME is given a NAME and is characterized by:

    1. a SHAPE identifier, specifying one of the basic geometrical shapes available [GEOM010],
    2. the SHAPE parameters, giving the dimensions of the volume,
    3. a local reference system, with origin and axes defined for the each shape,
    4. the physical properties, given by a set of constants describing the homogeneous MATERIAL which fills the volume [CONS],
    5. additional properties, known as `TRACKING MEDIUM' parameters, which depend on the characteristics of the volume itself (the MATERIAL identifier is one of the constants) and on its geometrical and physical environment (properties of the neighbour media, magnetic field, etc.) [CONS, TRAK],
    6. a set of attributes, in connection with the drawing package and the detector response package [DRAW, HITS].

    As long as it is not `positioned' in a given reference frame, a VOLUME is an entity which has no spatial relation with the other volumes. By convention, a unique initial volume has to be defined which should contain all the other volumes. The reference frame intrinsic to this volume is considered to be the master reference frame.

    Volumes with contents

    A VOLUME can be declared to have contents and become a mother volume. The contents are either predefined volumes which are explicitly positioned inside the mother, or new volumes which are implicitly defined by a division mechanism applied to the mother. Positioning a volume with given shape and dimensions inside a mother volume is obtained by specifying its translation and rotation with respect to the mother reference frame. The user should make sure that no volume extends beyond the boundaries of its mother. When a volume is positioned, the user gives it a NUMBER. Multiple copies of the same volume can be positioned inside the same or different mothers with different copy numbers, and the contents of the positioned volume are reproduced implicitly in all copies. Divisions are performed along the three axes of the mother volume. The definition of the axes (X, Y, Z or R ,phi, Z or R, theta, phi) depends on the shape. For certain xy shapes it is not possible to divide along one of the axis. The mother volume can be partially or totally divided. The division process generates a number of `cells', which are considered as new volumes often with the same shape of the mother. The cell dimensions are computed according to the number of divisions or the step size. A cell, as any other volume, can again be divided along its axes, or have other volumes positioned into it. Volumes positioned within a cell are reproduced implicitly in all cells. These operations permit to define a physical tree with several levels. The material and properties of the contents replace the ones of the mother within the space region they occupy. A VOLUME is therefore defined not only by its intrinsic characteristics but also by those of its descendants, namely its contents, the contents of its contents, etc.

    Overlapping volumes

    The user may define volumes which have no relation with the real objects. It is sometimes convenient to make use of such volumes, to artificially delimit regions with simple shapes. As a consequence, it may happen that volumes partially overlap each other. (A volume positioned inside a mother is obviously not regarded as overlapping the mother). It is possible in GEANT to handle partially overlapping volumes, but there are some implications that the user should be aware of. A flag `ONLY/MANY' is assigned to each copy of a given volume at the moment this is positioned. The `MANY' option indicates that a point found to be in this volume could also be in other volumes which are not direct descendants of it. If one of the overlapping volumes is declared as `ONLY' the geometry subroutines will give priority to this volume, and if a point is found in this volume the search stops. If a point is inside several `MANY' volumes and outside all `ONLY' ones, priority will be given to the volume found at the deepest level, or to the first found, if there are many valid `MANY' candidates at the same level. In order to avoid ambiguities, two overlapping `MANY' volumes should in general have the same default tracking medium.

    The physical tree

    An example of a 4 level physical tree with embedded volumes and the corresponding geometrical configuration are shown below:

    
               

    Figure: MonteCarlo in High Energy Physics

    [TAB1]

    where A and B are BOXes, C a TRAPezoid, and D and E TUBEs. Notice that the same physical configuration could be described as well though a 3 level tree if D were defined as a hollow TUBE, with inner radius non zero and E directly positioned into B. The package accepts a maximum of 15 levels, which should be enough to represent even the fine details of a complex setup.

    The data structure, JVOLUM and JGPAR and the common block /GCVOLU/

    In practice, the physical tree is not represented as such in the data part of the program. Instead, a logical tree structure is defined, the JVOLUM data structure, which describes the arrangement of volumes in a compact and recurrent way. Each generic volume appears once, and once only, and carries the information relevant to the volume itself and to its contents, if any, by reference to the generic volumes corresponding to those contents. In the situation where division or multiple copies occur, there is no longer a one-to-one correspondence between a given volume in the logical tree and a unique region in space. Information has to be kept at tracking time to identify which division cell or which copy was considered at each depth level along the path through the physical tree. This information is stored by the subroutine GMEDIA/GTMEDI, for the current point of the current track, in the common /GCVOLU/. It contains the current level number NLEVEL and, for each level, starting from the first initial reference volume, the identification of the corresponding volume, e.g.: NAME, NUMBER, `ONLY/MANY' flag, translation and rotation with respect to the master reference frame. The number of SHAPE parameters and pointers to the vector describing the actual values of those parameters, for all levels, are stored in the data part and in the link part, of the mother bank IGPAR, respectively.

    The basic user tools

    The rules of the game being established, it is easy to introduce the set of subroutines which ensure the functionality of the package.

    The user can define a volume through a call to the subroutine:

    GSVOLU
    Input arguments specify the NAME, SHAPE and parameters of the volume. An output argument returns the position of the volume inside the bank JVOLUM.

    The user can position a volume through a call to either one of the following subroutines:

    GSPOS
    Input arguments specify the NAME and copy NUMBER of the volume to be positioned, the NAME of the mother, the translation and the rotation matrix, and the `ONLY/MANY' flag.
    GSPOSP
    In case the user has to position, inside a mother, a large number of volumes with the same shape but different dimensions (lead glass blocks, BGO crystals, etc.) an alternative is proposed which consists of defining the generic volume once, with the number of shape parameters set to zero, and to call GSPOSP for each volume in turn, with the same arguments as GSPOS plus the shape parameters. The volumes will be identified by their NAME+NUMBER as for the multiple copies.

    The user can divide a volume through a call to either one of the following subroutines:

    GSDVN
    Input arguments specify the NAME of the cell volume, the name of the MOTHER being divided, the number of divisions NDIV and the axis along which the division is performed. In this simple case, the cell tracking medium is assumed to be the same as for the mother. See also GSDVN2.
    GSDVT
    The division STEP is given instead of NDIV, the cell tracking medium is specified and the expected (maximum) number of divisions is given. See also GSDVT2.
    GSDVX
    In addition to both STEP and NDIV (with at least one of them positive to be effectively useful), the origin of the first cell, the cell tracking medium and eventually the computed (maximum) number of divisions are specified.

    The optimisation tools

    When a track enters a volume with contents, the search time to identify whether the current point is in the mother or in any of the contents is very short when the contents are division cells (straightforward computation along the relevant axis). When the contents have been positioned, the search time can be quite large. In order to save time the user can make use of either of the two following facilities:

    1. GGORD From the known position of the contents inside a given volume for which an ordering request has been through a call to GSORD, the subroutine GSORD computes fictitious boundaries along the specified coordinate, simulating a division with non regular step size. A binary search technique is used to identify within which pseudo cell the current point is. The slow process of computing whether the point is inside or outside the contents is therefore limited to the few (if any) volumes sitting in that pseudo/cell, as sketched below:
      Pseudo cell       1    2   3     4          5      6             7
      
      The coordinate selected for the pseudo division can be any of X, Y, Z, R y, R, phi or theta;. For a given volume the call to x GSORD has to come after all its first level contents have been positioned.
    2. GSNEXT/GSNEAR when a particleenters a mother volume, the contents are scanned initially in the order they have been positioned, and the user should take care over the best sequence of GSPOS calls. However, when the particle comes back inside the mother from any one of the contents, it is usually possible to limit the search to the neighbour contents. The subroutines GSNEXT/GSNEAR permit the user to inject at initialisation time, for each content in turn, the list of neighbours to search for. GSNEAR is recommended, GSNEXT is kept for backward, compatibility and has a different default option. A proper use of this facility can reduce the search time significantly. GOSEAR To specify, and control a user ordering for the contents of a given volume.

      Geometrical information retrieval

      For any volume specified by the description of the path one has to follow through the physical volume tree in order to reach it (namely by the lists of NAMES and NUMBERs at all levels from the top, down to the given volume), the common/GCVOLU/ (and the structure JGPAR can be properly filled) by the user, through a call to the subroutine GLVOLU.