2019 Session 1 : Exercise

Code for download: session1_start.tar.gz

Exercise:

  • Geant4 is already installed on the machines in the directory /usr/local. We will first call the Geant4 script to define the environment needed to build & run Geant4 application:
    export CMAKE_PREFIX_PATH=/usr/local/opt/qt5
    . /usr/local/bin/geant4.sh
    unset DYLD_LIBRARY_PATH
  • Build & run the example:
    • Download the example source code session1_start.tar.gz. (The file will be saved as session1_start.tar in $HOME/Downloads directory.)
    • Untar the file:
      tar xvf session1_start.tar
    • Rename the example as exampleED:
      mv session1_start exampleED
    • Create the example build directory, run cmake, make and built application: 
      mkdir exampleED_build
      cd exampleED_build
      cmake ../exampleED
      make
      ./exampleED

  • Get familiar with the provided code
    • You can skip EDDetectorConstruction.cc and EDPrimaryGeneratorAction.cc which will be explored later
  • 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 EDEventAction; see G4Event class functions at the Geant4 documentation

Solution: session1_solution.tar.gz