Installing Geant4 VMC

Geant4 VMC requires the VMC core package, ROOT and Geant4 installed, and optionally, it can be built with VGM. See below tips for configuration and installation of these packages.

The VMC core package is maintained as a standalone vmc package. Current Geant4 VMC requires this standalone library; ROOT installations with the old embedded VMC enabled are rejected. See Installing VMC for setup instructions.

Geant4 VMC uses CMake to configure a build system for compiling and installing the headers, libraries and CMake configuration files. To install geant4_vmc:

  1. First get the Geant4 VMC source from the Download page. We will assume that the Geant4 VMC package sits in a subdirectory
/mypath/geant4_vmc
  1. Create build directory alongside our source directory
$ cd /mypath
$ mkdir geant4_vmc_build
$ ls
 geant4_vmc geant4_vmc_build    
  1. To configure the build, change into the build directory and run CMake:
$ cd /mypath/geant4_vmc_build 
$ cmake -DCMAKE_INSTALL_PREFIX=/mypath/geant4_vmc_install /mypath/geant4_vmc
  • If ROOT and Geant4 environment was defined using thisroot.[c]sh and geant4.[c]sh scripts, there is no need to provide path to their installations. Otherwise, they can be provided using -DROOT_DIR and -DGeant4_DIR cmake options.

  • Provide -DVMC_DIR with the directory containing VMCConfig.cmake if standalone VMC is not found automatically.

  • Since Geant4 VMC 6.0, the deprecated VMC library in ROOT cannot be used and building against ROOT built with the vmc option enabled will fail with CMake error.

  1. After the configuration has run, CMake will have generated Unix Makefiles for building Geant4 VMC. To run the build, simply execute make in the build directory:
$ make -jN

where N is the number of parallel jobs you require (e.g. if your machine has a dual core processor, you could set N to 2).

  • If you need more output to help resolve issues or simply for information, run make as
$ make -jN VERBOSE=1
  1. Once the build has completed, you can install Geant4 VMC to the directory you specified earlier in CMAKE_INSTALL_PREFIX by running
$ make install

This will build geant4_vmc, g4root and examples packages. For VMC examples see VMC examples installation page.


The instructions above describe the current CMake installation. For historical releases, see