Because, TH2 are often used to draw a pad frame, the TH2 Paint functions
with options like "colz", "cont" return immediately once the axes are
drawn if the number of entries is null. There is no need to loop on the
cell contents. If one use SetBinContent to fill an histogram, the number
of entries is not incremented. Only the Fill functions increment the
number of entries. In that case, the simplest is to add one statement
before drawing the histogram:
h->SetEntries(1);
-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch]
On Behalf Of Nicolas Produit
Sent: Thursday, December 13, 2007 12:21 PM
To: roottalk
Subject: [ROOT] AddBinContent
Hi,
I fill a 2D histogram in using in a loop the method h->AddBinContent(p,s)
The histogram does not show properly if doing:
h->Draw()
or
h->Draw("COLZ")
(show blank as it was 0 entry everywhere)
but it is displaying correctely when doing:
h->Draw("LEGO")
h->GetEntries()
return 0 Entries
but the statistical box has non zero entries everywhere
doing a
h->SetEntries(nn)
where nn is the number of time the AddBinContent was called
make the histogram behaving correctely for ->Draw() and ->Draw("COLZ")
root version 5.08/00
Thanks
--- Nicolas Produit INTEGRAL Science Data Center Phone: +41 22 379 2140 16, Chemin d'Ecogia Fax: +41 22 379 2133 CH-1290 Versoix www: http://isdc.unige.ch/~produitReceived on Thu Dec 13 2007 - 13:24:56 CET
This archive was generated by hypermail 2.2.0 : Fri Dec 14 2007 - 11:50:01 CET