Exercises and Solutions - Day 3 (May 21st)

Exercises: Exercises of the day

Exercises and solutions - Part I

The solutions are indicated in red.

Part I - Introductory Exercises

Exercise 3-1
Get familiar with the classes of the example application, which are subject of the exercises: PhysicsList and various concrete physics constructor classes: Also try to understand the class hierarchies (abstract base class, concrete user implementation) of the relevant classes.

The following diagrams shows the class hierarchies for the physics list and various physics constructors (click here for a files: A, B, C):

Class Diagram 3A (Day 3)

Class Diagram 3B (Day 3)

Class Diagram 3C (Day 3)

Answer following questions:

Exercise 3-2
Based on the provided macro file electronbeam.mac try to create a new macro file (protonbeam.mac) for a primary proton beam, which contains the following physics setup:

For each of above physics components a physics constructor is already implemented. Use the PhysicsList class to determine the parameters of the command
/physics/physConstructor
which activate the various constructors listed above. Furthermore, adapt the beam parameters according to the following values: Run the Geant4 application example using the new macro file for protons.

Once your macro file is completed and the application runs successfully, try to to add the visualization functionality as shown in the macro electronbeam_vis.mac to your proton macro file. Add a line setting the color of proton tracks to yellow. Rerun the application with the modified macro file.
The required physics constructors are instantiated by including the following commands in the macro file:
# electromagnetic physics for charged hadrons and ions: low energy models
/physics/physConstructor EM-HadronIon-LowEnergy
#
# electromagnetic physics for electrons: penelope models
/physics/physConstructor EM-Electron-Penelope
#
# electromagnetic physics for positrons: standard models
/physics/physConstructor EM-Photon-Penelope
#
# electromagnetic physics for positrons: standard models
/physics/physConstructor EM-Positron-Standard
#
# elastic hadronic physics for hadrons and ions: LElastic model
/physics/physConstructor HE-HadronIon-LElastic
#
# inelastic hadronic physics for protons and neutrons: binary model
/physics/physConstructor HI-ProtonNeutron-Inelastic
#
# inelastic hadronic physics for ions: binary model
/physics/physConstructor HI-Ion-Binary
The beam parameters should be set to the following values:
/source/primParticle   proton
/source/primEnergy     50.000 MeV
/source/sigmaEnergy    300.0 keV
/source/incidentAngle  45.0 deg
The visualization of tracks, required in the last part of the exercise, is activated by using the commands
/vis/scene/create
/vis/open OGLIX
/vis/viewer/flush
/vis/viewer/set/viewpointThetaPhi 120 20
#
#
# Many other options available with /vis/modeling and /vis/filtering.
/vis/modeling/trajectories/create/drawByParticleID
/vis/modeling/trajectories/drawByParticleID-0/set e- red
/vis/modeling/trajectories/drawByParticleID-0/set gamma green
/vis/modeling/trajectories/drawByParticleID-0/set proton yellow
/vis/scene/endOfEventAction accumulate
and after the initialization:
/tracking/storeTrajectory 1
The macro files can be found here:
protonbeam.mac
protonbeam_vis.mac