GEANT4 Installation Instructions

From New IAC Wiki
Jump to navigation Jump to search
Make directory GEANT4.
1.)
Under the directory GEANT4 makdir CLHEP and put into the directory CLHEP the source file of CLHEP, which can be downloaded from here

http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/distributions/clhep-2.0.3.1.tgz

soniatemo@inca:~/GEANT4/CLHEP$ ls
clhep-2.0.3.1.tgz
In GEANT4 directory make "geant4files" directory and copy geant4 source file and all data files that you need in geant4files directory

http://geant4.cern.ch/support/source/geant4.9.1.p02.tar.gz
http://geant4.cern.ch/support/source/G4NDL.3.10.tar.gz
http://geant4.cern.ch/support/source/G4NDL.0.2.tar.gz
http://geant4.cern.ch/support/source/G4EMLOW.4.2.tar.gz
http://geant4.cern.ch/support/source/PhotonEvaporation.2.0.tar.gz
http://geant4.cern.ch/support/source/G4RadioactiveDecay.3.1.tar.gz

soniatemo@inca:~/GEANT4$ cd geantfiles/
soniatemo@inca:~/GEANT4/geantfiles$ ls
G4EMLOW.4.2.tar.gz  G4NDL.3.10.tar.gz              geant4.9.1.p02.tar.gz
G4NDL.0.2.tar.gz    G4RadioactiveDecay.3.1.tar.gz  PhotonEvaporation.2.0.tar.gz
 
2.) CLHEP Installation
soniatemo@inca:~/GEANT4$ cd CLHEP/

soniatemo@inca:~/GEANT4/CLHEP$ ls
clhep-2.0.3.1.tgz
Unpack the source file
soniatemo@inca:~/GEANT4/CLHEP$ tar xzf clhep-2.0.3.1.tgz
After you are done do the following

soniatemo@inca:~/GEANT4/CLHEP/2.0.3.1/CLHEP$ ./configure --prefix=/home/soniatemo/GEANT4/CLHEP --disable-shared
At the end you should get

config.status: creating test/exctestNothrow.sh
config.status: creating test/excDblThrow.sh
config.status: creating Exceptions/defs.h
config.status: executing depfiles commands
5.) Make and Install
soniatemo@inca:~/GEANT4/CLHEP/2.0.3.1/CLHEP$ make && make install


