Histogram entries

May be something like that:

TH1F *hist = ...;
int totalEntries = 0;
for (int i = 1; i <= hist->GetNbinsX(); i++) {
    if (hist->GetBinContent(i) > 0) {
        totalEntries += hist->GetBinContent(i);
    }
}

?