MPF.bgContributionPlot module¶
Similiar to DataMCRatioPlot()
, but
also shows the relative contributions of the background processes
in each bin in a 3rd pad.
Example¶
#!/usr/bin/env python
import ROOT
from MPF.bgContributionPlot import BGContributionPlot
from MPF.atlasStyle import setAtlasStyle
setAtlasStyle()
bkg1 = ROOT.TH1F("bkg1", "", 100, -2, 5)
bkg2 = ROOT.TH1F("bkg2", "", 100, -2, 5)
data = ROOT.TH1F("data", "", 100, -2, 5)
signal = ROOT.TH1F("signal", "", 100, -2, 5)
bkg1.FillRandom("gaus")
bkg1.Scale(0.5)
bkg2.FillRandom("gaus")
bkg2.Scale(0.5)
data.FillRandom("gaus")
signal.FillRandom("landau")
p = BGContributionPlot(xTitle="x")
p.registerHist(bkg1, style="background", process="Bkg 1")
p.registerHist(bkg2, style="background", process="Bkg 2")
p.registerHist(data, style="data", process="Data")
p.registerHist(signal, style="signal", process="Signal")
p.saveAs("plot.pdf")
-
class
MPF.bgContributionPlot.
BGContributionPlot
(bgContributionPadTitle='Contributions', noData=False, ratioTitle='Data / MC', **kwargs)[source]¶ Bases:
MPF.plotStore.PlotStore
Parameters: - noData – Don’t show a data/MC ratio
- bgContributionPadTitle – Title on the pad showing the relative contributions
Overwrites the defaults for the following
PlotStore()
parameters:Parameters: - ignoreNumErrors – default: False
- ignoreDenErrors – default: True
- ratioMode – default: “rawpois”
- ratioUp – default: 2.25
- ratioDown – default: 0.25
- ratioTitle – Title for the ratio pad if data/MC ratio is shown (default: “Data / MC”)
For further options see
PlotStore()
-
saveAs
(path, **kwargs)[source]¶ Save the canvas. Arguments are passed to
MPF.canvas.Canvas.saveAs()