Tuesday, January 7, 2014

Installation of Geant4.10 on Ubuntu13.04

I am not an expert on these things but this is what I did to get my Geant4 (version 10.0) running up on Ubuntu -13.04. This is more for my reference though I think some of you might find this useful (for the rest - one can always go to Geant4 website). I already have all the software required to build Geant4 installed on my system. I also have Qt4 (Qt4 headers and libraries, OpenGL or MesaGL headers and libraries) and X11 headers and libraries to build optional components. 
  1. Make a directory in your home folder where you will store the source files 
    $ mkdir ~/geant4
  2. Go to the Geant4 download area and download the source file in Linux tar format and save it in the newly created directory( "geant4" ). Do
    $ tar -zxvf geant4.10.00.tar.gz
    $ ls
     geant4.10.00  geant4.10.00.tar.gz
  3. Make a build directory and enter
    $ mkdir geant4.10.00-build
    $ ls
    geant4.10.00  geant4.10.00-build  geant4.10.00.tar.gz
    $ cd geant4.10.00-build
  4. Before building lets make sure where the installation is going to reside. In my case I want it in "/usr/local/Geant4", so I have made a directory "Geant4" under /usr/local for the same.
    $ sudo mkdir /usr/local/Geant4
  5. We will perform the build of Geant4 using  cmake
    $ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/Geant4.10/ ../geant4.10.00
  6. I wanted few more additional build options for my usage (Please look at other build options before proceeding. You can choose the options depending on your application),
    $  cmake -DGEANT4_INSTALL_DATA=ON -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_RAYTRACER_X11=ON ../geant4.10.00
  7. To run the build, simply execute make in the build directory:
    $ make -j4
    where 4 is the number of  processor I have (you can just say make and leave it at that)
  8. After the build is complete, do make install
    $ sudo make install
    (sudo is not necessary if one is not installing it /usr/local)
If everything goes fine then you should have a working geant4 installation on your PC/notebook.