Logo ROOT  
Reference Guide
rf614_binned_fit_problems Namespace Reference

Functions

 disableBinIntegrator (func)
 Reset the integrator config to disable the RooBinIntegrator.
 enableBinIntegrator (func, num_bins)
 Force numeric integration and do this numeric integration with the RooBinIntegrator, which sums the function values at the bin centers.
 generateBinnedAsimov (pdf, x, n_events)
 Generate binned Asimov dataset for a continuous pdf.

Variables

 a = ROOT.RooRealVar("a", "a", -0.3, -5.0, 5.0)
 c = ROOT.RooRealVar("c", "c", -1.8, -5, 5)
 expo = ROOT.RooExponential("expo", "expo", x, c)
 expo_data = generateBinnedAsimov(expo, x, 10000)
 fit1 = expo.fitTo(expo_data, Save=True, PrintLevel=-1, SumW2Error=False)
 fit2 = expo.fitTo(expo_data, Save=True, PrintLevel=-1, SumW2Error=False)
 fit3 = powerlaw.fitTo(powerlaw_data, Save=True, PrintLevel=-1, SumW2Error=False)
 fit4 = powerlaw.fitTo(powerlaw_data, Save=True, PrintLevel=-1, SumW2Error=False)
 fit5 = powerlaw.fitTo(powerlaw_data, IntegrateBins=1e-3, Save=True, PrintLevel=-1, SumW2Error=False)
 fit6 = model.fitTo(model_data, Save=True, PrintLevel=-1, SumW2Error=False)
 fit7 = model.fitTo(model_data, Offset="bin", Save=True, PrintLevel=-1, SumW2Error=False)
 frac = ROOT.RooRealVar("frac", "frac", nsig.getVal() / (nsig.getVal() + nbkg.getVal()), 0.0, 1.0)
 gauss = ROOT.RooGaussian("gauss", "gauss", x, mu, sigma)
 model = ROOT.RooAddPdf("model", "model", [gauss, expo], [nsig, nbkg])
 model_data = model.generateBinned(x)
 mu = ROOT.RooRealVar("mu", "mu", 3.0, 0.1, 5.1)
 nbkg = ROOT.RooRealVar("nbkg", "nbkg", 10000000, 0, 1e9)
 nsig = ROOT.RooRealVar("nsig", "nsig", 10000, 0, 1e9)
 powerlaw = ROOT.RooPowerSum("powerlaw", "powerlaw", x, ROOT.RooFit.RooConst(1.0), a)
 powerlaw_data = generateBinnedAsimov(powerlaw, x, 10000)
 sigma = ROOT.RooRealVar("sigma", "sigma", 0.5, 0.01, 5.0)
 x = ROOT.RooRealVar("x", "x", 0.1, 5.1)

Function Documentation

◆ disableBinIntegrator()

rf614_binned_fit_problems.disableBinIntegrator ( func)

Reset the integrator config to disable the RooBinIntegrator.

Definition at line 61 of file rf614_binned_fit_problems.py.

◆ enableBinIntegrator()

rf614_binned_fit_problems.enableBinIntegrator ( func,
num_bins )

Force numeric integration and do this numeric integration with the RooBinIntegrator, which sums the function values at the bin centers.

Definition at line 49 of file rf614_binned_fit_problems.py.

◆ generateBinnedAsimov()

rf614_binned_fit_problems.generateBinnedAsimov ( pdf,
x,
n_events )

Generate binned Asimov dataset for a continuous pdf.

One should in principle be able to use pdf.generateBinned(x, n_events, RooFit.ExpectedData()). Unfortunately it has a problem: it also has the bin bias that this tutorial demonstrates, to if we would use it, the biases would cancel out.

Definition at line 28 of file rf614_binned_fit_problems.py.

Variable Documentation

◆ a

rf614_binned_fit_problems.a = ROOT.RooRealVar("a", "a", -0.3, -5.0, 5.0)

Definition at line 112 of file rf614_binned_fit_problems.py.

◆ c

rf614_binned_fit_problems.c = ROOT.RooRealVar("c", "c", -1.8, -5, 5)

Definition at line 83 of file rf614_binned_fit_problems.py.

◆ expo

rf614_binned_fit_problems.expo = ROOT.RooExponential("expo", "expo", x, c)