/usr/bin/install -c -m 644 'libCLHEP-2.0.3.1.a' '/home/soniatemo/GEANT4/CLHEP/lib/libCLHEP-2.0.3.1.a'
ranlib '/home/soniatemo/GEANT4/CLHEP/lib/libCLHEP-2.0.3.1.a'
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/soniatemo/GEANT4/CLHEP/2.0.3.1/CLHEP'
make[1]: Leaving directory `/home/soniatemo/GEANT4/CLHEP/2.0.3.1/CLHEP'


Make sure that under the CLHEP directory you have "include" and "lib" directories.
soniatemo@inca:~/GEANT4/CLHEP$ ls
2.0.3.1  bin  clhep-2.0.3.1.tgz  include  lib

Installation of CLHEP is done.
6.) GEANT4 Installation
soniatemo@inca:~/GEANT4$ ls
CLHEP  geant4  geantfiles


7.) Unpack the geant4 source file and put it in the following directory /home/soniatemo/GEANT4/geant4
soniatemo@inca:~/GEANT4/geantfiles$ tar xzf geant4.9.1.p02.tar.gz -C /home/soniatemo/GEANT4/geant4
soniatemo@inca:~/GEANT4/geantfiles$ cd ../
soniatemo@inca:~/GEANT4$ ls
CLHEP  geant4  geantfiles
soniatemo@inca:~/GEANT4$ cd geant4/
soniatemo@inca:~/GEANT4/geant4$ ls
geant4.9.1.p02

8.)
soniatemo@inca:~/GEANT4/geantfiles$ ls

G4EMLOW.4.2.tar.gz  G4NDL.3.10.tar.gz              geant4.9.1.p02.tar.gz
G4NDL.0.2.tar.gz    G4RadioactiveDecay.3.1.tar.gz  PhotonEvaporation.2.0.tar.gz
Start unpacking data files and put them into directory /home/soniatemo/GEANT4/geant4/data

soniatemo@inca:~/GEANT4/geantfiles$ tar xzf PhotonEvaporation.2.0.tar.gz -C /home/soniatemo/GEANT4/geant4/data
soniatemo@inca:~/GEANT4/geantfiles$ tar xzf G4RadioactiveDecay.3.1.tar.gz -C /home/soniatemo/GEANT4/geant4/data
soniatemo@inca:~/GEANT4/geantfiles$ tar xzf G4EMLOW.4.2.tar.gz -C /home/soniatemo/GEANT4/geant4/data
soniatemo@inca:~/GEANT4/geantfiles$ tar xzf G4NDL.3.10.tar.gz -C /home/soniatemo/GEANT4/geant4/data

soniatemo@inca:~/GEANT4/geantfiles$ cd ../
soniatemo@inca:~/GEANT4$ cd geant4/data/
soniatemo@inca:~/GEANT4/geant4/data$ ls

G4EMLOW4.2  G4NDL3.10  PhotonEvaporation2.0  RadioactiveDecay3.1

9.) Configure
soniatemo@inca:~/GEANT4/geant4/geant4.9.1.p02$ ./Configure -build


10.)
[Type carriage return to continue] (ENTER)
11.)
Definition of G4SYSTEM variable is Linux-g++.
That stands for:
1) OS           : Linux
2) Compiler     : g++
To modify default settings, select number above (e.g. 2) 
[Press [Enter] for default settings] (ENTER)


12.)
I can set things up so that your shell scripts and binaries are more portable,
at what may be a noticable cost in performance.  In particular, if you
ask to be portable, the following happens:
    1) Shell scripts will rely on the PATH variable rather than using
       the paths derived above.
    2) ~username interpretations will be done at run time rather than
       by Configure.
Do you expect to run these scripts and binaries on multiple machines? [n] y (ENTER)
13.)
Where is Geant4 source installed? 
[/home/soniatemo/GEANT4/geant4/geant4.9.1.p02] 
Specify the path where Geant4 libraries and source files should be
installed. 
[/home/soniatemo/GEANT4/geant4/geant4.9.1.p02] 
Do you want to copy all Geant4 headers 
in one directory? [n] y (ENTER)
14.)
Please, specify default directory where ALL the Geant4 data is installed:
G4LEVELGAMMADATA:              /home/soniatemo/GEANT4/geant4/geant4.9.1.p02/data/PhotonEvaporation2.0
G4RADIOACTIVEDATA:             /home/soniatemo/GEANT4/geant4/geant4.9.1.p02/data/RadioactiveDecay3.2
G4LEDATA:                      /home/soniatemo/GEANT4/geant4/geant4.9.1.p02/data/G4EMLOW5.1
G4NEUTRONHPDATA:               /home/soniatemo/GEANT4/geant4/geant4.9.1.p02/data/G4NDL3.12
G4ABLADATA:                    /home/soniatemo/GEANT4/geant4/geant4.9.1.p02/data/G4ABLA3.0
You will be asked about customizing these next. 
[/home/soniatemo/GEANT4/geant4/geant4.9.1.p02/data] /home/soniatemo/GEANT4/geant4/data            


15.)
[/home/soniatemo/GEANT4/geant4/geant4.9.1.p02/data] /home/soniatemo/GEANT4/geant4/data                   
Please, specify default directory where the Geant4 data is installed:
1) G4LEVELGAMMADATA:            /home/soniatemo/GEANT4/geant4/data/PhotonEvaporation2.0
2) G4RADIOACTIVEDATA:           /home/soniatemo/GEANT4/geant4/data/RadioactiveDecay3.2
3) G4LEDATA:                    /home/soniatemo/GEANT4/geant4/data/G4EMLOW5.1
4) G4NEUTRONHPDATA:             /home/soniatemo/GEANT4/geant4/data/G4NDL3.12
5) G4ABLADATA:                  /home/soniatemo/GEANT4/geant4/data/G4ABLA3.0
To modify default settings, select number above (e.g. 2) 
[Press [Enter] for default settings] 
16.)
Could not find CLHEP installed on this system!
Please, specify where CLHEP is installed:
CLHEP_BASE_DIR:                   /home/soniatemo/GEANT4/CLHEP


17.)
You can customize paths and library name of you CLHEP installation:
1) CLHEP_INCLUDE_DIR:           /home/soniatemo/GEANT4/CLHEP/include
2) CLHEP_LIB_DIR:               /home/soniatemo/GEANT4/CLHEP/lib
3) CLHEP_LIB:                   CLHEP
To modify default settings, select number above (e.g. 2)
[Press [Enter] for default settings] (ENTER)
18.)
By default 'static' (.a) libraries are built.
Do you want to build 'shared' (.so) libraries?
[n] (ENTER)


Do you want to build 'global' compound libraries? [n] y (ENTER)


Granular libraries are used by defaults, you asked to build global
compound libraries. Do you want to build 'granular' libraries too?
[n] 


Do you want to compile libraries in DEBUG mode (-g)? [n] (ENTER)


19.)
G4UI_NONE
If this variable is set, no UI sessions nor any UI libraries are built. 
This can be useful when running a pure batch job or in a user framework 
having its own UI system.
Do you want to set this variable ?
[n] (ENTER)
G4UI_BUILD_XAW_SESSION
G4UI_USE_XAW
Specifies to include and use the XAW interfaces in the
application to be built.
The XAW (X11 Athena Widget set) extensions are required to activate 
and build this driver.
[n] (ENTER)
G4UI_BUILD_XM_SESSION
G4UI_USE_XM
Specifies to include and use the XM Motif based user interfaces.
The XM Motif extensions are required to activate and build this
driver.
[n] (ENTER)
G4UI_BUILD_QT_SESSION
G4UI_USE_QT
Setting these variables will enable the building of the G4 Qt based 
user interface module and the use of this module in your applications
respectively.
The Qt4 headers, libraries and binaries are required to enable the
building of this module.
### WARNING! THIS FEATURE IS EXPERIMENTAL IN THIS RELEASE! ###
### WARNING! THIS FEATURE WILL ONLY WORK WITH Qt4!         ###
Do you want to enable build and use of this module?
[n] (ENTER)

G4VIS_NONE
If this variable is set, no visualization drivers will be built or used.
Do you want to set this variable ?
[n] (ENTER)


20.)
G4VIS_BUILD_OPENGLX_DRIVER
G4VIS_USE_OPENGLX
It is an interface to the de facto standard 3D graphics library,
OpenGL. It is well suited for real-time fast visualization
and prototyping. The X11 version of the OpenGL libraries is
required.
[n] y (ENTER)
21.)
G4VIS_BUILD_OPENGLXM_DRIVER
G4VIS_USE_OPENGLXM
It is an interface to the de facto standard 3D graphics library,
OpenGL. It is well suited for real-time fast visualization
and prototyping. The X11 version of the OpenGL libraries and 
the Motif Xm extension is required.
[n] (ENTER)


G4VIS_BUILD_DAWN_DRIVER
G4VIS_USE_DAWN
DAWN drivers are interfaces to the Fukui Renderer DAWN. DAWN is
a vectorized 3D PostScript processor suited to prepare technical
high quality outputs for presentation and/or documentation.
[n] y (ENTER)
22.)
G4VIS_BUILD_OIX_DRIVER
G4VIS_USE_OIX
The OpenInventor driver is based on OpenInventor technology 
for scientific visualization.
The X11 version of OpenInventor is required.
[n] (ENTER)
23.)
G4VIS_BUILD_RAYTRACERX_DRIVER
G4VIS_USE_RAYTRACERX
Allows for interactive ray-tracing graphics through X11.
The X11 package is required.
[n] (ENTER)
G4VIS_BUILD_VRML_DRIVER
G4VIS_USE_VRML
These driver generate VRML files, which describe 3D scenes to be 
visualized with a proper VRML viewer.
[n] y (ENTER)
24.)
OGLHOME/include
OGLHOME/lib
You have selected to use OpenGL driver.
Specify the correct path (OGLHOME) where OpenGL is installed in your system.
It was found in /usr. Press [Enter] to set this path or type the correct one.
You can set '-' (without quotation) to CANCEL the OpenGL flag at all: 
[/usr] (ENTER)


25.)
G4VIS_BUILD_OPENGLQT_DRIVER
G4VIS_USE_OPENGLQT
Setting these variables will enable the building of the G4 OpenGL Qt based
visualisation driver and the use of this driver in your applications
respectively.
The Qt4 headers, libraries and binaries are required to enable the
building of this module.
### WARNING! THIS FEATURE IS EXPERIMENTAL IN THIS RELEASE! ###
### WARNING! THIS FEATURE WILL ONLY WORK WITH Qt4!         ###
Do you want to enable build and use of this module?
[n] (ENTER)
26.)
G4LIB_BUILD_G3TOG4  
The utility module 'g3tog4' will be built by setting this
variable. NOTE: it requires a valid FORTRAN compiler to be
installed on your system and the 'cernlib' command in the
path, in order to build the ancillary tools!
Do you want to build 'g3tog4' ? 
[n] (ENTER)

G4LIB_BUILD_ZLIB  
Do you want to activate compression for output files
generated by the HepRep visualization driver? 
[n] (ENTER) 

G4ANALYSIS_USE
Activates the configuration setup for allowing plugins to
analysis tools based on AIDA (Astract Interfaces for Data
Analysis). In order to use AIDA features and compliant analysis
tools, the proper environment for these tools will have to be
set (see documentation for the specific analysis tools).
[n]  (ENTER) 
End of configuration phase. Stripping down executable paths... Creating configuration setup file... WARNING: the generated configuration file can be edited if necessary! You can introduce any change to the configuration file /home/soniatemo/GEANT4/geant4/geant4.9.1.p02/.config/bin/Linux-g++/config.sh before th inal installation. To do so, use a shell escape now (e.g. !vi /home/soniatemo/GEANT4/geant4/geant4.9.1.p0 config/bin/Linux-g++/config.sh). Press [Enter] to start installation or use a shell escape to edit config.sh: (ENTER)
27.)
Creating/replacing object files in /home/soniatemo/GEANT4/geant4/geant4.9.1.p02/lib/Linux-g++/libG4OpenGL.a ...
ar: creating /home/soniatemo/GEANT4/geant4/geant4.9.1.p02/lib/Linux-g++/libG4OpenGL.a
Building library management utility liblist ...
Libraries installation completed !
####################################################
# Your Geant4 installation seems to be successful!  
# To be sure please have a look into the log file:  
# /home/soniatemo/GEANT4/geant4/geant4.9.1.p02/.config/bin/Linux-g++/g4make.log                                
####################################################
soniatemo@inca:~/GEANT4/geant4/geant4.9.1.p02$ 
28.)
soniatemo@inca:~/GEANT4/geant4/geant4.9.1.p02$ ls
bin     Configure     examples  lib      ReleaseNotes  tmp
config  environments  include   LICENSE  source


29.) The setup script
soniatemo@inca:~/GEANT4/geant4/geant4.9.1.p02$ ./Configure

               --- Geant4 Toolkit Installation  ---
                 (setting environments for USER )
---------------------------------------------------
The Geant4 toolkit installation was found.
The files env.[c]sh will be copied to your current directory.
For setting Geant4 environments you should make:
source env.csh
or
. env.sh
It will also check G4WORKDIR setting and set it to
your HOME if needed.
You can use these files also for further modifications
(adding your own environments).
---------------------------------------------------
30.)
soniatemo@inca:~/GEANT4/geant4/geant4.9.1.p02$ ls
bin     Configure  environments  examples  lib      ReleaseNotes  tmp
config  env.csh    env.sh        include   LICENSE  source


31.) Configuring the Environment
soniatemo@inca:~/GEANT4/geant4/geant4.9.1.p02$ export LD_LIBRARY_PATH=~/CLHEP/lib/:$LD_LIBRARY_PATH
soniatemo@inca:~/GEANT4/geant4/geant4.9.1.p02$ source env.sh


On this machine the G4SYSTEM=Linux-g++
On this machine the G4INSTALL=/home/soniatemo/GEANT4/geant4/geant4.9.1.p02
On this machine the G4INCLUDE=/home/soniatemo/GEANT4/geant4/geant4.9.1.p02/i
clude/
On this machine the G4LIB=/home/soniatemo/GEANT4/geant4/geant4.9.1.p02/lib
On this machine the G4LEVELGAMMADATA=/home/soniatemo/GEANT4/geant4/data/Phot
nEvaporation2.0
On this machine the G4RADIOACTIVEDATA=/home/soniatemo/GEANT4/geant4/data/Rad
oactiveDecay3.2
On this machine the G4LEDATA=/home/soniatemo/GEANT4/geant4/data/G4EMLOW5.1
On this machine the G4NEUTRONHPDATA=/home/soniatemo/GEANT4/geant4/data/G4NDL
.12
On this machine the G4ABLADATA=/home/soniatemo/GEANT4/geant4/data/G4ABLA3.0
On this machine the CLHEP_BASE_DIR=/home/soniatemo/GEANT4/CLHEP
On this machine the CLHEP_INCLUDE_DIR=/home/soniatemo/GEANT4/CLHEP/include
On this machine the CLHEP_LIB_DIR=/home/soniatemo/GEANT4/CLHEP/lib
On this machine the CLHEP_LIB=CLHEP
On this machine the G4VIS_BUILD_DAWN_DRIVER=1
On this machine the G4VIS_BUILD_OPENGLX_DRIVER=1
On this machine the G4VIS_BUILD_VRML_DRIVER=1
On this machine the G4VIS_USE_DAWN=1
On this machine the G4VIS_USE_OPENGLX=1
On this machine the G4VIS_USE_VRML=1
On this machine the XMFLAGS=
On this machine the XMLIBS=
On this machine the XMFLAGS=
On this machine the XAWFLAGS=
On this machine the XAWLIBS=
On this machine the G4LIB_BUILD_STATIC=1
On this machine the G4UI_USE_TCSH=1

33.)
soniatemo@inca:~/GEANT4/geant4/geant4.9.1.p02$ cd examples/novice/N02
soniatemo@inca:~/GEANT4/geant4/geant4.9.1.p02/examples/novice/N02$ make


Making dependency for file exampleN02.cc ...
Making dependency for file src/ExN02TrackerSD.cc ...
Making dependency for file src/ExN02TrackerHit.cc ...
Making dependency for file src/ExN02SteppingVerbose.cc ...
Making dependency for file src/ExN02SteppingAction.cc ...
Making dependency for file src/ExN02RunAction.cc ... 


ending
Compiling ExN02TrackerSD.cc ...
Creating/replacing object files in /home/soniatemo/g4work/tmp/Linux-g++/exampleN02/libexampleN02.a ...
ar: creating /home/soniatemo/g4work/tmp/Linux-g++/exampleN02/libexampleN02.a
Compiling exampleN02.cc ...
Using global libraries ...
Linking exampleN02 ...
... Done!


34.)
soniatemo@inca:~/GEANT4/geant4/geant4.9.1.p02/examples/novice/N02$ exampleN02

ExampleN02 GEANT4.png


OpenGL Installation
1.) Download MesaLib-7.0.tar.gz and MesaGLUT-7.0.tar.gz from the following website

http://ftp.icm.edu.pl/packages/mesa/

2.) Unpack them

~/OpenGl > tar -zxvf MesaLib-7.0.tar.gz
~/OpenGl > tar -zxvf MesaGLUT-7.0.tar.gz 
3.)
~/OpenGl > Mesa-7.0  MesaGLUT-7.0.tar.gz  MesaLib-7.0.tar.gz  tar
Navigate to Mesa-7.0 directory and type "make linux-x86"
Mesa-7.0 > make linux-x86



References

1.) http://geant4.cern.ch/
2.) http://geant4.slac.stanford.edu/tutorial/installation/Geant4.9.0/Linux/Geant4_9_0_Linux_Installation.htm
3.) http://ftp.icm.edu.pl/packages/mesa/


Go Back