Repository navigation
Conversation
6ff6222 to
b4c320f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ff6222679
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
This PR refactors the event persistence mode configuration key by renaming the JSON field from event.mode to event.event_mode, updating both the C++ config reader and the checked-in sample config files so that Config continues to drive SEventConfig correctly.
Changes:
- Update
Config::ReadConfigto read the event mode fromevent.event_modeinstead ofevent.mode. - Reorder
Config’sevent_modemember placement and adjustConfig::Apply()call ordering forSEventConfig::SetEventMode. - Update sample JSON configs to use
"event_mode".
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sysrap/config.h | Moves event_mode member (no semantic change by itself). |
| sysrap/config.cpp | Reads renamed JSON key and applies SEventConfig::SetEventMode. |
| config/wls_test.json | Updates event mode key to "event_mode". |
| config/trap_iso.json | Updates event mode key to "event_mode". |
| config/sphere_leak.json | Updates event mode key to "event_mode". |
| config/dev.json | Updates event mode key to "event_mode" and reorders within the object. |
| config/8x8SiPM_crystal.json | Updates event mode key to "event_mode". |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b4c320f to
a270d5c
Compare
| int SEventConfig::_IntegrationMode = _IntegrationModeDefault; | ||
| const char* SEventConfig::_EventMode = _EventModeDefault; | ||
| const char* SEventConfig::_DeviceName = nullptr ; | ||
| int SEventConfig::_RunningMode = SRM::Type(ssys::getenvvar(kRunningMode, _RunningModeDefault)); | ||
|
|
||
|
|
||
|
|
||
|
|
||
| int SEventConfig::_StartIndex = ssys::getenvint(kStartIndex, _StartIndexDefault ); | ||
| int SEventConfig::_NumEvent = ssys::getenvint(kNumEvent, _NumEventDefault ); | ||
|
|
||
| std::vector<int64_t>* SEventConfig::_GetNumPhotonPerEvent() | ||
| { | ||
| const char* spec = ssys::getenvvar(kNumPhoton, _NumPhotonDefault ); | ||
| return sstr::ParseIntSpecList<int64_t>( spec, ',' ); | ||
| } | ||
| std::vector<int64_t>* SEventConfig::_NumPhotonPerEvent = _GetNumPhotonPerEvent() ; | ||
|
|
||
|
|
||
| std::vector<int64_t>* SEventConfig::_GetNumGenstepPerEvent() | ||
| { | ||
| const char* spec = ssys::getenvvar(kNumGenstep, _NumGenstepDefault ); | ||
| return sstr::ParseIntSpecList<int64_t>( spec, ',' ); | ||
| } | ||
| std::vector<int64_t>* SEventConfig::_NumGenstepPerEvent = _GetNumGenstepPerEvent() ; | ||
|
|
||
|
|
||
| /** | ||
| SEventConfig::_GetNumPhoton | ||
| ---------------------------- | ||
|
|
||
| Used by some tests that define a sequence of photon counts as inputs:: | ||
|
|
||
| OPTICKS_NUM_PHOTON=M1,2,3,4 OPTICKS_NUM_EVENT=4 SEventConfigTest | ||
| OPTICKS_NUM_PHOTON=G1,2,3,4 OPTICKS_NUM_EVENT=4 SEventConfigTest | ||
|
|
||
|
|
||
| Expected to define the below of envvars with equal numbers of entries:: | ||
|
|
||
| OPTICKS_NUM_PHOTON=M1,2,3,4 | ||
| OPTICKS_NUM_GENSTEP=1,1,1,1 | ||
|
|
||
|
|
||
| **/ | ||
| int64_t SEventConfig::_GetNumPhoton(int idx) | ||
| { | ||
| if(_NumPhotonPerEvent == nullptr) return 0 ; | ||
|
|
||
| int nevt0 = NumEvent() ; | ||
| int nevt1 = _NumPhotonPerEvent->size() ; | ||
| bool match = nevt0 == nevt1 ; | ||
| LOG_IF(fatal, !match) | ||
| << " NumEvent MISMATCH BETWEEN " | ||
| << std::endl | ||
| << " nevt0:_NumEvent " << nevt0 << "( from " << kNumEvent << ":" << ( getenv(kNumEvent) ? getenv(kNumEvent) : "-" ) << ") " | ||
| << " nevt1:_NumPhotonPerEvent.size " << nevt1 << "( from " << kNumPhoton << ":" << ( getenv(kNumPhoton) ? getenv(kNumPhoton) : "-" ) << ") " | ||
| ; | ||
| assert( match ); | ||
| if(idx < 0 ) idx += nevt0 ; // allow -ve indices to count from the back | ||
| if(idx >= nevt0) return 0 ; | ||
|
|
||
| return (*_NumPhotonPerEvent)[idx] ; | ||
| } | ||
|
|
||
|
|
||
| int64_t SEventConfig::_GetNumGenstep(int idx) | ||
| { | ||
| if(_NumGenstepPerEvent == nullptr) return 0 ; | ||
|
|
||
| int nevt0 = NumEvent() ; | ||
| int nevt1 = _NumGenstepPerEvent->size() ; | ||
| bool match = nevt0 == nevt1 ; | ||
| LOG_IF(fatal, !match) | ||
| << " NumEvent MISMATCH BETWEEN " | ||
| << std::endl | ||
| << " nevt0:_NumEvent " << nevt0 << "( from " << kNumEvent << ":" << ( getenv(kNumEvent) ? getenv(kNumEvent) : "-" ) << ") " | ||
| << " nevt1:_NumGenstepPerEvent.size " << nevt1 << "( from " << kNumGenstep << ":" << ( getenv(kNumGenstep) ? getenv(kNumGenstep) : "-" ) << ") " | ||
| ; | ||
| assert( match ); | ||
| if(idx < 0 ) idx += nevt0 ; // allow -ve indices to count from the back | ||
| if(idx >= nevt0) return 0 ; | ||
|
|
||
| return (*_NumGenstepPerEvent)[idx] ; | ||
| } | ||
| int SEventConfig::_RunningMode = SRM::Type(_RunningModeDefault); |
| ) | ||
|
|
||
| target_compile_definitions(ConfigTest PRIVATE | ||
| SIMPHONY_SOURCE_CONFIG_DIR="${CMAKE_SOURCE_DIR}/config" |
| NP* ip = SEvt::GetInputPhoton(0); | ||
|
|
||
| LOG_IF(error, ip == nullptr) << "SEvt::GetInputPhoton GIVES nullptr : SET OPTICKS_INPUT_PHOTON TO CONFIGURE " ; | ||
| LOG_IF(error, ip == nullptr) << "SEvt::GetInputPhoton GIVES nullptr : set event.input_photon in JSON"; |
Finish the event_mode rename across every shipped JSON profile and move the WLS event policy, bounce limit, and slot capacity out of its shell environment into wls_test.json. Remove redundant legacy overrides from Config-backed timing and photon-file workflows, pass an explicit JSON profile through the performance runner, and update the WLS output path for the simplified event_reldir default. Add a ConfigTest matrix covering the intended event policy of every shipped profile. JSON and script syntax checks pass, ConfigTest is green, and test_GPUPhotonFileSource.sh passes end to end; the WLS comparison skips because its external validator is unavailable.
Add typed Config fields for the retained SEventConfig runtime, resource, propagation, output, and input controls, parse them from the event object, and apply them through the existing low-level facade. Preserve useful OPTICKS_* settings as a one-release compatibility fallback when JSON keys are omitted, make explicit JSON values authoritative, and emit migration warnings that name the replacement keys. Extend ConfigTest to cover the complete JSON contract, adapter application, and precedence behavior. Also add the missing event-skipahead setter and non-lossy max-simtrace setter.
Stop loading obsolete, overwritten, or policy-derived OPTICKS_* values for event naming, per-event test counts, debug buffer maxima, legacy RNG/photon caps, save/client modes, compressed-record domains, ray-generation mode, component masks, and unused input selection. Keep the internal SEventConfig state required by existing allocation and programmatic callers, but derive component masks and debug maxima from event policy and default ray generation to simulate. Replace the disconnected event-name expansion with event.event_reldir. Add a fresh-process CTest that sets every retired variable and proves none affects runtime state. The complete enabled SysRap suite passes (101 tests; one pre-existing test disabled).
Reject event.mode explicitly instead of silently retaining the inherited or default event mode after the JSON schema rename. Point users to event.event_mode and cover the behavior in ConfigTest while leaving the valid torch.mode setting on its existing parser path.
Keep Config::output_dir at the current working directory when SEventConfig only contains its unresolved $DefaultOutputDir sentinel. Continue inheriting explicit JSON, environment, and programmatic output-directory values. Add regression coverage for omitted event.output_dir and document the distinction between application defaults and low-level SEvt path handling. This restores hit arrays and timing CSVs for the affected integration tests.
Make typed Config defaults plus the selected JSON file the sole source of modeled event settings, and apply every value deterministically through SEventConfig. Migrate the async and DD4hep examples to named JSON profiles, initialize DD4hep configuration once per process, and require C++20 for the plugin target. Remove retired variable names from code and documentation, update affected configuration files, and expand ConfigTest coverage for absent and empty event objects.
Resolve ConfigTest's source fixture directory relative to the SysRap test CMake file instead of the parent project's CMAKE_SOURCE_DIR. This keeps source-profile checks working when Simphony is included with add_subdirectory.
b524e77 to
cdab874
Compare


Summary
Make typed
simphony::Configdefaults plus the selected JSON profile the authoritative source for modeled event settings.SEventConfigfacade before event creation.OPTICKS_*event-setting support, including values that were previously read and then silently overwritten.add_subdirectory.Breaking changes
OPTICKS_*variables for modeled event settings are no longer honored. Set these values in the selected JSON profile.event.modehas been replaced byevent.event_mode; the old key is rejected with an explanatory error.simphony::Configbefore creating event or geometry consumers.SIMPHONY_CONFIG_DIRandSIMPHONY_PTX_DIRremain supported as discovery variables; they are not event settings.Migration
Select a configuration basename with
-cor--config:SIMPHONY_CONFIG_DIR=$PWD/config \ GPUPhotonSourceMinimal \ -g tests/geom/wls_test.gdml \ -c wls_test \ -m tests/run.macMove runtime settings into the profile’s
eventobject:{ "event": { "event_mode": "HitPhoton", "integration_mode": 1, "max_bounce": 100, "maxslot": 100000, "output_dir": "./output" } }Scope
The legacy G4CX layer is not being modernized here because it is scheduled for removal in a separate PR.