Code for download: session1_start.tar.gz
Exercise:
- Geant4 is already installed on the machines in the directory
/usr/local
. Please, do not forget to run the Geant4 script to define the environment needed to build & run Geant4 application; for example is you isntalled Geant4 in/usr/local/bin:
. /usr/local/bin/geant4.sh
- Build & run the example:
- Download the start source code session1_start.tar.gz. (On MacOS, the file will be saved as
session1_start.tar.gz
in$HOME/Downloads
directory.) - Untar the file:
tar xvf session1_start.tar.gz
- Rename the
session1_start
directory asexampleED
:
mv session1_start exampleED
- Create the example build directory, run
cmake
andmake
to build the application:
mkdir exampleED_build
cd exampleED_build
cmake ../exampleED
make - Run the created executable:
./exampleED- You can also find the instruction how to build and run the example at the Geant4 examples Web page .
- Download the start source code session1_start.tar.gz. (On MacOS, the file will be saved as
- Get familiar with the provided code
- You can skip
EDDetectorConstruction.cc
andEDPrimaryGeneratorAction.cc
which will be explored later
- You can skip
- Get familiar with Geant4 Qt User Interface
- Use the provided button (an arrow in a green circle) to run 1 event, observe the picture and the output in the Output window.
- Run 1 event from the command line. You have to type this command in the Session window:
/run/beamOn 1
- Run 1 event via a selection of the command from the Help menu.
- Set tracking verbose level to 1 and observe the output:
/tracking/verbose 1
- Add printing of the event number at the begin of event and another printing about the end of event in the
EDEventAction
class:
G4cout << ">>> Start event: " << event->GetEventID() << G4endl;
G4cout << ">>> End event: " << event->GetEventID() << G4endl;
- Hint: Each line of the code above should be inserted in the relevant function of the
EDEventAction
class in theEDEventAction.cc
file.
- Hint: Each line of the code above should be inserted in the relevant function of the
Solution: session1_solution.tar.gz