Re: [ROOT] Size of root file after writing a subset of a tree

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jan 27 2004 - 21:47:45 MET


Hi Frank,

Looking at the output of TTree::Print, I conclude that:
  -you have a serious problem with your input Trees. They are
all memory-resident. Input files are not compressed
 -your output file is disk-resident, but the file/tree
was created with no compression. By default, the ClonedTree
uses the same parameters as the input Tree.
You can "recover" by doing:
 
   TTree *xtree0 = chain1->CopyTree("m0B0>0",0);
   TIter next(xtree0->GetListOfBranches());
   TBranch *br;
   while ((br=(TBranch*)next())) {
      br->SetCompressionLevel(1);
   }
   xtree0->CopyEntries(chain1,-1);

Rene Brun

On Tue, 27 
Jan 
2004, Frank Winklmeier wrote:

> Hi Rene,
> 
> I attatched the file copytree.log to that mail which includes the Print() 
> output. To make it shorter I only used 5 of the input files. But the 
> difference in size is still remarkable.
> 
> Frank
> 
> 
> On Tue, 27 Jan 2004, Rene Brun wrote:
> 
> > Hi Frank,
> > 
> > Could you send the result of 
> > 
> > chain1->Print();
> > xtree0->Print();
> > 
> > Rene Brun
> > 
> > 
> > Frank Winklmeier wrote:
> > > 
> > > Hi Rene,
> > > 
> > > sorry about that. Here it is:
> > > 
> > > TChain *chain1 = new TChain("xtree");
> > > chain1->Add("/hep42/frank/root/xjpsi-*.root");
> > > 
> > > TFile f1("/hep42/frank/root/xjpsi-B0.root","recreate");
> > > TTree *xtree0 = chain1->CopyTree("m0B0>0");
> > > f1.Write();
> > > 
> > > Frank
> > > 
> > > On Tue, 27 Jan 2004, Rene Brun wrote:
> > > 
> > > > Frank,
> > > >
> > > > Please send your real code. In your snippet you have
> > > > TFile f("subset.root");
> > > > this should be
> > > > TFile f("subset.root","recreate");
> > > >
> > > > Rene Brun
> > > >
> > > > Frank Winklmeier wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > I want to select a subset of a tree which is split over several files and
> > > > > save this subset to one new file. Everything works fine but the resulting
> > > > > file size is much bigger than the sum of the input files.
> > > > >
> > > > > I start with:
> > > > >
> > > > > TChain *chain = new TChain("tree");
> > > > > chain->Add("data-*.root");
> > > > >
> > > > > // there is data-1 to data-21, each about 13 MB
> > > > >
> > > > > TFile f("subset.root");
> > > > > TTree *subtree = chain->CopyTree("m0b0>0");
> > > > > f.Write();
> > > > >
> > > > > The resuling size of subset.root is about 560 MB !!!
> > > > > But the total size of the (unfiltered) input is only about 270 MB.
> > > > > The compression level is 1 in all the files.
> > > > > The selection criteria "m0b0>0" selects about 50% of all entries.
> > > > > I am using RooT version 3.10-01 on RH9.
> > > > >
> > > > > How is that possible? Why is the compression so much worse for the subset?
> > > > >
> > > > > Thanks,
> > > > > Frank
> > > >
> > 
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET