Cherenkov Example
This example shows how to activate Cherenkov radiation in a GEMC detector.
You can run this example in your browser:
Quickstart
Copy the example to your current directory.
To create the geometry, run 10 events, and produce ROOT and CSV output files:
cp -r $GEMC_HOME/examples/optical/cherenkov .
cd cherenkov
./cherenkov.py
gemc cherenkov.yaml -n=10
Geometry
The geometry, shown below, is defined in cherenkov.py. It is produced in three variations: default, CO2, and C4F10.
The world (a box named root) contains a radiator box. The radiator material depends on the selected variation:
| variation | material | color |
|---|---|---|
| default | Carbon tetrafluoride CF4 |
red |
| CO2 | Carbon dioxide CO2 |
blue |
| C4F10 | Perfluorobutane C4F10 |
green |
- a
fluxdetector composed of four boxes (detector_left, detector_right, detector_top, and detector_bottom). This leaves a small hole in the center for the beam.
Interactive viewer:
Physics List
FTFP_BERT + G4OpticalPhysics is used by default in the YAML file. The optical physics component is required to produce optical photons.
Generator
The default kinematics is a 1 GeV electron beam generated along the z-axis near the start of the radiator. This is defined in the YAML file:
gparticle:
- name: e-
p: 1000
vz: -50
Digitization
The detector volumes are associated with the flux digitization (one of the available GEMC pre-built routines)
in cherenkov.py.
The identifier is used to distinguish the different detector boxes:
backplate.digitization = "flux"
backplate.set_identifier("detector", panel_id)
Usage
Building the detector
Use the Python script cherenkov.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.
Running gemc
The file cherenkov.yaml can be used to run the setup. Add -gui to run interactively:
gemc cherenkov.yaml -gui
Modify cherenkov.yaml as needed, in particular to add particles, control the number of threads, or change the output.
Because this example uses flux digitization for optical photons, recordZeroEdep must be set to true.
Optical photons deposit zero energy, and the flux digitization does not record zero-energy hits by default.
Variations
Within the YAML file, the variation is set to CO2. You can replace it with default or C4F10
to change the material. For example:
gsystem:
- name: cherenkov
variation: C4F10
Different radiator materials produce different photon yields and angles, as shown below.
Use the variation name in the gstreamer filename when you want separate output files for each variation.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Left: default (CF4) radiator, Center: CO2, Right: C4F10.
Output
The gstreamer option is used to select the name and format of the output. Two simultaneous streams are selected,
CSV and ROOT:
gstreamer:
- format: csv
filename: cherenkov
- format: root
filename: cherenkov
Because flux is a per-event digitization, GEMC will produce one output file per thread.
For ROOT files, you can use hadd to merge the files.
gstreamer
The
gstreameroption allows select the name and format of the output. Rungemc help gstreamerto check its documentation:-gstreamer=<sequence> ......: define a gstreamer output • filename: name of output file. Default value: NODFLT • format: format of output file. Default value: NODFLT • type: type of output fileDefault value: event Define output formats and filenames. It can be used to select <events> or <frame> streams. The file extension is added automatically based on the format. Supported formats: - jlabsro - root - ascii - csv - json Output types: - event: write events - stream: write frame time snapshots Example that defines two gstreamer outputs: -gstreamer="[{format: root, filename: out}, {format: csv, filename: out}]" The produced files structure depends on the accumulation method used: - event-based digitization (like <flux>) will have one file per thread, with "_t<thread#>" appended to the filename - run-based digitization (like <dosimeter>) will have one output file
Plotting with the GEMC Analyzer
Run GEMC with 1,000 events first. The default YAML file writes cherenkov_t0_digitized.csv and cherenkov_t0_true_info.csv.
gemc cherenkov.yaml -n=1000
Plot the digitized photon energy:
python3 -m analyzer cherenkov_t0_digitized.csv E --kind csv

Plot the true particle track total energy:
python3 -m analyzer cherenkov_t0_true_info.csv E --kind csv --data true_info






