/// \file /// \ingroup tutorial_roofit /// \notebook -js /// /// Likelihood and minimization: working with the profile likelihood estimator /// /// \macro_image /// \macro_output /// \macro_code /// /// \date 07/2008 /// \author Wouter Verkerke #include "RooRealVar.h" #include "RooDataSet.h" #include "RooGaussian.h" #include "RooConstVar.h" #include "RooAddPdf.h" #include "RooMinimizer.h" #include "TCanvas.h" #include "TAxis.h" #include "RooPlot.h" using namespace RooFit; void rf605_study() { // C r e a t e m o d e l a n d d a t a s e t // ----------------------------------------------- // Observable RooRealVar x("x", "x", -20, 20); // Model (intentional strong correlations) RooRealVar mean("mean", "mean of g1 and g2", 0, -10, 10); RooRealVar sigma_g2("sigma_g2", "width of g2", 4, 3.0, 6.0); RooGaussian g2("g2", "g2", x, mean, sigma_g2); TCanvas *cg = new TCanvas("cg", "cg", 1200,400); cg->Divide(3, 1); //--- g2 RooDataSet *data_g2x = g2.generate(x, 10000); RooPlot *xframe_g2x = x.frame(); data_g2x->plotOn(xframe_g2x, MarkerColor(kBlack)); g2.plotOn(xframe_g2x, LineColor(2)); cg->cd(1); xframe_g2x->Draw(); RooAbsReal *nll_g2x = g2.createNLL(*data_g2x, NumCPU(2)); RooMinimizer(*nll_g2x).migrad(); RooPlot* frame1_g2mean = mean.frame(); nll_g2x->plotOn(frame1_g2mean, ShiftToZero()); cg->cd(2); frame1_g2mean->Draw(); RooPlot* frame1_g2sigma = sigma_g2.frame(); nll_g2x->plotOn(frame1_g2sigma, ShiftToZero()); cg->cd(3); frame1_g2sigma->Draw(); }