Installing Geant4 VMC - Older Versions

The following instructions apply to the installation of versions < 3.0. For the required configurations of Root and Geant4 for these older versions see Special installations page.

  1. Getting source

    First get the Geant4 VMC source from the Download page.

  2. Root configuration

    Since the version 2.9 there are no special configuration options for Root needed.

    The path to Root installation can be defined in two complementary ways:
    a) With the environment variable ROOTSYS: ROOTSYS ... path to Root b) With the Root configuration script root-config ... Root configuration script Note that if the ROOTSYS environment variable is defined the root-config script is not used.

    For the older geant4_vmc versions (2.x - 2.8) see below.

  3. Geant4 configuration (with CMake)

    To install Geant4 - download the source from Geant4 Download page and follow the Geant4 Installation Guide together with the tips relevant to using it with VMC described below.

    Geant4 installation options:

    • G3toG4 tool
      The G3toG4 package is used in geant4_vmc to support geometry definition via VMC with Geant4 native navigation (geomVMCtoGeant4 option). It is required by default. As the G3toG4 package is optional its build has to be activated when building Geant4 by the following CMake options: -DGEANT4_USE_G3TOG4=ON

      Since the version 2.14, the user applications which build geometry via Root (or Geant4), can be built with Geant4 installed without G3toG4 package. The G3toG4 dependent code in geant4_vmc has to be then inactivated by setting the following environment variable: NO_G3TOG4 ... set to 1 to disable the code dependent on G3toG4 If this variable is set the geomVMCtoGeant4 option is unavailable.


    • OpenGL visualization
      It is recommended to build Geant4 X11 OpenGL visualization driver used in the VMC examples. It is handled in Geant4 CMake build via the following CMake option: -DGEANT4_USE_OPENGL_X11=ON

    • Multi-threading
      Geant4 VMC can be built against Geant4 installation in multi-threading mode (with -DG4MULTITHREADED cmake option). Dynamic loading of Geant4 libraries, as used in VMC, requires to change the Geant4 default option (defined in geant4/cmake/Modules/Geant4MakeRules_cxx.cmake) -ftls-model=initial-exec with -ftls-model=global-dynamic

      Geant4 VMC 2.15x version is not migrated to Geant4 multi-threading and it can be built against both Geant4 sequential and Geant4 multi-threading installations. The Geant4 MT installation requires -ftls-model=global-dynamic model. The VMC application will run in a sequential mode in both cases.

      Geant4 VMC 3.00.x version is migrated to Geant4 multi-threading and can be built against both Geant4 sequential and Geant4 multi-threading installations. The -ftls-model=global-dynamic model is required for running VMC applications from Root session (in a "traditional" way with dynamic loading of libraries). Since 3.00.x version, CMake configuration files are provided to build VMC application main program linked with all libraries, Geant4 built with -ftls-model=initial-exec model (default) can be then used.

      Only VMC applications which are migrated to multi-threading mode can be built and run against Geant4 multi-threading installation. Non migrated application have to be built against Geant4 sequential installation.

    The path to the Geant4 installation is defined with the Geant4 configuration script: geant4-config ... Geant4 configuration script To make Geant4 binaries (geant4-config) and libraries available on your PATH and library path (LD_LIBRARY_PATH on Linux, DYLD_LIBRARY_PATH on Mac OS X), you should source the relevant script from your Geant4 installation (CMAKE_INSTALL_PREFIX): $ . bin/geant4.sh ... on bourne shells (eg. bash) or $ source bin/geant4.csh ... on C shells

    Note that the G4INSTALL environment variable should NOT be set in this case as it would trigger building geant4_vmc against the Geant4 configuration via GNUmake build.

  4. VGM (optional)

    Since the version 2.0, you can choose to run Geant4 with the Geant4 native geometry navigation or the G4Root navigation.

    To run with the Geant4 native geometry navigation in case your geometry is defined via the Root geometry package, you will have to install the Virtual Geometry Model (VGM) package. See the VGM Web site how to do it.

    VGM is used in Geant4 VMC for a geometry in memory conversion from Root TGeo objects to the Geant4 native geometry. More details about this can be found at the page on geometry definition and navigation.

    The following environment variables that defines the paths to used systems have to be set: VGM_INSTALL ... path to VGM USE_VGM ... set to 1 to build VGM dependent code

  5. Geant4 VMC

    For the versions (2.9 - 2.15x), to install geant4_vmc: cd geant4_vmc make This will build g4root, geant4_vmc and VMC examples.

    For the older versions (2.x - 2.8) of geant4_vmc: cd geant4_vmc/source make

  6. VMC Examples

    The examples are provided within geant4_vmc package; to build all available examples:
    cd geant4_vmc/examples make