Skip to content

fix(g4app): record initial optical photon steps with null pre-step process#408

Merged
plexoos merged 2 commits into
mainfrom
fix-early-return-g4app
Jul 10, 2026
Merged

fix(g4app): record initial optical photon steps with null pre-step process#408
plexoos merged 2 commits into
mainfrom
fix-early-return-g4app

Conversation

@plexoos

@plexoos plexoos commented Jul 9, 2026

Copy link
Copy Markdown
Member

Geant4 can report a null GetProcessDefinedStep() on the pre-step
point, notably for the first optical-photon step. SteppingAction
previously treated that as a reason to return early, which skipped
recording the initial Geant4 photon point even though the process value
was not used afterward.

Remove that early return so the Geant4-side record.npy output
preserves the initial optical-photon step and stays aligned with the
Opticks-side record.

Update optiphy/ana/compare_ab.py to compare the A/B event records
directly instead of compensating for the previous one-step offset.

…ocess

Geant4 can report a null `GetProcessDefinedStep()` on the pre-step
point, notably for the first optical-photon step. `SteppingAction`
previously treated that as a reason to return early, which skipped
recording the initial Geant4 photon point even though the process value
was not used afterward.

Remove that early return so the Geant4-side `record.npy` output
preserves the initial optical-photon step and stays aligned with the
Opticks-side record.

Update `optiphy/ana/compare_ab.py` to compare the A/B event records
directly instead of compensating for the previous one-step offset.
Copilot AI review requested due to automatic review settings July 9, 2026 22:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Geant4 optical-photon step recording so that the initial photon step is not skipped when GetProcessDefinedStep() is null on the pre-step point, keeping Geant4 record.npy aligned with the Opticks record. It also updates the analysis script to compare A/B records directly now that the one-step offset is no longer expected.

Changes:

  • Remove early-return logic in SteppingAction that skipped recording when pre-step GetProcessDefinedStep() is null.
  • Update optiphy/ana/compare_ab.py to compare record.npy arrays without applying a one-step alignment slice.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/g4app.h Ensures the initial optical-photon step is recorded even when the pre-step process is null.
optiphy/ana/compare_ab.py Compares A/B event records directly (no longer compensating for a one-step shift).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/g4app.h
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@plexoos plexoos self-assigned this Jul 9, 2026
@plexoos plexoos added the bug Something isn't working label Jul 9, 2026
@plexoos plexoos merged commit a978515 into main Jul 10, 2026
23 checks passed
@plexoos plexoos deleted the fix-early-return-g4app branch July 10, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants