Geant4 is already installed on the machines in the directory /nfsapp/physics
. You can define the environment needed to build & run Geant4 application using the provided script:
source /nfsapp/physics/geant4.bash -n
The -n
parameter is used to select the latest Geant4 version installed, 11.0.p1.
Download the start source code session1_start.tar.gz. (On Linux, 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 as exampleED
:
mv session1_start exampleED
Create the example build directory, run cmake
and make
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.
You can skip DetectorConstruction.cc
and PrimaryGeneratorAction.cc
which will be explored later
/run/beamOn 1
/tracking/verbose 1
Add printing of the event number at the begin of event and another printing about the end of event in the EventAction
class.
G4cout << ">>> Start event: " << event->GetEventID() << G4endl;
G4cout << ">>> End event: " << event->GetEventID() << G4endl;
Check the G4Event
class functions in the Geant4 source code browser. Fill G4Event.hh
in ‘File Name Search’, then click on ‘/event/include/G4Event.hh’ and then you should see GetEventID()
among the class functions.
Hint: Each line of the code above should be inserted in the relevant function of the EventAction
class in the EventAction.cc
file.