Binary package for Geant4

Hello Experts,
Is there any binary package for Geant4 like ROOT.
like just by downloading and unpacking it and setting the environment in the .bashrc , it can work.
Thanks in advance!
Priyanshu

you mean something like the “Pre-compiled Libraries” on the downloads page:
https://geant4.web.cern.ch/support/download

1 Like

As @weller noted, there set of binaries for Geant4 on Centos7 (though needs additional install of GCC 8), macOS 11 and Windows 10 under the “Precompiled Libraries” section of the Download page. However, these are pretty minimal and might not match the system you are running on.

If those don’t match your OS or requirements for use, then one other option for Linux and macOS could be CVMFS. This is basically a remote filesystem over which precompiled software can be distributed (so does require a reasonable internet connection). CERN provide one of these which includes ROOT and Geant4 for Centos7/Centos8/Ubuntu1804/Ubuntu2004. The CVMFS Docs provide a full in-depth guide to install/setup, but in short, to take an Ubuntu system as an example, the steps would be:

  1. Install CVMFS:
$ wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb
$ sudo dpkg -i cvmfs-release-latest_all.deb
$ rm -f cvmfs-release-latest_all.deb
$ sudo apt-get update
$ sudo apt-get install cvmfs
  1. Setup cvmfs
$ sudo cvmfs_config setup
$ sudo systemctl reload autofs.service

Now create a file /etc/cvmfs/default.local and open it for editing. Put the following lines:

CVMFS_REPOSITORIES=sft.cern.ch,geant4.cern.ch
CVMFS_CLIENT_PROFILE=single
CVMFS_HTTP_PROXY=DIRECT

Save the file, then run

$ sudo systemctl reload autofs.service
$ cvmfs_config probe

It should print output like

Probing /cvmfs/sft.cern.ch... OK
Probing /cvmfs/geant4.cern.ch... OK

if things are setup o.k. and working. You can then do

$ ls /cvmfs/sft.cern.ch
# and it should print
lcg  README.md

The simplest setup to use is one of the so-called “views” under /cvmfs/sft.cern.ch/lcg/views. These are coherent sets of software, and a list is published on the LCG Info page so can be browsed to see what packages and versions are present. E.g. here’s the list for “LCG_100” on Ubuntu 20.04. You can also search/view by package so which versions are available in which stack, e.g. here’s Geant4.

To setup a view for use, it’s just a matter of sourceing one script. For example to setup the newest LCG_100 stack for Ubuntu 20.04:

$ source /cvmfs/sft.cern.ch/lcg/views/LCG_100/x86_64-ubuntu2004-gcc9-opt/setup.sh 

This should set all need paths, environment variables, and should allow a Geant4 application to be configured/compiled/run. There are a couple of things to watch:

  • Use geant4-config to check what features are configured, especially visualisation drivers
  • Being a network filesystem with caching, you may experience commands (e.g. cmake) seeming to take a long time to run or freezing. This should just happen after initial use, as the system downloads and caches the needed files. Further runs should then be fast.

Ah, I also completely forgot that for Linux/Mac there is are also nicely maintained Conda binary packages for ROOT and Geant4. To use these, it’s necessary to install Conda/Miniconda first, which is covered in detail in the Conda docs. Installing ROOT and Geant4 would then be:

$ conda config --add channels conda-forge
$ conda config --set channel_priority strict
$ conda install geant4 root root_base

these can then be used in Conda’s so-called environments along with any other Conda packages. There’s also a good walkthrough in this HEP Analysis tutorial on basic use.

Conda’s a great system for scientific computing/analysis, so it will repay time spent to learn/use it.

Thanks for your reply!
i mean is there any Geant4 installation package that if i download that folder and extract the folder and setting the path in .bashrc , i will be able to run the Geant4 ?
like root software Installing ROOT - ROOT
it is pre-compiled binary distributions. very easy to install by every one.

I think there is a difference between root as a binary that you can directly use, and geant4 as a library to program and compile simulations in c++. there is also software based on grant4 that could be distributed as a precompiled binary, e.g., gate or gorad
(not a complete list ;-))

http://www.opengatecollaboration.org/

by this, will the results be the same as normal Geant4 results we see after running the example. like same visualization and all ?
and can you please elaborate it, how can i do this ? actually i didn’t understand the use of pre-compiled libraries in Geant4 that are available at Geant4 installation page along with the source file.
Thanks in advance!
Priyanshu

In terms of physics, yes, the results from using a precompiled library should be identical, modulo that it is run on an identical OS and C/C++ library. The speed at which it runs may be slower, as a precompiled library may not be as well optimized for the system it ends up used on. Visualization comes down to having the right libraries (OpenGL/X11/Qt) installed on the system beforehand. For example, if we shipped a binary package for Geant4 built with Qt visualization support, and Qt wasn’t installed on your system, you wouldn’t be able to run (let alone link) a Geant4 application.

The precompiled libraries on the download page are basically the same as the ROOT binary package. It’s a tarball of the prebuilt Geant4 libraries/headers that can be unpacked locally and an application compiled/linked against just as you would with a local build-from-source-and-install. For example, the Linux one when unpacked has the directory/file tree:

Geant4-10.7.2-Linux/
  bin/
    geant4-config
    ...
  include/
    Geant4/
      G4Version.hh
      ...
  lib64/
    libG4global.so
    ...
  share/
    Geant4-10.7.2/

so is the same set of files that a build-from-source with “cmake, make, make install”.
The caveat as above is these may not be compatible with the system you are running on, or you may need to install extra packages first (e.g. gcc, Qt, X11) first.

I’ll make a target on our development board to improve these and docs for December’s release.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.