Using the SLAC Installation of the Geant4 Toolkit

Last modified :

Current Installation

The latest Geant4 libraries are centrally maintained and installed so that users may build and link their applications to them, rather than build and maintain their own libraries.
Geant4 9.4 is now installed on the 32-bit and 64-bit Linux machines: Access to older libraries, including Geant4 9.3 (patch02) is available upon request.
Various data files required for optional Geant4 processes and models are also centrally maintained and automatically accessed by the setup scripts.

Accessing the SLAC installation

To compile and link a simulation executable using the current Geant4 toolkit, several environment variables must first be set. This is done in a script which also chooses the combination of Geant4 and CLHEP libraries appropriate to the computing platform. The script can be found in


To begin: The essential variables set by this file are: g4setup.env must be sourced each time you log in and want to rebuild or run the executable. If you log in to a generic machine (e.g. noric) as opposed to a specific one (e.g. noric10), the machine, and hence the libraries may be different. In this case, clean and rebuild your application.

Alternate method: if you know the specific platform you are using (rhel4-32, for example):


Interfaces for several visualization drivers have been compiled into the toolkit libraries. Currently the setup scripts choose OPENGL, but the user may choose another driver by setting the appropriate environment variable before building the executable.

Building and Running the Executable

The following steps will lead you to a working executable with visualization using OPENGL:
  1. go to your work directory (in the above example, geant4)
  2. from the Geant4 installation copy the code for example 3:
  3. cd to N03
  4. gmake
  5. while in directory N03, run the executable:
  6. if everything goes according to plan, you should see the Idle> prompt on your screen (after some preliminary output). From this prompt type to see an event displayed. Repeat until you get tired or bored.
  7. when finished type at the Idle> prompt.
At this point you are ready to add to and modify the code in your copy of N03. For more information about developing your own simulation code using Geant4, see the Application Developer's Guide .
Dennis Wright