Geant4
On this page... (hide)
Geant4 is available as an RPM package for Scientific Linux 4. Acually, it should be already installed on most of the Linux PCs of the PSI group.
Type rpm -q geant4 to check which version is installed, yum install geant4 geant4-examples to install or update. See also Scientific Linux.
1. Links
- Geant4
The main page for Geant4 - Geant4 at INFN Genova
Plenty of tutorials, papers, talks and links - Documentation
- Go to the GEANT4 home-page and get the latest documentation (make sure you have installed the latest version)
- Class list
- Geant4 Source reference
- CLHEP 1.9.2.2 Source reference (local, with search)
- Cross-reference of the complete Geant4 sources
- GATE - Geant4 Application for Tomographic Emission
Geant4 and PET, with sophisticated support for time (movement of the detectors, decaying of the sources). - PDG info on materials
- Parallel Geant4
- ParGeant4
- ParGeant4 @CERN
- Notes on Parallel Geant4
- TOP-C Task Oriented Parallel C/C++ library
- DAWN (Drawer for Academic WritiNgs) visualization - best for papers
- Visualisation tricks
2. Documentation
3. Geant4 Course
4. Examples
from Sergio (Updated to work with Geant4.8):
- Attach:MineralPET_scint.tgz
A simple source and scintillator setup, with only minimal EM processes, and a proper G4SensitiveDetector that saves data in a Root TTree. - Attach:MineralPET_target.tgz
A simple setup to test different converter target materials for e- -> gamma beam. Uses a SteppingAction to save (to a Root TTree) info about generated particles. Includes a more complete and modular PhysicsList, excluding processes that need the additional data files.
Newer versions of the same examples might be available from the PSI Subversion repository:
svn checkout svn+ssh://psi.phys.wits.ac.za:/SVN/psi/scint
from Jonathan
This example shows how to add electromagnetic fields to a Geant 4 simulation.
5. Hints and changes
- G4.8.2 uses the new CLHEP 2, which requires the CLHEP:: namespace - just specify it or add some "using" statements
- To re-seed the Random Number Generator for many repeats of a MC from GEANT4 on differnt cores. In the
mainprogram of the GEANT4 application -
// choose the Random engine
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
if (argc>=3) {
CLHEP::HepRandom::setTheSeed(atoi(argv[2]));
}
in this way you can run, for example
./<geant4app> <macro>.mac 1 ./<geant4app> <macro>.mac 2
6. Installing GEANT4
- Download the sources and the data libraries here
- The Installation guides are here
- Building Geant4 on Windows
- see ROOT and GEANT4 in CYGWIN on Windows XP (not sure if this works anymore)
- Building Geant4 on Linux
- See instructions at the GEANT4
- Building Geant4 on a Mac (a la Martin)
- To have the visualisation tools, automatically download and install the data libraries (make sure you have x11, Qt, openmotif, expat) .... do the following ....:
> cmake -DCMAKE_INSTALL_PREFIX=/Users/martin/Geant4/geant4.9.5-install/
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DGEANT4_INSTALL_DATA=ON
-DGEANT4_USE_QT=ON
-DGEANT4_USE_XM=ON
-DGEANT4_USE_OPENGL_X11=ON
-DGEANT4_USE_RAYTRACER_X11=ON
-DMOTIF_INCLUDE_DIR=/usr/OpenMotif/include
-DMOTIF_LIBRARIES=/usr/OpenMotif/lib/libXm.3.1.dylib
/path to your source of geant4.9.5.p01/
> make -j4
to compile with support for 4 cores. Then
> make install
- To get for example ...example B1 working nicely in Xcode (with line by line debugging etc), make a folder called B1 with the source code, and B1-build in which to make B1. Then (from within B1-build), run:
> cmake -G Xcode -DGeant4_DIR=/Users/martin/Geant4/geant4.9.5-install/lib/Geant4-9.5.1 ../B1
- Open the resulting Xcode project from within Xcode. If it compiles fine, but wont run: If your Xcode version is (4.5) do the following: In the product menu, choose edit scheme, expand the one called Run exampleB1 Debug, and click on the line called Run exampleB1. There is a dropdown menu called Executable, select "exampleB1" (it was the only option). Then, it should run. It will have an error however, about not finding init_vis.mac. Go to B1-build/Debug, and make links to the vis files (depending on what .mac files you want to use). :
> ln -s ../init_vis.mac init_vis.mac > ln -s ../vis.mac vis.mac
