Skip to content

Draw InteractionSampler random numbers directly instead of from fixed rings - #16189

Open
sawenzel wants to merge 2 commits into
AliceO2Group:devfrom
sawenzel:interaction-sampler-no-ring
Open

sawenzel wants to merge 2 commits into
AliceO2Group:devfrom
sawenzel:interaction-sampler-no-ring

Conversation

@sawenzel

Copy link
Copy Markdown
Collaborator

Increase randomicity and control speed by drawing from inverted distribution.

https://its.cern.ch/jira/browse/O2-7330

Assisted by Claude Code.

sawenzel and others added 2 commits November 24, 2026 16:07
… rings

This fixes a problem in the uniform InteractionSampler and adds a unit test.

- The BC jump, the collision multiplicity per crossing and the collision time came from RandomRing buffers filled once in init() and never refilled.
- The multiplicities therefore repeated every 1000 occupied crossings, and triple collisions were missing at small mu.
- These quantities are now drawn from gRandom on each use, with the same distributions.
- FixedSkipBC_InteractionSampler and NonUniformMuInteractionSampler use the same time draw.
- The new test compares the crossing multiplicities with Poisson at mu 0.05 and 0.3 and checks that they show no period of 1000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This replaces the rejection loop for the zero-truncated Poisson draw and adds a unit test.

- The number of collisions in an occupied crossing was drawn with gRandom->Poisson(mu) until it was not zero.
- This needs about 1/mu calls, i.e. about 500 calls per crossing at Pb-Pb rates.
- The new drawZeroTruncatedPoisson() inverts the cumulative distribution with one uniform number per call.
- Above mu = 30 it keeps the Poisson draw, where a zero is negligible and exp(-mu) would underflow.
- InteractionSampler and NonUniformMuInteractionSampler both use it.
- init() now stops with a fatal error for a non-positive mu.
- The new test checks the frequencies, mean and variance of the draw for mu from 2e-4 to 100.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant