Skip to content

refactor(api)!: remove G4CX and migrate external integrations - #459

Merged
plexoos merged 1 commit into
mainfrom
retire-g4cx
Oct 18, 2026
Merged

plexoos merged 1 commit into
mainfrom
retire-g4cx

Conversation

@plexoos

@plexoos plexoos commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #457, now merged into main. The public runtime, sensor interface, and API regression tests were introduced there; this PR removes G4CX and migrates its remaining consumers.

Remove the legacy G4CX coordinator and move its remaining consumers to simphony::simphony. This completes the migration of CSG test setup, DD4hep run/event actions, and the MC-truth and async examples to the same initialization and event lifecycle used by simg4ox.

  • Delete G4CX sources, installed target/headers, legacy executables/tests, top-level build entries, and logger hooks.
  • Preserve GDML name handling and auxiliary sensitive-detector tags in CSG tests while initializing the runtime with the GPU disabled.
  • Reuse the DD4hep runtime across runs, preserve hit injection and end-of-run batch flushing, and export geometry through SaveGeometry plus GeometryDirectory.
  • Migrate standalone examples and explicitly reset retained events after result retrieval, including synchronous and output-file failure paths.
  • Keep in-tree and standalone DD4hep builds working with C++20 by removing inherited raw standard flags from DD4hep's Geant4 helper target.
  • Update external-build, saved-geometry, and application-capability documentation and replace retired geometry-test export paths with consgeo exports.

Validation:

  • Full DD4hep-enabled build and all 255 enabled CTest tests passed; two existing tests remain disabled.
  • Clean Release build/install with testing disabled contains no G4CX library, headers, exported target, or runtime dependency. Installed consgeo export passed.
  • All four standalone examples built against the clean package. MC-truth and both async examples completed repeated runs, including synchronous and batched modes.
  • DD4hep v01-38 / ROOT 6.36.14 / Geant4 11.4.2: in-tree and standalone plugin builds, standalone installation, and CPU/GPU raindrop tests passed. With the same GPU kernel, in-tree and standalone hit counts matched. Consecutive runs, geometry export, and end-of-run batch flushing passed.
  • The local Geant4 build uses initial-exec TLS, so these DD4hep checks used its documented TLS-check override and Geant4 preloading.

Breaking change: consumers of simphony::G4CX / G4CXOpticks must link simphony::simphony, include simphony.h, initialize from a live Geant4 world, and reset retained events after reading results. Saved-foundry rendering and simtrace remain available through lower-level CSGOptiX tools. The three migrated standalone examples explicitly move from C++17 to C++20.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T17:29:52.370727Z 9c65904 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@plexoos
plexoos force-pushed the retire-g4cx branch 2 times, most recently from 08442b5 to 1d0b888 Compare October 17, 2026 04:20
plexoos added a commit that referenced this pull request Oct 17, 2026
Introduce an installed, function-based runtime over U4 geometry
conversion and CSGOptiX execution. Applications initialize a live Geant4
world through `simphony::simphony`, query GPU availability,
simulate/reset events, and explicitly save geometry.

- Install the documented `simphony.h` and `SensorIdentifier.h` public
headers. Applications provide custom sensor mappings through
`simphony::SensorIdentifier` without including U4 implementation
headers.
- Support `Required`, `Optional`, and `Disabled` GPU policies,
idempotent initialization with matching inputs, and explicit
pending-event/reset checks.
- Update U4Tree, the default sensor identifier, and the retained
G4CX/DD4hep sensor adapters to consume the public protocol.
- Migrate the Simphony-owned `src/` applications to the runtime. The
external-example and DD4hep run/event migrations are in the stacked G4CX
retirement PR.
- Cover custom sensor dispatch, changed-identifier rejection, lifecycle
errors, geometry-only export, and executable ELF dependencies. Honor
`CMAKE_INSTALL_PREFIX` for installed configuration data.

