How to: Physics#
The management of physics in Geant4 is rich and complex, with hundreds of options. OPENGATE proposes a subset of available options.
Physics List and Decay#
With GATE, you can (and should) use Geant4 physics lists, i.e. pre-defined sets of physics processes. You can set the physics list via the physics_manager like this:
sim = gate.Simulation()
# ...
sim.physics_manager.physics_list_name = 'QGSP_BERT_EMZ'
The default physics list is QGSP_BERT_EMV. You find more details about physics lists and processes in the detailed part of this used guide in section Physics lists and in the Geant4 guide.
You can use the following python command to get a list of all physics lists available in GATE:
print(sim.physics_manager.dump_available_physics_lists())
This output lists the exact names accepted by GATE’s PhysicsListBuilder,
including supported EM suffixes for special lists such as ShieldingLIQMD_EMZ.
When opengate is imported, GATE compares its reference-list registry with the
linked Geant4 library and warns about discrepancies. The check does not construct
physics lists or change the registry. Any Geant4 EM options that GATE does not
support are reported separately from missing registry entries or bindings.
The supported EM suffixes include __SS (G4EmStandardPhysicsSS, single
scattering) and _WVI (G4EmStandardPhysicsWVI, Wentzel VI mixed scattering).
For example, use FTFP_BERT__SS or ShieldingLIQMD_WVI. Both constructors
are also available as standalone physics lists by their full constructor names.
To repeat the check and obtain a dictionary of discrepancies without emitting a warning:
from opengate.physics import PhysicsListBuilder
differences = PhysicsListBuilder.check_reference_physics_list_registry(
emit_warning=False
)
You can also activate additional sets of processes bundled in so-called “special physics constructors”. To see which are available and which are active, use:
print(sim.physics_manager.special_physics_constructors)
If you want to activate one of them, say G4EmDNAPhysics, you add this line to your script:
sim.physics_manager.special_physics_constructors.G4EmDNAPhysics = True
Radioactive Decay#
Not all Geant4 physics lists include radioactive decay. If you want to enable radioactive decay regardless of the list, use:
sim.physics_manager.enable_decay = True
Important
This will not turn off radioactive decay if the physics list actually includes it. Think of the option as a light switch that turns on the light, but does not turn it off.
Very long half-lives. Since Geant4 11.2, the radioactive decay of the ions
whose lifetime is above a threshold (thresholdForVeryLongDecayTime) is
ignored: these ions are considered stable. With the default threshold of the
Geant4 version currently used by GATE (11.4), a Cs137 source (half-life 30 years)
does not decay at all. To simulate such ions, increase the threshold, after the
initialization:
sim.g4_commands_after_init.append(
"/process/had/rdm/thresholdForVeryLongDecayTime 1.0e+60 year"
)
Be careful: this also enables the decay of the (almost) stable descendants of a
decay chain (e.g. Bi209, half-life 1.9e19 years, in the Ac225 chain), which may add
energy that is not expected in the time range of interest. See the
Geant4 documentation
and test147.
Electromagnetic Parameters#
Specific electromagnetic parameters can be turned on or off like this:
sim.physics_manager.em_parameters.fluo = True
sim.physics_manager.em_parameters.auger = True
sim.physics_manager.em_parameters.auger_cascade = True
sim.physics_manager.em_parameters.pixe = True
sim.physics_manager.em_parameters.deexcitation_ignore_cut = True
Production cuts#
Geant4 allows you to tune the conditions under which it should actually produce and track secodnary particles, i.e. particles produced as the results of interactions of an existing particles with the target (or from fragmentation). More specifically, you can set the production cut in terms of range for a given particle. For example, a 10 mm cut applied to electrons means that secondary electrons are only produced if their energy gives them a range of at least 10 mm in the material where they are. As a rule of thumb: the higher the cut value the faster but also the less accurate the simulation.
You can set production cuts globally, i.e. apply them to the entire world, either like this:
sim.physics_manager.global_production_cuts.electron = 10 * gate.g4_units.mm
or like this:
sim.physics_manager.set_production_cut("world", "electron", 10 * gate.g4_units.mm)
Both of the above commands are equivalent.
If you want to apply a cut only to a certain volume, you can either do:
my_vol = sim.add_volume("SphereVolume", name="my_vol")
sim.physics_manager.set_production_cut("my_vol", "electron", 10 * gate.g4_units.mm)
or set the cut via the volume like this:
my_vol = sim.add_volume("SphereVolume", name="my_vol")
my_vol.set_production_cut("electron", 10 * gate.g4_units.mm)
Both of the above commands are equivalent.
Important
Geant4 only applies production cuts to electron, positrons, gammas, and protons. Use “all” instead of a specific particle to apply the cuts to all four particles.
Repeated volumes#
Production cuts, step limits and the other per-volume physics settings (regions) cannot be set on a volume repeated with RepeatParametrisedVolume, nor on the RepeatParametrisedVolume itself. Geant4 does not support a region that starts at a parameterised volume, so the simulation stops with a message if you try.
Set them on the mother volume instead. A region applies to its volume and to all the volumes inside it (unless one of them starts its own region), so the cut then applies to all the repeated volumes:
detector = sim.add_volume("Box", "detector")
pixel = sim.add_volume("Box", "pixel")
pixel.mother = detector
param = RepeatParametrisedVolume(repeated_volume=pixel)
# ...
sim.volume_manager.add_volume(param)
# not possible: "pixel" is repeated
# sim.physics_manager.set_production_cut("pixel", "gamma", 0.01 * mm)
# the cut applies to all the pixels
sim.physics_manager.set_production_cut("detector", "gamma", 0.01 * mm)
The cut then also applies to the material of the mother volume itself, and to its other daughters. Cuts are applied per material, so this usually only changes the speed of the simulation. To limit the cut to the repeated volumes, add an intermediate container volume inside the mother. Make it just large enough to hold the repeated volumes and give it the same material as the mother. Repeat the volume inside this container, and set the cut on the container.
Have a look at section Production cuts in the detailed part of this user guide for more information.
Limit the step size#
Geant4 automatically determines the best step size to be used in given circumstances while it transports a particle. Generally speaking, if interactions are not likely to occur close to the current position of the particle, Geant4 takes a large step. If a next interaction is likely to occur close by the current position, the step size will be small. Clearly, this not only depends on the particle properties, but also on the material, e.g. on its density.
You can impose a maximum step size that Geant4 may use, e.g. to guarantee a certain level of accuracy, in a specific volume in your simulation. There are two equivalent ways to achieve this. You can either do:
my_vol = sim.add_volume("SphereVolume", name="my_vol")
sim.physics_manager.set_max_step_size(my_vol.name, 1 * gate.g4_units.mm)
or
my_vol = sim.add_volume("SphereVolume", name="my_vol")
my_vol.set_max_step_size(1 * gate.g4_units.mm)
Additionally, you need to tell GATE to which particles you want to apply the step limit. To apply the 1 mm limit to electrons and positrons, you need this line:
sim.physics_manager.user_limits_particles = ['electron', 'positron']
There are other user limits like ‘’maximum track length’’ and ‘’minimium kinetic energy’’, that are used in analogy to the ‘’maximum step size’’. You can also use Regions if your geometry is complex. Have a look at the section User limits in the detailed part of this user guide for more info.