Hi,
I would like to know if there is any possibility to add my own fit options in the RooAbsPdf::fitTo() method, without having to write a lot of new inherited RooFit classes .
To be more precise, we are working for the KaliVeda toolkit on a backtracing method based on RooFit. We had some issues on this procedure because the number of calls and the number of iterations can’t be changed.
We have finally added these new options by adding new RooGlobalFunc.{h,cpp} files with new RooCmdArg:
RooCmdArg SetMaxIter(Int_t maxiter) {return RooCmdArg(“SetMaxIter”, maxiter, 0, 0, 0, 0, 0, 0,0 ); };
RooCmdArg SetMaxCalls(Int_t maxcalls) {return RooCmdArg(“SetMaxCalls”, maxiter, 0, 0, 0, 0, 0, 0,0 ); };
We then have written a “NewRooAddPdf” class which inherits from RooAddPdf and where we have added the new fit commands in a new fit method, the NewRooAddPdf::improvedFitTo(RooAbsData& data, const RooLinkedList& cmdList), this looks like:
RooCmdConfig pc(Form(“RooAbsPdf::ImprovedFitTo(%s”), GetName()));
pc.defineInt(“numiter”, “SetMaxIter”, 0, 0);
pc.defineInt(“numcalls”,"SetMaxCalls, 0, 0);
and then added these commands for the RooMinimizer:
fnll= createNLL(data, nllCmdList);
RooMinimizer m(*fnll) ;
m.setMaxIterations(numiter);
m.setMaxFunctionCalls(numcalls);
For simplicity, I have just drawn here the simple steps, because we had to create some other inherited classes (RooAddPdf, RooFitResult, RooMinimizer, RooMinimizerFcn, RooGlobalFunc, RooMinuit).
All this work has been done using the ROOT version 5.34, and you can access to the files with this link: github.com/kaliveda-dev/kalived … Track/base.
I don’t know if it was the best choice to add new options, because we would like now to make the backtracing procedure possible with the ROOT version 6.05 (so as to try to solve fit issues), where apparently some methods have been changed, making the migration between versions complicated…
Best regards,
Quentin.