-
Notifications
You must be signed in to change notification settings - Fork 4
How To: Making Stack Plots
To visualize how the observed data and background predictions look like in an analysis region (possibly together with signal), stack plots are often very useful. These plots will show how much contribution is coming from each background source, and how the overall background prediction compares with data, within statistical uncertainties.
The functionality to produce stack plots are located under plot/studies/stack_plot
directory. For VBF H(inv) analysis use cases, stack plots can be created using the plot_data_mc.py
script, located here. This script takes a couple command line arguments, which can be found by executing ./plot_data_mc.py --help
. More details will be included below.
For the stack plot script to work, we first need to produce an additional .root
file, which specifies the template for the forward-jet (HF) noise estimation we have for the signal region. This is done via the get_hf_noise_estimate.py
script, located in the same directory here. To see a full list of command line options, please execute ./get_hf_noise_estimate.py --help
.
Given the merged accumulator input, this script can be run as follows:
./get_hf_noise_estimate.py /path/to/input/merged/acc
By default, this script will produce HF noise estimates for both 2017 and 2018, and all distributions specified in the distributions.py
script. We can customize these options as follows:
# Run only on 2017, only for distributions matching "ak4_.*"
./get_hf_noise_estimate.py /path/to/input/merged/acc --years 2017 --distribution 'ak4_.*'
# Or just produce the noise estimate as a function of the CNN score
./get_hf_noise_estimate.py /path/to/input/merged/acc --distribution 'cnn_score'
This will produce stack plots for the HF-enriched control region, and a ROOT file containing the noise templates, to be used further for the stack plotting in the next step.
Once the ROOT file containing the HF noise estimate is placed under output/<tag>/hf_estimate
, full stack plots can be produced via plot_data_mc.py
, as follows:
./plot_data_mc.py /path/to/input/merged/acc
This will save stack plots per analysis region and distribution under output/<tag>
. Similar to the get_hf_noise_estimate.py
script, the usage can be configured:
# Plot only 2017 data, only mjj distribution
./plot_data_mc.py /path/to/input/merged/acc --years 2017 --distribution mjj
# 1/5th unblinding on data (only will impact signal region)
./plot_data_mc.py /path/to/input/merged/acc --one-fifth-unblind
# Plot only control regions
./plot_data_mc.py /path/to/input/merged/acc --region 'cr_.*'
For a full set of command line options, please execute ./plot_data_mc.py --help
.