Re: [ROOT] adding files

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jun 04 2002 - 08:33:42 MEST


Anne-Sylvie,

See tutorial $ROOTSYS/tutorials/hadd.C

Rene Brun

Anne-Sylvie Nicollerat wrote:
> 
> Hello,
> 
> I would like to know if it is possible to combine root files.
> 
> I am now running on big sets of data and to go faster, I divided the
> data set in 4 different subsets. I am now running root parallely on each
> of the subsets, writing 4 different .root files.
> In the end, I would like to combine the histograms of the 4 different
> root files. A way I found was to open all the files and then add the
> histograms.
> (eg:
> f10 = new TFile("essai0.root");
> f11 = new TFile("essai1.root");
> .....
> TH1D *a1=(TH1D*) f10->Get("z0100");
> TH1D *a2=(TH1D*) f10->Get("z0101");
> 
> TH1D *b1=(TH1D*) f11->Get("z0100");
> TH1D *b2=(TH1D*) f11->Get("z0101");
> 
> ....
> a1->Add(b1);
> a2->Add(b2);
> .....)
> 
> I was wondering if there was a possibility to do it in a more
> staightforward way (that means without needing to ask root to add
> separately all the histograms I am interested in).
> I saw that there was an Add and an Append method for a root files but
> somehow I didn't find out how it worked.
> 
> Thanks a lot for your help
> 
> cheers
> 
> Anne-Sylvie



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:54 MET