About kCanRebing, SetBinContent,TH1::Add and TProfile::Add


I am working with root 5.22.

In these days I have (re?)discovered the feature of TH1::SetBinContent which causes a strange doubling of the number of bins in histograms with kCanRebin bit set if the bin N+1 (overflow) is set. I found no description of these feature in the documentation of this method while I found a protection and a comment about that in the method TH1::Add(const TH1*, const TH1*, double,double). I think it would be better to describe it in the documentation.
Related to the protection in that method I have the impression that the kCanRebin bit is reset before using SetBinContent but , then, it is not set back (if it was set at the origin). In this way I think that a rebinnable histogram is no more rebinnable after a call to TH1::Add.
Finally I did not see such a protection in TH1::Add(const TH1*, double) or in any TProfile::Add method. Is it because in the former case AddBinContent is used (and it is not affected by the same feature) and in the latter case the data member array is modified directly?



the kCanRebin bit is automatically set for histograms with automatic bin limits calculation.
This bit is effectively reset when an operation is performed on this histogram): Draw, Add, etc.