Skip Ribbon Commands
Skip to main content


GEANT4 VERSIONS AND ENVIRONMENT VARIABLES

Geant4 users at FNAL have several options for setting up Geant4 toolkit for their tasks.

The latest - and the most recommended - release is Geant4.9.6.p02. 

Tips on its availability and installation(s) at FNAL are given in a separate document; these tips are also applicable to several previous, reasonably recent versions of Geant4.

As an alternative, users may download the toolkit directly from the Geant4 web site and to build it on their own.
Those who want to build Geant4 on their own, please refer to the Installation Guide. In particular, startup tips of using cmake on the Unix platform are offered in Section 2.1.

Please note that in its very basic configuration Geant4 does NOT require any additional external package in order to build. For example, CLHEP has been imported into the core code of Geant4 (for those who still want to use an external build of CLHEP, such option has also been preserved with the Geant4 build machinery). But bear in mind that some extensions to Geant4 may require additional libraries; for example choosing to build Geant4 with its GDML part will call for xercex-c package.

However, in order to function properly Geant4 requires several external data sets.

The data sets are available for download from the same Geant4 download area as the core code tarball; however, most of them are also centrally available at FNAL via ups/upd, A user needs to be aware that each one is distributed as separate product, unrelated to others, and its setup is separate step from Geant4's setup. The list of centrally available products is the following: 

  • g4neutron 
  • g4neutronxs 
  • g4photon 
  • g4emlow 
  • g4radiative 
  • g4elastic 
  • g4abla
  • g4pii
  • g4surface

The data sets have their own versions; it is always specified in the Geant4 release download instructions what data sets are required with each release of Geant4. Some of them are relatively recent additions (for example, G4SAIDDATA), and are not necessary needed with earlier releases of Geant4. Bear in mind that sometimes Geant4 and the data sets are backward and/or forward compatible but it is not guaranteed.

A Geant4 application, at the run time, recognizes the data sets via a group of environmental variables that point to At present (as of Geant4.9.6 cycle), these environmental variables are $G4LEVELGAMMADATA, $G4LEDATA, $G4NEUTRONHPDATA, $G4RADIOACTIVEDATA, $G4ABLADATA, $G4REALSURFACEDATA, $G4NEUTRONXSDATA, $G4PIIDATA, $G4SAIDXSDATA. It is fair enough to say that a user should always make sure this group of environmental variables is properly set.

As an alternative, a user may consider manual initialization of a group of environmental variables.

If one chooses Geant4.9.6.p02, these set of commands may be helpful  for  bash users:

export G4DATA=<location-of-geant4-datasets>
export G4LEDATA=${G4DATA}/G4EMLOW6.32
export G4LEVELGAMMADATA=${G4DATA}/PhotonEvaporation2.3
export G4NEUTRONHPDATA=${G4DATA}/G4NDL4.3
export G4RADIOACTIVEDATA=${G4DATA}/RadioactiveDecay3.6
export G4ABLADATA=${G4DATA}/G4ABLA3.0
export G4REALSURFACEDATA=${G4DATA}/RealSurface1.0
export G4NEUTRONXSDATA=${G4DATA}/G4NEUTRONXS1.2
export G4PIIDATA=${G4DATA}/G4PII1.3
export G4SAIDXSDATA=${G4DATA}/G4SAIDDATA1.1

C-shell users may want to consider these commands:

setenv G4DATA                          <location-of-geant4-datasets>
setenv G4LEDATA                      $G4DATA/G4EMLOW6.32
setenv G4NEUTRONHPDATA     $G4DATA/G4NDL4.3
setenv G4RADIOACTIVEDATA   $G4DATA/RadioactiveDecay3.6
setenv G4ABLADATA                 $G4DATA/G4ABLA3.0
setenv G4REALSURFACEDATA $G4DATA/RealSurface1.0
setenv G4NEUTRONXSDATA     $G4DATA/G4NEUTRONXS1.2
setenv G4PIIDATA                      $G4DATA/G4PII1.3
setenv G4SAIDXSDATA              $G4DATA/G4SAIDDATA1.1

For practical and historical reasons we will also preserve some tips related to older versions of Geant4 and their distribuions at FNAL; please see this document.

Several additional details and tips are provided in the Find and Try Geant4 Examples document.