Histogram with not adjacent custom bins

Please read tips for efficient and successful posting and posting code

_ROOT Version: 6.24
_Platform: lxplus7
_Compiler: g++ 4.8.5


I would like to make a histogram with custom bins. Not just custom bin widths, but also the possibility of non-adjacent bins.

My bins look like:

  - [0.0, 0.98]
  - [1.1, 2.]
  - [2., 3.]
  - [3., 4.]
  - [4., 5.]
  - [5., 6.]
  - [6., 7.]
  - [7., 8.]
  - [11., 11.8]
  - [11.8, 12.50]
  - [14.8225, 16.]
  - [16., 17.]
  - [17., 18.]
  - [18., 19.246]
  - [19.246, 23.]

So far I have been using TGraph to display plots with this binning, but I would like to use the functionality of histograms.

This is where I want to apply it:
I want to measure the relative efficiencies of a sequence of cuts in those bins. So, I would like to fill the new histograms with entries that pass each cut per bin. Then, just divide the histograms to get efficiencies, or use the TEfficiency class.

All of the above works if all bins are adjacent.

Maybe a new constructor for TH1 which allows for a array[N][2] would work. It would also be helpful to have something analogous to overflow/underflow for events that are withing the overall min/max but fall in the gap between bins.

Also, any workaround to this issue is very welcome.


I do not think ROOT has histograms with such bins. @moneta can confirm.