Hi, @moneta,
I am surprised to hear you don’t observe a large difference in a binned fit using SumW2Errors
and BatchMode
. Here is a more concise reproducer:
import ROOT as r
ws = r.RooWorkspace("workspace")
x = ws.factory("x[-10, 10]")
sig = ws.factory("Gaussian::sig(x, mu[-1, 1], s[0.1, 5])")
bkg = ws.factory("Chebychev::bkg(x, {c1[0.1, -1, 1]})")
shp = ws.factory("SUM::shp(Nsig[0, 200] * sig, Nbkg[0, 200] * bkg)")
data = shp.generate(r.RooArgSet(x))
datahist = r.RooDataHist("datahist", "datahist", data.get(), data)
print("with BatchMode:")
resWith = shp.fitTo(
datahist,
r.RooFit.Extended(),
r.RooFit.Save(),
r.RooFit.SumW2Error(True),
r.RooFit.Strategy(1),
r.RooFit.BatchMode(True),
)
print("without BatchMode:")
resWithout = shp.fitTo(
datahist,
r.RooFit.Extended(),
r.RooFit.Save(),
r.RooFit.SumW2Error(True),
r.RooFit.Strategy(1),
r.RooFit.BatchMode(False),
)
resWith.Print()
resWithout.Print()
With BatchMode
:
RooFitResult: minimized FCN value: 1171.58, estimated distance to minimum: 267.825
covariance matrix quality: Full, accurate covariance matrix
Status : MINIMIZE=0 HESSE=0 HESSE=0
Floating Parameter FinalValue +/- Error
-------------------- --------------------------
Nbkg 5.4048e+01 +/- 6.78e+01
Nsig 1.4599e+02 +/- 7.73e+01
c1 2.0586e-01 +/- 5.90e-01
mu 4.6270e-01 +/- 1.06e+00
s 3.1733e+00 +/- 1.40e+00
Without BatchMode
:
RooFitResult: minimized FCN value: -303.384, estimated distance to minimum: 2.03636e-05
covariance matrix quality: Full, accurate covariance matrix
Status : MINIMIZE=0 HESSE=0 HESSE=0
Floating Parameter FinalValue +/- Error
-------------------- --------------------------
Nbkg 5.4053e+01 +/- 2.23e+01
Nsig 1.4595e+02 +/- 2.43e+01
c1 2.0472e-01 +/- 3.44e-01
mu 4.6150e-01 +/- 4.05e-01
s 3.1738e+00 +/- 4.88e-01
The central values are quite similar, but the errors are very different (more than a factor of 2 greater with BatchMode
than without). Is this not the output you get with this reproducer?