Number of entries of histogram obtained from RooDataHist is always 100

Hi Rooters,

While I was working on the binned dataset observed that a histogram created from RooDataHist has total entries always equal to 100. To illustrate this point I have attached the modified code from tutorial rf201_composite.C. Here I make a binned clone of data (see line 72) and convert it to a TH1 histogram using the createHistogram method. I observe that the number of entries shown in the statistics box of TH1 is always equal to 100. I also confirmed it by printing it h1->GetEntries(). In the example, I have generated 1000 data points and filled them into 50 bins. I expect the number of entries of the histogram to be 1000. But it shows that the number of entries is 100. Can someone explain why is this so?
rf201_composite.C (4.3 KB)

Hi,

Thanks for the post and reproducer. Passing through a RooDataHist is not necessary. You can directly obtain your histogram, with the right number of entries, like this:

   RooDataSet *data = model.generate(x, 123);
   
   TH1 *h1 = data->createHistogram("h1", x, Binning(50,0.0,10.0));

Cheers,
D

PS
@jonas

Dear Danilo,

Thanks for the reply. It worked. But I am just curious to know why the same histogram made using RooDataHist does not show the correct entries. Is it some bug?

Regards
KKR

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.