Re: [ROOT] How to check if the histogram is empty?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Apr 19 2003 - 19:05:42 MEST


Hi Mateusz,

In the current CVS version, I have modified the SetBinContent functions
to also increment the number of entries.
This should also fix the problem when drawing 2-d histograms
filled via SetBinContent.

Rene Brun

On 
17 Apr 2003, Mateusz Ploskon wrote:

> Dear Rene,
> 
> Thak You for Your prompt answer.
> I think my question was a little bit confusing...
> Let me clearify what I ment by an "empty" histogram...
> The GetEntries() returns also under and over flows while the "content"
> (i.e. data which might tell You something else than if the
> entry went outside the histogram limits...:)) - that is not interesting
> for me... I thought there might be a smart to check if thereĀ“s something
> inside the histo bounds.
> 
> Please consider following:
> 1)
> {
> TH1F a("a","a",10,0,9);
> a.Fill(5, -1);
> a.Fill(6, 1);
> a.GetEntries(); // = 2
> a.GetSumOfWeights(); // = 0
> }
> 
> 2)
> {
> TH1F a("a","a",10,0,9);
> a.Fill(-10000);
> a.Fill(100000);
> a.GetEntries(); // = 2
> a.GetSumOfWeights(); // = 0
> }
> 
> ... but the pictures are not comparable... :(
> 
> Of course one could have a look into Mean and RMS but, in strange cases
> I think even this might not help...
> There's also possibility to check the underflow && over bins but for
> histo dim > 1 this makes some fuss... while I iterate on the TList when
> checking... (fuss = I can call GetNbinsX(), ..Y, ..Z to get the numbers
> and check the under and overflow bins and compare with GetEntries and so
> on...) 
> 
> 
> Best regards,
> Mateusz
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET