Best way to store a lattice simulation?

Hi all,

I’m working on some code to do lattice simulations, and I want to periodically store a snapshot of the lattice in a ROOT file. I’m a ROOT novice, and I was hoping some of the experts here might suggest the most disk-space-efficient way of storing the data.

Essentially, my Lattice is 2-d with L sites per side, and at each site there is a vector with N components. So, it can be represented in C++ by a three-dimensional array of doubles.

It would be ideal if I could store a matrix of arrays or something of the sort. But maybe TTree would be better?

Thanks for your help.


The answer depends a bit on what you want to do with the snapshot. If you intent is to look at their variation across time, I would recommend a TTree containing an object like:

class Lattice {

double top[N][L];
double bottom[N][L];


if the value of N and L are fixed. If N or L is small, it would also be better for compression to separate each in its own data member (to take advantage of splitting).