80 likes | 217 Views
RooFit – tools for ML fits. Authors: Wouter Verkerke and David Kirkby. Some history. there was always a gap between common tools for handling “binned” data samples ( Paw, Mn_Fit, Root.. ) and tools for doing more complicated unbinned ML analysis for arbitrary number of variables,
E N D
RooFit – tools for ML fits Authors: Wouter Verkerke and David Kirkby
Some history • there was always a gap between common tools for handling “binned” data samples (Paw, Mn_Fit, Root..) and tools for doing more complicated unbinned ML analysis for arbitrary number of variables, • few years ago David and Wouter wrote a prototype for BaBar(RooFitTools), and many groups jumped on it, used it, and gave feedback to authors(good and bad..), • based on all the feedback, authors decided to re-write the package from scratch, and call it RooFit • since then, all the most complicated CP-fitting analyses in BaBar were done with this package, which became essentially a standard(~40 variables, per-event-errors, realistic resolution functions,~20-50 signal/background categories)
Documentation • source code, help, tutorials are available from the open-source server: http://roofit.sourceforge.net • code was compiled/tested on various flavors of Linux and Unix, • it took few minor changes in the Makefiles to install it on BNL “acas” Linux farm: ~vasia/RooFit-V01-00-03 • works “out of the box” for many simple tasks, but can be easily customized for each specific analysis, in fact most of the analyses in BaBar have their own RooFit-based package which archived in CVS (helps each time you need to go back and re-check stuff),
Example 1(code) RooRealVarx("x","x",0.0,0, 10.0); RooRealVarmean ("mean","mean", 6.5,0,10); RooRealVarsigma("sigma","sigma",0.4,0,10); RooRealVarnsig("nsig","nsig",90,-10,1000); RooGaussiang("g","Generation Pdf",x,mean,sigma); RooRealVarargpar ("argpar", “Argus shape paramerter",-1.0,-10,10); RooRealVar cutoff ("cutoff", “Argus cutoff",10.0,0,20); RooArgusBG a ("a", "Argus PDF", x, cutoff,argpar); RooRealVar nbkg("nbkg","nbkg",210,-10,1000); RooAddPdf fit ("fit", "g+a", RooArgList(g, a), RooArgList(nsig, nbkg)); RooDataSet *data = fit.generate(x,300); RooPlot* xframe = x.frame(); data->plotOn(xframe); fit->plotOn(xframe); fit->plotOn(xframe,Components(RooArgSet(ge,a))); xframe->Draw();
Example 2(toy studies) RooMCStudy toymc("fit", fit, “x”, “evh”); toymc.generateAndFit(1000,300); RooPlot* xfr = nsig.frame(20,160,25); // 4 - plots toymc.plotParamOn(xfr); RooPlot* exfr = toymc.plotError(nsig,0,30,25); RooPlot* pxfr =toymc.plotPull(nsig,-5,5,25); RooPlot* xll = toymc.plotNLL(-1200,-500,50); ~30 min on 1 “acas” box
Conclusion • please try RooFit for yourself (notice, PDF normalization is taken away from the user and handled by the package..), • there are few hundreds slides of tutorials, and full class references, - a lot of very useful features(e.g. mix of data and Toy MC..) • a lot of “tricks” vent into optimization (e.g. for PDF normalization analytical solutions are used for simple functions, for more complicated integrals, numerical integration is done and look-up tables are generated, “lazy” recalculations, )