Vous êtes sur la page 1sur 5

Post Cheers

Hi particle simulator friend ! I encountered several problems while trying to compile Geant4.10 on my
Ubuntu 13.10 machine. So if you want to avoid reading the manual and searching the web for possible
solutions, follow this quick & essential tutorial.
quick Geant4.10
installation
To start you need this:
Geant4 Toolkit source code (select the source files you prefer)
cmake
c++ compiler : open a terminal and type
sudo apt-get install build-essential
make
xerces-c
QT5
freeglut
libX11, libX11-devel, libXt, libXt-devel and xorg
libmotif-dev
Now that everything is set-up you should decide the path/to/ your geant installation, and unpack the source
file in path/to/. So youll get a directory named path/to/geant4.10.00 . The next step will be to create a
directory in which youll build the source files, these are the command lines to use in your terminal:
$ cd /path/to
1
1
1
2
1
1
1
Geant4.10 on Ubuntu 13.10 ! | Post Cheers http://www.postcheers.com/blog/programmazione...
1 of 5 07/03/2014 11:00 AM
$ mkdir geant4_10_00-build
$ ls
geant4_10_00 geant4_10_00-build
Now we are ready to move into the newly build directory and configure the makefile of Geant, so follow the
next instructions:
$ cd /path/to/geant4_10_00-build
$ cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4_10_00-install
-DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON
-DGEANT4_USE_QT=ON /path/to/geant4_10_00/
Lets try to go through the last line; -DCMAKE_INSTALL_PREFIX will tell cmake where you want to install
geant4.10. While -DGEANT4_INSTALL_DATA=ON asks cmake to download the data files (which are essential if
you want to simulate particles crossing some kind of material). Finally the
options DGEANT4_USE_OPENGL_X11 and DGEANT4_USE_QT will tell cmake to use X11 and QT as the
graphical user interface. The last argument /path/to/geant4.10.00/ tells cmake where to search for the source
files, once cmake has finished with the creation of the makefile you are ready to compile :
$ make -jN
Where N is the number of cpu cores of your machine. Its almost finished, your compilation will
be completed by:
$ make install
Before running an example you need to configure your system to run geant and this is done by:
$ cd /path/to/geant4.10.00-install/bin/
$ . geant4.sh
To see if the installation was correctly accomplished you should try to run an example, so lets try the basic
B1 example. Create on your desktop a directory called B1-build and move in that directory with your
3
Geant4.10 on Ubuntu 13.10 ! | Post Cheers http://www.postcheers.com/blog/programmazione...
2 of 5 07/03/2014 11:00 AM
terminal. Then write the following code:
$ cmake -DGEANT4_DIR= /home/simple/geant/geant4.10.00-install
/lib/Geant4-10.0.0/ /home/simple/geant/geant4.10.00/examples
/basic/B1/
$ make -jN
$ make install
Now you are ready to execute your basic geant program by:
$ ./exampleB1
Geant4.10 on Ubuntu 13.10 ! | Post Cheers http://www.postcheers.com/blog/programmazione...
3 of 5 07/03/2014 11:00 AM
Result of the execution of Example B1
I hope this tutorial has helped you during the installation of Geant and execution of the first simulation.
Anyhow this is only a simple installation, for more complex ones you should read the manual and select the
cmake arguments that fit your needs. Cheers and Have fun
Get it from synaptic Package Manager
Get it fromQt Poject
To automate this process open .bashrc (a file in your Home directory) and write this command on a new
line:
1
2
3
Geant4.10 on Ubuntu 13.10 ! | Post Cheers http://www.postcheers.com/blog/programmazione...
4 of 5 07/03/2014 11:00 AM
. /path/to/geant4.10.00-install/bin/geant4.sh
Condividi:
Facebook 11 Twitter Google Tumblr Pinterest E-mail
Stampa
Google+
ian postuma

18 febbraio, 2014 [http://www.postcheers.com/blog/programmazione/geant4-10/]

Programmazione Geant4

Theo di 31
Mi piace:
Mi piace
Piace a un blogger.

Geant4.10 on Ubuntu 13.10 ! | Post Cheers http://www.postcheers.com/blog/programmazione...


5 of 5 07/03/2014 11:00 AM