Quickstart

Using the python API, we’ll create a simple geometry consisting of a target and a flux detector. We will then shoot protons at the target and count how many particles of each type cross the flux detector.


Create a system

Create a counter system:

system_template.py -s counter

You should see the following output:

 Writing files for experiment >examples<, system template >counter< using variations >['default']<:

  - counter.py
  - geometry.py
  - materials.py
  - README.md

  - Variations defined in counter.py:
    * default

This created a subdir called counter containing python templates for the system geometry and materials. The files are already configured to create the geometry with a target and a flux detector. By default, a yaml card is provided to shoot protons at the target.

Use -h to see other options for system_template.py.


Build the geometry

Inside the counter directory, run counter.py to create the geometry and materials databases:

./counter.py

You should see the following output:

  ❖ Database file gemc.db does not exist
  ❖ Created new SQLite database: gemc.db

  ❖  GConfiguration for experiment <example>,  system <counter> : 
	▪︎ Factory: sqlite         
	▪︎ SQLite File: gemc.db
	▪︎ (Variation, Run): (default, 1)
	▪︎ Number of volumes: 2
	▪︎ Number of materials: 2

By default, the sqlite factory is used, so an the file gemc.db is been created containing the geometry and materials.

The geometry is created for run number 1 and variation default, using . Use -h to see other options for the factory, run number and variations.


Run gemc

Use the counter.yaml steering card and run GEMC in interactive mode:

gemc counter.yaml -gui

You will see the gemc GUI window. Click on the Run button (green triangle) to start the simulation. You should see a few particles being generated and crossing the flux box, producing red hits.

The quickstart example
A proton beam impinging on an epoxy target. The flux box collects hits from all particles crossing it.