but when I open it in the TBrowser, the histograms have ~150000 entries. In fact, that is the number of entries I am expecting.
First, I would like to understand why when typing tree->Print() I see more entries than I can see in the histogram in TBrowser.
Also, I have been having a lot of problems getting the value of each entry. I followed some tutorials and other questions in this forum but nothing worked. What would be the best way to access each entry?
So far I have been working with double objects, and I would just loop over the entries of the TTree to get the variable. Is there a similar way to work with vector<double> objects?
TTree::Print shows as “Entries” the number of vectors (one for each “Fill” call) stored in the branch, while the histogram in TBrowser contains all the entries of all the vectors in the branch.
Thank you! What threw me off is that Entries printed by TTree::Print is higher than the reported number of entries according to the histogram – maybe a lot of the vectors are empty…?
How can I access to an specific entry with this idea? The while (r.Next()) loop will go over every entry. How can I make it to just go from entry 500 to entry 1000, for example?
Hello,
I have a similar situation. #Entries in TBrowser is less then #Entries in tree->Print().
And it is exactly what you mentioned, many vectors are empty.
I need to get #Entries in TBrowser.
Do you have any hints which Root documents that I should look at to get this value?
Hi @nvhviet ,
note that this is a very old thread. The histogram displayed by the TBrowser shows the number of values the histogram was filled with. Empty vectors count as zero, vectors with many elements count as N. TTree::Print instead lists the number of vectors, i.e. the number of entries in the TTree. These are two different numbers.
If this does not help please open a new topic describing your problem, I am not sure I understand what value you want to see in the TBrowser (try right-clicking on the TTree in the browser, that allows you calling some of its methods).
I set the vector-type branch address and fill it into a TH1 histogram.
Then I use the GetEntries() of the histogram to get the Entries displayed by TBrowser.