Installing Geant4

From UCL HEP PBT Wiki

Jump to: navigation, search

For the sake of demonstration I will assume you are installing geant4.10.00.p01 and that you wish to install Geant4 on your Desktop. The unzipped Geant4 package will have the following directory /home/your_name/Desktop/geant4.10.00.p01

In the same directory (i.e: on the Desktop) create a folder called 'Geant4-build In the same directory (i.e: on the Desktop) create another folder called Geant4-install

Now using the terminal as a root user, type the command:

cd /home/your_name/Desktop/Geant4-build

This command will change your present working directory to the folder “Geant4-build”. This is important because the Terminal will use present working directory as the destination for the build files.

Using the terminal as root user type the command:

cmake -DCMAKE_INSTALL_PREFIX = /home/your_name/Desktop/Geant4-install -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON 

-DGEANT4_INSTALL_EXAMPLES=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON /home/your_name/Desktop/geant4.10.00.p01

ENSURE YOU CORRECTLY TYPE THE ENTIRE PHRASE. IF YOU MISTYPE SOMETHING CERTAIN FEATURES MAY NOT WORK

Explanation

DGEANT4_INSTALL_DATA=ON ensures that the all of the optional modules (data files) are included with the installation. Failure to include these modules may prevent you from running certain simulations. It is better to include these modules; they will NOT slow your simulations down as they will only be called if they are needed.

DGEANT4_USE_OPENGL_X11=ON ensures that your Geant4 installation is correctly linked to the visualizer OpenGL. If you do not include this command you will not be able to see the output of any of your simulations

DGEANT4_INSTALL_EXAMPLES=ON ensures that the example simulations included with Geant4 are insatalled

After this command has been processed you should receive the message

-- Configuring Done
-- Generating done
-- Build files have been written to…..

If you receive this message, type the command

 
make

If an error occurs during the “make” processes, retype the command make.

This error will most likely occur if the terminal has trouble connecting to the internet. Make sure you have a fully functioning internet connection. It is advised to use a wired internet connection as some of the data files are large and will take a long time to download).

If your internet connection is faulty (but functional) then you may have to re-type the command several times! Personally, I have had to retype if (on one occasion) as many as 6 times!


The make command will download the necessary extra data files and will set up the Geant4 build files in the Geant4-build directory.

When this has been done type the command

make install

to install Geant4.


THE INSTALLATION PROCESS CAN TAKE SEVERAL HOURS!!

Personal tools