THnSparse Projection option 'A' does not do anything

According to the documentation, option “A” in THnSparse::Projection does:

  • “A” ranges of the taget axes will be ignored.

However, it does not appear to do anything; the projected histogram is truncated just as before. Am I missing something? Demonstration follows.


I have a THnSparse with 10,897,521 entries and axis 2 has a range from -12 to 12:

In [5]: htest.GetAxis(2).GetXmin(), htest.GetAxis(2).GetXmax()
Out[5]: (-12.0, 12.0)

In [6]: htest.GetEntries()
Out[6]: 10897521.0

If I restrict the range of axis 2 and project, I get the expected result (reduced entries):

In [4]: htest.GetAxis(2).SetRangeUser(3, 4)

In [5]: hproj = htest.Projection(1)

In [6]: hproj.GetEntries()
Out[6]: 2652305.0

However, I get the same result even if I tell it to ignore the axis range with option 'A':

In [8]: htest.Projection(1, 'A').GetEntries()
Out[8]: 2652305.0

FYI, without setting the axis range, Projection appears to work as expected:

In [4]: hproj = htest.Projection(1)

In [5]: hproj.GetEntries()
Out[5]: 10897521.0

ROOT Version: 6.19/01
Platform: macOS
Compiler: Not Provided


Hello,

I invite @bellenot and @couet to have a look, but they are both travelling this week.

I guess @moneta may help with this.

Upon further investigation, it turns out that it does do what it advertises: ignore the range of the projection-axis. If I instead do:

In [4]: htest.GetAxis(2).SetRangeUser(3, 4)

In [5]: hproj = htest.Projection(2, 'A')

I get the expected result:

In [6]: hproj.GetEntries()
Out[6]: 10897521.0

It still enforces the ranges of the other axes. It might be nice to have another option to ignore the ranges of all the axes, but this feature does, it seems, work as advertised.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.