Skip to content

High level API#

To set up the inputs for the plots, have a look here.

The following examples use the dummy data which is described here

All the previous examples show how to use the plotting of individual plots often requiring a fair amount of code to produce ROC curves etc.

This high level API facilitates several steps and is designed to quickly plot b- and c-jet performance plots.

Initialising the taggers#

The Results object is initialised with the signal class, by default this is bjets but can be changed to cjets to produce the c-tagging plots, or Hbb/Hcc for Xbb tagging.

"""Produce roc curves from tagger output and labels."""

from __future__ import annotations

from puma.hlplots import Results, Tagger
from puma.utils import get_dummy_2_taggers, logger

# The line below generates dummy data which is similar to a NN output
file = get_dummy_2_taggers(add_pt=True, return_file=True)

# define jet selections
cuts = [("n_truth_promptLepton", "==", 0)]

# define the taggers
dips = Tagger(
    name="dips",
    label="dummy DIPS ($f_{c}=0.005$)",
    fxs={"fc": 0.005, "fb": 0.04},
    colour="#AA3377",
)
rnnip = Tagger(
    name="rnnip",
    label="dummy RNNIP ($f_{c}=0.07$)",
    fxs={"fc": 0.07, "fb": 0.04},
    colour="#4477AA",
    reference=True,
)

# create the Results object
# for c-tagging use signal="cjets"
# for Xbb/cc-tagging use signal="hbb"/"hcc"
results = Results(signal="bjets", sample="dummy")

# load taggers from the file object
logger.info("Loading taggers.")
results.load_taggers_from_file(
    [dips, rnnip],
    file.filename,
    cuts=cuts,
    num_jets=len(file["jets"]),
)

results.atlas_second_tag = (
    "$\\sqrt{s}=13$ TeV, dummy jets \n$t\\bar{t}$, $20$ GeV $< p_{T} <250$ GeV"
)

Probability distributions#

You can get the output probability distributions just run

# tagger probability distributions
results.plot_probs(logy=True, bins=40)

Discriminant plots#

To plot the discriminant, you can now simply call one function and everything else is handled automatically, here for the b-jet discriminant

# tagger discriminant distributions
logger.info("Plotting tagger discriminant plots.")
results.plot_discs(logy=False, wp_vlines=[60, 85])
results.plot_discs(logy=True, wp_vlines=[60, 85], suffix="log")

ROC plots#

In the same manner you can plot ROC curves, here for the b-tagging performance

# ROC curves
logger.info("Plotting ROC curves.")
results.plot_rocs()

Performance vs a variable#

In this case we plot the performance as a function of the jet pT with the same syntax as above for an inclusive working point of 70%

# eff/rej vs. variable plots
logger.info("Plotting efficiency/rejection vs pT curves.")
results.atlas_second_tag = "$\\sqrt{s}=13$ TeV, dummy jets \n$t\\bar{t}$"

# or alternatively also pass the argument `working_point` to the plot_var_perf function.
# specifying the `disc_cut` per tagger is also possible.
results.plot_var_perf(
    working_point=0.7,
    bins=[20, 30, 40, 60, 85, 110, 140, 175, 250],
    flat_per_bin=False,
)

and similar for a fixed b-efficiency per bin.

results.atlas_second_tag = "$\\sqrt{s}=13$ TeV, dummy jets \n$t\\bar{t}$"
results.plot_var_perf(
    bins=[20, 30, 40, 60, 85, 110, 140, 175, 250],
    flat_per_bin=True,
    working_point=0.7,
    h_line=0.7,
    disc_cut=None,
)

Similar to above you can also do these plots for c-tagging by changing the signal_class to cjets.

Fraction scans#

Plot the two background efficiencies as a function of the f_c or f_b value.

# fraction scan plots
logger.info("Plotting fraction scans.")
results.atlas_second_tag = "$\\sqrt{s}=13$ TeV, dummy jets \n$t\\bar{t}$\n70% WP"
results.plot_fraction_scans(efficiency=0.7, rej=False)