RE: [ROOT] TChain misuderstandings

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Aug 18 2003 - 17:13:04 MEST


Hi,

> The variables are declared in the class but only a few are set
> through the SetBranchAddress functions.

In the case where the TTree was created using a 'leaflist' (which seems to
be your case),
the MakeClass only call SetBranchAddress for the top branch.  The branch has
then enough
information to set the address of the sub-branch (it __assummes__ that the
memory is set
as it was declared during its construction).

> At this point I can not just run the same code as I did above.

You should by just replacing SMT bu data_chain.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Justace Clutter
Sent: Sunday, August 17, 2003 4:43 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] TChain misuderstandings


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



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET