Fit - Log scale

Hi,

I am new with ROOT and I have some problems related with fitting histograms. First of all, I am trying to analysis the Z decays into pairs of muons, as well, I generate all the data and plotted it in a histogram with the y-axis in log scale. Now I want to fit only the background (ignoring the signal) with a pre defined function. I am trying to use exp(f(x)), but it isn’t returning something good… There is another way to do this fit?
Thanks everyone! :slight_smile:

  • Obs: I already know how to ignore the signal (peak)

fit.cpp (663 Bytes)

Try: TF1 *fl = new TF1("fl", fline, 10, 200, 6); // 6 parameters fl->SetParameters(0, 0, 0, 0, 0, 0); imass_z0->Fit(fl, "L");

1 Like

WOW! It worked much better, what happened?

Just to update:
<img src="/uploads/default/original/2X/9/94a28a1e55bd2c20a1e353db76e9110b3f3275b7.jpg" width=500" height=“407”>

@Wile_E_Coyote added the fitting option “L” which changed from a chi squared minimization to a log likelihood fit.

imass_z0->Fit(fl, "L");

See the documentation for TH1::Fit

“L” Use Loglikelihood method (default is chisquare method)

In addition, he corrected the number and initial values of the parameters of the fit fucntion. The function need six parameters not four.

TF1 *fl = new TF1("fl", fline, 10, 200, 6); // 6 parameters
fl->SetParameters(0, 0, 0, 0, 0, 0);
1 Like

Now i see… :hushed:

Thanks a lot @Wile_E_Coyote and @ksmith !!

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