In the following code there is obvious problem when fitting one point with pol0 which is legal and than drawing the function. Whats the problem?
void foo() { TCanvas* c = new TCanvas(); TGraph* g = new TGraph(); g->SetPoint(0, 1, 2); g->Fit("pol0"); TF1* f = g->GetFunction("pol0"); f->Draw(); }
The fit is correct. Instead of TF1* f = g->GetFunction(“pol0”); f->Draw(); do g->Draw(“ap”)
The problem in this special case is that teh function is defined in the range [1,1]
Rene
ok[1, 1] is the problem but Draw(“ap”) will do nothing if g->Fit(“pol0”) but one have to fit with constant function in a range:Fit(“pol0”, “”, “”, 0, 1) or something like this which is a bit strange but probably there is no other way.
thanks