TH1 fit parameters

I have a TH1F h1 which I fit using a Landau:

h1->Fit("landau","W","",20,60);

I would like to be able to get the MPV and Sigma of the fit. Is there a way of doing it without creating a TF1 and passing parameters to it?

Before or after fitting:
TF1 *f = (TF1*)gROOT->GetFunction("landau"); f->Print("V");

After fitting:
TF1 *f = h1->GetFunction("landau"); f->Print("V");

1 Like

This plus:

double MPV = f->GetParameter("MPV");
double Sigma = f->GetParameter("Sigma");

Gave me exactly what I wanted. Thank you!

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