From bc4d99343bdb36ff0b57ade843d8f044b46a74ad Mon Sep 17 00:00:00 2001
From: Rene Brun <Rene.Brun@cern.ch>
Date: Tue, 5 Jun 2001 13:51:13 +0000
Subject: [PATCH] Modify the functions:  TGraph::Fit  TH1::Fit 
 TTreePlayer::UnbinnedFit to call TF1::SetNDF(ndf) where ndf is the number of
 degrees of freedom taking into account the number of points used in the fit
 minus the number of free parameters.

git-svn-id: http://root.cern.ch/svn/root/trunk@2375 27541ba8-7e3a-0410-8455-c3a389f83636
---
 graf/src/TGraph.cxx            | 3 ++-
 hist/src/TH1.cxx               | 5 +++--
 treeplayer/src/TTreePlayer.cxx | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/graf/src/TGraph.cxx b/graf/src/TGraph.cxx
index ac2a35efed5..ecf1981ade0 100644
--- a/graf/src/TGraph.cxx
+++ b/graf/src/TGraph.cxx
@@ -1,4 +1,4 @@
-// @(#)root/graf:$Name:  $:$Id: TGraph.cxx,v 1.38 2001/03/22 07:26:58 brun Exp $
+// @(#)root/graf:$Name:  $:$Id: TGraph.cxx,v 1.39 2001/05/19 17:41:37 brun Exp $
 // Author: Rene Brun, Olivier Couet   12/12/94
 
 /*************************************************************************
@@ -759,6 +759,7 @@ void TGraph::Fit(TF1 *f1, Option_t *option, Option_t *)
    }
    grFitter->GetStats(amin,edm,errdef,nvpar,nparx);
    grF1->SetChisquare(amin);
+   grF1->SetNDF(grF1->GetNumberFitPoints()-npar-nfixed);
 
 //*-*- Print final values of parameters.
    if (!fitOption.Quiet) {
diff --git a/hist/src/TH1.cxx b/hist/src/TH1.cxx
index e850dc951d4..764e661b149 100644
--- a/hist/src/TH1.cxx
+++ b/hist/src/TH1.cxx
@@ -1,4 +1,4 @@
-// @(#)root/hist:$Name:  $:$Id: TH1.cxx,v 1.48 2001/05/08 14:01:25 rdm Exp $
+// @(#)root/hist:$Name:  $:$Id: TH1.cxx,v 1.49 2001/05/24 21:27:06 brun Exp $
 // Author: Rene Brun   26/12/94
 
 /*************************************************************************
@@ -1727,7 +1727,8 @@ void TH1::Fit(TF1 *f1 ,Option_t *option ,Option_t *goption, Axis_t xxmin, Axis_t
    if (Foption.Like) H1FitChisquare(npar, params, amin, params, 1);
 
    gF1->SetChisquare(amin);
-
+   gF1->SetNDF(gF1->GetNumberFitPoints()-npar-nfixed);
+   
 //*-*- Store fitted function in histogram functions list and draw
    if (!Foption.Nostore) {
       if (!Foption.Plus) {
diff --git a/treeplayer/src/TTreePlayer.cxx b/treeplayer/src/TTreePlayer.cxx
index 696c236332c..a6017da95fb 100644
--- a/treeplayer/src/TTreePlayer.cxx
+++ b/treeplayer/src/TTreePlayer.cxx
@@ -1,4 +1,4 @@
-// @(#)root/treeplayer:$Name:  $:$Id: TTreePlayer.cxx,v 1.47 2001/05/07 12:34:35 brun Exp $
+// @(#)root/treeplayer:$Name:  $:$Id: TTreePlayer.cxx,v 1.48 2001/05/28 06:32:09 brun Exp $
 // Author: Rene Brun   12/01/96
 
 /*************************************************************************
@@ -3198,6 +3198,7 @@ Int_t TTreePlayer::UnbinnedFit(const char *funcname ,const char *varexp, const c
      tFitter->ExecuteCommand("MINOS",arglist,0);
   }
   fitfunc->SetChisquare(0); //to not confuse user with the stored sum of w**2
+  fitfunc->SetNDF(fitfunc->GetNumberFitPoints()-npar);
 
    // Get return status into function
    char parName[50];
-- 
GitLab