The following instructions apply to the installation since the version 3.00. Since this 3.00, VMC examples are installed with CMake.
The VMC examples libraries require ROOT installation and the VMC core package if using ROOT built without vmc
enabled. The VMC examples programs can be built against Geant3 with VMC or Geant4 VMC libraries. Only the examples with the multiple engine mode (at present only E03c) can be built with both Geant3 and Geant4 VMC libraries. The VMC_WITH_Multi
CMake option has to be set, too, in this special case.
By default, the VMC examples libraries and the VMC examples programs are built against Geant4 VMC libraries together with Geant4 VMC installation. Below we provide the instructions how to build VMC examples altogether outside Geant4 VMC. The analogous instructions can be used to build each example individually or to build a user application.
To install all examples
First get the Geant4 VMC source from the Download page, as the examples are provided within this package. We will assume that the Geant4 VMC package sits in a subdirectory
/mypath/geant4_vmc
Create build directory alongside our source directory for installation with Geant4:
$ cd /mypath
$ mkdir examples_build_g4
$ ls
geant4_vmc examples_build_g4
$ cd /mypath
$ mkdir examples_build_g3
$ ls
geant4_vmc examples_build_g3
$ cd /mypath
$ mkdir examples_build
$ ls
geant4_vmc examples_build
To configure the build, change into the build directory and run CMake with either -DVMC_WITH_Geant4
$ cd /mypath/example_build_g4
$ cmake -DCMAKE_INSTALL_PREFIX=/mypath/examples_install_g4 \
-DVMC_WITH_Geant4=ON \
-DGeant4VMC_DIR=/mypath/geant4_vmc_install/lib[64]/Geant4VMC-3.0.0 \
/mypath/geant4_vmc/examples
-DVMC_WITH_Geant3
,
$ cd /mypath/example_build_g3
$ cmake -DCMAKE_INSTALL_PREFIX=/mypath/examples_install_g3 \
-DVMC_WITH_Geant3=ON \
-DGeant3_DIR=/mypath/geant3_install/lib[64]/Geant3-2.0.0 \
-DPythia6_LIB_DIR=/my_path_to_pythia6_library \
/mypath/geant4_vmc/examples
VMC_WITH_Multi
,
$ cd /mypath/example_build_multi
$ cmake -DCMAKE_INSTALL_PREFIX=/mypath/examples_install_multi \
-DVMC_WITH_Geant3=ON \
-DVMC_WITH_Geant4=ON \
-DVMC_WITH_Multi=ON \
-DGeant3_DIR=/mypath/geant3_install/lib[64]/Geant3-2.0.0 \
-DGeant4VMC_DIR=/mypath/geant4_vmc_install/lib[64]/Geant4VMC-3.0.0 \
-DPythia6_LIB_DIR=/my_path_to_pythia6_library \
/mypath/geant4_vmc/examples
$ cd /mypath/example_build_g3
$ cmake -DCMAKE_INSTALL_PREFIX=/mypath/examples_install \
-DCMAKE_MODULE_PATH=/mypath/geant4_vmc_install/lib[64]/Geant4VMC-3.0.0/Modules \
/mypath/geant4_vmc/examples
Note that in the last case, you still have to define the path to CMake configuration files used in examples which are provided with both Geant4 VMC and Geant3 CMake installations. Only examples libraries are built and installed in this case.
If ROOT and Geant4 environment was defined using thisroot.[c]sh
and geant4.[c]sh
scripts, there is no need to provide the path to their installations. Otherwise, they can be provided using -DROOT_DIR
and -DGeant4_DIR
cmake options.
-DVMC_DIR
cmake option.$ make -jN
$ make -jN VERBOSE=1
$ make install
This will install examples libraries in lib[64] and executables in bin directory in CMAKE_INSTALL_PREFIX directory.
For the old instructions see: