Re: Division of Histograms

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Wed, 13 Oct 2010 15:31:51 +0200


see below

Harinder Singh Bawa wrote:
> Dear experts,
>
> I may be missing something but I am trying to divide 2 histograms bin
> by bin as follows
>
>
> Declaring
> ===========
> TH1F *hist1=new TH1F("hist1","",40,0,2000);
> TH1F *hist2=new TH1F("hist2","",40,0,2000);
>
> TH1F *histdiv=new TH1F("histdiv","",40,0,2000);
>
> Filling
> =====
>
> hist1->Fill(some variable from input rootfile);
> hist2->Fill(some variable from input rootfile);
>
> histdiv->Divide(hist1,hist2,1.,1.,"b");
>
> Is this correct.?

yes it is
>
> The problem I am seeing is that though I am getting many points from
> division in plot but in Stat it is showing only 1 entry. Can anyone
> say why?

What is the meaning of the number of entries in this case. Suppose h1 with 1000 and h2 with 2000 entries. what do you expect for histdiv. You can do something like

   histdiv->SetEntries(h1->GetEntries());

see also the new class TEfficiency at : http://root.cern.ch/root/html/TEfficiency.html

Rene Received on Wed Oct 13 2010 - 15:31:56 CEST

This archive was generated by hypermail 2.2.0 : Wed Oct 13 2010 - 17:50:01 CEST