Geant4 Usage at CERN

Location of Releases

At CERN  Geant4 installations are located in the CVMFS directories of the  Geant4 project under:

 /cvmfs/geant4.cern.ch/geant4/

We provide libraries and source code for releases and patch releases. Reference versions are also available without support and without full source code. For release 10.5 and centos7 compiled using gcc63 we have two versions:

 /cvmfs/geant4.cern.ch/geant4/10.5/x86_64-centos7-gcc63-opt
 /cvmfs/geant4.cern.ch/geant4/10.5/x86_64-centos7-gcc63-opt-MT

And similarly named directories for slc6, and/or other compiler versions. We currently build versions for sequential and multithreading, as marked by the extension -MT, code is optimised, yet debug information is kept. Users have to choose the correct OS  and use a compatible compiler to compile user code. For each architecture the are setup scripts for use with either CMake or GNUmake, CMake-setup or GNUmake-setup. These scripts set all required environment variables used to run an application based on libraries provided, including those for required datasets.

Geant4 data sets are available from

 /cvmfs/geant4.cern.ch/share/data

Scripts to Set-up Environment

In each version available, there are scripts to set up the environment to use.  For example, to use Geant4 release 10.5  based on on slc6 and gcc 6.3, you can use the following commands depending on the shell you use:

For sh or bash:

 source /cvmfs/sft.cern.ch/lcg/contrib/gcc/6.3/x86_64-slc6/setup.sh                    #set up compiler
 source /cvmfs/geant4.cern.ch/geant4/10.5/x86_64-slc6-gcc63-opt-MT/CMake-setup.sh      #set up environment for Geant4
 export CXX=`which g++`                                                                #tell CMake about compiler used 
 export CC=`which gcc`

For csh or tcsh:

 source /cvmfs/sft.cern.ch/lcg/contrib/gcc/6.3/x86_64-slc6/setup.csh                    #set up compiler
 source /cvmfs/geant4.cern.ch/geant4/10.5/x86_64-slc6-gcc63-opt-MT/CMake-setup.csh      #set up environment for Geant4
 setenv CXX `which g++`                                                                 #tell CMake about compiler used 
 setenv CC `which gcc`

Examples

Geant4 examples are available as source code in the directories under:

 /cvmfs/geant4.cern.ch/geant4/G4VERSION/ARCHITECTURE/share/examples

where G4VERSION and ARCHITECTURE stand for the Geant4 version you want to use and for the OS/compiler version. Each example has a README file with specific details and options. To build and execute one of the examples, for example basic B1, set the environment using the recipe above, and then copy the example,  compile and execute:

 cp -R /cvmfs/geant4.cern.ch/geant4/10.1.p02/share/examples/basic/B1 $HOME                                  # copy example
 mkdir $HOME/B1_build                                                                                       # create directory to compile
 cd $HOME/B1_build
 cmake -DGeant4_DIR=/cvmfs/geant4.cern.ch/geant4/10.5/x86_64-slc6-gcc63-opt-MT/lib64/Geant4-10.5.0 $HOME/B1 # create MakeFiles
 make                                                                                                       # compile/build using make 
 ./exampleB1 exampleB1.in                                                           # run the example, using exampleB1.in as input file

You are here