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:
- Element and material definition
- Geometry (define & modify)
- Generation of primary particles
A Geant4 application example is provided, which serves as basis of the exercises. The exercises include the modification
and/or extension of the following classes:
- DetectorConstruction
- PrimaryGenerator
Exercises
Part I - Introductory exercises
Exercise 2-1
Get familiar with the classes of the example application, that correspond to the
topic of the exercises.
The following diagram shows the class hierarchy of the detector (click here for a
PDF file):
The class hierarchy of the primary generator is shown in the second diagram (click here for a pdf file):
Answer the following questions:
- Which are the base classes of the following user classes?
- DetectorConstrution
- PrimaryGenerator
- Which of above classes is mandatory for a Geant4 application?
- Which virtual method do you have to overload in your DetectorConstruction? What does it return?
- Which virtual method do you have to overload in your PrimaryGenerator? What does it do?
- How do you define a G4Material (molecule, material or compound)?
- What are the mandatory ingredients to define a G4Material? And the optional ones?
- Which G4VSolid specializations describe boxes, cylinders and spheres?
- How would you define a cylindrical sector of
π/4 opening angle?
- What is the difference between a solid and a logical volume?
- What is the difference between a logical and a physical volume?
- What does it mean that a volume is the daughter of another one?
- Is it possible for a volume to protrude from its mother?
- Sensitive and visualization attributes are attached to logical or physical volumes?
- Which concrete generator (namely, inheriting from G4VPrimaryGenerator)
is used in the tutorial
example to shoot primary particles?
- How can you get a pointer to the electron G4ParticleDefinition?
Part II - Materials
Exercise 2-2
In the DetectorConstruction.cc class define the following G4Isotopes (stable isotopes of
germanium); then define a G4Element, which is germanium enriched in Ge-76.
- Ge-72: Z=32, A=72, atomic mass=71.92 g/mole, isotopic abundance = 0.1%
- Ge-73: Z=32, A=73, atomic mass=73.0 g/mole, isotopic abundance = 0.2%
- Ge-74: Z=32, A=74, atomic mass=74.0 g/mole, isotopic abundance = 13.1%
- Ge-76: Z=32, A=76, atomic mass=76.0 g/mole, isotopic abundance = 86.6%
Define a G4Material, as metallic germaniumm with density=5.32 g/cm3.
Exercise 2-3
- Define a G4Material, liquid nitrogen,
consisting of one element (nitrogen):
- Z=7,
- A=14.01 g/mole,
- density=0.808 g/cm3,
- temperature=77 K
- Define a gaseous G4Material, air, as a mixture of nitrogen (80% in mass) and oxygen
(20% in mass).
- Density=1.290 mg/cm3,
- pressure=1 atm,
- temperature=300 K.
- Elemental properties
of nitrogen are listed above. For oxygen: Z=8 and A=15.9994 g/mole
Part III - Geometry
Exercise 2-4
- Replace the material of the world volume (worldVolLogic): from vacuum to air
- Include in the setup a cylinder made of liquid nitrogen, radius = 10 cm, height = 20 cm.
This volume
should be daughter of the world volume and mother of the silicon box
- Place the nitrogen volume in the centre of the air world volume
- Rotate the liquid nitrogen volume, in such a way that the cylinder axis corresponds to the x-axis,
rather than the z-axis (default). This corresponds to rotating the cylinder by
π/2 with respect to the y-axis
- This volume is not sensitive.
- Define detVolPhys as a daugther of the nitrogen cylinder. Keep the same translation as before, namely
(0,0,boxLength*0.5) with respect to the global coordinate system. Be careful: the mother volume is rotated!
Exercise 2-5
- Re-define the material of detVolLogic from silicon to enriched germanium
- Change the maximum step size in the detVolLogic from 1.0 micrometer to 0.5 micrometer
(note: this can be also changed interactively with the command /detector/maxStepSize). Set the maximum step size
in liquid nitrogen to 0.1 mm.
- Do you need to re-define or update the read-out geometry? Why?
Part IV - Primary generator
Exercise 2-6
In the default case, the primary particle is a 1 MeV electron impinging
perpendicularly on a side of the detector box. The beam angle can be changed interactively by the command /source/incidentAngle
- for each event, draw a random number x in [0,1] using G4UniformRand(), and shoot an electron if
x=0.5 and a positron (G4Positron) if x>0.5
- what does it happen if you generate a positron at rest (namely zero kinetic energy)?
Exercise 2-7
Remove the code produced within the previous exercise, and replace the "pencil beam" defined by default
with a isotropic point source.
The source should be
placed 1 cm above the centre of the detector (on z axis).
It emits 662-keV gamma-rays with isotropic angular distribution.
Exercise 2-8
Generate a point source, as before, emitting gamma-rays of 122 keV (branching ratio: 86%) and 136 keV
(branching ratio: 14%)
|