root : strange behaviour of AddBinContent()

From: Marc Escalier <escalier_at_lal.in2p3.fr>
Date: Fri, 2 Sep 2011 16:24:21 +0200


Hello,

it seems that there is a strange behaviour of TH1::AddBinContent()

intuitively, i would think that adding a content to a bin would mean that the number of entries should increase, as it is when one does TH1::Fill(1) (apart that this last comment is very slow)

but :

root [0] TH1F *hist_initial_events=new
TH1F("hist_initial_events","hist_initial_events",20,0.5,20.5);

root [1] hist_initial_events.GetEntries()
(const Double_t)0.00000000000000000e+00
root [3] hist_initial_events->AddBinContent(1)
root [4] hist_initial_events.GetEntries()
(const Double_t)0.00000000000000000e+00

root [5] hist_initial_events.GetBinContent(1)

(const Double_t)1.00000000000000000e+00

-->

*is the fact that AddBinContent() does not increase the number of entries expected ?

*On other subject, is there a way to find a much faster command that TH1::Fill to add 1 to an histogram ?

(i see that a simple counter "int" is much more faster, but i need a TH1 for proof, because TH1 derivates from a TObject and the fOutput needs derivatives from TObject : it can not deal with common counters ; and recreating a class derivated from TObject with an integer is rather painful for a clean implementation)

thanks for your help Received on Fri Sep 02 2011 - 16:25:28 CEST

This archive was generated by hypermail 2.2.0 : Fri Sep 02 2011 - 23:50:02 CEST