I am having trouble fitting a histogram with a user-defined function.
I declare a TF1 like this and try to fit it:
TF1 f2("pdf", "280*0.1091196*((x+0.511)*(x+0.511))*((2.4578+0.511-x)*(2.4578+0.511-x)), 0, 2.4578);
energyhist->Fit("pdf");
I get this error:
Isn’t x the parameter?
brun
2
The message is correct. You should define a function with at least one parameter. See examples in tutorials/fit
Rene
I looked at the example here:
http://root.cern.ch/root/html/examples/myfit.C.html
I am somewhat confused as to the difference between x and par. How would I write my function in this example?
Please disregard, I found my mistake.