Definition at line 84 of file rf614_binned_fit_problems.py.

◆ expo_data

rf614_binned_fit_problems.expo_data = generateBinnedAsimov(expo, x, 10000)

Definition at line 88 of file rf614_binned_fit_problems.py.

◆ fit1

rf614_binned_fit_problems.fit1 = expo.fitTo(expo_data, Save=True, PrintLevel=-1, SumW2Error=False)

Definition at line 93 of file rf614_binned_fit_problems.py.

◆ fit2

rf614_binned_fit_problems.fit2 = expo.fitTo(expo_data, Save=True, PrintLevel=-1, SumW2Error=False)

Definition at line 104 of file rf614_binned_fit_problems.py.

◆ fit3

rf614_binned_fit_problems.fit3 = powerlaw.fitTo(powerlaw_data, Save=True, PrintLevel=-1, SumW2Error=False)

Definition at line 117 of file rf614_binned_fit_problems.py.

◆ fit4

rf614_binned_fit_problems.fit4 = powerlaw.fitTo(powerlaw_data, Save=True, PrintLevel=-1, SumW2Error=False)

Definition at line 128 of file rf614_binned_fit_problems.py.

◆ fit5

rf614_binned_fit_problems.fit5 = powerlaw.fitTo(powerlaw_data, IntegrateBins=1e-3, Save=True, PrintLevel=-1, SumW2Error=False)

Definition at line 138 of file rf614_binned_fit_problems.py.

◆ fit6

rf614_binned_fit_problems.fit6 = model.fitTo(model_data, Save=True, PrintLevel=-1, SumW2Error=False)

Definition at line 179 of file rf614_binned_fit_problems.py.

◆ fit7

rf614_binned_fit_problems.fit7 = model.fitTo(model_data, Offset="bin", Save=True, PrintLevel=-1, SumW2Error=False)

Definition at line 194 of file rf614_binned_fit_problems.py.

◆ frac

rf614_binned_fit_problems.frac = ROOT.RooRealVar("frac", "frac", nsig.getVal() / (nsig.getVal() + nbkg.getVal()), 0.0, 1.0)

Definition at line 168 of file rf614_binned_fit_problems.py.

◆ gauss

rf614_binned_fit_problems.gauss = ROOT.RooGaussian("gauss", "gauss", x, mu, sigma)

Definition at line 164 of file rf614_binned_fit_problems.py.

◆ model

rf614_binned_fit_problems.model = ROOT.RooAddPdf("model", "model", [gauss, expo], [nsig, nbkg])

Definition at line 170 of file rf614_binned_fit_problems.py.

◆ model_data

rf614_binned_fit_problems.model_data = model.generateBinned(x)

Definition at line 172 of file rf614_binned_fit_problems.py.

◆ mu

rf614_binned_fit_problems.mu = ROOT.RooRealVar("mu", "mu", 3.0, 0.1, 5.1)

Definition at line 162 of file rf614_binned_fit_problems.py.

◆ nbkg

rf614_binned_fit_problems.nbkg = ROOT.RooRealVar("nbkg", "nbkg", 10000000, 0, 1e9)

Definition at line 167 of file rf614_binned_fit_problems.py.

◆ nsig

rf614_binned_fit_problems.nsig = ROOT.RooRealVar("nsig", "nsig", 10000, 0, 1e9)

Definition at line 166 of file rf614_binned_fit_problems.py.

◆ powerlaw

rf614_binned_fit_problems.powerlaw = ROOT.RooPowerSum("powerlaw", "powerlaw", x, ROOT.RooFit.RooConst(1.0), a)

Definition at line 113 of file rf614_binned_fit_problems.py.

◆ powerlaw_data

rf614_binned_fit_problems.powerlaw_data = generateBinnedAsimov(powerlaw, x, 10000)

Definition at line 114 of file rf614_binned_fit_problems.py.

◆ sigma

rf614_binned_fit_problems.sigma = ROOT.RooRealVar("sigma", "sigma", 0.5, 0.01, 5.0)

Definition at line 163 of file rf614_binned_fit_problems.py.

◆ x

rf614_binned_fit_problems.x = ROOT.RooRealVar("x", "x", 0.1, 5.1)

Definition at line 78 of file rf614_binned_fit_problems.py.