I have used FitTo to perform fits on a roofit extended pdf, using the syntax below.
self.fitresult = self.func_pdf.chi2FitTo( self.datahist,
RooFit.Range("runfit"),
RooFit.SumCoefRange("runfit"),
RooFit.SumW2Error(True),
ROOT.RooCmdArg( 'Strategy', 3 ) ,
RooFit.Save(ROOT.kTRUE))
I try to switch to chi2 fit by only changing FitTo to chi2FitTo and it gives me the following error. It seems that the pyroot method is bound to the C method that takes a RooLinkedList instead of several option arguments. i.e. RooAbsPdf::chi2FitTo(RooDataHist& data, const RooLinkedList& cmdList) I checked that chi2FitTo and FitTo are overloaded in the same way in the C++ source code so I am surprised they have different behavior.
I wonder if there is any workaround. If the only way is to use RooLinkedList, how do I do that?
root version: 6.06.00
Traceback (most recent call last):
File "./MakeZFit.py", line 608, in <module>
main()
File "./MakeZFit.py", line 161, in main
basesel=baseeta+failpix+ltmet,tag="regB"+tbase,ic = ic,maxtimes=150,doData=doData)
File "./MakeZFit.py", line 231, in makevariableplots_simultaneous
tag=tag, ic = ic, xbins=(200,0,200), dobkgd =dobkgd, maxtimes = maxtimes, doData=doData)
File "./MakeZFit.py", line 296, in fitting_simultaneous
tag=tag,ic = ic, maxtimes =maxtimes)
File "./MakeZFit.py", line 352, in corefitting_simultaneous
froo_dcb = fm.run_fit_chi2(fr)
File "/home/kakw/efake/WG_Analysis/Plotting/FitManager.py", line 406, in run_fit_chi2
RooFit.Save(ROOT.kTRUE))
TypeError: RooFitResult* RooAbsPdf::chi2FitTo(RooDataHist& data, const RooLinkedList& cmdList) =>
takes at most 2 arguments (6 given)