The .C file and graph you can see the attached files. But if i want to output the values of “Sigma” and “Chisquare2/ndf” and so on, we don’t know how to set the corresponding codes. I have a try with code “Double_t sigma=p1->GetSigma();” and fail to get the following errors:
Error: Can't call TF1::GetSigma() in current scope C:\root\Gaussian.C(27)
Possible candidates are...
(in TF1)
(in TFormula)
*** Interpreter error recovered ***
Thank anyone for giving me help. Gaussian.C (673 Bytes)
p1->GetParameter(0);//this is the constant
p1->GetParameter(1);//this is the mean
p1->GetParameter(2); //this is the sigma
Thank you. I know the above code which are used to obtain the three parameters of gaussian curve. I want to output more imformation about fitted parameters in Gaussian or other curves. Thank you again.
parameters are numbered; each parameter has a certain meaning for a given function. If gr1->GetFunction(“p1”); really returns a gaussian, and if the parameters are numbered the way ROOT does, then 0 is Constant, 1 is Mean, 3 is Sigma. There is no TF1::GetSigma because TF1 does not care (nor know) what fuction it represents. So use GetParameter(0) to get the constant (aka maximum). You can e.g. get the uncertainty of the mean using p1->GetParError(1).