I am new to ROOT and I learned how to use the Scan function to print the data entries of a leaf. I noticed, however, when I use Scan on an entire TTree then the data is printed along with the number of instances that it occurs, as shown here:
Is there a way for me to use Scan on a single variable and also have it print how many times it repeats instead of it only printing entries that are different? This is what it shows when I use scan on a single variable:
“Instance” usually means the branch or leaf is an array (fixed size) or a vector (different sizes). The size of each vector (within each event or “Row” shown in Scan) may be stored in another branch or leaf in the same tree. Try printing the tree structure
tree->Print();
(of course, change “tree” to the name you are using).
For example, here:
Also, note that the values of the instances (the "a"s with the same “Row”) are not necessarily equal; they might be in your tree, but that’s not the general case, so if you really want to remove only the repeated values you will need a different solution, unless you are 100% sure all values in the instances of each row (for all rows) are in fact equal.
I don’t want to remove the repeated values- that is what I want to see as well as how many times they repeat! In the response you posted, I see you are scanning two variables (n and a), is it possible to see the instances of n without also scanning a?