Cross sections and a luminosity instead of hand-made scale factors¶
Samples carrying xsec (and ngen, here the number of entries) are scaled to
expected yields with lumi=: weights are multiplied by xsec * lumi / ngen. Units
may be given in the strings; the luminosity also lands in the label. Any experiment name
works in a Style, with GeV and ab^-1 where a lepton collider needs them.

import rootfig as rf
# the same three toy files, this time as e+e- processes with a cross section each
zh = rf.Sample("signal.root", tree="events", label="ZH", weight="weight", xsec="0.2 pb")
ww = rf.Sample("background.root", tree="events", label="WW", weight="weight", xsec="16.4 pb")
zz = rf.Sample("diboson.root", tree="events", label="ZZ", weight="weight", xsec="1.4 pb")
fcc = rf.Style(experiment="FCC-ee", status="Simulation", com="240 GeV")
rf.plot(
[ww, zz, zh],
mll,
lumi="10.8 ab^-1",
stack=True,
logy=True,
ratio="significance",
style=fcc,
)
Setup
The code reads the toy dataset. In a checkout of rootfig, python examples/gallery writes it to examples/out/ in a few seconds; run the code inside that directory.
It uses these samples and variables, shared by the gallery examples (see Samples, variables, cuts and styles):
signal = rf.Sample("signal.root", tree="events", label="Signal", weight="weight", scale=0.03)
zjets = rf.Sample("background.root", tree="events", label="Z + jets", weight="weight")
diboson = rf.Sample("diboson.root", tree="events", label="Diboson", weight="weight", scale=0.15)
data = rf.Sample("data.root", tree="events", label="Data", is_data=True)
mc = [zjets, diboson, signal] # stacked bottom to top
pt = rf.Variable("Muon_pt", bins=(30, 0, 300), label=r"$p_T^{\mu}$", unit="GeV")
mll = rf.Variable("m_ll", bins=(70, 50, 260), label=r"$m_{\ell\ell}$", unit="GeV")
met = rf.Variable("MET", bins=(40, 0, 400), label=r"$E_T^{miss}$", unit="GeV")