Day 1 - Geant4 Basics

OBJECTIVE

Start Geant4 novice example.

HOW

For background information see Getting Started

To start tutorial create an empty directory you will use for all exercises and cd in it.

        % mkdir g4course2011
        % cd g4course2011

To start Geant4 a set of environment varials should be defined. For the purposes of the tutorial, Geant4 and ROOT environment variables are initialised in shell script and are available after each login.

        % env | grep G4
        % env | grep ROOT

PRACTICE

Exercise 1.1 : Geant4 environment

Study the most important Geant4 environment variables and basic structure of directories.
        % echo $G4INSTALL
        % ls   $G4INSTALL

        % echo $CLHEP_BASE_DIR
        % echo $G4SYSTEM
        % echo $G4WORKDIR
and activate the vanilla Geant4 interface for this exercise.
	% unset G4UI_USE_QT
        % unset G4UI_USE_XM

Exercise 1.2 : compile and run novice example N02

Copy example from the repository to the local place compile and run.
        % cp -r $G4INSTALL/examples/novice/N02 ./
        % cd N02
        % gmake -j2
        % ls $G4WORKDIR 
        % ls $G4WORKDIR/bin/Linux-g++/
        % exampleN02
or alternatively
        % $G4WORKDIR/bin/Linux-g++/exampleN02 
        Idle> /gun/particle proton
        Idle> /gun/energy 2 GeV
        Idle> /run/beamOn 1
        Idle> /gun/particle gamma
        Idle> /run/beamOn 1
        Idle> /gun/particle mu+
        Idle> /tracking/verbose 1
        Idle> /run/beamOn 1
        Idle> exit
end the program using
        Idle> exit   

Exercise 1.3 : study novice example N02

Try to understand the structure of the example. Which classes are mandatory?
        % ls
        % less README
        % less exampleN02.cc
        % ls include
        % ls src

Exercise 1.4 : study extended example TestEm3

Try to understand the structure of the extended electromagnetic example of sampling calorimeter.
        % cd ../
        % ls
        % cp -r $G4INSTALL/examples/extended/electromagnetic/TestEm3 ./
        % cd TestEm3
        % gmake
        % ls $G4WORKDIR 
        % ls $G4WORKDIR/bin/Linux-g++/
        % $G4WORKDIR/bin/Linux-g++/TestEm3 
Default geometry: 50 layers 2.3 mm Lead and 5.7 mm liquid Argon
        Idle> /gun/particle e-
        Idle> /gun/energy 1 GeV
        Idle> /run/beamOn 1

Generated on Tue May 10 17:25:54 2011