Set up


Basics

This snippet uses Monte Carlo simulations to study the response of nuclear physics detectors to radiation. It uses the C++ libraries package Geant4.

The program to run is sim1/test.cc. It defines and creates all the necessary tools to launch a simulation. It also checks for certain environment variables that you may define when you work with Geant4. The relevant subroutines are in the src and include folders, where the source and header files are, respectively.

Once the program is compiled with the Geant4 libraries, the executable is generated in the bin/Linux-g++/ folder. You can run it by typing:

$ . ./bin/Linux-g++/test

The tracks can be visualized with vis.mac. This macro can be edited to try different configurations in DAWN. There is a manual in the DAWN tutorial page.

The detailed information of the tracks can be studied with the macro print-track.mac. The spectra of deposited energy can be obtained with spec-eff.mac and then visualized with hplot.cpp in ROOT, to calculate the total and peak efficiency.

Before you compile and run this program, you will need to install the Geant4 libraries.

GEANT4 Installation Guide

This short set of instructions are written to help in an individual installation of GEANT4. A file .geant_myconfig containing environment variables for GEANT4 should be used with this instructions. Please, check the additional documentation in the GEANT4 pages.

The guide has been elaborated using Fedora Core 3 with gcc3.4.2 and gcc3.4.3 and GEANT4.7.0.p01 with CLHEP 1.8.1.0. Please, note that paths and installation details could be different using other Linux flavours, compilers...

Check your OS installation.

Download the following files

Most of them available from the GEANT4 main web, section download:

CLHEP installation

Create a directory for the GEANT4 code

I normally use the directory name G4 in my local account.

Now you have two possibilities:

Once the process of building the libraries has been completed successfully, the Geant4 toolkit can be installed in the specified (already existing) installation area by typing:

$./Configure -install

(I do not use this command and I stay with the program in the directory where it was compiled).

Test

Test the available GEANT4 examples, following the instruction in their README.

OPTIONAL: If you want a user interface for Geant4, download the G4UIROOT program and follow the installation instructions

Geant4 configuration file

#! /bin/tcsh

export G4SYSTEM          = Linux-g++
export G4INSTALL         = /home/admin/G4/geant4.7.0.p01
export CLHEP_BASE_DIR    = /usr/local/clhep
export CLHEP_NAME        = CLHEP
export CLHEP_LIB_DIR     = $CLHEP_BASE_DIR/lib
export CLHEP_INCLUDE_DIR = $CLHEP_BASE_DIR/include


#optionals... see manuals
export G4WORKDIR              = /home/admin/G4/geant4.7.0.p01
export G4TMP                  = $G4WORKDIR/tmp
export G4BIN                  = $G4WORKDIR/bin
export G4INCLUDE              = $G4INSTALL/include
export G4UI_USE_TCSH          = 1
export G4LEVELGAMMADATA       = $G4WORKDIR/data/PhotonEvaporation
export G4RADIOACTIVEDATA      = $G4WORKDIR/data/RadiativeDecay
export G4LEDATA               = $G4WORKDIR/data/G4EMLOW2.3
export NeutronHPCrossSections = $G4WORKDIR/data/G4NDL3.7
export G4ELASTICDATA          = $G4WORKDIR/data/Elastic


export G4ANALYSIS_USE     = 1
export G4DEBUG            = 1
export G4LIB_BUILD_G3TOG4 = 1
export G4USE_G3TOG4       = 1
export G4LIB_BUILD_SHARED = 1
export G4LIB_BUILD_STATIC = 1
export G4LIB_USE_GRANULAR = 1


#visualization
#export G4UI_BUILD_XAW_SESSION      = 1
#export G4UI_BUILD_XM_SESSION       = 1
export G4VIS_BUILD_OPENGLX_DRIVER  = 1
#export G4VIS_BUILD_OPENGLXM_DRIVER = 1
#export G4VIS_BUILD_DAWN_DRIVER     = 1

#export G4UI_USE_XAW       = 1
#export G4UI_USE_XM        = 1
export G4VIS_USE_OPENGLX  = 1
#export G4VIS_USE_OPENGLXM = 1
#export G4VIS_USE_DAWN     = 1


#ROOT INTERFACE TO G4
export G4UI_BUILD_ROOT_SESSION = 1
export G4UI_USE_ROOT           = 1
export OGLHOME = /usr/X11R6/lib



LD_LIBRARY_PATH = $G4WORKDIR/lib/Linux-g++:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

LD_LIBRARY_PATH = /usr/local/clhep/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

PATH = $G4INSTALL/bin/Linux-g++:$PATH
export PATH

echo GEANT4 Variables Configured...
				

ROOT configuration file

#! /bin/tcsh

# Variables
setenv ROOTSYS /afs/ific.uv.es/project/gamma/root_v3.10.02.Linux.RH7.3.gcc296

# Paths
set path = ($path $ROOTSYS/bin)

# Library paths
setenv LD_LIBRARY_PATH $ROOTSYS/lib
				

Resources

Check out the official Geant4 installation guide

Published: 2006-04-28 15:56:04