-
Notifications
You must be signed in to change notification settings - Fork 277
Description
Describe the bug
In DigiGate offline mode (Gate --d), enabling ROOT Singles output with
/gate/output/root/setRootSinglesFlag 1
causes the simulation to abort at acquisition start with:
GateOutputMgr.cc (l.167): Output Module analysis not found
I reproduced this in both Gate v9.4.1 and v9.3.
After inspecting the source, the issue appears to come from GateOutputMgr.cc:
- in the constructor,
analysis(andfastanalysis) are only added whenm_digiMode == kruntimeMode - but in
RecordBeginOfAcquisition(), when Singles or Coincidences are requested, the code still calls:FindOutputModule("analysis")->IsEnabled()FindOutputModule("fastanalysis")->IsEnabled()
So in offline mode (--d), analysis is not registered, but it is still required later, which triggers the error.
In my local build, the problem was fixed by:
- making
analysisavailable in offline mode as well - replacing the direct
FindOutputModule(...)->IsEnabled()logic with a null-safe check
After recompiling Gate, DigiGate offline mode works correctly with /gate/output/root/setRootSinglesFlag 1.
====================================================
Desktop (please complete the following information):
- OS: Ubuntu 20.04.6 LTS
- Gate version or commit hash: v9.4.1 (also reproduced in: v9.3)
- Geant4 version: 11.3.0
- Root version: 6.24/06
- compiler version: gcc/g++ 9.4.0
====================================================
Minimal example
A minimal reproduction requires two steps.
- Generate a ROOT Hits file in normal runtime mode.
- Re-run in DigiGate offline mode with
Gate --dand enable ROOT Singles output.
main.mac:
...verbose definition here...
...geometry and detector definition here...
...physics definition here...
/gate/run/initialize
/vis/disable
...digitizer definition here...
...source definition here...
/gate/hitreader/setFileName output/hits
/gate/output/root/enable
/gate/output/root/setFileName outputSingles/singles
/gate/output/root/setRootHitFlag 0
/gate/output/root/setRootSinglesFlag 1
/gate/random/setEngineName JamesRandom
/gate/random/setEngineSeed auto
/gate/random/verbose 0
/gate/application/setTotalNumberOfPrimaries 5e7
/gate/application/start
Run with:
Gate --d main.mac
This aborts with:
GateOutputMgr.cc (l.167): Output Module analysis not found
====================================================
Expected behavior
DigiGate offline mode should allow writing Singles to ROOT when processing a previously generated ROOT Hits file, without aborting because analysis is missing.
====================================================
Additional context
The issue appears to be in:
source/digits_hits/src/GateOutputMgr.cc
In this file:
GateAnalysis/GateFastAnalysisare only registered inkruntimeModeRecordBeginOfAcquisition()still assumes these modules exist when Singles or Coincidences are requested
This makes offline DigiGate internally inconsistent.
I have already tested a local source-level fix, and after recompiling Gate, offline mode works correctly with /gate/output/root/setRootSinglesFlag 1.
Possible fix:
- register
analysisin offline mode as well - use null-safe logic such as:
auto *analysis = GetModule("analysis");auto *fastanalysis = GetModule("fastanalysis");- check pointers before calling
IsEnabled()
Thank you for maintaining Gate.