A system geometry is a collection of volume definitions. The volumes can be native geant4 objects or be imported from CAD / GDML.

Before continuing, make sure you have read the systems documentation and are working within a system directory.

Quickstart: build native Geant4 Volumes

To build native geant4 volumes a set of functions and templates to build the geant4 volumes1 can be used.

To following will display the code, shown below, to build a volume, for example a G4Box of 30x40x50 cm:

scigTemplate.py -gv G4Box  -gvp '30 40 50 cm'

you can paste it in the geometry.py file and modify it as needed with your desired parameters.

Use the -silent option to omit the printout of the lines commented out with #.

Let’s go over each line. The lines commented out with # set the default values as shown below.

  1. volume constructor. The argument is the name of the volume
  2. solid type builder . The arguments are its dimensions
  3. volume’s material name
  4. the name of the volume that contains this volume
  5. volume’s description
  6. volume’s position. The default unit is mm but an optional 4th argument with the unit can be added
  7. volume’s rotation. The default unit is deg but an optional 4th argument with the unit can be added
  8. volume’s magnetic field
  9. volume’s color. This is a 6 digits hexadecimal number. For example, ff0000 is red, 0x00ff00 is green and 0x0000ff is blue. 0xffffff is white and 0x000000 is black. An optional int (0-5) 7th argument can be added to set the transparency, where 0 is opaque and 5 is transparent
  10. volume’s style
  11. volume’s visibility
  12. volume’s sensitivity: this is the name of the digitization plugin associated with the volume
  13. volume’s identifier: unique set of pairs (string, id) that identifies the volume

The types builders can be listed with scigTemplate.py -sl and can found here.


In the following recording, a system ‘forward’ is created and a G4Box is added to the build_target routine in geometry.py using the template script:

For more information on how to build native Geant4 volumes, see the native geometry documentation.




How to build import CAD volumes





  1. a geant4 volume is usually 3 objects: a. a solid, that defines the dimensions. b. a logical volume, that includes materials and fields. c. a physical volume, that places the volume within its mother volume.