Setting the fit parameters Limits

Dear all,

I’m trying to fit a histogram with a reversed crystal ball function (signal) and a polynomial function (background).
The crystal ball has the “n” and the “alpha” parameters.
If I set “n” 's limits as [1,8] after the fit I get n=2.3
If I set “n” 's limits as [1,5] after the fit I get n=4.49.

The problem is every time I change the upper limit I get a completely different fit (N_signal events …) results.
I’m not familiar with the crystal ball function so I don’t know what are the best limits to choose on these parameters!!

1-Should I assume that for n [1,8] I will have the best fit for my histogram?
2-I don’t want to fix my parameters however is there’s any way to not limit them?
I hope someone will be able to shed a light on my problem. I’m a Roofit newbie and I still did not figure everything out.
Thank you in advance.

RooRealVar mean1("#mu","",3.0962,3.0962,3.0979);
RooRealVar sigma1("#sigma","",0.0048,0.0046,0.0056);

RooRealVar alpha("#alpha","",-1.54,-2,-1);
RooRealVar n("n","",1,1,8);

RooCBShape sig1("sig1", "sig1", x, mean1, sigma1, alpha,n);

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 nsig("N_{SIG}","signal events",500,0,100000000);
RooRealVar nbkg("N_{BKG}","signal background even0ts",500,0,100000000);
RooExtendPdf esig("esig","esig",sig1,nsig) ;
RooExtendPdf ebkg("ebkg","ebkg",bkg,nbkg) ;
RooAddPdf all("all","all",RooArgList(esig,ebkg)) ;


You are having probably some different local minima which are possible solutions to your problem.
You should pick up alway the solution which will give you the minimum negative log-likelihood function value.

Changing the parameter limits often changes also the initial parameter values and the step sizes. You can try playing with different initial parameter values and look for the different solution you find, but at the end you must choose always the one with minimum nll.

Best Regards


Hi Lorenzo,

Thank you very much for your answer :slight_smile: .
Excuse my ignorance :fearful: , how can I know which value gave me the minimum nll?.
Just to make sure. Does it appear in the fit result : " minimized FCN value: -1.51257e+08, estimated distance to minimum: 4.984" ?
Thank you


Yes it appears in the Fit result, you can get it from RooFItResult::minNll()


1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.