Exercises and Solutions - Day 4 (May 22nd)
Exercises and solutions - Part I
The solutions are indicated in red.
Part I - Introductionary exercises
Exercise 4-1
Get familiar with the classes of the example application, which are subject of the exercises. 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):
The class hierarchy of user event action classes is shown in the second diagram (click here for a pdf file):
Answer following questions:
- What are the base classes of the following user classes?
- SensitiveDetector G4VSensitiveDetector
- DetectorReadOutGeometry G4VReadOutGeometry
- DetectorHit G4VHit
- UserEventAction G4UserEventAction
- Try to remember: Which of above classes is mandatory for a Geant4 application? None
- Does a sensitive detector require a readout geometry? No
- What is the primary mandate of a sensitive detector? To create hit objects
- Which method of the sensitive detector (SD) is called for each particle step (if the step is inside the logical volume the SD is attached to and provided the track is alive)? ProcessHits()
- In which member function of the DetectorReadOutGeometry class is the readout geometry constructed? What is the return value of this function? In the Build() function; it returns the pointer to the physical volume of the readout geometry world
- The readout geometry uses replicas of thin slices. Along which coordinate axis are the slices placed? z-axis
- The hit class of our example is capable of storing two different quantities. What are they? The energy deposition of the step and the center of the readout-slice along the z-axis.
- When are hit objects created in our application example:
- At the beginning of an event,
- at the end of an event,
- at the beginning of a step or
- at the end of a step?
End of a step
- At what level of tracking is the information of hits filled into analysis objects in our simulation application: Step, Event or Run? Event
- What are the names of the member functions, where DetectorHit objects are created and filled, and where the hit information filled into analysis objects? ProcessHits() (of the SensivitveDetector class), EndOfEventAction() (of the UserEventAction class)
- A G4Event object holds a pointer to a class which stores all hits collections at the end of an event. What is the name of this class? G4HCofThisEvent
- What is required to retrieve the pointer to a hits collection from this class: The hits collection name or the collection index? The unique collection index (the collection index is obtained from the G4SDManager using the GetCollectionID function, where the hits collection name must be specified as argument)