How do you find the bin index in a THn

Hi ROOTers,
I want to get the content of a specific bin in a THn (or THnSparse). I can locate the bin on each axis by doing


(numbers here are jusrt an example) but then I can not use the GetBinContent(bin) function, since it requires as input the global bin index and not one index for each axis.
Is there a way to do this?

_ROOT Version: 6.18/00
_Platform: Linux 3.10.0-1127.13.1.el7.x86_64

Hi Riccardo,
I bet @moneta can help!


@eguiraud thanks.

In the meantime I found that the THn::GetBin(const Int_t* idx*) function seems to do what I need.
Of course, if you or anybody else knows a better way of doing it, I’d be happy to hear.

1 Like

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