Re: Bad Number of entries in Statistics box after histos substraction

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Aug 16 1999 - 08:58:59 MEST


Hi David,
The convention when making operations between histograms is to always
add the entries of the histograms. Histograms may have been filled with
weights and coefficients may also be specified (including negative or
fractional
coeeficients). In case of a substraction, the result may be negative.
I know that this is an arbitrary convention.
In case of operations, you should look at the Integral, not the number
of entries.
If somebody has a better suggestion, let me know.

Rene Brun

David d'Enterria wrote:
> 
> Hello developers,
> 
> I substract two histograms via:
> TH1F *h_en_90deg_photon_no_cosm = new TH1F(*h_en_90deg_photon);
> h_en_90deg_photon_no_cosm->Sumw2();
> h_en_90deg_photon_no_cosm->Add(h_en_90deg_photon,h_en_90deg_cosmic,1,-1);
> 
> The number of entries of each histo is:
> h_en_90deg_photon.Integral()
> 23119
> h_en_90deg_cosmic.Integral()
> 439
> h_en_90deg_photon_no_cosm.Integral()
> 22680
> 
> However when one draws this last histogram:
> h_en_90deg_photon_no_cosm.Draw()
> 
> one reads in the statistics box:
> Nent=23558        (namely, the SUM of the substracted histos ...)
> 
> This result is a little bit misleading ... Can you correct that ?
> 
> I'm using ROOT 2.22/10 on
> uname -a:"Linux nanpc45.in2p3.fr 2.0.35 #1 Thu Jul 23 14:01:04 EDT 1998
> i686 unknown
> 
> Thank you in advance,
> 
> David d'Enterria
> ¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
> Groupe Photons Subatech       http://www-subatech.in2p3.fr/~photons/
> mailto:enterria@in2p3.fr      phone: +33.2.51.85.84.89
> ¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
> Grup Física Radiacions UAB    http://cc.uab.es/~iffr1/
> mailto:d.enterria@cc.uab.es   phone: +3493.581.13.64



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:38 MET