Validation: independently built the API commit with the retained G4CX
library, `simg4ox`, `consgeo`, and API/legacy geometry tests. All 22
API, retained-G4CX geometry, and `simg4ox` integration checks passed.
The complete stack passed 255 enabled CTest tests and DD4hep
in-tree/standalone runtime checks.

Migration: custom identifiers now implement `simphony::SensorIdentifier`
from `SensorIdentifier.h`; the old `U4SensorIdentifier` type/header is
removed. The retained G4CX setter accepts the new protocol.

Follow-up: #459 removes G4CX and migrates the remaining external
examples and DD4hep run/event actions. It is stacked on this PR and
targets `rm-g4cx`.
Base automatically changed from rm-g4cx to main October 17, 2026 14:54
Finish retiring the legacy G4CX layer after the src frontends moved to the
public Simphony runtime. Embedded applications, DD4hep actions, and CSG
geometry tests now use the same process-wide initialization and event
lifecycle through simphony::simphony.

- Remove the g4cx library, exported target, headers, legacy executables and
  tests, top-level build entries, and OPTICKS_G4CX logging hooks.
- Migrate the MC_Truth, async_gpu_launch, and async_gpu_std examples to
  simphony::initialize/simulate/reset and the installed public target.
  Require C++20 and release retained event data after result retrieval,
  including synchronous and output-file failure paths.
- Migrate DD4hep run/event actions while retaining sensor mapping, hit
  injection, and end-of-run batch flushing. Reuse the initialized runtime
  across runs, remove the no-op Finalize call, and add GeometryDirectory
  (default: geometry) as the explicit SaveGeometry destination.
- Preserve in-tree and standalone DD4hep builds. Remove inherited raw
  language-standard flags from DD4hep's Geant4::Interface helper so they
  cannot override the plugin's declared C++20 requirement.
- Initialize CSG test geometry with the GPU disabled. Keep U4GDML parsing
  to preserve volume names, path expansion, and auxiliary sensitive-
  detector tags. Replace retired geometry-test export lookup paths with
  consgeo exports and the SIMPHONY_GEOMETRY_DIR override.
- Document external builds, reset ordering, geometry export, lower-level
  saved-foundry tools, and current simg4ox Cerenkov/scintillation capabilities.

Validation:
- Full build with DD4hep enabled; 255 enabled CTest tests passed, including
  all 20 simg4ox integration tests. SBndTest and CSGOptiXRenderTest remain
  disabled. All 44 CSG tests also passed after preserving GDML handling.
- Clean Release build/install with BUILD_TESTING=OFF; no G4CX library,
  headers, exported target, or runtime dependency in the clean package.
  The installed geometry-only consgeo export also passed.
- All four standalone examples built against the clean installation.
  MC-truth completed two runs; both async examples completed synchronous
  and batched modes across two runs.
- DD4hep v01-38, ROOT 6.36.14, and Geant4 11.4.2: in-tree and standalone
  plugin builds and standalone installation passed, as did two-event
  CPU/GPU raindrop tests.
  In-tree and standalone hit counts matched with the same GPU kernel.
  Consecutive runs, geometry export, and end-of-run batch flushing passed.
  This local Geant4 build required DD4hep's TLS-check override and Geant4
  preloading because it uses initial-exec TLS.
- git diff --check and public-header/script syntax checks passed.

BREAKING CHANGE: remove simphony::G4CX and G4CXOpticks. Consumers must link
simphony::simphony and use simphony.h. Initialize from a live Geant4 world
and reset retained events after reading results. Saved-foundry rendering
and simtrace remain available through lower-level CSGOptiX tools.
@plexoos plexoos self-assigned this Oct 18, 2026
@plexoos

plexoos commented Oct 18, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 9c65904b61

ℹ️ 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".

@plexoos
plexoos merged commit 1a4dd1c into main Oct 18, 2026
24 checks passed
@plexoos
plexoos deleted the retire-g4cx branch October 18, 2026 23:50
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