Hi folks
Finally I get the solution to my problem. I was trying to fit a pol2 into my data but root was fitting a linear function… I was using:
TF1 *myfit;
.
.
.
c1 = new TCanvas(“c1”,“Transmission”,20,50,1200,800);
c1->SetFillColor(kWhite);
c1->SetGrid();
myfit = new TF1(“myfit”,“pol2(0)”, 3170, 3181);
.
.
.
gr->SetTitle(message);
gr->GetXaxis()->SetTitle(“runs”);
gr->GetYaxis()->SetTitle(“Signal Output”);
gr->Fit(“myfit”,“R”);
gr->Draw(“ACP”);
.
.
.
this did not work, but then I wrote this instead:
.
.
.
gr->Fit(“pol2”);
and it is working now. To tell you the truth, this is the first time using root, and after around 4 hours trying to find the error I hit a post that brought me to this solution. I would like to know what the first code that I wrote did not work. I really appreciate your comments.
Second question: how can I extended mi fitting to a wider range … can I use the option “R” in the line
gr->Fit(“pol2”,“R”)
I did like that but root does not show the fitting.
Third and final question: if this is the way to do a plot, then I do not need the object TF1 *myfit ?
Again, thanks for any comments,
Cheers,
Kris[quote][/quote][quote][/quote]