VS Code extension for viewing HepMC3 ASCII event files (.hepmc, .hepmc3).
Features
- Opens HepMC files in a custom editor
- Shows one event at a time with next/previous navigation
- Supports pan and zoom
- Right-click in the graph to save the current event as SVG
- Layout and styling follow pyhepmc's graphviz view:
- unicode particle names for every PDG ID pyhepmc knows (6,496 entries incl. nuclei)
- track thickness scales with energy relative to the event's most energetic particle
- color by category (hadron, quark/gluon, lepton/boson, generator-internal, …), dashed neutrals, arrowheads on beam and final-state particles only
- Shows particle hover tooltips with:
- name
- PDG ID
- status
- mass
- 4-momentum
- electric charge
Supported input
The parser handles the common HepMC3 ASCII records used in this project:
Eevent headersUunitsWevent weightsAattributesPparticlesVvertices
Architecture
src/common/contains the portable HepMC parser, PDG lookup (pdg.ts+ generatedpdg-data.json), graph construction, the DOT builder (dot.ts) and the graphviz WASM wrapper (render.ts).src/webview/contains the browser-side shell: it injects the SVG produced by the host and adds zoom and tooltips.src/extension.tscontains the VS Code custom editor host layer; it parses the file, lays events out with graphviz on request, and serves the theme stylesheet (src/common/theme.ts).- Vocabulary is in
CONTEXT.md; design decisions are recorded indocs/adr/.
Build
npm install
npm run build
Regenerating particle data
src/common/pdg-data.json is generated from pyhepmc's unicode name table and the particle package.
It is committed, so a normal build needs no Python. To refresh it:
uv run --with "pyhepmc,particle" python scripts/generate_pdg_data.py
Notes
- The UI is intentionally browser-native so it can be reused in a standalone website later
(
@hpcc-js/wasm-graphvizruns in both Node and browsers). d3-selectionandd3-zoomare used for the lightweight interactive view layer.
Third-party notices
- Particle names in
src/common/pdg-data.jsoncome from pyhepmc (BSD-3-Clause), with categories and charges derived from particle (BSD-3-Clause). - Layout uses Graphviz (EPL-1.0) via @hpcc-js/wasm-graphviz (Apache-2.0).