Re: [ROOT] tree->ChangeFile(....) and output rootfile larger than textfile.

From: zaldy (zaldy@neutrino.kek.jp)
Date: Thu Aug 07 2003 - 17:50:13 MEST


Dear Rene,


(-:) !!! yes ... its working...
Thanks...



> > Hi EveryOne,
> > 
> > I have two items which are new to my experience with root now, and I 
> > dont understand them very well. I'd appreciate very much your help.
> > 
> > FIRST: ROOT Tree too large ...
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^
> > Can someone tell me how to use the tree->ChangeFile(TFile * file)?
> > 
> > I just learned it from ROOT FAQ, that this is used when root tree size 
> > exceeds the 2GB limit. Bbut I don't know how to insert them along 
> > which line, or next to what line. Am having trouble saving a large root 
> > file greater than 2 GByte Limit.
> 
> In principle, you have nothing to do. ROOT will automatically  switch
> to a new file when the current file is above 1.9GByte (default).
> see TTree::ChangeFile for more details.
> 
> > 
> > 
> > SECOND: ROOT File Tree larger than the source file? 
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > I have a source file(text file), actually 2 columns, an integer and a 
> > Float
> > 
> >         Ch  Time 
> > i.e.,   4   20567.90
> >         8   38930.34
> >        15   24523.67 
> >        .............
> >        .............
> > 
> > There are about 380,000 lines of the above format. So I decided to create 
> > a tree 
> > like:    ...................
> >          ....................
> >          Int_t comp = 1;
> >         TFile * f     = new TFile("out.root","NEW");
> >         f->SetCompression(1);
> >         TTree * tree  = new TTree("T", "myTree");
> >         tree->SetAutoSave(1000000000);         
> > 
> >         tree->Branch("Ch",&Ch,"Ch/I");
> >         tree->Branch("Time",&Time,"Time/F");
> >         
> >         while(fgets(.......)) { 
> > 
> >         ........filling.....
> > 
> >         Int_t nb = 0;
> >         nb += tree->Fill(); 
> >         tree->AutoSave(); 
> >         tree->Print();
> >         tree->Write          
> >         ......... 
> >         }
> 
> 
> OUIH!!!!
>   You should not call the 3 last lines inside the loop, but do something
> like
>   while (fgets(.. )  {
>    nb += tree->Fill();
>  }
>  tree->AutoSave();
>  tree->Print();
> 
> The Tree should be about 5 times smaller than the original text file.
> 
> Rene Brun
> 
> > 
> > But during implementation, I was disturbed that the output sizeof the root 
> > file is larger than the source text file by several (~5)factors. Do you 
> > know what is going on here? That  means that the way I created a tree is 
> > not "efficient"; and filling of the  tree takes some time. I figure out 
> > that obtaining a histogram by directly  filling the contents from the 
> > source file maybe faster than obtaining a  histogram from a rootproduced 
> > tree (later).
> > 
> > But having a root tree is still more advantageous. 
> > How do we rewrite the above script?
> > 
> > Thank you for bearing with me.
> > 
> > 
> > PS.
> > root version 3.05/05
> > gcc 3.2.2 RedHat 9
> > 
> 

-- 

--------------------------------------------------------
                   Zaldy A. Nawang 
                   PS Users Room 2
                   Yon Gokan, 
                   E362, Neutrino Group, 
                   IPNS, KEK, 
                   Japan 
                    
                   e-mail: zaldy@neutrino.kek.jp
                   Tel. No. : (81) 029864 - 5387
--------------------------------------------------------



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