Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.

This is the application based on tutorial application by Mihaly Novak, implemented for the Geant4 Beginner Course (at CERN 21-23 January 2020). https://indico.cern.ch/event/865808/contributions/3647803/

This version is developed for the purpose of ESIPAP.

Requirements

The pre-requirement for running this application is Geant4 toolkit. There may not be enough time to get running Geant4 and analyse this application at this course, so please consider installing it in advance.

How to install Geant4

There are three alternatives to get Geant4:

  1. Build and install Geant4 from source or via package manager of (some) operating systems, as described in the Installation guide. Building from source can take considerable time, O(1h), depending on the machine.

  2. Use a docker image which was prepared especially for this tutorial, so it contains all necessary data, including this tutorial application. You will need to install docker and then pull an image from docker hub.

  3. Use a virtual machine, with instructions how to get it available at First Steps with Geant4 course webpage.

More details about Geant4 can be found on the Getting started page.

Test Geant4

To test if you are able to use Geant4 properly, please build the most basic example of Geant4.

cd examples/basic/B1/
mkdir build
cd build
cmake ..
make

If you installed Geant4 with visualization available (e.g. with Qt) or if you are using a docker or a virtual machine, you schould be able to execute the example:

./exampleB1

and see a similar window opening:

B1 example

If you do not succeed in getting this image, or if you have questions what's the best way for you to install Geant4, please contact me on ESIPAP's Slack.

How to build this application

You need to generate the Makefile using cmake, from the build directory:

mkdir build
cd build
cmake ../

After the Makefile is generated by the above cmake command you need to invoke the make command to build (compile and link) your application with Geant4 toolkit:

make

If everything is compiled and linked successfully, the yourMainApplication executable of the application is available under this build directory.

Macro files

You can find a simple Geant4 macro file (g4Macro.mac) as well as the macro file that allows to use visualization (vis.mac). Application can be execute either in interactive (no any input argument) or in batch mode (the only one input argument is a Geant4 macro file). So it can be run (from the build where the executable is located):

  1. with the given "g4Macro.mac" file:
./yourMainApplication ../g4Macro.mac
  1. in interactive mode:
./yourMainApplication

This should result in getting a similar window as below:

interactive mode

When executing in interactive mode, one can set up the visualisation before executing the simulation (but the run needs to be initialised before) by invoking the following commands in the UI session (either in the "QT" session or in the session "terminal"):

/run/initialize
/control/execute ../vis.mac
/control/execute ../g4Macro.mac

Execution of vis.mac macro should result in following picture:

vis.mac

Execution of g4Macro.mac macro should result in following picture:

g4Macro.mac

Experimental data

This application can be used to compute the distribution of energy deposited by 100 [MeV] electrons in 5.6 [um] thin silicon target. All relevant information and macro files are located in experiment directory:

  • exp_Meroli_100MeV_electron_5p6um_Si.dat the experimental data taken from S. Meroli et al 2011 JINST 6 P06013: https://www.researchgate.net/publication/230949562_Energy_loss_measurement_for_charged_particles_in_very_thin_silicon_layers
  • g4Macro_Meroli_100MeV_electron_5p6um_Si.mac Geant4 macro to set this application to achieve the experimental setup (target material, thickness primary energy, particle type, etc.)
  • gplot.p is a gnuplot script i.e. input file to 'gnuplot' to create a nice plot that compares the result of our simulation and the experimental data (see more information inside this gplot.p file)
  • the remaining 3 files are the simulated energy loss histogram (Hist_Edep.ascii) copied here from the build directory, and two figures (same ones, in '.eps' and '.pdf' format) produced by the gplot.p script.