Create a Tchain from many root files, but only several bran

Hi,

After reading TChain doc, I am wondering whether I can create a TChain from many (same type of ) trees (saved in different root files) by only selecting several branches of the tree.

For example, I have a TTree T, which has v1,v2,v3 branches. I only want to use v1 to make a chain.

All the root doc examples assume that the chain will read all the branches in the tree. I did not really find an answer from searching the forum. Many thanks.

regards,

gma

see example in $ROOTSYS/tutorials/tree/copytree2.C, and replace oldtree by your TChain.

Rene

Man thanks, Brun. I will take a look at the example you mentioned.

regards,

gma

Hi, Rene

I looked at the example you mentioned in email. I guess when we do Tchain->Add(“file1”), Tchain->Add(“file2”), it did not really read from the files, but collect some info. Tchain begin to read files only when we do the event loop. Is this right?

This is important to my question because I was assuming Add would read the files from disk after fire.

Many thanks.

gma

[quote]I looked at the example you mentioned in email. I guess when we do Tchain->Add(“file1”), Tchain->Add(“file2”), it did not really read from the files, but collect some info. Tchain begin to read files only when we do the event loop. Is this right?
[/quote]
yes

Rene