I would like to superimpose a chi-squared pdf over some data. I’ve read the section on special functions in the user’s guide, but I still don’t know how to actually plot the thing (syntax & all that)! Sorry for what may be a very basic question, but I’m new to ROOT.
Make a TF1 *mypdf function and add plot it with mypdf->Draw() or
add it to the list of functions of a histogram with
h->GetListOfFunctions()->Add(mypdf); It will be automatically drawn when drawing the histogram.
c1 = new TCanvas(“c1”, “chi”, 100, 10, 700, 700);
TF1 *pdf = new TF1(“pdf”, “chisquared_pdf(x, r, x0)”,0,10);
pdf -> SetLineColor(1);
pdf -> Draw();
}
And I get the following errors:
Error in TFormula::Compile: Bad numerical expression : "chisquared_pdf(x,r,x0)"
Error in TF1::TF1: function: pdf/chisquared_pdf(x, r, x0) has 0 parameters instead of 1