Skip to main content

Plotter for combine postfits

Project description

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
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

combine_postfits-0.1.0.tar.gz (29.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

combine_postfits-0.1.0-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

Details for the file combine_postfits-0.1.0.tar.gz.

File metadata

  • Download URL: combine_postfits-0.1.0.tar.gz
  • Upload date:
  • Size: 29.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for combine_postfits-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d7844b883d0d9761a219aafa296ee5c965e9caa5c33353fa8caaf7917ad80dd3
MD5 a3064403553fbc2b654582a6163b07d2
BLAKE2b-256 b9e08a2303b0c8b9afc35b554c33c4cf04af3d33de4d5f1d4540913f38164a28

See more details on using hashes here.

Provenance

The following attestation bundles were made for combine_postfits-0.1.0.tar.gz:

Publisher: release.yml on andrzejnovak/combine_postfits

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file combine_postfits-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for combine_postfits-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a17991c9c470c624bd8666fe0affde7c7070320ddd342540a2f3d5cd4fcf1a9
MD5 a63cfdd5aeb060526d6fbeb8630491f3
BLAKE2b-256 7db32b078dbeef90b1937cdaccd377c7126f0e49862c4c8efd646bd6df0736b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for combine_postfits-0.1.0-py3-none-any.whl:

Publisher: release.yml on andrzejnovak/combine_postfits

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page