Storing dynamically allocated array in TTree

Hello,

I have a multidimensional array dynamically declared as arrays of pointers. Is there a way to store such a thing in a TTree? Following script gives improper values in the stored array…

int main()
{
	TFile *f = new TFile("test.root", "RECREATE");
	TTree *t = new TTree("t", "t");

	unsigned char ***arr = new (unsigned char **[2]);
	for(int i=0; i<2; ++i)
	{
		arr[i] = new (unsigned char*[2]);
		for(int j=0; j<2; ++j)
		{
			arr[i][j] = new unsigned char[2];
			for(int k=0; k<2; ++k) 
			{
			arr[i][j][k] = k;
			cout << i << " " << j << " " << k << " " << (int)arr[i][j][k] << endl;
			}
		}
	}

	vector< vector<int> > v;

	t->Branch("one", arr, "one[2][2][2]/b");

	t->Fill();
	t->Write();
	f->Close();

	return 9;
}

I guess lack of answer means it is impossible to store array of pointer in the TTree. It is also impossible to store vector of vectors without dictionary. So in general TTree lacks the function to store and read dynamically allocated arrays in a simple way. Therefore maybe it would be worth to add types like “*i”, “*b”, “*d” etc, which would tell the TTree when writing a branch to follow the pointer of pointers (of pointers of pointers…) memory alignment? I guess this should be quite easy to do.