Re: [ROOT] Merging files

From: Christian Schmitt (schmittc@whep.uni-wuppertal.de)
Date: Thu Nov 29 2001 - 16:17:07 MET


Hi Rene,

I tried this but unfortunately the total size is something like 10GB and so I 
cannot merge them into one file, I have to merge them into several files 
(with a filesize of less than 2GB).

I tried to add them into a chain and then loop over all events. As soon as I 
reach a certain amount of events I tried to close the file and open a new one 
to continue writing. Unfortunately this didn't work, because the tree I get 
with TChain::GetTree gets invalid as soon as the chain jumps from one file to 
another.
Then I tried to call the function GetTree again as soon as the chain jumps to 
the next file and this worked somehow but at the end I ended up with a merged 
file which contained a lot of copies of the original tree:
for example the original tree was named "Global" then the merged file had a 
lot of Trees named "Globalxx" with x from 1 to the number of files processed 
so far ...


Christian Schmitt

	

> The procedure to merge ROOT Trees is described in TChain::Merge. See:
>    http://root.cern.ch/root/htmldoc/TChain.html#TChain:Merge
>
> If you have files named file1.root,file2.root,file3.root, containing a Tree
> "T", do
>   TChain ch("T");
>   ch.Add("file1.root");
>   ch.Add("file2.root");
>   ch.Add("file3.root");
>   ch.Merge("big.root");
>
> Rene Brun
>
> Christian Schmitt wrote:
> > Hi ROOTers,
> >
> > I have the following problem: I need to merge several hundred files, each
> > containing the same tree. The total size is something like 10 GB.
> > So I cannot use just TChain::Merge because of the 2GB limit of
> > root-files.
> >
> > Now my wuestion is: how can I merge the files such that ideally I get 5
> > to 6 files with each having a filesize < 2GB ?
> >
> > It should be a solution which works in general, i.e. doesn't make an
> > asumption on the structure of the tree in the files (the only thing known
> > is that the trees are simple trees, i.e. only integers, or floats are
> > stored).
> >
> > Thanks for your help,
> >
> >         Christian Schmitt



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:10 MET