TProfile fitting

I am trying to fit a TProfile with ‘pol1’. It shows “Warning in : Fit data is empty”. I understand I am trying to fit with a 1-D function. Please tell me how to get this done.

In this example you would see how you could do it:
root.cern.ch/root/html/tutorial … t2d.C.html

If this doesn’t work for you, maybe show the code you try to use.

[quote=“hegner”]In this example you would see how you could do it:
root.cern.ch/root/html/tutorial … t2d.C.html

If this doesn’t work for you, maybe show the code you try to use.[/quote]
I have attached the ROOT file contains a TProfile histogram. And I have posted how I used the commands. Even with FitPanel it doesn’t work. But the same when I convert to TH1* then fitting works.

MacBook-Air:Downloads hari$ r temp.root root [0] Attaching file temp.root as _file0... root [1] .ls TFile** temp.root TFile* temp.root KEY: TProfile alld_ift;1 alld_ift root [2] alld_ift->Draw() Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1 root [3] alld_ift->Fit("pol1") Warning in <Fit>: Fit data is empty (class TFitResultPtr)140617827378464 root [4]
temp.root (25.8 KB)

I don’t know how you created this histogram but, apparently “errors” for all bins are 0 (and bins with no errors are quietly ignored by the chisquare method).
Try something like:
alld_ift->Fit(“pol1”, “W”);
alld_ift->Fit(“pol1”, “WW”);

[quote=“Pepe Le Pew”]I don’t know how you created this histogram but, apparently “errors” for all bins are 0 (and bins with no errors are quietly ignored by the chisquare method).
Try something like:
alld_ift->Fit(“pol1”, “W”);
alld_ift->Fit(“pol1”, “WW”);[/quote]
Your suggestion works. Thank you very much.
I filled the histogram by profile->SetBinContent(x, y);