Re: [ROOT] TChain misuderstandings

From: zaldy (zaldy@neutrino.kek.jp)
Date: Sun Aug 17 2003 - 22:34:49 MEST


Hi,

If I understood it correctly; you want to chain 4 root files, say 
file1.root, file2.root, file3.root, and file4.root, then you want to 
produce a code using the MakeClass Functionality.

If this is the case, one possibility is:

At the directory where all these root files are located do:
 root[] TChain ch("SMT");
 root[] ch.Add("file*.root");
 root[] SMT->MakeClass("myClass");

Assuming the root files are of same tree structure, the above lines should 
result to the creatioin of myClass.C and myClass.h. 
Then you can edit/modify the files according the nature of your 
application.

I you want to understand the meaning of the codes and functions in the 
TChain class I suggest you go to the site:

http://root.cern.ch/root/html/TChain.html

Hope it helps...keep trying.



On Sun, 17 Aug 2003, Justace Clutter wrote:

> I am a very new root user and have been trying to understand how the TChain 
> works.  There is a TTree, called SMT, spread out among four different root 
> files.  If I load the first file up using just a straight TFile I can access 
> the data directly like the following:
> 
> 	Int_t fdisk01_wedge01_n[768];
> 
> 	SMT->SetBranchAddress("fdisk01_wedge01_n", &fdisk01_wedge01_n);
> 	SMT->GetEntry(0);
> 
> However when I try to load all the data at once with TChain I get very 
> confused.
> 
> 	TChain *data_chain = new TChain("SMT");
> 
> 	data_chain->Add("file1");
> 	data_chain->Add("file2");
> 	data_chain->Add("file3");
> 	data_chain->Add("file4");
> 
> At this point I can not just run the same code as I did above.  Now I ran the 
> makeclass utilities and generated the class files, but now I am even more 
> confused.  The variables are declared in the class but only a few are set 
> through the SetBranchAddress functions.  But they are all available somehow.  
> 
> I know that this post is very confusing, but I am confused.  I have went 
> through the ROOT Users Guide and the examples but they did not help my 
> understanding of this.  Any help on this matter would be greatly appreciated.
> I guess that I just want to know how it works, I could just use the makeclass 
> and close my eyes but that does not put a smile on my face.
> 
> Justace Clutter
> 

-- 

--------------------------------------------------------
                   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