Skip to main content

Installation

gh repo clone andrzejnovak/combine_postfits
cd combine_postfits
pip install -e .

Run

Default plotter can be ran as combine_postfits -i fitDiagnostics.root. If you need further customization edit the source file at make_plot.py, which can be also copied separately and edited as needed.

USAGE: combine_postfits [-h] [--input INPUT] [--output OUTPUT] [--fit {all,prefit,fit_s,fit_b}] [--cats CATS] [--format {png,pdf,both}] [-p [MULTIPROCESSING]]
                        (--data | --MC | --toys) [--unblind] [--blind BLIND] [--sigs SIGS] [--project-signals PROJECT_SIGNALS] [--bkgs BKGS] [--onto ONTO] [--rmap RMAP]
                        [--style STYLE] [--cmap CMAP] [--cmslabel CMSLABEL] [--year {2016,2017,2018,""}] [--pub PUB] [--lumi LUMI] [--xlabel XLABEL] [--ylabel YLABEL]
                        [--catlabels CATLABELS] [--clipx [{True,False}]] [--no_zero [{True,False}]] [--dpi DPI] [--verbose] [--debug] [--chi2 [{True,False}]]
                        [--residuals [{True,False}]] [--noroot]

OPTIONS:
  -h, --help            show this help message and exit
  --input, -i INPUT     Input combine fitDiagnostics file (default: fitDiagnosticsTest.root)
  --output, -o OUTPUT   Output folder (will becreated if it doesn\'t exist). (default: plots)
  --fit {all,prefit,fit_s,fit_b}
                        Shape set to plot. (default: all)
  --cats CATS           Categories to plot. Either a comma-separated list of categories to plot (`cat1,cat2`) or a mapping of categories to plot and/or merge
                        (`mcat1:cat1,cat2;mcat2:cat3,cat4`).
  --format, -f {png,pdf,both}
                        Plot output format (default: png)
  -p [MULTIPROCESSING]  Use multiprocessing. May fail due to parallel reads from fitDiag. `-p` defaults to 10 processes.

DATA:
  What type of data is stored in 'data_obs' in the input file.

  --data
  --MC
  --toys
  --unblind             Confirm wanting to plot real data
  --blind BLIND         Category to blind data (not plotted), e.g. `cat1`
  --blind-data, --blind_data BLIND_DATA
                        Range of data to blind in a category. Format: `cat:start:stop` where start:stop can be:
                        - By bin index: `cat1:1:15` (blinds bins 1 to 14, Python slice convention, stop is exclusive)
                        - By value: `cat1:1j:15j` (blinds bins with left edges between 1.0 and 15.0)
                        - Multiple categories: `cat1:1:15;cat2:5:10`
                        Examples: `pass:1:16` blinds bins 1-15 by index, `pass:1j:15j` blinds bins with edges 1-15 by value

STACKING OPTIONS:
  --sigs SIGS           Signals. Comma-separated list of keys available in provided --style sty.yml file, e.g. `ggH,VBF`
  --project-signals, --project_signals PROJECT_SIGNALS
                        Project signals onto the x-axis at scale. Comma-separated list of values of equal length with --sigs, e.g. `1,1`.
  --bkgs BKGS           Backgrounds. Comma-separated list of keys available in provided `--style sty.yml` file, e.g. `qcd,ttbar`
  --onto ONTO           Background to plot unfilled and stack other processes onto, e.g. `qcd`. Useful when one background is dominant.
  --rmap RMAP           A dict-like string (`hbb:r_q,htt:r_t`) mapping signal keys in --sigs to POIs in --input fitDiagnostics file (requires ROOT).

STYLING:
  --style, -s STYLE     Style yaml file e.g. `style.yml`. Automatically created as `sty.yml` if not provided.
  --cmap CMAP           Name of `cmap` to fill colors in `sty.yml` from. Eg.: Tiepolo;Renoir;tab10. Only used if `sty.yml` is not provided.
  --cmslabel CMSLABEL   CMS Label. (default: Private Work)
  --year {2016,2017,2018,""}
                        Year label.
  --pub PUB             Supplementary label - arxiv no.
  --lumi LUMI           Luminosity for label.
  --xlabel XLABEL       Plot x-label eg `$m_{\tau\bar{\tau}}^{reg}$`. If left `None` will read from combine. When using latex enclose string as 'str'.
  --ylabel YLABEL       Plot y-label. If left `None` will read from combine. When using latex enclose string as 'str'.
  --catlabels CATLABELS
                        Category label to replace automated labelling. To pass per-category label, use `;` separator.
  --clipx [{True,False}]
                        Clip x-axis to range of data. (default: True)
  --no_zero [{True,False}]
                        Hide zeroth tick on the y-axis.
  --dpi DPI             DPI for png format. (default: 300)

DEBUG OPTIONS:
  --verbose, -v, -_v    Verbose logging
  --debug, -vv, --vv    Debug logging
  --chi2 [{True,False}]
                        Display chi2 (when plotting multiple categories a per-category sum is displayed).
  --residuals [{True,False}]
                        Display data/MC residuals.
  --noroot              Skip ROOT dependency

EXAMPLES::

  Minimal example:
  ``
  combine_postfits -i fitDiagnosticsTest.root --toys
  ``

  Basic usage (modify generated `sty.yml` file) with debug options on:
  ``
  combine_postfits -i fitDiagnosticsTest.root --sigs hbb --bkgs qcd,wjets,zjets,ttbar --rmap 'hbb:r' --onto qcd --style sty.yml
  --data --unblind
  --cmslabel 'Private Work' --year 2016 --lumi 35.9 --xlabel '$m_{b\bar{b}}^{reg}$'
  --chi2 True --residuals True -p
  ``

  Extended example with category merging and signal mapping
  ``
  combine_postfits -i fitDiagnosticsTest.root -o final_plots --style sty.yml
  --data --unblind --sigs hbb,zbb --bkgs top,ttbat,wjets,wcq,zjets_other --onto qcd
  --rmap zbb:r_z,hbb:r  --project-signal 50,0
  --cats 'pass16:ptbin*pass2016;pass:ptbin*pass*;fail:ptbin*fail*;muCRpass16:muonCRpass2016'
  -p 20
  ``

  For more examples see https://github.com/andrzejnovak/combine_postfits/blob/master/tests/test.sh



# Examples

In `cd test` directory:


- `fit_diag_A.root`
  - Simple
  ```bash
  combine_postfits -i fitDiags/fit_diag_A.root -o outs/plots_A_all --data --unblind  -p
  • Customized
combine_postfits -i fitDiags/fit_diag_A.root -o outs/plots_A --style styles/style_A.yml --data --unblind --sigs hcc,zcc --onto qcd --rmap zcc:z,hcc:r  --cats 'pass:ptbin*pass2016;fail:ptbin*fail*;muCRpass:muonCRpass2016;muCRfail:muonCRfail2016' --bkgs top,other,wqq,wcq,zqq,zbb,hbb -vv --project-signal 200,0 -p
  • fit_diag_Abig.root

    • Simple
    combine_postfits -i fitDiags/fit_diag_Abig.root -o outs/plots_Abig_all --data --unblind  -p
    
    • Customized
    combine_postfits -i fitDiags/fit_diag_Abig.root -o outs/plots_Abig --style styles/style_A.yml --data --unblind --sigs hcc,zcc --onto qcd --rmap zcc:z,hcc:r  --cats 'pass16:ptbin*pass2016;fail16:ptbin*fail2016;pass17:ptbin*pass2017;fail17:ptbin*fail2017;pass18:ptbin*pass2018;fail18:ptbin*fail2018;pass:ptbin*pass*;fail:ptbin*fail*;muCRpass16:muonCRpass2016;muCRfail16:muonCRfail2016;muCRpass17:muonCRpass2017;muCRfail17:muonCRfail2017;muCRpass18:muonCRpass2018;muCRfail18:muonCRfail2018' --bkgs top,other,wqq,wcq,zqq,zbb,hbb -vv --project-signal 200,0 -p
    
  • fit_diag_B.root

    • Simple
    combine_postfits -i fitDiags/fit_diag_B.root -o outs/plots_B_all --MC  -p
    
    • Customized
    combine_postfits -i fitDiags/fit_diag_B.root --data --unblind -o outs/plots_B --style styles/style_B.yml  --xlabel 'Jet $m_{SD}$' --sigs b150,m150 --project-signals 2,2 --rmap 'm150:r_q,b150:r_b' --bkgs top,vlep,wqq,zqq,zbb,hbb --onto 2017_qcd --cats 'fail:ptbin*fail;passlow:ptbin*high*;passhigh:ptbin*passlow*' -v -p
    
    # 'mufail:muonCRfail;mupasslow:muonCRpasslowbvl;mupasshigh:muonCRpasshighbvl'
    
  • fit_diag_C.root

    • Simple
    combine_postfits -i fitDiags/fit_diag_C.root -o outs/plots_C_all --toys  -p
    
    • Customized
    combine_postfits -i fitDiags/fit_diag_C.root -o outs/plots_C --toys  --style styles/style_C.yml --xlabel 'Jet $m_{reg}$'
    
  • fit_diag_D.root

    • Simple
    combine_postfits -i fitDiags/fit_diag_D.root -o outs/plots_D_all --MC  -p
    
    • Customized
    combine_postfits -i fitDiags/fit_diag_D.root -o outs/plots_D --MC --style styles/style_D.yml --onto qcd --sigs VH --bkgs qcd,top,Wjets,Zjets,VV,H  --rmap 'VH:rVH' --project-signals 3 --xlabel 'Jet $m_{SD}$' -p 20
    

Metadata

Release files for combine-postfits 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for combine-postfits 0.1.1
File Size Uploaded Provenance
combine_postfits-0.1.1.tar.gz 29.1 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for combine-postfits 0.1.1
File Interpreter ABI Platform
combine_postfits-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.1 MB

Release files / combine_postfits-0.1.1.tar.gz

Download URL combine_postfits-0.1.1.tar.gz
Size 29.1 MB
Tags Source
SHA-256 checksum
How to use checksums
feb01a5ed8b381e629680e59671acbb7fea849fded07447ae8603d4f2ae3970e
BLAKE2b-256 checksum
How to use checksums
a2e7f869146faa993164595c87d3c07ce601bb32c0feb8cf08bd8deb26867697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.

Transparency log

Release files / combine_postfits-0.1.1-py3-none-any.whl

Download URL combine_postfits-0.1.1-py3-none-any.whl
Size 30.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b02c13295d2249230dacd108fa9fd2ec3bc5ddd127d8579a62bb150a233ffd77
BLAKE2b-256 checksum
How to use checksums
f2ca26ad4f1e75c711f3370c4248db6398c638ff74aee19880de6f364de2a8de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.

Transparency log

Security for combine-postfits 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for combine_postfits-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page