Next: , Previous: Output, Up: Top


Appendix A Geometry description formats

The element with user-defined physical geometry is defined by

<element_name> : element, geometry=format:filename, attributes

for example,

colli : element, geometry="gmad:colli.geo"

A.1 gmad format

gmad is a simple format used as G4geometry wrapper. It can be used for specifying more or less simple geometries like collimators. Available shapes are:

     Box {
     x0=x_origin,
     y0=y_origin,
     z0=z_origin,
     x=xsize,
     y=ysize,
     z=zsize,
     phi=Euler angle for rotation,
     theta=Euler angle for rotation,
     psi=Euler angle for rotation,
     material=MaterialName
     }

     Tubs {
     x0=x_origin,
     y0=y_origin,
     z0=z_origin,
     rmin=inner radius,
     rmax=outer radius,
     z=zsize,
     phi=Euler angle for rotation,
     theta=Euler angle for rotation,
     psi=Euler angle for rotation,
     material=MaterialName
     }


     Cons {
     x0=x_origin,
     y0=y_origin,
     z0=z_origin,
     rmin1=inner radius at start,
     rmax1=outer radius at start,
     rmin2=inner radius at end,
     rmax2=outer radius at end,
     z=zsize,
     material=MaterialName,
     phi=Euler angle for rotation,
     theta=Euler angle for rotation,
     psi=Euler angle for rotation,
     phi0=angle for start of sector,
     dphi=angle swept by sector
     }
     

     Trd {
     x0=x_origin,
     y0=y_origin,
     z0=z_origin,
     x1=half length at wider side,
     x2=half length at narrower side,
     y1=half length at wider side,
     y2=half length at narrower side,
     z=zsize,
     phi=Euler angle for rotation,
     theta=Euler angle for rotation,
     psi=Euler angle for rotation,
     material=MaterialName
     }


A file can contain several objects which will be placed sequentially into the volume, A user has to make sure that there is no overlap between them.

A.2 mokka

As well as using the GMAD format to describe user-defined physical geometry it is also possible to use a Mokka style format. This format is currently in the form of a dumped MySQL database format - although future versions of BDSIM will also support online querying of MySQL databases. Note that throughout any of the Mokka files, a # may be used to represent a commented line. There are three key stages, which are detailed in the following sections, that are required to setting up the Mokka geometry:

A.2.1 Describing the geometry

An object must be described by creating a MySQL file containing commands that would typically be used for uploading/creating a database and a corresponding new table into a MySQL database. BDSIM supports only a few such commands - specifically the CREATE TABLE and INSERT INTO commands. When writing a table to describe a solid there are some parameters that are common to all solid types (such as NAME and MATERIAL) and some that are more specific (such as those relating to radii for cone objects). A full list of the standard and specific table parameters, as well as some basic examples, are given below with each solid type. All files containing geometry descriptions must have the following database creation commands at the top of the file:

DROP DATABASE IF EXISTS DATABASE_NAME;

CREATE DATABASE DATABASE_NAME;

USE DATABASE_NAME;

A table must be created to allow for the insertion of the geometry descriptions. A table is created using the following, MySQL compliant, commands:

CREATE TABLE TABLE-NAME_GEOMETRY-TYPE (


TABLE-PARAMETER VARIABLE-TYPE,


TABLE-PARAMETER VARIABLE-TYPE,


TABLE-PARAMETER VARIABLE-TYPE


);

Once a table has been created values must be entered into it in order to define the solids and position them. The insertion command must appear after the table creation and must the MySQL compliant table insertion command:

INSERT INTO TABLE-NAME_GEOMETRY-TYPE VALUES(value1, value2, "char-value", ...);

The values must be inserted in the same order as their corresponding parameter types are described in the table creation. Note that ALL length types must be specified in mm and that ALL angles must be in radians.

An example of two simple boxes with no visual attributes set is shown below. The first box is a simple vacuum cube whilst the second is an iron box with length_x = 10mm, length_y = 150mm, length_z = 50mm, positioned at x=1m, y=0, z=0.5m and with zero rotation.

CREATE TABLE mytable_BOX (


NAME VARCHAR(32),


MATERIAL VARCHAR(32),


LENGTHX DOUBLE(10,3),


LENGTHY DOUBLE(10,3),


LENGTHZ DOUBLE(10,3),


POSX DOUBLE(10,3),


POSY DOUBLE(10,3),


POSZ DOUBLE(10,3),


ROTPSI DOUBLE(10,3),


ROTTHETA DOUBLE(10,3),


ROTPHI DOUBLE(10,3)


);

INSERT INTO mytable_BOX VALUES("a_box","vacuum", 50.0, 50.0, 50.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

INSERT INTO mytable_BOX VALUES("another_box","iron", 10.0, 150.0, 50.0, 1000.0, 0.0, 500.0, 0.0, 0.0, 0.0);

Further examples of the Mokka geometry implementation can be found in the examples/Mokka/General directory. See the common table parameters and solid type sections below for more information on the table parameters available for use.

A.2.1.1 Common Table Parameters

The following is a list of table parameters that are common to all solid types either as an optional or mandatory parameter:

A.2.1.2 'Box' Solid Types

Append _BOX to the table name in order to make use of the G4Box solid type. The following table parameters are specific to the box solid:

A.2.1.3 'Trapezoid' Solid Types

Append _TRAP to the table name in order to make use of the G4Trd solid type - which is defined as a trapezoid with the X and Y dimensions varying along z functions. The following table parameters are specific to the trapezoid solid:

A.2.1.4 'Cone' Solid Types

Append _CONE to the table name in order to make use of the G4Cons solid type. The following table parameters are specific to the cone solid:

A.2.1.5 'Torus' Solid Types

Append _TORUS to the table name in order to make use of the G4Torus solid type. The following table parameters are specific to the torus solid:

A.2.1.6 'Polycone' Solid Types

Append _POLYCONE to the table name in order to make use of the G4Polycone solid type. The following table parameters are specific to the polycone solid:

A.2.1.7 'Elliptical Cone' Solid Types

Append _ELLIPTICALCONE to the table name in order to make use of the G4Ellipticalcone solid type. The following table parameters are specific to the elliptical cone solid:

Note that the above parameters are used to define an elliptical cone with the following parametric equations (in the usual Geant4 way):

x = XSEMIAXIS * (LENGTHZ - u) / u * Cos(v)

Y = YSEMIAXIS * (LENGTHZ - u) / u * Sin(v)

z = u

where v is between 0 and 2*PI and u between 0 and h respectively.

A.2.2 Creating a geometry list

A geometry list is a simple file consisting of a list of file names that contain geometry descriptions. This is the file that should be passed to the GMAD file when defining the Mokka element. An example of a geometry list containing 'boxes.sql' and 'cones.sql' would be:

# '#' symbols can be used for commenting out an entire line

/directory/boxes.sql

/directory/cones.sql

A.2.3 Defining a Mokka element in the GMAD file

The Mokka element can be defined by the following command:

<element_name> : element, geometry=format:filename, attributes

where format must be set to mokka and filename must point to a file that contains a list of files that have the geometry descriptions.

for example,

collimator : element, geometry=mokka:coll_geomlist.sql

A.3 gdml

GDML is a XML schema for detector description. GDML will be supported as an external format starting from next release.