From ab3932be3e2f8da2229a900610f70d86e5394442 Mon Sep 17 00:00:00 2001
From: Lorenzo Moneta <Lorenzo.Moneta@cern.ch>
Date: Sat, 4 Apr 2009 13:09:38 +0000
Subject: [PATCH] fix a problem in InitGaus when having only one data point.
 This fixes the bug https://savannah.cern.ch/bugs/?48936

git-svn-id: http://root.cern.ch/svn/root/trunk@28104 27541ba8-7e3a-0410-8455-c3a389f83636
---
 hist/hist/src/HFitInterface.cxx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hist/hist/src/HFitInterface.cxx b/hist/hist/src/HFitInterface.cxx
index 63972dd56d5..462d20c9cfa 100644
--- a/hist/hist/src/HFitInterface.cxx
+++ b/hist/hist/src/HFitInterface.cxx
@@ -290,7 +290,9 @@ void InitGaus(const ROOT::Fit::BinData & data, TF1 * f1)
    double allcha = 0;
    double valmax = 0; 
    double rangex = data.Coords(n-1)[0] - data.Coords(0)[0];
-   double binwidth = rangex;
+   // to avoid binwidth = 0 set arbitrarly to 1
+   double binwidth = 1;
+   if ( rangex > 0) binwidth = rangex; 
    double x0 = 0;
    for (unsigned int i = 0; i < n; ++ i) { 
       double val; 
-- 
GitLab