How to divide histograms with empty bins

Hi everybody,

I attempt to divide two histograms having the same number of bins using:

histo->Divide(h1,h2,1,1,“B”)

Some of the bins are empty and, as a result, I get the following error:
“Attempt to divide histograms with different number of bins”.

Any way around without painfully dividing them bin-by-bin in a loop?

The problem is not with empty bins, but the fact that your histograms have different number of bins.

Rene

They do have the same number of bins. If I do h1.GetNbinsY() and equivalent for the X axis, I get the same numbers.

This is not strange if one takes into account that they are created by the same macro with different input parameters.

If you get the message “Attempt to divide histograms with different number of bins”"
your histograms that you want to divide have different numbers of bins. Please check your code

Rene

Attempting to produce a macro and a root file that I could upload for you, I found the problem. The division histogram had a different number of bins (x as y and other way around). The error message was misleading.
If you want I can upload the files.
Sorry for the trouble