Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch 2D histograms to use THnSparse #193

Open
benkrikler opened this issue Aug 18, 2014 · 3 comments
Open

Switch 2D histograms to use THnSparse #193

benkrikler opened this issue Aug 18, 2014 · 3 comments

Comments

@benkrikler
Copy link
Contributor

I've just come across the ROOT histogram class, THnSparse. It's designed specifically to handle histograms where most bins are empty which would hugely reduce the amount of memory the histogram consumes.

Most of the bad-allocs I've seen were due to too many histograms with too many bins. As a result many of our plots have had there binning reduced, which white-washes many of the small speaks. With this sparse histogram version, we'd be able to keep smaller bin widths and consume far less memory.

Does anyone have experience with this histogram type?

I'm not sure whether this should be a priority though if we want to increase binning immediately or whether we should focus on other things now. I'm putting it to the long term milestone for now.

@AndrewEdmonds11
Copy link
Contributor

How much work would it be to change? Is it just a case of doing a search and replace of TH2F to THnSparse?

@benkrikler
Copy link
Contributor Author

THnSparse provides a single interface for an arbitrary number of dimensions. That means the constructor and the Fill method are different to normal TH1 / TH2s in that they use arrays to pass in values. Each array should have a length equal to the number of dimensions in the histogram. So this is not quite as simple as search and replace, although probably not too much hard work.

@litchfld
Copy link
Contributor

This is getting kind of weird... Its not normal to run out of memory allocating histograms. I can't help feeling something is more fundamentally wrong in what we are doing.

I've not used this class, but the basic concept is really intended for high dimension (>4) histograms, which do become sparse very quickly. So our 2D histograms may not be sparse enough to benefit (I guess you need to be lower than about 10% filled so see anything significant). And if there is a significant effect, you likely either have a bad range or too fine binning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants