Exercises

Content:
Introduction
Application
Download
Exercises
Gallery

Exercises:
Day 2
Day 3
Day 4

Web:
SW references

Manual:
Appl. Dev. Man

Presentations:
Slides

Introduction

A Geant4 application example is provided, which serves as basis of the exercises. The same example is used as a starting point for each day, but the focus is on different parts of the application according to the specific topics presented in the morning lectures. Each day, the exercises include the modification and/or extension of a few classes of the simulation application.

A webpage was prepared for each exercise session, including instructions and hints, and links to solutions (which are only available after a given time interval). For each day, the exercises are grouped into several categories, which may cover different topics.

Links to the webpage for each day's exercise instructions can be found in the panel on the left.

On the panel you can also find important links, e.g. to the Geant4 software reference manual (online) or the Geant4 application developers manual.

Example Application

The Geant4 simulation example used in the exercises models a simple cuboid silicon detector. An electron beam is shot onto the detector, where the energy distribution is a Gaussian. The following beam parameters can be changed via macro commands

The geometry is illustrated in the below figure (click on the figure to enlarge it (.gif format). Alternatively, click here to get a high-resolution .eps plot of the geometry, or here for a .pdf file).

Class Diagram 4A (Day 4)

The detector setup in the application example consists of

The physics setup is organized in a modular physics list with the following components:

For each item a physics constructor exists, where the physics components must be explicitly activated in the macro file. For some components several physics constructors are implemented, including alternative physics models or processes.

Download Instructions and Environment Setup

Perform the following steps to prepare the environment:

  1. Login to the machine 10.12.95.182

  2. The exercises should be performed in a c-shell environment. Execute:
    tcsh

  3. For each day, create a new directory, e.g.
    mkdir exampleday2

  4. Copy the tar-ball G4Tutorial.tgz from /geant4_course/exercises/code into this directory and extract it:
    cd exampleday2
    cp /geant4_course/exercises/code/G4Tutorial.tgz ./
    tar xzvf G4Tutorial.tgz

  5. Set up the environment in your current working shell:
    source /geant4_course/config/env.tcsh

  6. Compile the example application:
    make
    (Remember to recompile the application code for each exercise that involves modifying the example)

  7. The executable Tutorial is in the directory $G4WORKDIR/bin/Linux-g++, where the environment variable G4WORKDIR is by default set to the path of your home directory, i.e. G4WORKDIR=/home/userXX/geant4. Perform a test run using the macro file electronbeam.mac:
    $G4WORKDIR/bin/Linux-g++/Tutorial electronbeam_vis.mac

  8. If you managed to run the macro file successfully, you are ready to start the exercises of the day. Good luck!

Exercises

Please note, that some exercises rely on the successful completion of previous exercises, i.e. previously introduced functionalities might be used at a later stage. These mandatory exercises are marked with a star next to the exercise number (*). If you don't manage to complete them by your own, try to understand the provided solutions and introduce the requested functionalites into your example.

Gallery

The following pictures show detector of the application example (the pictures were obtained with different visualization tools: VRML and Ray tracer).

Screenshot from VRML visualization:

Detector VRML

Ray tracer:

Detector Raytracer