Re: [ROOT] TH1F Divide Entries

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Oct 31 2003 - 08:19:06 MET


Hi Ben,

In the released version 3.05/07, I changed the behaviour for the number
of entries following a division or a multiplication.
The number of entries in the result histogram is set to the number of entries
in the histogram being divided. You can always call SetEntries to reset it
to another definition, such as the integral of the bins.

Rene Brun


Ben Kilminster wrote:
> 
> Hi,
> 
> What is the intended behavior of the Entries field in a histogram when it
> is created by dividing two histograms ?
> 
> In the following, I take 2 10-bin histograms, one with 6 entries, and one
> with 12 entries, and divide them.  The integral is what I would expect.
> However, the quotient histogram has 23 entries, which doesn't make sense
> to me.  BTW, I am using root v3_05_04b KCC_4_0 Linux+2.2.
> 
> -Ben
> 
> {
> 
> TH1F *N = new TH1F("N","Numerator",10,0,10);
> TH1F *D = new TH1F("D","Denominator",10,0,10);
> 
> N->Fill(1);N->Fill(1);N->Fill(1);
> D->Fill(1);D->Fill(1);D->Fill(1);D->Fill(1);D->Fill(1);D->Fill(1);
> 
> N->Fill(3);N->Fill(3);N->Fill(3);
> D->Fill(3);D->Fill(3);D->Fill(3);D->Fill(3);D->Fill(3);D->Fill(3);
> 
> N->Sumw2();
> D->Sumw2();
> TH1F *Q = N->Clone("Q");
> Q->SetTitle("Quotient");
> Q->Reset();
> Q->Divide(N,D,1,1);
> Q->Sumw2();
> 
> c1 = new TCanvas();
> c1->Divide(1,3);
> c1->cd(1);
> N->Draw();
> c1->cd(2);
> D->Draw();
> c1->cd(3);
> Q->Draw();
> 
> }



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