University of Saskatchewan  Physics and Engineering Physics

Experimental Subatomic Physics 

GEANT Exercise Download and Installation Notes

These exercises were created for a Linux environment. Thus, many of the following instructions assume you are using Linux.
Download and Installation notes for the Exercise code.
Environment Variables
Motif Support
Startup Trouble
Files for this Exercise
File Manifest
How These Files Fit into the GEANT Scheme


A gzip'd 'tar' archive file of the starting GEANT code for these exercises can be downloaded by anonymous FTP from



To extract the files, you should create a simulation directory, move or copy the archive file there, change your working directory, and untar the file:
> mkdir exer1
> mv simple4.tgz exer1
> cd exer1
> tar -z -x -f simple4.tgz
If your version of tar does not have zlib compiled in but you do have gzip or zcat, the last command can be replaced by:
> zcat simple4.tgz | tar -x -f - 
> gzip -d -c simple4.tgz | tar -x -f -

Environment Variables

Two environment variables usually need to be set, and the PATH variable modified, before running GEANT. Check to see if they are already set, and what they are set to if they are set.

> echo $CERN
> echo $CERN_ROOT

The CERN variable should be set to the cern root directory, the directory containing the various versions of cernlib you use. It could be /opt/cern, /usr/local/cern, /usr/local/share/cern, etc. It should not point directly to the particular version of cernlib (usually named by the year or "pro"), so /opt/cern/2000 is not right. You will want to set this in your shell startup script. For example, if your cern root directory is /opt/cern, and you use 'csh' or 'tcsh', add this to your .cshrc or .tcshrc,

setenv CERN /opt/cern
Or if you use 'sh' or 'bash',

The CERN_ROOT (a misnomer, really) needs to be set to the particular version of cernlib you use. Some administrators create a "pro" symbolic link to the more current version so that users don't have to change their startup scripts for every upgrade. Otherwise, the directory is usually a year. For example, using the tcsh example, the variable could be set by

setenv CERN_ROOT $CERN/pro
setenv CERN_ROOT /usr/local/cern/98a

The PATH variable should have the cern bin directory added to it.

setenv PATH ${PATH}:/opt/cern/pro/bin

Motif Support

Finally, you need to decide if you want MOTIF GUI support for PAW++. You don't have to use the MOTIF GUI, but if you want the option you should set up GEANT with it. Be sure you have Motif installed on your machine (e.g. OSFMotif or LessTif). If you do, you need to change two files, the Makefile, and gxint.f.

In Makefile, make sure the line

is uncommented (i.e. no "#" in front of it).

In gxint.f, make sure the line with CALL GPAWPP is uncommented and CALL GPAW is commented. They should appear like,


If you don't want the Motif option, or don't have Motif support in your system, the relevant line in Makefile should look like

and in gxint like

Startup Trouble

Missing libraries

When you run GEANT, if you get messages indicating the library files can't be found, insert in the "LIBS=... cernlib ... " line "-v 2000" or whatever your cernlib installation version is, after "cernlib". So for "2000" it should read,

LIBS=$(shell cernlib -v 2000 geant321 pawlib $(Motiflib) packlib mathlib)

Missing xsneut95.dat

If at some point you get something that resembles:

 *        G C A L O R             *
 *        -----------             *
 *  File XSNEUT95.DAT not found   *
 *         Program STOP           *
 *   Check CERN_ROOT environment  *
 *           variable             *
then your system is probably missing the file "xsneut95.dat" or similar, or it has simply been misplaced, or the CERN_ROOT environment variable has not been set, as per Installation intructions. If "xsneut95.dat" (or perhaps an updated version) is missing, then you can get it from Put the file in $CERN_ROOT/lib and 'gunzip' it.

Files for this Exercise

File Manifest

The main files of interest are:

gxint.f - sets up the X11 interactive user interface.
uginit.f - calls initialization routines, most importantly UGEOM and UHINIT.
ugeom.f - called by uginit.f, this sets up the geometry of the experiment, the location of volumes, shapes of volumes, and materials in the volumes.
uhinit.f - called by uginit.f, this defines histograms.
gukine.f - called at the start of each event, this initializes the kinematics of each event.
gutrev.f - called to start particle tracking
guphad.f - called at each step whenever a hadron is involved, this determines the distance to the next interaction point
guhadr.f - called at each step whenever a hadron is involved, this determines the final state of the interaction
gustep.f - called at each step within an event, this would be where tallying would occur for later treatment, and would be for any manipulation of microscopic information in the event.
guout.f - called at the end of each event, this would be where histograms for totals (e.g. energy deposition) would incremented, and would be for any manipulation of macroscopic information about the event.
uglast.f - called at the end of the simulation (or at "exit" of interactive session), this would be where results would be outputted (to files, or to screen).
gcommon - directory containing GEANT common block definitions
Makefile - 'make' script to compile and run the simulation.
view.kumac - a PAW macro file, used to initialize a simulation and set up drawings for track display.
pawlogon.kumac, glogon.kumac - PAW macro files, used by PAW for user customization of a PAW/GEANT session.
INSTALL - installation instructions

Files specific to the exercises


How These Files Fit into the GEANT Scheme

According to the GEANT manual, this is a schematic of the subroutine hierarchy in GEANT, and how the FORTRAN files in these exercises fit in. The items in green are user supplied routines (with the corresponding file in white), with their contents immediately to their right. The items in red are existing GEANT subroutines. Some are called automatically by GEANT; the ones with green immediately to their left are called by the corresponding user subroutine. Note, this chart only applies for these exercises; some of the subroutines in red can actually be replaced by user subroutines, and some of the routines in green are not represented by the exercise files.

   user code

Main Page

Last updated: 19 October 2001