Re: [ROOT] number of entries when two histos are subtracted ?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jul 23 2001 - 10:02:56 MEST


Hi Ahmet,

The number of entries after an operation is most of the time meaningless
unless you add two histograms where all weights had been set to 1.
I do not see a reasonable and general solution to the number of entries
in operations like subtraction, multiplication and division.
What would you expect for:
hdiff->Add(h2,h3,1.3,-1.6);

In your case, you can do:
 Int_t N = h2->GetEntries() - h3->GetEntries();
 hdiff->Add(h2,h3,1,-1);
 hdiff->SetEntries(N);
if this has a meaning in your case.

Rene Brun

Ahmet Sedat Ayan wrote:
> 
> Hi Rooters,
> 
> I noticed that when I subtract two histograms as in the following
> 
> TH1F *hdiff = new TH1F(*h1);
> hdiff->Add(h2,h3,1,-1);
> 
> the number of entries in the statistics box shows the sum of the number of
> the entries of histos h2 and h3. Is this a bug? or?
> 
> thankx
> 
> ahmet
> 
> ***************
> 
> Ahmet Sedat Ayan
> 
> Physics & Astronomy Dept.
> Van Allen Hall
> University of Iowa
> Iowa City, IA, 52242
> 
> Voice      : (++ 1 319) 335-2832 (W) (GMT-6)
> Occupation : Ph.D Candidate (But still dreamer!)
> e-mail     : ayan@cms.physics.uiowa.edu
> web        : http://jazz.physics.uiowa.edu/~ayan



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:52 MET