NextStatNextStat

TRExFitter Interop

NextStat can import TRExFitter .config files and run the full pipeline — from ROOT ntuples or pre-built histograms to fits and reports — without TRExFitter or ROOT C++.

Import a TRExFitter Config

# Convert a TRExFitter config into a pyhf JSON workspace
nextstat import trex-config --config myanalysis.config --out workspace.json

# Specify base directory for relative File: paths
nextstat import trex-config --config myanalysis.config --base-dir /data/ntuples/

Build Histograms (NTUP Mode)

# Run the ntuple pipeline and produce workspace.json
nextstat build-hists --config myanalysis.config --out-dir results/

# This reads ROOT ntuples, applies selections/weights,
# fills histograms, and assembles a HistFactory workspace.

HIST Mode

For configs with ReadFrom: HIST, NextStat reads pre-built ROOT histograms directly instead of processing ntuples. Both modes (NTUP, HIST, and mixed NTUP+HIST) are supported.

Analysis Spec v0

The Analysis Spec is a declarative YAML format that orchestrates the full workflow: import → fit → scan → report. JSON Schema is provided for IDE autocomplete.

# Run a full analysis from a spec file
nextstat run analysis.yaml

# Dry run (validate without executing)
nextstat run analysis.yaml --dry-run

Example spec:

# analysis.yaml
inputs:
  mode: trex_config_yaml
  config: myanalysis.config
  base_dir: /data/ntuples/

steps:
  - action: import
  - action: fit
  - action: scan
    poi: mu_sig
    range: [0.0, 3.0]
    points: 30
  - action: report
    blind: true

TRExFitter Config Subset

The following TRExFitter config blocks are supported:

  • Job — ReadFrom (NTUP/HIST), POI, Lumi, regions, MCweight
  • Region — Variable, Selection, Binning, Type (SIGNAL/CONTROL/VALIDATION)
  • Sample — NtupleFiles, HistoFiles, MCweight, Selection, modifiers
  • Systematic — NormSys, HistoSys, WeightSys, TreeSys, OverallSys
  • NormFactor — free normalization parameters

Visualization Parity (18 / 18 plot types)

NextStat now covers every TRExFitter output plot type via the ns-viz crate. All artifacts are JSON-serialisable Rust structs with Python matplotlib renderers.

PlotTRExFitterNextStat CLI
Prefit / postfit distributionsdviz distributions
NP pullspviz pulls
Correlation matrixpviz corr
NP rankingrviz ranking
Brazil band (CLs)lviz cls
Profile likelihoodlviz profile
Yield tablesdreport
Uncertainty breakdownbviz uncertainty
Gammas (stat NPs)pviz gammas
Summary (μ multi-fit)mviz summary
Separation (S vs B)dviz separation
Pie chartdviz pie
Significance scansviz significance
2D contoursGetContourviz contour
Unfoldingxviz unfolding
Morphing validationviz morphing
Signal injectionviz injection
Report bundlereport --render

See the Visualization page for code examples and Rust artifact details.