Size of the TArrayD object in the histogram

Hello,

while dividing two histograms I receive an error of different bins limits. Histograms are create by exactly the same function, with the same bins and limits settings. I started to digging into the code, and found that comparison is done on the basis of comparing sizes of TArrayD objects. So I made a small test, and I found that the size of the array in the second histogram is 0. It is strange because histogram is drawn as it should be.

So I open root, and executed following two line code:

root [0] TH2D * h3 = new TH2D("h3", "h3", 10, 1, 10, 10, 1 , 10) root [1] h3->GetXaxis()->GetXbins()->fN (Int_t)0 root [2]
Apparently, fN variable of the TArrayD object is 0 even if there should be 10 bins. How to explain this?

Observed in 5-34/30 and 5.34/34.

…:: edit

I think I found the reason, In one case it was created from the array of bins, in the second as a fixed bin width. In both cases however bins are the same, but fAxisX has different meaning:

root [26] double xarr[11] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ,10 } root [27] TH2D * h4 = new TH2D("h4", "h4", 10, xarr, 10, xarr) root [28] h4->GetYaxis()->GetXbins()->fN (Int_t)11 root [29]

Explanation: it’s a “fix bin size” histogram. <img src="/uploads/default/original/2X/8/84c2fe9464a4066c00e1bd5978e913e7869cbb07.gif" width=“22” height=“16” alt=":-"" title=“Whistle”/>