Re: [ROOT] to chain trees up with TChain

From: zaldy (zaldy@neutrino.kek.jp)
Date: Fri Jul 25 2003 - 05:00:54 MEST


Hi Lesley,

One possibility is:

    TChain myChain("TreeName");
    myChain.Add("Firstfile.root");
    myChain.Add("Secondfile.root"); 
..........

This Chains your root files(you can extend this)

Then to see the content of the chain,

.....
   TreeName->StartViewer();

I did this and its working for me, in root[] session
(and compile code)

There is a detailed discussion of this in the root user's manual and it is 
very helpful. you can download it at the root website.


Hope this helps.
Keep trying...


Zaldy



>     I have two root files (which can be loaded with TFile and TTree)
> containing the same types of variables but of course different valuse.
> If I want to use TChain to chain them up so that I can do calculations
> by extracting the same type of variable from the two files (eg, find the
> sum of a particular variable from a file and the same var from another
> file), how to create such a Chain? And if I get such a chain of the two
> file, can I plot histograms with the chain in the same way I do using a
> single TTree file?
> 
> Thank you very much!
> 
> Lesley
> 

-- 

--------------------------------------------------------
                   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:13 MET