# Tested on Linux Mint 22 Wilma (based on Ubuntu 24.04) # Manual Installation of geant4 # Will require about 3GB of storage space including Geant4 datasets # Create your workspace folder and enter the folder, e.g. mkdir -p $HOME/software/geant4 && cd $_ # Download Geant4 distribution GEANT_RELEASE=v11.4.0 wget https://gitlab.cern.ch/geant4/geant4/-/archive/${GEANT_RELEASE}/geant4-${GEANT_RELEASE}.tar.gz # If download successful, uncompress the archive tar zxvf geant4-${GEANT_RELEASE}.tar.gz # create build directory mv geant4-${GEANT_RELEASE}{,-src} mkdir geant4-${GEANT_RELEASE}{,-build} cd geant4-${GEANT_RELEASE}-build # install pre-requisite packages sudo apt install libxerces-c3.2 \ libxerces-c-dev \ libx11-dev \ libxmu-dev \ libcoin-dev \ libxt-dev \ libxext-dev \ libsimage-dev \ libxm4 \ libmotif-dev \ libmotif-common # Look for Qt5 library/tools in your system sudo apt-cache search qt5 | grep '^qt5-default' # --- qt5-default - Qt 5 development defaults package # if you see the above do, sudo apt install qt5-default qt5-style-plugin-motif # else do sudo apt install qt5-assistant qtcreator qtbase5-dev qttools5-dev # (for most recent Ubuntu/Mint distributions) # for v11.4.0 qt6 is required sudo apt install qt6-tools-dev # Now prepare makefiles with cmake cmake -DCMAKE_INSTALL_PREFIX=../geant4-${GEANT_RELEASE} -DGEANT4_BUILD_MULTITHREADED=ON \ -DGEANT4_INSTALL_DATA=OFF \ -DGEANT4_USE_QT=ON \ -DGEANT4_USE_GDML=ON \ -DGEANT4_USE_OPENGL_X11=ON \ -DGEANT4_BUILD_STORE_TRAJECTORY=ON \ -DGEANT4_USE_RAYTRACER_X11=ON \ -DGEANT4_USE_SYSTEM_EXPAT=ON \ -DGEANT4_USE_SYSTEM_ZLIB=ON \ -DGEANT4_USE_XM=ON ../geant4-${GEANT_RELEASE}-src # now compile and install make -jN ## (e.g N=4 based on the number of cores on your system) make install # Installation complete! # Copy GEANT4 datasets (OPTIONAL) # Warning! Large amount of data will be downloaded # Check if you can copy the datasets offline mkdir -p ../geant4-${GEANT_RELEASE}/share/Geant4/data && cd $_ for dset in $(echo https://cern.ch/geant4-data/datasets/G4NDL.4.7.1.tar.gz \ https://cern.ch/geant4-data/datasets/G4EMLOW.8.8.tar.gz \ https://cern.ch/geant4-data/datasets/G4PhotonEvaporation.6.1.2.tar.gz \ https://cern.ch/geant4-data/datasets/G4RadioactiveDecay.6.1.2.tar.gz \ https://cern.ch/geant4-data/datasets/G4PARTICLEXS.4.2.tar.gz \ https://cern.ch/geant4-data/datasets/G4PII.1.3.tar.gz \ https://cern.ch/geant4-data/datasets/G4RealSurface.2.2.tar.gz \ https://cern.ch/geant4-data/datasets/G4SAIDDATA.2.0.tar.gz \ https://cern.ch/geant4-data/datasets/G4ABLA.3.3.tar.gz \ https://cern.ch/geant4-data/datasets/G4INCL.1.3.tar.gz \ https://cern.ch/geant4-data/datasets/G4ENSDFSTATE.3.0.tar.gz) do wget $dset && tar zxvf $(basename $dset) done # After successful installation of geant4, build applications (e.g B1) cd $HOME/software/geant4 # copy the examples folder from the geant4 src directory rsync -avz --progress geant4-${GEANT_RELEASE}-src/examples . cd examples/basic mkdir -p B1-build && cd $_ cmake -DCMAKE_PREFIX_PATH=$HOME/software/geant4/geant4-${GEANT_RELEASE} ../B1 make # finally, you can run the example now # Note that, geant4 datasets should be available by now source $HOME/software/geant4/geant4-${GEANT_RELEASE}/bin/geant4.sh ./exampleB1