while finding a general way to modify axises of histograms after the initial booking, I found a problem with any TProfile. Consider the following example:
At this point (as a Dump() shows), fBinEntries.fN is 12, as expected, and fXaxis.fNbins is 10.
This of course only modified fXaxis.fNbins. Now a call to Rebuild should fix the situation:
Another Dump() shows that fNcells was correctly fixed, but fBinEntries.fN is still 12, and filling into the TProfile (of any dimension) will cause invalid writes or segmentation faults.
The way to go is:
It appears fBinEntries is only modified in TProfile::BuildOptions and TProfile::SetBins but not in Rebuild() (naturally not as this is inherited from TH1 without any override).
SetBins is not the way to go if only some of the axises should have a variable binning (and is of course not a method of the common baseclass, as the number of parameters has to differ for each dimensionality, which makes it much less convenient if you don't want to care about the actual histogram class which is in use).
Of course the outlined way to use TProfile::BuildOptions works perfectly well for me, but I think that TProfile::Rebuild should either be implemented for each TProfile to set the correct size for the fBinEntries array or be forbidden in all TProfile-classes.