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

From: Matthieu Lechowski (lechowsk@lal.in2p3.fr)
Date: Mon Sep 29 2003 - 09:56:35 MEST


Hello,
Thanks, but unfortunately it doesn't work.
The first solution doesn't change anything, and with the second ROOT
tells me my file is not writable (Error in <TTree::Write>: File ... is
not writable).
Have you others ideas ?
Thank you.

Matthieu.

On Fri, 26 Sep 2003, Rene Brun wrote:

> 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