TChain of TFriends

I’m relatively new to ROOT, so I apologize if this question doesn’t make complete sense. We currently have a group of ROOT files that are organized with the data in a sequential time based files and then selection cuts in separate files that correspond to the same time periods. I would like to be able to load data from a single branch on all the files while applying selections that comes partially from these other files.

Specifically, I do:

from glob import glob
from ROOT import TFile, TChain

filelist = glob('/home/tdoughty1/Workspace/data/cf/calib*.root')
fileChain = TChain('rrqDir/calibzip1')
for fName in filelist:
    fileChain.Add(fName)

fileChain.GetEntries('cQin1_v53 == 1 && ytNF<1.2')

The output is

Error in <TTreeFormula::Compile>:  Bad numerical expression : "cQin1_v53"

I recognize this is because the cQin1_v53 quantity doesn’t exist in the files listed, but I don’t know how or where to TFriend in it’s appropriate file and tree. Any help would be appreciated! Thanks!

Try something along the line of[code]filelist = glob(’/home/tdoughty1/Workspace/data/cf/calib*.root’)
fileChain = TChain(‘rrqDir/calibzip1’)

filelist2 = glob(’/home/tdoughty1/Workspace/data/cf/otherfilename*.root’)
fileChain2 = TChain(dirAndNameOfOtherTTree)

fileChain.AddFriend(fileChain2);[/code]

Cheers,
Philippe.

Great, that took care of it. Thanks for your help!