Binning in root file

Hi everyone,
I am curious that when viewing the histogram of a single branch in a TTree (I opened up a root file and clicked on the branch to view the histogram), why does in some of the case, the rebin option is less flexible than the other (as in figure b). I dont think that this is limited by entries number, because the root file in figures (a) and (b) have 1M and 5M entries respectively.
Is is something to do with the saving process? If so, how do I take care of this when saving root files ?

Thanks in advance.


_ROOT Version: 6.24 (via cvmfs)
Platform: Ubuntu20.0LTS on WSL 2
Compiler: gcc9

Seems to me the left scale from -5 tp 5 is wrong. It should be a scale changing the number of bins. I see the same when I access and histogram produced by TTree::Draw. When I access an other histogram it is ok:

auto h = new*TH1F("h","h",500,0,1)

Note that it seems only the slider scale is wrong. When you move it changes the number of bins correctly. Same when you enter directly the number of bins in the text box.

1 Like

Actually looking at the code, I see there is two different cases depending if the histogram comes from a tree or not. In the “tree case” the code is here:

I have no idea it was done that way …

1 Like

The doc is here:

1 Like