Installing geant4_vmc
New instructions
The following instructions apply to the installation since the version 2.13 built against Geant4 9.5. For the installation of the 2.12 and older versions see below.-
Getting source
First get the Geant4 VMC source from the Download page. -
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:b) With the Root configuration scriptROOTSYS ... path to RootNote that if the ROOTSYS environment variable is defined the root-config script is not used.root-config ... Root configuration script
For the older geant4_vmc versions (2.x - 2.8) see below.
-
Geant4 configuration (with CMake)
To install Geant4 - follow the Geant4 Installation Guide together with the tips relevant to using it with VMC described below.
Note that Geant4 VMC requires some Geant4 installation options which are not set by default during the Geant4 installation procedure:
- Build Geant4 with the use of the G3toG4 tool
- It is also recommended to build Geant4 X11 OpenGL visualization driver which is used in the VMC examples.
-DGEANT4_USE_G3TOG4=ON -DGEANT4_USE_OPENGL_X11=ON
The path to the Geant4 installation is then defined with the 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):geant4-config ... Geant4 configuration script
$ . 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.
- Build Geant4 with the use of the G3toG4 tool
-
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
-
Geant4 VMC
To install geant4_vmc:This will build g4root, geant4_vmc and VMC examples.cd geant4_vmc make
Special installations, Older versions
-
Root Configuration for geant4_vmc versions (2.x - 2.8)
The older geant4_vmc versions (2.x - 2.8) require Root to be configured with g4root package; for this you have to specify the following configure options:
--enable-g4root \ --with-g4-incdir=$G4INSTALL/include \ --with-g4-libdir=$G4INSTALL/lib/Linux-g++ \ --with-clhep-incdir=$CLHEP_BASE_DIR/include \
-
Geant4 configuration (version >= 9.5)
If you install Geant4 with the GNUmakefile build system and your own environment setting, you need to have set the following environment variables. This way of installation requires an experience in Geant4 and so it is not recommended for novice users.
with manual installation (with GNUmake)G4LIB_BUILD_SHARED set to 1 (required) G4LIB_USE_G3TOG4 set to 1 (required) G4VIS_BUILD_OPENGLX_DRIVER set to 1 (recommended) G4VIS_USE_OPENGLX set to 1 (recommended)
The path to Geant4 installation is then defined with the environment variables.
If Geant4 is installed in a different path than the path to the source tree, the following additional variables have to be set:G4INSTALL ... path to Geant4 installation G4SYSTEM ... Geant4 system flavor CLHEP_BASE_DIR ... path to CLHEP
G4LIB ... path to Geant4 libraries (optional) G4INCLUDE ... path to Geant4 include files (option)
-
Geant4 configuration (version <= 9.4)
Installation of Geant4 + Geant4 VMC requires the CLHEP shared library.
- Geant4 shared libraries;
- All Geant4 header files in the include directory
- Build Geant4 with the use of the G3toG4 tool
- It is also recommended to build Geant4 X11 OpenGL visualization driver which is used in the VMC examples.
-
Geant4 VMC - versions (2.x - 2.8):
For the older versions (2.x - 2.8) of geant4_vmc:cd geant4_vmc/source make
Note that Geant4 VMC requires some Geant4 installation options which are not set by default during the Geant4 installation procedure:
To get these options when using Configure program, you should reply y to the following questions. The Configure program will then generate automatically a script for an environment setup which should be sourced each time when using Geant4.
Do you want to install all Geant4 headers in one directory? [n] y (required) Do you want to build shared libraries? [y] y (required) Enable building of visualization drivers? [y] y (recommended) Enable building of the X11 OpenGL visualization driver? [n] y (recommended) Enable build of the g3tog4 utility module? [n] y (required)
If you install Geant4 with your own environment setting, you need to have set the following environment variables. This way of installation requires an experience in Geant4 and so it is not recommended for novice users.
G4LIB_BUILD_SHARED set to 1 (required) G4LIB_USE_G3TOG4 set to 1 (required) G4VIS_BUILD_OPENGLX_DRIVER set to 1 (recommended) G4VIS_USE_OPENGLX set to 1 (recommended)