Unbinned likelihood fit and contour plot


I performed an unbinned likelihood fit:
RooFitResult* results = addpdf2a.fitTo(data,RooFit::Extended(kTRUE));

where data is a TTree and addpdf2a is a sum of 3 RooHistPdf
RooAddPdf addpdf2a(“addpdf2a”,"",RooArgList(GeoPDF,reaPDF,randomPDF),RooArgList(g,re,ra));

The fit works.
Now I would need the 1,2, and 3 sigma contour plot for 2 fit variables.



Hi Livia,

You can do this as follows:

//RooFitResult* results = addpdf2a.fitTo(data,RooFit::Extended(kTRUE));

// This effectively does the same as the line above
RooAbsReal* nll = addpdf2a.createNLL(data,RooFit::Extended(kTRUE));
RooMinuit m(*nll) ;
m.migrad() ;
m.hesse() ;

// Now use the MINUIT session to make a contour plot
RooPlot* p1 = m.contour(var1,var2,1,2,3) ;
p1->Draw() ;