I am currently struggling to get the number of entries in a Ttree branch satisfying flag = 1.
I found the following conversation Find the number of entries in a TTree satisfying conditions yet it appears that the suggested code is not compatible with ROOT version Root Version 6.22/06. Is it possible to see the number of entries in the TreeViewer interface?
Unfortunately, no. When I run my macro with the fit of my data I cannot find the number of entries from tree->GetEntries(“fl_r_b02 == 1”) in the output.
What Philippe @pcanal probably means is that you have to print out the result of tree->GetEntries("fl_r_b02 == 1");, not just leave it hanging out there. Like
TFile *file = new TFile("merged_simulated_data.root");
TTree *tree = (TTree*)file->Get("h1");
printf("There are %li entries satisfying your condition\n", tree->GetEntries("fl_r_b02 == 1"));