Geant4 for DebianScience
What is Geant4?
Geant4 is a toolkit for the simulation of the passage of particles through matter. Its application areas include high energy physics and nuclear experiments, medical, accelerator and space physics studies. The Geant4 software consists of an extensive set of libraries, fundamentally object-oriented and based in modern C++. It may be used to develop programs with command-line, Xaw-based, or Motif-based interfaces.
Although rewritten from scratch, Geant4 is the conceptual successor to GEANT3.21, a FORTRAN-based version of the toolkit. GEANT3.21 is part of Cernlib, is licensed under the GNU General Public License, and is available in the official geant321 Debian package in Sarge and more recent versions of Debian. If you have a strong preference for FORTRAN and/or for software known to be Free, maybe you would rather use that. Warning: it is not 64-bit clean and is no longer really maintained by upstream. See also the Cernlib on Debian pages.
What is the status of Debian packages?
There are no official packages for Geant4 due to license issue. However, KevinMcCarty has prepared a Debianized source package for Geant4 nevertheless since it is quite annoying to build the "traditional" way. He has built from the source package successfully on both Sarge and Sid. These packages are now maintained by YngveInntjoreLevinsen
Unofficial Geant4 repository
Since release 8.1, Geant4 has been available under a new Geant4 Software License that looks similar to the new (positive-advertising-clause) XFree86 license, plus an anti-patent clause. This makes it non-free by Debian standards, as well as GPL-incompatible. However, none of the libraries used by Geant4 are pure GPL. Therefore I feel that it will be OK for me to distribute binary .debs of Geant4 8.1 and above. They are available for several architectures on both Sarge and Sid. The PowerPC builds are courtesy of Frédéric Lehobey and Carlo Segre. MIPS and Sparc builds are from Carlo Segre.
Tracking the latest Geant4
If you always want to have the latest versions of Geant4 available for your distribution (e.g. Lenny or Sid) and architecture, you should simply add these lines to /etc/apt/sources.list:
deb http://lcg-heppkg.web.cern.ch/lcg-heppkg/debian stable hep deb-src http://lcg-heppkg.web.cern.ch/lcg-heppkg/debian stable hep
(replace "unstable" with "stable" if running Lenny) and then run
apt-get update && apt-get install geant4
You may first want to run "apt-get install cern-archive-keyring" in order to make the repository trusted by secure APT. For more information, please see the CERN Debian repository web pages, in particular the package installation and keyring verification pages.
The source package is also of course available via "apt-get source geant4".
Be aware that Geant4 upstream does not make binary compatibility a high priority, and it is inherently difficult to keep it in a C++-based library. So it is likely that the soversion used for these packages will be bumped with each new upstream release. (The soversion is Debian-specific; upstream does not version their libraries.) This means that with each upgrade you'll need to recompile your existing local Geant4-dependent programs and libraries in order to take advantage of new upstream features and bug fixes. However, obsolete runtime library packages of old Geant4 versions, in compliance with DebianPolicy, will never be forced off the system by file conflicts; so in principle recompiling should be optional.
PLEASE NOTE THAT currently my free time is very limited and I am no longer in the physics field, so the future of these packages is not entirely clear. The latest Geant4 release available from this repository is 9.1 + patch 03.
Older Geant4 releases
The current CERN repository does not offer the possibility to track Geant4 packages by release version. If you do not need a Geant4 any newer than version 8.2 + patch 01, you may obtain it from an older, now-obsolete repository. BE WARNED THAT said repository is no longer supported in any way and may in the future cease to exist without warning.
Using the obsolete repository
Often one wishes to have a specific release of Geant4 available, for consistency, throughout an experiment. Toward this purpose, the unofficial repository has been reorganized such that it is possible to track a specific release of Geant4 packages. For instance, if you want to track packages for release 8.1.p01 (8.1 + patch 01), you would add the following lines to /etc/apt/sources.list
deb http://borex.princeton.edu/~kmccarty/ unstable geant4-8.1.p01 deb-src http://borex.princeton.edu/~kmccarty/ unstable geant4-8.1.p01
The table below indicates which releases are available for specific distributions and architectures. At the moment, it is very likely that the Sid packages will also work on Etch.
NOTE: I intend to remove the binary packages built against Sarge (oldstable) on August 13, 2007, or so in order to free up disk space. If you have an objection, please tell me before then at kmccarty (at) debian (dot) org. The source packages will remain.
Packages for different Geant4 releases cannot be installed in parallel. Comments about the work that would be needed to make this possible are at http://lists.debian.org/debian-science/2006/12/msg00017.html.
The obsolete repository with secure APT
If you are using a secure version of apt-get or aptitude (newer than the one in Sarge) it may complain that the repository signature could not be verified. To make apt-get/aptitude aware of my GPG key, you may run the following commands:
gpg --keyserver keyring.debian.org --recv-keys 4F83C751 gpg --export 4F83C751 | apt-key add -
Do NOT do this until you have verified the validity of my key to your satisfaction.
After building and installing the Geant4 Debian packages, you'll want to take a look at the file /usr/share/doc/geant4-common/README.Debian.gz -- it includes instructions for setting up your environment and for installing the optional data files. Usually Geant4 requires a lot of environment variables to be set. This is both annoying and against DebianPolicy. I've tried to work around it by writing a couple of wrapper scripts called "g4make" and "g4run" for convenience. Please provide feedback if you really like or dislike the wrapper scripts.
Known problems with older releases
The md5sum of the data file PhotonEvaporation.2.0.tar.gz has changed since it was apparently repacked on the Geant4 server. This will cause the install-geant4-data script to abort when trying to install this file. To fix this issue, ensure that the PhotonEvaporation line in the file /etc/install-geant4-data.conf reads as follows:
PhotonEvaporation 2.0 097fa94e2ec361cbfe3477ed5886a423
before running install-geant4-data.
Two users of the packages have reported segfaults when using the OGLSX visualization (the OGLIX seems to mostly work). I'm unfortunately not able to reproduce this problem, so I hypothesize that it might be an issue with certain video card drivers. Frank Dohrmann has reported that the problem persists when compiling "vanilla" upstream Geant4 from source.
There also seem to be some problems with the OGLSXm and OGLIXm visualization methods in various cases.
If you are able to verify that a problem with the packages is present also in "vanilla" Geant4 compiled from upstream source code, your best chance for support is to report it upstream. They have support forums at http://geant4-hn.slac.stanford.edu:5090/Geant4-HyperNews/index. In particular this thread seems to cover aspects of the OpenGL problems, though with no definitive solution.