This answer it does not help. It is the same as the link I provided. The only thing It approaches to my answer is with bedtools:
bedtools coverage -hist -b 152611.qual.rmdup.bam -a exones.sort.bed -g hg19.genome -sorted -header >hist.txt
Similar as in here But in the link, they put the options -b as the captured.bed i.e the region of interest. However, on mu line, is the other way around, Furthemore, do you know why do they compute 1-cumsum ?