Exercises - Day 4 (May 22nd)

Content:
Introduction
Exercises
Part I
Part II
Part III
Part IV

Solutions:
Part I
Part II
Part III
Part IV

Web:
SW references

Manual:
Appl. Dev. Man

Presentations:
Slides

Main:
Main

Introduction

Today's exercises cover the following items:

The Geant4 application example, which is presented on the main page, serves again as the basis of the exercises. Do not use the example with your modifications from the last two days, but download again the original tar-ball (you may find the instructions on the main page).
The exercises include the modification and/or extension of the following classes:

Exercises

Part I - Introductory exercises

Exercise 4-1
Get familiar with the classes of the example application, which are subject of the exercises (see the
list above). Also try to understand the class hierarchies (abstract base class, concrete user implementation) of the relevant classes (see the below diagrams).

The following diagram shows the class hierarchy of the sensitive detector, hit, hits collection and readout geometry (click here for a pdf file):

Class Diagram 4A (Day 4)

The class hierarchy of user event action classes is shown in the second diagram (click here for a pdf file):

Class Diagram 4B (Day 4)

Answer following questions:

Part II - Sensitive Detector and Hits

Exercise 4-2*
Extend the functionality of the hit class, in order that lateral coordinates (x and y) of hits can also be stored. Implement appropriate get and set functions. Moreover extend the copy constructor and the assignment operator accordingly.

Exercise 4-3
This exercise provides a transition to part III (The topics covered in part II and III are closely linked, since the functionality of sensitive detectors allows to keep track of information which is basically retrieved from objects of classes like G4Track, G4Step or G4DynamicParticle):
In the ProcessHits method of your sensitive detector, retrieve the lateral coordinates of the particle step, and store them in the modified Hit class by using the new get functions.

Part III - Retrieval of information from tracks, steps and particle classes

Exercise 4-4
Introduce a conditional statement in the ProcessHits method of the sensitive detector, in order that hits are only created for primary particle tracks:

Exercise 4-5
Modify the conditional statement of the previous example, in order that hits are only created for secondary gammas:

Exercise 4-6
You can find
here the header file for a user tracking action class (the Geant4 exercise example does not yet included a user tracking action). The aim is to complete the class implementation and to integrate the class into the existing application:

  1. Class implementation:
    Introduce a counting mechnism in the method PostUserTrackingAction, which keeps track of the total number of secondary electrons produced in the simulation:
  2. Integration of user action class into the example:

Part IV - Analysis

For the following exercise the AIDA tutorial example must be downloaded and compiled:

  1. The analysis exercise should be performed in a c-shell environment. Execute:
    tcsh

  2. Create a new directory, e.g.
    mkdir analysis

  3. Copy the tar-ball AIDATutorial.tgz from /geant4_course/exercises/code into this directory and extract it:
    cd analysis
    cp /geant4_course/exercises/code/AIDATutorial.tgz .
    tar xzvf AIDATutorial.tgz

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

  5. Compile the analysis example:
    make

  6. The executable AIDATutorial is located in the current directory. Synopsis:
    ./AIDATutorial < AIDA XML file > < name of IHistogram1D object >
    E.g.:
    /AIDATutorial $HOME/exerciseday4/energydeposit.xml energydeposit

  7. The program creates an output file "histogram.ps" in the current directory.

Exercise 4-7
Use the AIDATutorial program to create plots of the longitudinal energy deposition for different particle beams and beam energies (prepare macro files for each particle-energy combination):