Filling more than 4d data

Hi Rooters,

I saw that filling a histogram is more faster than doing same thing by making loops, for example:

TH3D *h3 = new TH3D("h3", "h3", 200, 0, 20, 200, 0, 20, 200, 0, 20);
//do some clculation
h3->Fill(x, y, z);

is faster than

for(int i=0; i<20; i++) {
     for(int j=0; j<20; j++)) {
          for(int k=0; k<20; k++) {
                  // do some calculation
                   out << x << "\t" << y < "\t" << z << endl;       // write to a file

By filling histogram, I can write upto 3d only. Is there any way to write more than 3d array efficiently like filling the histogram or is there 4d histogram (off course not for graphical representation but at least to store the data)? I have not looked in the histogram filling code yet.



You could take a look a THnSparse