feat: add Halton sequences support to isotrope generator#1602
Merged
andresailer merged 5 commits intoAIDASoft:masterfrom Apr 14, 2026
Merged
feat: add Halton sequences support to isotrope generator#1602andresailer merged 5 commits intoAIDASoft:masterfrom
andresailer merged 5 commits intoAIDASoft:masterfrom
Conversation
Halton sequences are low-discrepancy sequences that fill phase space with faster variance reduction (1/N) than standard uniform point picking with PRNGs (1/sqrt(N)). It's not cheating statistics since you lose the Poisson statistical properties between two consecutive events. This technique is often referred to as RQMC, randomized quasi-Monte Carlo. This adds scrambled Halton sequence support to the isotrope generators (where inter-event statistics are not considered since they don't represent real experimental running conditions). The scrambling uses Cranley-Patterson rotation, which is sufficient to remove correlations in three dimensional phase space sampling. The sequences are scrambled with the random seed, so different runs with different seeds will produce different sequences. This also then allows statistical treatment to determine the errors on aggregate quantities (see note in ddsim help). The various distributions are modified to take a sampler function that can either use PRNG or Halton sequences. For FFbar this is not possible since it uses an accept/reject algorithm that only works for PRNG.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds scrambled Halton (RQMC) sampling support to the isotrope generator, enabling low-discrepancy phase-space coverage as an alternative to PRNG-based sampling.
Changes:
- Introduces Halton-based sampling (with Cranley–Patterson rotation) for
uniform,cos(theta), andetaisotrope distributions. - Refactors isotrope distributions to accept a sampler function (PRNG or Halton) and adds Halton-related generator properties (
Halton,HaltonOffset). - Exposes Halton configuration options via the DDSim gun helper.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
DDG4/src/Geant4IsotropeGenerator.cpp |
Implements Halton radical-inverse sampling + scrambling and routes direction/momentum generation through a sampler abstraction. |
DDG4/include/DDG4/Geant4IsotropeGenerator.h |
Declares Halton properties/state and documents the new sampling mode/API changes. |
DDG4/python/DDSim/Helper/Gun.py |
Adds CLI/help + option wiring for Halton and HaltonOffset into the DDG4 particle gun configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test Results 18 files 18 suites 6h 30m 5s ⏱️ Results for commit ee7a9a8. ♻️ This comment has been updated with latest results. |
andresailer
reviewed
Mar 30, 2026
andresailer
reviewed
Mar 30, 2026
wdconinc
commented
Mar 30, 2026
Contributor
|
@wdconinc @andresailer Is this MR supposed to be merged now? |
Member
Yes, good to go! |
andresailer
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Halton sequences are low-discrepancy sequences that fill phase space with faster variance reduction (1/N) than standard uniform point picking with PRNGs (1/sqrt(N)). It's not cheating statistics since you lose the Poisson statistical properties between two consecutive events. This technique is often referred to as RQMC, randomized quasi-Monte Carlo.
This adds scrambled Halton sequence support to the isotrope generators (where inter-event statistics are not considered since they don't represent real experimental running conditions). The scrambling uses Cranley-Patterson rotation, which is sufficient to remove correlations in three dimensional phase space sampling.
The sequences are scrambled with the random seed, so different runs with different seeds will produce different sequences. This also then allows statistical treatment to determine the errors on aggregate quantities (see note in ddsim help).
The various distributions are modified to take a sampler function that can either use PRNG or Halton sequences. For FFbar this is not possible since it uses an accept/reject algorithm that only works for PRNG.
Additional implementation notes:
getParticleMomentumUniformneeded to get the sample passed to it, so it was renamed tosampleMomentum. That leaves parentGeant4ParticleGenerator::getParticleMomentumUniformwithout any use or re-implementation in DD4hep, I think.haltonValueis written to use a pure integer loop with conversion to double only on return.Since a picture (from wikipedia) is worth 1000 words:
BEGINRELEASENOTES
ENDRELEASENOTES