I’m trying to assess the number of unweighted events surviving a cut. The events are stored in one (or many) TTrees and I get a histogram of all events surviving a cut. The draw call looks like this:
tree->Draw("1>>hist(1,0,2)", "!!(cutA && cutB && cutC)", "e");
The “!!” in the cut/weight expression is meant to make sure that all weights are 0 or 1. For some samples I have multiple trees and add the histograms using TH1::Add.
In the end, the result of hist->GetEntries() differs from hist->Integral() (even when taking the under-/overflow bins into account, which are not filled). It seems that the GetEntries() function returns the number of events plus two times the number of TTree::Draw calls, which is not what I expected. This happens even when only one histogram is created, so I assume it has something to do with how TTree::Draw() creates the histogram.
When I add up the return values from TTree::Draw I get to the same result as when using Integral().
Using the Integral() function works fine, but I wanted to cross check with the experts to make sure that I do nothing totally stupid.