Creating TH3 larger than 810x810x810

Hello this is my first time posting to Root Support, I hope I’m following all the rules.

My issue is that I want to build big 3 dimensional arrays. But,

void cubeBuild() {
TFile *File = new TFile(“cubeTest.root”,“RECREATE”);
int nRange = 100;
int nBins = 811;
TH3S f(“h3”, “h3”, nBins, 0, nRange, nBins, 0, nRange, nBins, 0, nRange);
File->Write();
}

Causes:
Error in TBufferFile::WriteByteCount: bytecount too large (more than 1073741822)

But when nBins = 810 or lower there is no Error. Is there a way to make nBins larger?

What should be my next step? I would eventually like to use hadd to add many cubes from different data sets. It would also be nice to use integers instead of shorts, but this consumes even more bytes.
Thanks in advance,
-Leo

Your histogram’s size exceeds 1GB (and then ROOT fails when writing it to a file as the buffer is growing past 1GB, which is some kind of a “limit”).

So how do I increase this “limit”?
810 bins is quite small when doing spectroscopy.
Most analog to digital converters have upwards of 4096 channels (modern ones go to 16384).

Sounds like THnSparse should fill your needs.

Thanks the THnSparse worked after a bit of learning about it.
Thanks