TTree::GetEntries() problem

Hi Rooters,

I have maybe a problem with TTree::GetEntries() method.

If I plot a branch (“branch1”, for example) with StartViewer and then I get the Entries of this histo, I’ll find a different value from that coming out from t1->GetEntries(“branch1”) method.

Where is the problem??

I hope I’ve explained my trouble in the right way.

Thanks in advance.

Hi,

This might be the excepted behavior if the branch is actually holding a container that hold more than one value per TTree entry. To assert if there is a problem please provide the 2 numbers you are getting, the name of the branch you are looking at and the result of t1->Print();

Cheers,
Philippe.

Thanks for your answer Philippe!

The name of the branch is “enfus6”.
t1->GetEntries(“enfus6”) = 2812

From the histo of enfus6 --> 2900

And finally this is the output of t1->Print() :

******************************************************************************
*Tree    :h1_gam6   : reduced_data                                           *
*Entries :   545964 : Total =        17624802 bytes  File  Size =     323658 *
*        :          : Tree compression factor =  55.85                       *
******************************************************************************
*Br    0 :mulfu6    : mulfu6/I                                               *
*Entries :   545964 : Total  Size=    2191114 bytes  File Size  =      28262 *
*Baskets :       68 : Basket Size=      32000 bytes  Compression=  76.98     *
*............................................................................*
*Br    1 :mulfi     : mulfi/I                                                *
*Entries :   545964 : Total  Size=    2191040 bytes  File Size  =      26459 *
*Baskets :       68 : Basket Size=      32000 bytes  Compression=  82.24     *
*............................................................................*
*Br    2 :baffu6    : baffu6[mulfu6]/I                                       *
*Entries :   545964 : Total  Size=    2210802 bytes  File Size  =      46693 *
*Baskets :      137 : Basket Size=      32000 bytes  Compression=  47.21     *
*............................................................................*
*Br    3 :baffi     : baffi[mulfi]/I                                         *
*Entries :   545964 : Total  Size=    2208719 bytes  File Size  =      43456 *
*Baskets :      137 : Basket Size=      32000 bytes  Compression=  50.70     *
*............................................................................*
*Br    4 :enfus6    : enfus6[mulfu6]/D                                       *                                       
*Entries :   545964 : Total  Size=    2222417 bytes  File Size  =      69159 *
*Baskets :      137 : Basket Size=      32000 bytes  Compression=  31.96     *
*............................................................................* 
*Br    5 :enfis     : enfis[mulfi]/D                                         *
*Entries :   545964 : Total  Size=    2218398 bytes  File Size  =      62893 *
*Baskets :      137 : Basket Size=      32000 bytes  Compression=  35.11     *
*............................................................................*
*Br    6 :libfus6   : libfus6/I                                              *
*Entries :   545964 : Total  Size=    2191188 bytes  File Size  =      17229 *
*Baskets :       68 : Basket Size=      32000 bytes  Compression= 126.29     *
*............................................................................*
*Br    7 :libfis    : libfis/I                                               *
*Entries :   545964 : Total  Size=    2191114 bytes  File Size  =      19722 *
*Baskets :       68 : Basket Size=      32000 bytes  Compression= 110.32     *
*............................................................................*


Cheers,
Tina

So indeed this is the expected behavior :slight_smile:. enfus6 is a variable size array:

t1->GetEntries(“enfus6”) counts the number of entries in the TTree where the array has one of more element that is non zero. Drawing enfus6 will plot an histogram which all the elements including the one that are zero. (I.e. the number of value in the histogram is Sum(mulfu6+1) over the entries which the result of GetEntries).

Cheers,
Philippe.

Maybe I’ve understood the difference between the two entries.

But now I’m not so sure about the truth … i.e., if I should use a value, which of the them is the right?
Maybe my question is not comprehensible and/or correct. #-o

Cheers,
Tina.

I’ve solved my trouble!! :smiley: :smiley: :smiley:

Thanks!

Cheers,
Tina.

[quote]But now I’m not so sure about the truth … i.e., if I should use a value, which of the them is the right?[/quote]It depends of course of what you are trying to get at. Both function work correctly but have different semantic and intent.

So the question, what number are you interested in (semantically) …

Cheers,
Philippe.