Skip to content

Add forced-detection estimator to EGS_PlanarFluence and EGS_SphericalFluence - #1438

Open
mainegra wants to merge 2 commits into
feature-spherical-fluencefrom
feature-spherical-fluence-fd
Open

Add forced-detection estimator to EGS_PlanarFluence and EGS_SphericalFluence#1438
mainegra wants to merge 2 commits into
feature-spherical-fluencefrom
feature-spherical-fluence-fd

Conversation

@mainegra

@mainegra mainegra commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Depends on: #1437 (must merge first)

Summary

Adds a forced-detection (FD) estimator to EGS_PlanarFluence and
EGS_SphericalFluence, alongside the existing boundary-crossing estimator.

  • scoring method input key: crossing (default), forced detection, or both
    (separate arrays, allows direct estimator comparison in one run)
  • FD fires exactly once per free path regardless of how many geometry
    boundaries the photon crosses before its next interaction — gated by a
    generation-counter (m_fd_gen / m_fd_slot_gen) that is O(1) to check
    and requires no per-history clearing
  • Primary FD scoring with correlated tot/pri ratio via per-history
    cross-term arrays, consistent with the volumetric scorer
  • New virtual methods on EGS_Application / EGS_AdvancedApplication:
    getMFPInterpolators() and isRayleighOn(), used by the FD ray-tracer
    to compute attenuation along the forced ray; falls back to crossing-only
    with a warning when the application does not provide them
  • needsCall extended to register UserDiscard and the six AfterXxx
    interaction events when FD is active, so the gate can mark secondaries
    and clean up discarded particles correctly
  • Test inputs added to HEN_HOUSE/user_codes/egs_app/:
    sph-f-FD-vs-cross-iron.egsinp, sph-f-FD-vs-cross-vacuum.egsinp

Test plan

  • Build egs_fluence_scoring and egs_app; confirm no compilation errors
  • Run sph-f-FD-vs-cross-iron.egsinp with scoring method = both:
    FD and crossing total fluence should agree within statistics at all radii;
    FD primary uncertainty should be 0.000% (point source at sphere centre →
    deterministic FD score per primary)
  • Run sph-f-FD-vs-cross-vacuum.egsinp: crossing and FD agree in vacuum
    (no attenuation, pure geometry check)
  • Confirm parallel job merging (addState) works for score_both arrays

mainegra and others added 2 commits July 29, 2026 07:32
…lFluence

  Extends both planar and spherical fluence scorers with a forced-detection
  (FD) estimator. FD deterministically scores w·exp(−μr) at the start of
  each photon step, giving variance independent of geometric crossing
  probability.

  - `scoring method = crossing | FD | both` for both AO types; `both`
    keeps separate crossing and FD arrays and reports them side-by-side
  - Virtual getMFPInterpolators/getCoheInterpolators/isRayleighOn added to
    EGS_Application base (overridden in EGS_AdvancedApplication) to avoid
    dynamic_cast DSO link error; falls back to crossing with warning for
    non-advanced apps or non-photon particles
  - Correlated tot/pri ratio for FD arrays in EGS_SphericalFluence
    (fluT_FD_x_p cross-term)
  - Test inputs: sph-f-FD-vs-cross-vacuum.egsinp and
    sph-f-FD-vs-cross-iron.egsinp
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mainegra
mainegra requested a review from a team as a code owner July 29, 2026 12:06
@mainegra
mainegra requested review from ftessier and rtownson and removed request for a team July 29, 2026 12:06
@mainegra mainegra self-assigned this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant