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-runExample 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: trueTRExFitter 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.
| Plot | TRExFitter | NextStat CLI |
|---|---|---|
| Prefit / postfit distributions | d | viz distributions |
| NP pulls | p | viz pulls |
| Correlation matrix | p | viz corr |
| NP ranking | r | viz ranking |
| Brazil band (CLs) | l | viz cls |
| Profile likelihood | l | viz profile |
| Yield tables | d | report |
| Uncertainty breakdown | b | viz uncertainty |
| Gammas (stat NPs) | p | viz gammas |
| Summary (μ multi-fit) | m | viz summary |
| Separation (S vs B) | d | viz separation |
| Pie chart | d | viz pie |
| Significance scan | s | viz significance |
| 2D contours | GetContour | viz contour |
| Unfolding | x | viz unfolding |
| Morphing validation | — | viz morphing |
| Signal injection | — | viz injection |
| Report bundle | — | report --render |
See the Visualization page for code examples and Rust artifact details.
