ROOT appears to be performing automatic rebinning of my TH2D by default against my will... extremely undesirable behavior

I recently wrote a macro creating a TH2D, and when I loop over a TTree and fill this TH2D, it appears to be automatically rebinning my TH2D by default. This is not at all the behavior I want. It only seems to be exhibiting this behavior for SOME of my TH2Ds and not others. This is the first time I’ve ever seen this kind of behavior. This is yet another egregious example of “clever” software incorrectly mind-reading; substituting its own wrong interpretation of what it thought I meant versus what I actually meant, which is what I told the code to do. Under what criteria would ROOT automatically rebin a histogram without being asked to do so by the user who wrote the code? Under no reasonable criteria SHOULD this happen…

PS: here is some code and a screenshot of the result. As you can see, my desired x-axis binning was 200 bins from -2 to 7 and my desired y-axis binning was 200 bins from -2 to 2. ROOT automatically rebinned this to something like -17.5 to 72.5 and -11 to 5.

Apparently it didn’t like the amount of overflows I had, even though most of the distribution is contained within the limits I asked for? What’s going on here?

TH2D *hpmisspar_vs_W2_proton = new TH2D("hpmisspar_vs_W2_proton","",200,-2.0,7.0,200,-2.0,-2.0);
/// then later on it is filled with:
hpmisspar_vs_W2_proton->Fill( W2_recon, pmiss_par, weight );


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.22
Platform: Mac OS X
Compiler: clang


Maybe @moneta can explain this behavior

...,-2.0,-2.0); triggers automatic binning for the y-axis (and due to a bug in ROOT it triggers it also for the x-axis, which should not be the case as there is ...,-2.0,7.0,...).

1 Like

A sign error! That was it… I need to get more sleep…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.