# Landau fit

Hi All,

I have arrays of histograms that I fill in a for loop;

for(something);
myhist[i]->Fill(n,variable[i]);

and it’s all ok. When I try to fit the data points that I wrote, with;

myhist[i]->Fit(“landau”);

It looks ok but the range of the histogram automatically reduces to -1,1 in the x axis.
I tried defining a “new TF1” and then “->SetParameters” but result stayed the same.

I was wondering if I can change the x-axis interval after fitting with that one-liner.

Thank you.

Hi,

The TH1::Fit function should not change the axis range. If it does, please pst the code reproducing the problem.
You can always change the axis range later by doing
myHist->GetXaxis()->SetRange(firstbin, lastbin); or myHist->GetXaxis()->SetRangeUser(xmin, xmax);

Best Regards

Lorenzo