void gausfit( TH1F *histname, Double_t &sigma, Double_t &errsigma, Double_t &chisq, Double_t &ndf) { histname->Fit("gaus"); TF1 *gausfunc = histname->GetFunction("gaus"); Double_t chisq = gausfunc->GetChisquare(); Double_t ndf = gausfunc->GetNDF();if(ndf == 0)ndf=-999; Double_t sigma = gausfunc->GetParameter(2); Double_t errsigma = gausfunc->GetParError(2); }