Scintillator Barrel



This example builds a cylindrical scintillator barrel detector made of 48 trapezoidal paddles arranged in a complete ring. It demonstrates the distribute_on_circle API to replicate a volume at equal angular intervals around a circle and shows how to size the paddles so that adjacent faces are nearly contiguous.

You can run this example in your browser: Scintillator Barrel


Quickstart

Copy the example to your current directory. To create the geometry and run 3 events:

cp -r $GEMC_HOME/examples/basic/scintillator_barrel .
cd scintillator_barrel
./scintillator_barrel.py
gemc scintillator_barrel.yaml


Geometry

The geometry is defined in scintillator_barrel.py. The world (a box named root) contains 48 identical paddle volumes arranged in a ring:

See the Structure Helpers documentation for the full distribute_on_circle API reference and the sizing geometry.

Interactive viewer (full 48-paddle barrel):


Physics List

QBBC is used by default, selected in the YAML file with phys_list: QBBC.

phys_list

The physics list can be selected using the option

gemc -phys_list <value>

where <value> can be a combination of the Geant4 physics constructors separated by the + sign. For example

gemc -phys_list="FTFP_BERT + G4NeutronCrossSectionXS"

To see a list of the available Geant4 constructors:

gemc -showPhysics


Generator

The particle kinematics are defined in the YAML file:

gparticle:
  - name: proton
    p: 500*MeV
    theta: 90*deg
    delta_phi: 360*deg
    multiplicity: 3

See also the Internal Generator Documentation for more information.


Digitization

Each paddle is assigned the flux digitization with a unique paddle identifier:

paddle.digitization = "flux"
# ...
v.set_identifier("paddle", i)

See the Flux Documentation for more information.


The distribute_on_circle API

The distribute_on_circle method on GVolume replicates the template volume n times around a circle of the given radius. With align=True, each copy is additionally rotated around the chosen axis by its angular position φᵢ, keeping each paddle’s local frame aligned radially:

for i, v in enumerate(paddle.distribute_on_circle(n, radius, align=True, axis='z')):
    v.set_identifier("paddle", i)
    v.publish(cfg)

The method returns a list of independent GVolume copies, one per angular step, each named <name>_i and positioned at (radius·cos φᵢ, radius·sin φᵢ, 0). Full API reference in the Structure Helpers documentation.


Usage

Building the detector

Use the Python script scintillator_barrel.py to build the detector. By default, the setup is stored in a SQLite file named gemc.db. Command-line options can define the database type, variations, and run number.

See also the Building Geometry for more information.


Running GEMC

The file scintillator_barrel.yaml runs the simulation. Add -gui to run interactively:

gemc scintillator_barrel.yaml -gui

Modify scintillator_barrel.yaml as needed, in particular to change the number of events, add threads, or select output formats.


Running Events

The view below shows the barrel end-on after one event, with 3 protons fired radially outward at θ = 90°. Each proton traverses one scintillator paddle.

Scintillator barrel viewed end-on along the beam axis. Three protons at θ = 90° travel radially outward, each depositing energy in one paddle.


Output

The gstreamer option selects the output filenames and the format:

gstreamer:
  - format: csv
    filename: scintillator_barrel

See also the Output Documentation for more information.


Plotting with the GEMC Analyzer

Run GEMC with 1,000 events first. With a CSV streamer, GEMC writes scintillator_barrel_t0_digitized.csv and scintillator_barrel_t0_true_info.csv.

gemc scintillator_barrel.yaml -n=1000

Plot the total energy deposited per hit across all paddles:

gemc-analyzer scintillator_barrel_t0_digitized.csv totEdep --kind csv

scintillator barrel total energy deposited

Plot the true particle track energy:

gemc-analyzer scintillator_barrel_t0_true_info.csv E --kind csv --data true_info

scintillator barrel true track energy