Home | News | Documentation | Download

Bin width in TH1::GetCumulative

Hello everyone,
it seems to me there is no way to make TH1::GetCumulative account for bin width, in a way similar to what TH1::Integral can do when the option “width” is specified. Maybe an equivalent option would be helpful.
Accounting for bin width would make the cumulative equal to the mathematical integral of the function represented in the original histogram, this is useful when dealing with normalized quantities, like probability density functions.

For the time being, you could try:

TH1 *h_tmp = ((TH1*)(h_original->Clone()));
h_tmp->Scale(1., "width");
TH1 *h_cumulative = h_tmp->GetCumulative(...);
delete h_tmp; // no longer needed