From f4564ff3b5770971996246beca565e7fb1bf8a6a Mon Sep 17 00:00:00 2001
From: Rene Brun <Rene.Brun@cern.ch>
Date: Sun, 28 Jul 2002 07:31:53 +0000
Subject: [PATCH] The logic in THistPainter::PaintTable to invoke PaintStat2
 was wrong. The first object in the list of functions is not always (and
 rarely) a TF2 object. One must iterate on the list of functions to find the
 first object deriving from TF1.

git-svn-id: http://root.cern.ch/svn/root/trunk@5019 27541ba8-7e3a-0410-8455-c3a389f83636
---
 histpainter/src/THistPainter.cxx | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/histpainter/src/THistPainter.cxx b/histpainter/src/THistPainter.cxx
index e38cf146bc4..3961ea4a1f7 100644
--- a/histpainter/src/THistPainter.cxx
+++ b/histpainter/src/THistPainter.cxx
@@ -1,4 +1,4 @@
-// @(#)root/histpainter:$Name:  $:$Id: THistPainter.cxx,v 1.89 2002/07/15 10:56:22 brun Exp $
+// @(#)root/histpainter:$Name:  $:$Id: THistPainter.cxx,v 1.90 2002/07/16 20:32:56 brun Exp $
 // Author: Rene Brun   26/08/99
 
 /*************************************************************************
@@ -4575,9 +4575,17 @@ void THistPainter::PaintTable(Option_t *option)
    PaintTitle();    //    Draw histogram title
 //   PaintFile();     //    Draw Current File name corresp to current directory
 //   PaintDate();     //    Draw date/time
-//   if (!Hoption.Same && !Hoption.Lego && !Hoption.Surf) {
+
+   TF1 *fit  = 0;
+   TIter next(fFunctions);
+   TObject *obj;
+   while ((obj = next())) {
+      if (obj->InheritsFrom(TF1::Class())) {
+         fit = (TF1*)obj;
+         break;
+      }
+   }
    if (Hoption.Same != 1) {
-      TF2 *fit = (TF2*)fFunctions->First();
       if (!fH->TestBit(TH1::kNoStats)) {  // bit set via TH1::SetStats
          PaintStat2(gStyle->GetOptStat(),fit);
       }
-- 
GitLab