How to output the parameters of Gaussian such as Sigma

Hello,everyone. I try to fit an gaussian and output the results of three parameters of Gaussian successful.

Partial codes is as follows:

TF1 *p1 = gr1->GetFunction("p1");
	    Double_t en=p1->GetMaximum();
        //en=par[11]; 
		Double_t chi2=p1->GetChisquare();
		//chi2=par[10];
		Double_t el=p1->GetParError(0);	
cout<<en<<" "<<chi2<<" "<<el<<" "<<endl;

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)

Sorry, I failed to attach the EPS format picture. How to? Please tell me.
Thank you very much.
Best regares.
lowland

p1->GetParameter(0);//this is the constant
p1->GetParameter(1);//this is the mean
p1->GetParameter(2); //this is the sigma
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.

What more information do you want to know? Errors of fitting?
RooFit can output errors of fitting, I don’t know whehter Fit can also do the same job.

It can output Chisquare2. But more information such as Chisquare2/ndf and errors of the three parameters. Thank you very much

Hi,

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).

Cheers. Axel.

Thank you. I followed you struction and passed it.

Hey! Can you tell me how you can output Chisquare/ndf ?