1.  Links

2.  Documentation

3.  Geant4 Course

4.  Examples

5.  Hints and changes

  • RNG Seeding : G4.8.2 uses the new CLHEP 2, which requires the CLHEP:: namespace - just specify it or add some "using" statements
    • To re-seed the Random Number Generator for many repeats of a MC from GEANT4 on differnt cores. In the main program of the GEANT4 application -
     choose the Random engine
    CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
    if (argc>=3) {
in this way you can run, for example
  • ./<geant4app> <macro>.mac 1
  • ./<geant4app> <macro>.mac 2
  • cmake : Discussion about using cmake or make to compile projects.
  • GEANT on the Cluster :
    • See the following page for a tutorial on using Swift:
    • Swift tutorial.
    • Note that this uses the modifications as for the rdecay02 example for the passing arguments on the command line and using the messenger class technology, so that you can do parameter scans etc. (See the redcay02 example discussion above).

6.  Installing GEANT4

  • Download the sources and the data libraries here
  • The Installation guides are here, use of the default names for the source, install and build directories, and also the path to the data files, is recommended.
  • Building Geant4 on Windows
  • Building Geant4 on Linux
    • See instructions at the GEANT4 and then do ...
    •  cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4.10.00.p01-install/  \\
                -DCMAKE_BUILD_TYPE=RelWithDebInfo \\
                -DGEANT4_INSTALL_DATA=ON \\
                -DGEANT4_USE_QT=ON \\
                -DQT_QMAKE_EXECUTABLE=/usr/lib64/qt4/bin/qmake    <--- if its not in the default place
                -DGEANT4_USE_XM=ON \\                   <--- if you have it
                -DGEANT4_USE_OPENGL_X11=ON \\
                -DGEANT4_USE_RAYTRACER_X11=ON \\                   <--- if you have it
                -DMOTIF_INCLUDE_DIR=/usr/include/Xm/ \\                    <--- if you have it
                -DMOTIF_LIBRARIES=/usr/lib64/  \\                   <--- if you have it
    • make -jN (N = number of cores)
    • make install
  • Building Geant4 on a Mac (a la Martin) ....
    • tested on 4.9.3 and 4.9.5
      • To have the visualisation tools, automatically download and install the data libraries (make sure you have x11, Qt, openmotif, expat) .... do the following (from your build directory) ....:
      •  cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4.9.5-install/\\
                  -DCMAKE_BUILD_TYPE=RelWithDebInfo \\
                  -DGEANT4_INSTALL_DATA=ON \\
                  -DGEANT4_USE_QT=ON \\
                  -DGEANT4_USE_XM=ON \\                   <--- if you have it
                  -DGEANT4_USE_OPENGL_X11=ON \\
                  -DGEANT4_USE_RAYTRACER_X11=ON \\                   <--- if you have it
                  -DMOTIF_INCLUDE_DIR=/usr/OpenMotif/include \\                    <--- if you have it
                  -DMOTIF_LIBRARIES=/usr/OpenMotif/lib/libXm.3.1.dylib \\                   <--- if you have it
                   /path to your source of geant4.9.5.p01/ 
      • make -j4 to compile with support for 4 cores. Then
      • make install
    • Update for OSX 10.9.2 (Mavericks) and Geant4.10.00.p01 :
      • Install Xcode (latest), the command line tools and XQuartz
      • Install Macports and use that to instal openmotif (sudo port install openmotif).
      • Install Qt version 4.8.5.
      • For Geant4.10.00.p01 ... the data directory is by default /(path-to-geant)/geant4.10.0-install/share/Geant4-10.0.1/data, so if you do a manual install of the data, place them in this folder.
      • Don't forget to source the script in your bashrc file from geant4.10.0-install/bin folder.
      • The rest of the current instructions for the Installation of Geant and also the template application code (rdecay02) is pretty similar. The CmakeLists file is now already set for using ROOT ... so just add export $G4ANALYSIS_USE_ROOT 1 in your bashrc file as well.
    • Update for OS X 10.10.5 (Yosemite) and Geant4.10.01.p02 :
      • Followed instructions at
      • First installed Qt uninstalled previous version using script in /Developer/Tools
        • brew install qt (qt4 sounds like it is more widely used than qt5)
        • brew install homebrew/x11/openmotif ( installed stable 2.3.4 )
      • Made sure my xquartz was up to date (just ran Xquartz, it automatically gave a notice about an update).
      • Go into a separate build directory, out of source tree
        • cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4.10.01-install/ \\
                      -DCMAKE_BUILD_TYPE=RelWithDebInfo \\
                      -DGEANT4_INSTALL_DATA=ON \\
                      -DGEANT4_USE_OPENGL_X11=ON \\
                      -DGEANT4_USE_RAYTRACER_X11=ON \\
        • make -j4 ... your number of cores
        • make install
    • Note on the datasets. You can download them manually and place them in /path/to/geant4.10.01.p02-install/share/Geant4-10.1.2/data as that is where they are preconfigured to be. Then don't use the switch -DGEANT4_INSTALL_DATA=ON ... this is easier for slow networks.
    • Don't forget to source the environment configuration script ... its [@/path/to/geant4.10.01.p02-install/bin/]

7.  Physics Lists for after 4.9.5

  • We start from "Shielding" for MinPET Physics lists from the Use Cases.