//ガウシアン二つ void fit(double xmin,double xmax,double height1,double mean1,double sigma1,double height2, double mean2, double sigma2) { TF1* func = new TF1("func","[0]/(sqrt(2*3.14159265358979)*[2])*exp(-(x-[1])*(x-[1])/2./[2]/[2])+[3]/(sqrt(2*3.14159265358979)*[5])*exp(-(x-[4])*(x-[4])/2./[5]/[5])",xmin,xmax); func>SetLineColor(3); func->SetParameters(height1,mean1,sigma1,height2,mean2,sigma2); hPS->Fit("func","","",xmin,xmax); hPS->Draw(); cout << "Chisquare="<GetChisquare() << endl; cout << "NDF=" <GetNDF() << endl; cout << "Chisquare/NDF="<GetChisquare()/func->GetNDF() << endl; gROOT->Reset(); }