A way to extend the low bin edge of the lowest bin and save as .root file?

ROOT Version: 6_10
Platform: Ubuntu 16.04
Compiler: gcc 630

Hi, I have a rootfile, which has a 2D histogram with lowest bin (20,25).

Is there an easy way to extend the lower threshold such that the bin has range of (12,25) with same bincontent?

I guess one can literally use setbincontent, getbincontent functions for every single entry to recreate entire 2Dhist.

However, I expect that experts would know a much faster shortcut for my situation where I need to change only one bin’s lower threshold and save that as root file.

I appreciate your expert comments and advice

Thank you so much.


Are the axes of your histogram “fix bin size” or “variable bin size”?

Try (if you want to modify the “x axis”):


If the axis is a “fix bin size” then, you will need to create a new histogram with correct axes ranges.

If the axis is a “variable bin size” then, you can simply execute (if you want to modify the “x axis”):

(*(TArrayD*)your_histogram->GetXaxis()->GetXbins())[0] = 12.; // the lowest edge

Afterwards, you need to execute:

// one must set the new proper "xmin" and "xmax" for this axis
1 Like

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