Get double entries count in TH1F

Hi,

I have this issue.
The entries number given in a TH1F is double the number by using T->GetEntries(“CUT”) with same cuts applied. And the variable I plot in the TH1F is a number not array. I feel the number given by GetEntries should be the correct one. Can someone explain why the entries in histogram is bigger? Thanks!

Please provide the following information:


ROOT Version : 6.10.02
Platform, compiler (e.g. CentOS 7.3, gcc6.2): redhat


What is the “CUT” exactly?
How do you fill your histogram exactly?
(Basically, I think, from both approaches, you should get exactly the same number of entries.)

Here is the sentence related:

Double_t ntrack2 = T->GetEntries(beta+Ep+CK+VZ+trigger2+TRK2+ACC);
T->Draw(“L.s2.nthit”,beta+Ep+CK+VZ+trigger2+TRK2+ACC);

Those cuts (like beta, Ep) could be array or number.
The entries I see in the histogram is 2*ntrack2-1

Well, even if “L.s2.nthit” is just an ordinary value, but your “CUT” contains arrays then, I think, your histogram will be filled with this ordinary value as many times as there are elements in the arrays (which satisfy the selection).

Yeah. You’re right. After replacing the array with a number in “CUT”, those two entries are equal.
BTW, is there a simple way to make it fill the histogram only one time when an array is in the cut?

Well, see “Special functions and variables” in the TTree::Draw method description.

Maybe @couet has some better ideas.

You may also have a look at MakeSelector . Using it you have the full control.

Thank you all! I probably need some time to understand how to use it…

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.