Skip to content

Add viztracks example for Opticks photon trajectory visualization#284

Draft
ggalgoczi wants to merge 4 commits into
mainfrom
trackviz
Draft

Add viztracks example for Opticks photon trajectory visualization#284
ggalgoczi wants to merge 4 commits into
mainfrom
trackviz

Conversation

@ggalgoczi
Copy link
Copy Markdown
Contributor

Add examples/viztracks/ that converts GPU photon step records into G4VTrajectory objects for Geant4 interactive visualization. Uses KeepTheCurrentEvent to preserve the event, then injects trajectories from the Opticks record array in EndOfRunAction.

Add examples/viztracks/ that converts GPU photon step records into
G4VTrajectory objects for Geant4 interactive visualization. Uses
KeepTheCurrentEvent to preserve the event, then injects trajectories
from the Opticks record array in EndOfRunAction.
@ggalgoczi ggalgoczi requested a review from plexoos April 9, 2026 02:28
@ggalgoczi ggalgoczi marked this pull request as draft April 9, 2026 02:28
Aligned validation using precooked curand Philox sequences so G4 consumes
the same random numbers as the GPU. Includes:
- StandAloneGeant4Validation with ShimG4Op* for RNG alignment
- generate_precooked_rng.cu for Philox sequence generation
- compare_aligned.py for flag/position/chi2 comparison
- raindrop configs for testing

Tested on raindrop geometry: 10000/10000 photons match (100%).
- StandAloneGeant4Validation: add StepRecordAccumulator that saves
  per-step photon positions as g4_record.npy (N, 32, 4, 4), matching
  the Opticks record.npy format for photon-by-photon track comparison
- Add plot_divergent_tracks.py: VTK offscreen renderer that overlays
  GPU (red) and G4 (blue) photon tracks on GDML wireframe geometry
- Add apex.json config for apex.gdml torch photon simulation
apex.gdml: scintillator detector with WLS plates, SiPMs, and Vikuiti
reflective foil wrapping (500x500x6mm flat detector).

sphere_leak_simple.gdml: nested sphere mirror leak test with
dielectric_metal skinsurface, no RINDEX on mirror material — verified
zero-leak configuration for both GPU and G4.
@github-actions
Copy link
Copy Markdown
Contributor

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format (v20.1.2) reports: 4 file(s) not formatted
  • examples/AlignGpuCpuTracks/StandAloneGeant4Validation.cpp
  • examples/AlignGpuCpuTracks/StandAloneGeant4Validation.h
  • examples/viztracks/OpticksTrajectory.h
  • examples/viztracks/viztracks.cpp

Have any feedback or feature suggestions? Share it here.

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.

1 participant