Projection in THnSparse

Some time ago, I wrote various source code (which deals with a creation of a 3D THnSparse and then its 1D and 2D projections) for someone else which you can reuse: