NOTE : When using installation on lxplus. first set env for CMSSW (cmsenv) and then set env for G4 otherwise it will ruin the environment settings and you will see error related to graphics.
Download & Install
Download latest stable version(4.9.6 patch2)
See detailed installation instructions from
http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/
For a quick installation of 4.9.6 patch just copy paste following lines on terminal :
### On lxplus 445
mkdir GEANT
cd GEANT
wget http://geant4.cern.ch/support/source/geant4.9.6.p02.tar.gz
tar -xzvf geant4.9.6.p02.tar.gz
mkdir geant4.9.6-build
ls
cd geant4.9.6-build/
cmake -DCMAKE_INSTALL_PREFIX=/afs/cern.ch/work/k/khurana/GEANT/geant4.9.6.p02-install -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_RAYTRACER_X11=ON /afs/cern.ch/work/k/khurana/GEANT/geant4.9.6.p02
#or @ cmssusy use
#/opt/exp_soft/misc/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=/cmshome/khurana/GEANT/geant4.9.6.p02-install -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_RAYTRACER_X11=ON /cmshome/khurana/GEANT/geant4.9.6.p02
make -j2 ## this will take almost 30 mins (depends on your system also)
make install
included the following in CmakeLists.txt:
find_package(ROOT)
include_directories(${ROOT_INCLUDE_DIR})
MESSAGE(${ROOT_LIBRARIES})
target_link_libraries(fcalor ${Geant4_LIBRARIES} ${ROOT_LIBRARIES})
cmake again
You can use directly Root classes from your
Geant4 application.
To use Root histogram in eg. Geant4 novice example N02,
you just have to add in the makefile
(examples/novice/N02/GNUmakefile)
the following lines:
CPPFLAGS += -I$(ROOTSYS)/include
EXTRALIBS = $(shell root-config --glibs)
before
include $(G4INSTALL)/config/binmake.gmk
Once Installed go through following link to run the examples.
http://www.tunl.duke.edu/~tajima/geant4/handson1.html
Follow the link to write own geometry from scratch :
http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/ForApplicationDeveloper/html/GettingStarted/mainProgram.html