Tree fill and setmaxtreesize

Hi all,

I’ve stuck with a problem to split tree into different files. The following code is creating 2 files: 1st is big and the 2nd is empty, instead of multiple small files.

It seems that SetMaxTreeSize is not working during the array fill. Should it behave like that?

[code]int N=100000;
TFile *f=new TFile(“test_1.root”,“RECREATE”);
TTree *tree=new TTree(“T5”,"/test");
tree->SetMaxTreeSize(1000);
tree->SetFileNumber(1);

int *k=new int[N];
tree->Branch(“Nk”,&N,“N/I”);
tree->Branch(“k”,k,“k[N]/F”);
for(int i=0;i<N;i++){
k[i]=(i+3)*i;
}
tree->Fill();
tree->Write();
tree->GetCurrentFile()->Close();[/code]

Hi,

Yes. The minimal unit of storage in a TTree is one entry. I.e. the Fill must complete inside a single file and only at the end of the operation does it check whether it went over the limit.

Cheers,
Philippe.