Hi all,
I wanted to learn how to use the RooMinuit implementation so I converted one of the examples (rf403_weightedevts.C) to PyRoot. I’ve attached both the original .C macro and my python’ized version here.
The standard RooFit calls produced similar output between the two scripts, but the RooMinuit implementation produces different results. I can safely say that the PyRoot version is wrong.
chi2 = RooChi2Var("chi2","chi2",p2,binnedData,RooFit.DataError(RooAbsData.SumW2))
m = RooMinuit(chi2)
m.migrad()
m.hesse()
Here’s the .C output…
RooFitResult: minimized FCN value: 31.3747, estimated distance to minimum: 8.52316e-08
coviarance matrix quality: Full, accurate covariance matrix
Floating Parameter FinalValue +/- Error
-------------------- --------------------------
a1 -9.9890e-03 +/- 2.63e-02
a2 1.0637e-01 +/- 1.02e-02
And here’s the .py output…
RooFitResult: minimized FCN value: 998.709, estimated distance to minimum: 0.000310136
coviarance matrix quality: Full, accurate covariance matrix
Floating Parameter FinalValue +/- Error
-------------------- --------------------------
a1 -6.9585e-02 +/- 1.45e+00
a2 5.9616e-12 +/- 6.73e-01
The only place where I was a little unsure of the conversion between .C and .py was here:
// Instruct dataset wdata in interpret w as event weight rather than as observable
RooDataSet wdata(data->GetName(),data->GetTitle(),data,*data->get(),0,w->GetName()) ;
wdata = RooDataSet(data.GetName(),data.GetTitle(),data,RooArgSet(data.get()),RooFormulaVar(),w.GetName())
I think everything else was straightforward. Thanks in advance for any clues.
Matt
rf403_weightedevts.C (6.55 KB)
rf403_weightedevts.py (6.2 KB)