Skip to content

CI: run Pythia8 event-generation fragments verbatim and validate output - #211

Open
ianna wants to merge 3 commits into
HEP-FCC:mainfrom
ianna:ci-tutorial-fragments
Open

ianna wants to merge 3 commits into
HEP-FCC:mainfrom
ianna:ci-tutorial-fragments

Conversation

@ianna

@ianna ianna commented Oct 8, 2026

Copy link
Copy Markdown

What

Runs the Pythia8 shell commands of Getting Started with Event Generation exactly as written, then validates the EDM4hep file they produce. It runs in the existing CTest job, against both the release and nightly stacks.

  • <!-- ci-fragment: pythia8 --> markers (invisible when rendered) tag three fences: downloading pythia.py plus the dry run, downloading the card, and the 500-event k4run command.
  • .github/scripts/run_fragments.py runs the tagged fences in page order, in one fresh bash shell inside an empty directory. cd and variables therefore carry over as they do for a reader. Each block is labelled with its line number in the page. The test fails if no tagged fence is found, so it cannot pass without running anything.
  • The output is then checked with [key4hep-validate](https://github.com/ianna/mcp-server-key4hep), pinned by commit. The check covers the event count, that every collection reads, and finite values and consistent parent/daughter links in MCParticles. The validator needs only the stack's Python, with no pip install.
  • test.yml uses ctest --output-on-failure so a failing fragment's output appears in the log.

Page fixes found by the test

Run on LXPLUS with the current release (k4gen 0.1pre15), the unchanged page fails at the 500-event command:

k4run: error: unrecognized arguments: --out.filename p8_mumu_500.e4h.root

k4Gen's options/pythia.py now writes output through IOSvc. This PR therefore:

  • replaces --out.filename with --IOSvc.Output p8_mumu_500.e4h.root;
  • updates the documented --dry-run output to the current algorithm chain (--> eventHeaderCreator --> Pythia8 --> HepMCToEDMConverter --> StableParticles).

With these changes, the test passes on LXPLUS:

p8_mumu_500.e4h.root: {"collections": ["EventHeader", "MCParticles", "MCParticlesStable"], "entries": 500, "particles": 7096, "scope": "EDM4hep structure and MCParticle relations", "valid": true}

Other sections still use --out.filename (the ditau and LHE examples). They are not tagged yet; tagging them would catch the same problem there.

Related: notebook tests may execute nothing

With jupytext 1.19.6, every page I tried converts to a notebook with zero code cells: once jupytext reaches a MyST :::{admonition} fence, it treats the rest of the page as markdown. The existing add_nb_test tests may therefore pass without running anything. Please check against the jupytext version in the CI image. A guard that fails on an empty notebook could follow in a separate PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

ianna and others added 3 commits October 8, 2026 12:13
Tag the Pythia8 shell fences of 2-1-event-generation with invisible
ci-fragment markers, run them in page order in one fresh shell, and
validate the produced EDM4hep file with key4hep-validate. The runner
fails when no tagged fragment is found, so it cannot pass vacuously.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UKgjg6FJ4R6Jbp3pdhqVQD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UKgjg6FJ4R6Jbp3pdhqVQD

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant