From 1983a5fb8902b3edd8cb514ed748a8141e91e28f Mon Sep 17 00:00:00 2001
From: Olivier Couet <Olivier.Couet@cern.ch>
Date: Thu, 2 Dec 2010 13:31:09 +0000
Subject: [PATCH] - use Fill(const char* name, Double_t w);

git-svn-id: http://root.cern.ch/svn/root/trunk@37179 27541ba8-7e3a-0410-8455-c3a389f83636
---
 tutorials/hist/th2polyUSA.C | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tutorials/hist/th2polyUSA.C b/tutorials/hist/th2polyUSA.C
index 3e81cd856e8..4fec80b4ced 100644
--- a/tutorials/hist/th2polyUSA.C
+++ b/tutorials/hist/th2polyUSA.C
@@ -47,6 +47,7 @@ void th2polyUSA()
    TFile *f;
    f = TFile::Open("http://root.cern.ch/files/usa.root");
 
+   // Define the TH2Poly bins.
    TMultiGraph *mg;
    TKey *key;
    TIter nextkey(gDirectory->GetListOfKeys());
@@ -55,14 +56,12 @@ void th2polyUSA()
       if (obj->InheritsFrom("TMultiGraph")) {
          mg = (TMultiGraph*)obj;
          bin = p->AddBin(mg);
-	 for (i=0; i<nx; i++) {
-            if (strstr(states[i],mg->GetName())) {
-               p->SetBinContent(bin, pop[i]);
-            }
-         }
       }
    }
 
+   // Fill TH2Poly.
+   for (i=0; i<nx; i++) p->Fill(states[i], pop[i]);
+
    gStyle->SetOptStat(11);
    gStyle->SetPalette(1);
    p->Draw("gllego");
-- 
GitLab