Skip to content

Multi-Channel Positronium Decay Source Model#763

Merged
kochebina merged 152 commits into
OpenGATE:developfrom
cis-imaging:positronium_source_rebased
Jun 9, 2026
Merged

Multi-Channel Positronium Decay Source Model#763
kochebina merged 152 commits into
OpenGATE:developfrom
cis-imaging:positronium_source_rebased

Conversation

@wkrzemien

@wkrzemien wkrzemien commented May 14, 2026

Copy link
Copy Markdown
Contributor

A Multi-Channel Positronium Decay Source Model

This work introduces an extended positronium source model for GATE, centred on a clearer separation between source configuration, decay parameter generation, and decay model execution. The implementation adds support for multiple decay-related configurations, including prompt gamma handling, Electron Capture, lifetime and energy parameters, and positron range modelling, while preserving backward compatibility through a dedicated legacy layer.

In addition to the source-model refactoring, the branch introduces a new multiphoton analysis module integrated with the existing digits_hits and ROOT output pipeline. The overall change is supported by an expanded set of unit tests and build-system updates, making the new functionality easier to validate and maintain.

Main changes

1. Refactoring and extension of positronium support

  • A new positronium handling layer was extracted and organized, introducing classes such as GatePositronium, GatePositroniumSource, GatePositroniumSourceMessenger, GatePositroniumHelper, GatePositroniumDecayParamsGenerator, GatePositroniumConstants, and GatePositroniumDecayModelParams.
  • The GatePositroniumSource structure was simplified and the parameter flow between the messenger, decay parameter generator, and decay model was clarified.
  • GatePositroniumDecayModel and related classes were refactored to improve naming, physical constants, decay channel handling, and parameter validation.

2. Backward compatibility through legacy extraction

  • Older implementations related to positronium, ExtendedVSource, GammaEmissionModel, and EmittedGammaInformation were moved into the legacy namespace.
  • Changes in CMakeLists.txt and GateSourceMgr connect the new implementation while preserving a backward-compatible execution path.
  • This PR separates ongoing development from old code and reduces the risk of mixing both execution paths.

3. Extended physics configuration and decay parameter handling

  • Support was added for prompt gamma and prompt probabilities in both the messenger and the decay model.
  • Parsing of parameters with units for energies and lifetimes was added, along with improved validation of the number of provided parameters.
  • Support was added for mean positron range and decay vertex shifting.
  • Electron Capture handling was introduced together with additional consistency checks and fixes to warning conditions.
  • The output flow to ROOT was extended, including propagation of decayIndex.

4. New multiphoton analysis module

  • A new multiphoton analysis module was added under source/digits_hits, including GateMultiPhotonAnalysis, its messenger, helper utilities, and GateMultiPhotonTrajectoryNavigator.
  • The changes also integrate with GateHit, GateOutputMgr, GateToTree, and ROOT-related definitions.
  • This is the largest single functional addition outside the positronium refactoring itself.

5. Expanded tests and build integration

  • Tests were added or extended for GatePositronium, GatePositroniumDecayModel, GatePositroniumDecayParamsGenerator, GatePositroniumHelper, GatePositroniumSourceMessenger, and GateExtendedVSource.
  • Test utilities (TestingTools.h, test_dummy.cpp) and CMake test registration were also extended.
  • The commit history also shows a series of fixes driven by those tests, which suggests that the PR stabilizes the new code in parallel with extending it.
  • Related simple benchmark, based on the previous ExtendedVSource benchmark, is added here: T35 Benchmark positronium source GateBenchmarks#110
  • The old legacy-code benchmark t17_extended_source should be passing as well.

Short version for the PR description

This PR reorganizes and extends positronium support in GATE by introducing a new class structure for the source, decay model, and decay parameter generation, while moving older implementations into a legacy layer. It also extends the physics configuration with prompt gamma support, Electron Capture handling, unit-aware parameters, and positron range modeling.

In parallel, the PR adds a new multiphoton analysis module integrated with the existing data output and ROOT pipeline. The overall change is backed by a broad set of unit tests and CMake updates that connect the new functionality with the existing build system.

Authors: W. Krzemien, M. Bala, K. Dulski

wkrzemien added 30 commits May 9, 2026 00:28
Replace in-house code by std::optional. Also, removing const and & from
basic type arguments in setters.
E.g. calling sstringstream constructor instead of adding the value
later.
Also, update the contribution section
!Work in Progress!
Add the stub of the proposed solution
!Work in progress!
We can actually run some simple unit tests for GatePositroniumDecayModel
!Work in Progress!
Add some overlapping functionality e.g. MiniPositroniumDecayModel
to be able to test the new functionality independently. This must be
cleaned up later.
Add Gate initialization
Fix typo in method name, also ordering of the code etc.
Warning this is Work in Progress commit. Some part of code must be
still improved
It contains a raw pointer to fDecayChannel which it does not own.
It is meant to replace the GatePositroniumDecayModel later.
It uses cleaned up GatePositronium class.
wkrzemien and others added 23 commits May 9, 2026 00:33
Also, add a dedicated command to set the probabilites of electron
captures from macro
If, no prompt emission and electron capture happens, then we repeat the sampling
of the channel.
…int>(fractions.size()) - 1;

This -1 could lead to undefined behaviour, since it was used as a index.
Also, remove relevant tests and fix method signatures.
docs: add PositroniumSource user documentation
@wkrzemien wkrzemien changed the title [WIP] Multi-Channel Positronium Decay Source Model Multi-Channel Positronium Decay Source Model May 22, 2026
Also, prevent crash in PositroniumSource.

Changes in GateCrystalSD: add fallback dynamic_cast to GateLegacy::GateEmittedGammaInformation
when the primary cast to ::GateEmittedGammaInformation returns nullptr. The legacy
ExtendedVSource attaches GateLegacy::GateEmittedGammaInformation objects, which are
a different C++ type (separate namespace) from the new class, causing all three ROOT
fields (sourceType, decayType, gammaType) to be written as 0. The fallback restores
the correct values (sourceType=2/3, decayType=1/2, gammaType=2/3) for ExtendedVSource
hits while leaving the PositroniumSource code path unchanged.

Changes in GatePositroniumDecayModel: guard fPositronInteractions access in GetSourceKind
with a bounds check to prevent an out-of-bounds crash when setPositronInteractions is not
called (e.g. when only setDecayKinds is used). k2Gamma cannot be safely mapped to
ParaPositronium because oPs pick-off/quenching also produces 2 gammas, so no fallback
inference from fDecayKind is performed. SetSourceKind is only called when GetSourceKind
returns a value other than NotDefined, preserving the base-class default (sourceType=1)
when fPositronInteractions is not set.

Changes in GatePositroniumDecayParamsGenerator:
emit a one-time warning at parameter validation time when fPositronInteractions is empty,
explaining that sourceType will be 1 (SingleGammaEmitter generic default) and why inference
from decayKind is not done.

Also, remove test_dummy.cpp
wkrzemien added 2 commits June 5, 2026 18:32
It should solve the fftw3 problem. It is not found correctly by cmake
so part of the linking is failing.
@kochebina kochebina merged commit e7b1497 into OpenGATE:develop Jun 9, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants