Skip to content

initialize safety in InitTracks - #682

Open
SeverinDiederichs wants to merge 1 commit into
apt-sim:masterfrom
SeverinDiederichs:calculate_safety_in_InitTracks
Open

initialize safety in InitTracks#682
SeverinDiederichs wants to merge 1 commit into
apt-sim:masterfrom
SeverinDiederichs:calculate_safety_in_InitTracks

Conversation

@SeverinDiederichs

Copy link
Copy Markdown
Collaborator

This PR implements the first step of #681:

When initializing the tracks that come from the CPU on the device asynchronously, their safety is already calculated, thus reducing the amount of safety calculation in HowFar. Note that in this initial approach in a bad case when the new calculated safety is still smaller than the physics limit, the safety would be calculated both in the InitTracks and HowFar, but as the init tracks is fully hidden, it is considered negligible for this first implementation, as this will be changed in the subsequent steps of #681.

@SeverinDiederichs

Copy link
Copy Markdown
Collaborator Author

@codex review

@SeverinDiederichs

Copy link
Copy Markdown
Collaborator Author

/run-test

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 0d74a98de0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@phsft-bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

@SeverinDiederichs

Copy link
Copy Markdown
Collaborator Author

The failure in the CI is bad luck:

We currently running 60k primaries with a threshold of rejection of 1% between the result of the PR and the high statistics result stored from G4HepEm.
Changing the seed can cause the setup to be unlucky to fail the 1%, despite being as accurate as before.
This PR shifts the physics output to this unlucky case, as the following table shows:

Result Master This PR
Validation passes 19/20 19/20
Validation failures 1/20 1/20
Aggregate maximum layer error 0.244% 0.219%
Mean per-run maximum error 0.574% 0.585%

Therefore, the number of primaries should be increased to make these failures appear less often

SeverinDiederichs added a commit that referenced this pull request Jul 27, 2026
As it was observed in #682 and explained in [this
comment](#682 (comment)),
the CI can fail due to bad luck on the seed. Increasing the number of
primaries reduces the risk of those random failure
@SeverinDiederichs
SeverinDiederichs force-pushed the calculate_safety_in_InitTracks branch from 0d74a98 to 0a73d84 Compare July 27, 2026 14:26
@SeverinDiederichs

Copy link
Copy Markdown
Collaborator Author

/run-test

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.

2 participants