Skip to content

Fix PhaseSpaceActor scoring in nested attached volumes#975

Open
nkrah wants to merge 3 commits into
masterfrom
phasespaceactor-volume-hierarchy
Open

Fix PhaseSpaceActor scoring in nested attached volumes#975
nkrah wants to merge 3 commits into
masterfrom
phasespaceactor-volume-hierarchy

Conversation

@nkrah

@nkrah nkrah commented Mar 28, 2026

Copy link
Copy Markdown
Collaborator

Summary:

  • add a GateVActor helper to detect whether a step occurs in the top attached volume rather than a daughter
  • use that helper in GatePhaseSpaceActor to ignore subtree-triggered internal surface crossings

Motivation:
PhaseSpaceActor is attached to a single volume in GATE, but the underlying sensitive detector registration is recursive over the attached volume hierarchy. This can lead to surprising extra phase-space entries when daughter volumes are crossed.

Changes:

  • add GateVActor::IsStepInTopAttachedVolume(const G4Step*)
  • early-return in GatePhaseSpaceActor::SteppingAction() unless the step is in the top attached volume

Notes:

  • this keeps the framework helper isolated from the actor behavior change in two separate commits
  • it does not change recursive SD registration globally; it only tightens PhaseSpaceActor behavior

@tbaudier

Copy link
Copy Markdown
Contributor

Hello @nkrah
I think your PR modify the behavior of the test: geometry/test058_iec_six_spheres.py

@dsarrut dsarrut requested a review from tbaudier April 14, 2026 13:53
@dsarrut dsarrut added the bug Something isn't working label Apr 14, 2026

const auto history_depth = touchable->GetHistoryDepth();
int attached_volume_depth = -1;
for (int i = 0; i <= history_depth; i++) {

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.

Why did you do a for loop instead of looking for the name of touchable->GetVolume(0)?

// actor) internal surface crossing
if (!IsStepInTopAttachedVolume(step))
return;

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.

How can we manage the others policy of the storing: ‘exiting’, ‘first’ or ‘all’


// Check if this SteppingAction was triggered via the sensitive detector
// attached to the top volume, i.e. the "attached_to" volume
// if it was triggered by a daughter volume, this is not truely a step

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.

We need to pay attention to daughter volume with same boundary than mother volume when the particle enters.
Or if the particle is created inside a daughter volume like in test058 with iec spheres, the mother volume is the world

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.

3 participants