Hi everyone.
I want to return the entries of my histogram, but I see that it return not correct result.
#include <iostream>
#include <TH1.h>
using namespace std;
void anh()
{
delete gROOT->FindObject("h"); //delete old object
TH1D *h = new TH1D("h", "his", 10, 0, 10);
for (int i = 1; i <= h->GetNbinsX(); i++)
{
h->SetBinContent(i, i);
}
cout << "Entries: " << h->GetEntries() << endl;
h->Draw();
}
Here is an output.
root [9] .x anh.cpp
Entries: 10
I think correct entries are 55 (1+2+…+10 = 55).