gStyle->SetOptFit(1111) in Roofit

Dear Rooters,

After fitting in RooFit, I want to show the fit-parameters box on screen. I think I should use “paramOn()” but I don’t know quite how to do it.

(This is my first post so if my question is not clear please let me know so I can provide you with more details).


Usually a small script reproducing your problem will help to solve it.

Please find my code down below.
I want to have the fit-parameters box (sigma and width of the gaussian and the chi square of the fit)
As you can see I tried to use “paramOn” but the parameter box is not appearing (I’m sure I used it wrong :unamused: )
I hope you’ll be able to help me.
RooRealVar x(“x”,“MM”,3.,3.19) ;
RooDataHist dh(“dh”,“dataset”,x,h);
RooPlot* frame = x.frame(Title("")) ;
dh.plotOn(frame) ;

RooRealVar mean1(“mean1”,“mean of gaussians”,3.095);
RooRealVar sigma1(“sigma1”,“width of gaussians”,0.004);
RooGaussian sig1(“sig1”,“Signal component 1”,x,mean1,sigma1); //gaussianSignal

RooRealVar a0(“a0”,“a0”,0.0005,-2.,1.) ;
RooRealVar a1(“a1”,“a1”,-0.0002,-2.,1.) ;
RooRealVar a2(“a2”,“a2”,0.0005,-1.,1.) ;

RooChebychev bkg(“bkg”,“background p.d.f.”,x,RooArgList(a0,a1,a2)) ;

RooRealVar sig1frac(“sig1frac”,“fraction of component 1 in signal”,0.8,0.,1.) ; //sig +bcg
RooAddPdf all(“all”,“Signal”,RooArgList(bkg,sig1),sig1frac) ;

all.fitTo(dh) ;
all.plotOn(frame) ;

paramOn (frame,RooFit.Parameters(mean1,sigma1))


Ideas anyone? [-o<

Looking at the roofit tutorials … oofit.html

I see that this one has a fit box plotted: … on_8C.html

Thanks for the links Olivier :slight_smile: It worked