Automatically separate histogram into X ~equally portions

Hello,
is there a way that I can divide a histogram into a number of sections, roughly equal in the number of entries?
For example, I have a 2d histogram and I want to take the projection in 6 different regions, with a nearly equal number of entries ending up in each section (it can’t be equal because of binning I guess). I can request the projection to cover only a select range of bins, but what should I do to get these sections to cover similar event counts without going through them by hand?
ROOT 6.20/06 on lxplus
Thanks!

I am not sure ROOT provides an automatic way to do that. I guess you will need to implement the algorithm yourself. @moneta can confirm.

Hi,
In reality we have something to divide the histograms in different regions according to the integral content. Look at TH1::GetQuantiles. There is also a tutorial for this: ROOT: tutorials/math/hlquantiles.C File Reference.

Cheers

Lorenzo