Next: Fields, Previous: Architecture, Up: Top
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"
gmad
formatgmad
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, material=MaterialName, temperature=T }
Tubs { x0=x_origin, y0=y_origin, z0=z_origin, x=xsize, y=ysize, z=zsize, material=MaterialName, temperature=T }
For example
Cons { x0=0, y0=0, z0=0, rmin1=5 rmax1=500 rmin2=5 rmax2=500 z=250 material="Graphite", phi0=0, dphi=360, temperature=1 }
A file can contain several objects which will be placed consequently into the volume, A user has to make sure that there is no overlap between them.
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:
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.
The following is a list of table parameters that are common to all solid types either as an optional or mandatory parameter:
NAME
Variable type: VARCHAR(32)
This is an optional parameter. If supplied, then the Geant4 LogicalVolume associated with the solid will be labelled with this name. The default is set to be the table's name plus an automatically assigned volume number.
MATERIAL
Variable type: VARCHAR(32)
This is an optional parameter. If supplied, then the volume will be created with this material type - note that the material must be given as a character string inside double quotation marks(“). The default material is set as Vacuum.
PARENTNAME
Variable type: VARCHAR(32)
This is an optional parameter. If supplied, then the volume will be placed as a daughter volume to the object with ID
equal to PARENTNAME
. The default parent is set to be the Component Volume. Note that if PARENTID
is set to the Component Volume then POSZ
will be defined with respect to the start of the object. Else POSZ
will be defined with respect to the center of the parent object.
ALIGNIN
Variable type: INTEGER(11)
This is an optional parameter. If set to 1 then the placement of components will be rotated and translated such that the incoming beamline will pass through the z-axis of this object. The default is set to 0.
ALIGNOUT
Variable type: INTEGER(11)
This is an optional parameter. If set to 1 then the placement of the next beamline component will be rotated and translated such that the outgoing beamline will pass through the z-axis of this object. The default is set to 0.
SETSENSITIVE
Variable type: INTEGER(11)
This is an optional parameter. If set to 1 then the object will be set up to register energy depositions made within it and to also record the z-position at which this deposition occurs. This information will be saved in the ELoss Histogram if using ROOT output. The default is set to 0.
MAGTYPE
Variable type: VARCHAR(32)
This is an optional parameter. If supplied, then the object will be set up to produce the appropriate magnetic field using the supplied K1
or K2
table parameter values . Two magnet types are available - “QUAD” and “SEXT”. The default is set to no magnet type. Note that if MAGTYPE
is set to a value whilst K1
or K2
are not set, then no magnetic field will be implemented.
K1
Variable type: DOUBLE(10,3)
This is an optional parameter. If set to a value other than zero, in conjuction with MAGTYPE
set to “QUAD” then a quadrupole field with this K1
value will be set up within the object. Default it set to zero.
K2
Variable type: DOUBLE(10,3)
This is an optional parameter. If set to a value other than zero, in conjuction with MAGTYPE
set to “SEXT” then a sextupole field with this K2
value will be set up within the object. Default it set to zero.
POSX
Variable type: DOUBLE(10,3)
This is a required parameter. This is the X-position in mm used to place the object in the component volume. It is defined with respect to the center of the component volume and with respect to the component volume's rotation.
POSY
Variable type: DOUBLE(10,3)
This is a required parameter. This is the Y-position in mm used to place the object in the component volume. It is defined with respect to the center of the component volume and with respect to the component volume's rotation.
POSZ
Variable type: DOUBLE(10,3)
This is a required parameter. This is the Z-position in mm used to place the object in the component volume. It is defined with respect to the start of the component volume and with respect to the component volume's rotation.
ROTPSI
Variable type: DOUBLE(10,3)
This is an optional parameter. This is the psi Euler angle in radians used to rotate the obejct before it is placed. The default is set to zero.
ROTTHETA
Variable type: DOUBLE(10,3)
This is an optional parameter. This is the theta Euler angle in radians used to rotate the obejct before it is placed. The default is set to zero.
ROTPHI
Variable type: DOUBLE(10,3)
This is an optional parameter. This is the phi Euler angle in radians used to rotate the obejct before it is placed. The default is set to zero.
RED
Variable type: DOUBLE(10,3)
This is an optional parameter. This is the red component of the RGB colour assigned to the object and should be a value between 0 and 1. The default is set to zero.
BLUE
Variable type: DOUBLE(10,3)
This is an optional parameter. This is the blue component of the RGB colour assigned to the object and should be a value between 0 and 1. The default is set to zero.
GREEN
Variable type: DOUBLE(10,3)
This is an optional parameter. This is the green component of the RGB colour assigned to the object and should be a value between 0 and 1. The default is set to zero.
VISATT
Variable type: VARCHAR(32)
This is an optional parameter. This is the visual state setting for the object. Setting this to “W” results in a wireframe displayment of the object. “S” produces a shaded solid and “I” leaves the object invisible. The default is set to be wireframe.
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:
LENGTHX
Variable type: DOUBLE(10,3)
This is a required parameter. This value will be used to specify the x-extent of the box's dimensions.
LENGTHY
Variable type: DOUBLE(10,3)
This is a required parameter. This value will be used to specify the y-extent of the box's dimensions.
LENGTHZ
Variable type: DOUBLE(10,3)
This is a required parameter. This value will be used to specify the z-extent of the box's dimensions.
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:
LENGTH
Variable type: DOUBLE(10,3)
This is a required parameter. This value will be used to specify the z-extent of the cone's dimensions.
RINNERSTART
Variable type: DOUBLE(10,3)
This is an optional parameter. If set then this value will be used to specify the inner radius of the start of the cone. The default value is zero.
RINNEREND
Variable type: DOUBLE(10,3)
This is an optional parameter. If set then this value will be used to specify the inner radius of the end of the cone. The default value is zero.
ROUTERSTART
Variable type: DOUBLE(10,3)
This is a required parameter. This value will be used to specify the outer radius of the start of the cone.
ROUTEREND
Variable type: DOUBLE(10,3)
This is a required parameter. This value will be used to specify the outer radius of the end of the cone.
STARTPHI
Variable type: DOUBLE(10,3)
This is an optional parameter. If set then this value will be used to specify the starting angle of the cone. The default value is zero.
DELTAPHI
Variable type: DOUBLE(10,3)
This is an optional parameter. If set then this value will be used to specify the delta angle of the cone. The default value is 2*PI.
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:
RINNER
Variable type: DOUBLE(10,3)
This is an optional parameter. If set then this value will be used to specify the inner radius of the torus tube. The default value is zero.
ROUTER
Variable type: DOUBLE(10,3)
This is a required parameter. This value will be used to specify the outer radius of the torus tube.
RSWEPT
Variable type: DOUBLE(10,3)
This is a required parameter. This value will be used to specify the swept radius of the torus. It is defined as being the distance from the center of the torus ring to the center of the torus tube. For this reason this value should not be set to less than ROUTER
.
STARTPHI
Variable type: DOUBLE(10,3)
This is an optional parameter. If set then this value will be used to specify the starting angle of the torus. The default value is zero.
DELTAPHI
Variable type: DOUBLE(10,3)
This is an optional parameter. If set then this value will be used to specify the delta swept angle of the torus. The default value is 2*PI.
Append _POLYCONE
to the table name in order to make use of the G4Cons solid type. The following table parameters are specific to the polycone solid:
NZPLANES
Variable type: INTEGER(11)
This is a required parameter. This value will be used to specify the number of z-planes to be used in the polycone. This value must be set to greater than 1.
PLANEPOS1, PLANEPOS2, ..., PLANEPOSN
Variable type: DOUBLE(10,3)
These are required parameters. These values will be used to specify the z-position of the corresponding z-plane of the polycone. There should be as many PLANEPOS
parameters set as the number of z-planes. For example, 3 z-planes will require that PLANEPOS1
, PLANEPOS2
, and PLANEPOS3
are all set up.
RINNER1, RINNER2, ..., RINNERN
Variable type: DOUBLE(10,3)
These are required parameters. These values will be used to specify the inner radius of the corresponding z-plane of the polycone. There should be as many RINNER
parameters set as the number of z-planes. For example, 3 z-planes will require that RINNER1
, RINNER2
, and RINNER3
are all set up.
ROUTER1, ROUTER2, ..., ROUTERN
Variable type: DOUBLE(10,3)
These are required parameters. These values will be used to specify the outer radius of the corresponding z-plane of the polycone. There should be as many ROUTER
parameters set as the number of z-planes. For example, 3 z-planes will require that ROUTER1
, ROUTER2
, and ROUTER3
are all set up.
STARTPHI
Variable type: DOUBLE(10,3)
This is an optional parameter. If set then this value will be used to specify the starting angle of the polycone. The default value is zero.
DELTAPHI
Variable type: DOUBLE(10,3)
This is an optional parameter. If set then this value will be used to specify the delta angle of the polycone. The default value is 2*PI.
A geometry list is a simple file consisting of a list of filenames 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
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
gdml
GDML is a XML schema for dtector description. GDML will be supported as an external format starting from next release.