-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Check duplicate issues.
- Checked for duplicates
Description
This issue continues the discussion from #20077, which originally reported that histogram projections and UHI operations fail for histograms with axes having infinite upper edges.
Part of the problem, the UHI slicing and projection behavior differing from the standard ROOT projection functions, was addressed in #20146.
However, the core C++ histogram projection methods (TH2::ProjectionY in this example) still produce incorrect results: when a histogram has an axis with an infinite upper bin edge, the contents of the highest bin are not included in the projected histogram.
Reproducer
int main() {
Double_t xedges[] = {0., 1., 2.};
Double_t yedges[] = {0., 1., 2., std::numeric_limits<double>::infinity()};
TH2D h("h_inf", "h_inf;X;Y", 2, xedges, 3, yedges);
h.SetBinContent(1, 1, 11.);
h.SetBinContent(2, 1, 21.);
h.SetBinContent(1, 2, 12.);
h.SetBinContent(2, 2, 22.);
h.SetBinContent(1, 3, 13.);
h.SetBinContent(2, 3, 23.);
std::cout << "ProjectionY values:" << std::endl;
auto projY = h.ProjectionY();
for (int i = 1; i <= projY->GetNbinsX(); ++i) {
std::cout << " bin " << i << ": " << projY->GetBinContent(i) << ", expected " << h.Integral(1, 2, i, i) << std::endl;
}
return 0;
}Output:
ProjectionY values:
bin 1: 32, expected 32
bin 2: 34, expected 34
bin 3: 0, expected 36ROOT version
6.37.01
Installation method
all
Operating system
all
Additional context
No response