Skip to content

DigiGate (--d) fails with "Output Module analysis not found" when enabling ROOT Singles output in offline mode #758

@QQvx2001

Description

@QQvx2001

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 (and fastanalysis) are only added when m_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:

  1. making analysis available in offline mode as well
  2. 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.

  1. Generate a ROOT Hits file in normal runtime mode.
  2. Re-run in DigiGate offline mode with Gate --d and 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 / GateFastAnalysis are only registered in kruntimeMode
  • RecordBeginOfAcquisition() 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 analysis in 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions