Skip to content

Apply the -t trigger to the Hyperloop hybrid expansion - #16179

Open
sawenzel wants to merge 1 commit into
AliceO2Group:devfrom
sawenzel:hybrid-hyperloop-trigger
Open

sawenzel wants to merge 1 commit into
AliceO2Group:devfrom
sawenzel:hybrid-hyperloop-trigger

Conversation

@sawenzel

Copy link
Copy Markdown
Collaborator

This PR fixes the Hyperloop expansion of an external generator, which ignored a trigger given with -t. Triggers from -t are attached only to non-hybrid generators, while the hybrid configuration generated for Hyperloop carried none, so with GeneratorHybrid.num_workers > 1 every generated event was accepted.

An external trigger is now written into each sub-generator of the generated configuration. Each clone gets its own trigger object, but the macro is loaded once, so its static state is shared between the worker threads and trigger macros must not keep state. A particle trigger has no JSON equivalent, and the plain external generator is kept for it, with a warning that parallel generation is lost. An external trigger without TriggerExternal.fileName is fatal.

The trigger loading of the hybrid generator is brought closer to the plain path. An empty function name is now derived from the macro file name, as GetFromMacro does for the plain generator. A macro that returns neither a Trigger nor a DeepTrigger, and a trigger mode for which no trigger macro is given, are now fatal instead of running untriggered. A missing macro file or function was already fatal. In addition, a -t trigger given to a user-configured hybrid generator gives a warning, a cocktail in parallel mode is rejected instead of producing empty events and stalling, and a non-positive num_workers in the Hyperloop expansion gives a warning.

The change was tested with libO2Generators rebuilt against O2 daily-20261123 and o2-sim --noGeant with IS_HYPERLOOP=1, 20 events of one pion with p = 0–10 GeV/c and a trigger requiring pT > 5 GeV/c.

configuration daily-20261123 this PR
-t external, num_workers = 4 11 / 20 fail 0 / 20
-t external, num_workers = 1 15 / 20 fail 0 / 20
-t external, no funcName, num_workers = 4 11 / 20 fail 0 / 20
-t external, no fileName, num_workers = 4 12 / 20 fail fatal
-t particle, num_workers = 4 10–14 / 20 fail 0 / 20
cocktail in parallel mode hangs fatal

The daily predates #16164 and always expanded to 8 sub-generators, which is why the single-worker row also fails there. A hybrid JSON with trigger mode or and an empty macro is now fatal, while an empty placeholder spec next to a valid one still triggers correctly (0 / 20). No configuration in O2DPG or in the O2 examples is affected by the new fatal checks.

Overall, a trigger given with -t now selects events on Hyperloop independently of num_workers.

Assisted by Claude Code.

This fixes a problem in the Hyperloop expansion of an external generator, where a trigger given with -t was ignored.

- Triggers from -t are only attached to non-hybrid generators, and the generated hybrid JSON had none.
- An external trigger is now written into every sub-generator of the generated JSON.
- With a particle trigger the plain external generator is kept, with a warning.
- The hybrid generator now derives an empty trigger function name from the macro file name, as the plain path does.
- A hybrid trigger that returns no trigger type is now fatal instead of being skipped.
- A hybrid trigger mode without any trigger macro is now fatal.
- A trigger given with -t to a user-configured hybrid generator now gives a warning.
- A cocktail in parallel mode is now rejected, since it produced empty events and stalled.
- A non-positive GeneratorHybrid.num_workers on Hyperloop now gives a warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sawenzel
sawenzel requested a review from jackal1-66 as a code owner November 23, 2026 13:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant