Re: [ROOT] write a big Tree in a TFile

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Sep 26 2003 - 17:44:25 MEST


Matthieu,

This seems to be a problem with the destructor of your TTree when
you close the file.
You can try two solutions:
 1- after TREE.Write(); add the statement
    TREE.SetFile(0);

 2- Do not create your Tree in the stack, but in the heap with
   TFile *myfile=new TFile(name_ntuple, "RECREATE");
   TTree *TREE = new TTRee(...
   //..fill tree
   TREE->Write();
   delete myfile; //do not delete TREE

Rene Brun

Matthieu Lechowski wrote:
> 
> Hello,
> 
> ROOT leaves without saying anything when I try to write a TTree in a
> TFile, and the file has only few bytes (and can not be opened of
> course).
> 
> I have a global tree: TTree TREE("T","TREE");
> In a function, I fill it, then:
>  TFile *myfile=new TFile(name_ntuple, "RECREATE");
>  TREE.Write();
>  myfile->Close();
> 
> This is the way I always used, and it always worked, but this time I
> have a big Tree and this doesn't work, I don't know why.
> Its size is less than the limit 2Gb, I think it should be around 80Mb
> with 100.000 entries (I have already a similar file of 8Mb with 10.000
> entries that I succeeded to write).
> 
> Have you an idea of what goes wrong ?
> Thank you.
> 
>         Matthieu Lechowski
>         LAL Orsay
> 
> lxplus
> ROOTSYS=/afs/cern.ch/sw/root/v3.05.05/rh73_gcc2952/root



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET