--
CamiloSevilla - 2018-04-20
geant4.10.04 Installation Handbook v04
Autor: Andrés Camilo Sevilla
12, José Mauricio Sevilla
3
1Grupo Física de Bajas Temperaturas y Detectores CRYOMAG - UNAL
2Grupo Física Médica - UNAL
3Grupo de Caos y Complejidad - UNAL
April 2018 - Bogotá, Colombia
1. Prerequisites
OS recommended: Ubuntu 16.04, Ubuntu 18.04
To use the most common and useful Geant4 components (in Medical and Detectors Physics), you need install some package on your ubuntu system via terminal using $sudo apt-get install --package-- or synaptic package manager.
- GDML Support
requires: libxerces-c-dev
- User Interface and Visualization
requires: qt4-dev-tools, freeglut3-dev, libmotif-dev, tk-dev
- other requirements: cmake, libxpm-dev, libxmu-dev, libxi-dev
$ sudo apt-get install libxerces-c-dev qt4-dev-tools freeglut3-dev libmotif-dev tk-dev cmake libxpm-dev libxmu-dev libxi-dev
2. Building from source files
Create a folder "geant4" in your system:
$ cd /opt/
$ sudo mkdir applications
$ cd applications
$ sudo mkdir geant4
Download and copy
geant4.10.04 source files to geant4 folder, then unpack it:
$ sudo mv ~/Downloads/geant4.10.04.p01.tar.gz /opt/applications/geant4/.
$ cd /opt/applications/geant4/
$ sudo tar -zxvf geant4.10.04.p01.tar.gz
Create a directory to configure and build Geant4.
$ mkdir geant4.10.04.p01-build
To configure the build, enter to build directory and run CMake
$ cd geant4.10.04.p01-build
$ sudo cmake -DCMAKE_INSTALL_PREFIX=/opt/applications/geant4/geant4.10.04.p01-install -DGEANT4_USE_GDML=ON -DCMAKE_BUILD_TYPE=Debug -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_XM=ON -DGEANT4_USE_QT=ON -DGEANT4_BUILD_MULTITHREADED=ON /opt/applications/geant4/geant4.10.04.p01
After the configuration, CMake will have generated Unix Makefiles for building Geant4. To build, simply execute make in the build directory:
$ make -jN
$ make install -jN
Note: N is the number of cores available in your PC.
To finish the installation open the .bashrc file:
$ gedit ~/.bashrc
At the end include the lines:
# geant4
source /opt/applications/geant4/geant4.10.04.p01-install/bin/geant4.sh
3. Running an example
Create a
G4WORK folder:
$ mkdir ~/workspace
$ mkdir ~/workspace/G4WORK
Copy there a G4 example:
$ cp -R ~/geant4/geant4.10.04.p01/examples/basic/B1/ ~/workspace/G4WORK/.
Configure and compile B1 example
$ cd ~/workspace/G4WORK/
$ mkdir B1-build
$ cd B1-build
$ cmake ../B1
$ make -jN
Note: N is the number of cores available in your PC.
Finally run the example
$ ./exampleB1
4. References
[1]
Geant4 installation guide, Geant4 Collaboration,
http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/index.html[2]
Twiki Allpix , John Idarraga,
https://twiki.cern.ch/twiki/bin/view/Main/AllPix