Back in the good old days, one could use a wild card in the TChain.Add() method to create a long chain of files to read. This does not (currently) work with xrootd.

Incidentally, to read a single ROOT file which resides in xroot, you may use the following 1-line construction:

TFile *f = TFile::Open("root://glast-rdr.slac.stanford.edu//glast/Data/Flight/Level1/LPA/prod/1.56/digi/r0236102471_v000_digi.root")

New recipe that works for ROOT v5.18 (added 5/22/2008)

The second recipe below works for ROOT version 5.16 but not for 5.18. Please see this Root Talk discussion for a method that works with 5.18. http://root.cern.ch/phpBB2/viewtopic.php?t=4857&highlight=tfileinfo+createlist
in particular the response posted by user ganis on Wed Jan 23, 2008 13:04

If your files are listed in a file, e.g. 'myfilelist.txt' such that

$ cat myfilelist.txt
root://glast-rdr//glast/mc/OpsSim/opssim2-GR-v13r9p2/merit/opssim2-GR-v13r9p2-000000-merit.root
root://glast-rdr//glast/mc/OpsSim/opssim2-GR-v13r9p2/merit/opssim2-GR-v13r9p2-000001-merit.root
root://glast-rdr//glast/mc/OpsSim/opssim2-GR-v13r9p2/merit/opssim2-GR-v13r9p2-000002-merit.root
root://glast-rdr//glast/mc/OpsSim/opssim2-GR-v13r9p2/merit/opssim2-GR-v13r9p2-000003-merit.root
root://glast-rdr//glast/mc/OpsSim/opssim2-GR-v13r9p2/merit/opssim2-GR-v13r9p2-000004-merit.root

then you can do

root [0] TChain ch("MeritTuple")
root [11 TFileCollection fc("dum","","myfilelist.txt")
root [2] ch.AddFileInfoList(fc.GetList())
root [3] MeritTuple->GetEntries()
(const Long64_t)4240

"Old" recipe that works for ROOT v5.16

Here is a technique as described in ROOT-talk (http://root.cern.ch/phpBB2/viewtopic.php?t=4857&highlight=&sid=621b9582641b9fcb3f9c4af806442fb5).

1. Create a file containing a list of desired xrootd files.

Example: Using the DataCatalog, locate the task of interest, e.g. backgnd-GR-v13r9, and navigate to the merit files produced. You should see a frame entitled "Folder MC-Tasks/ServiceChallenge/backgnd-GR-v13r9/runs Group merit". Next, click on the link "Dump file list SLAC_XROOT" and after some delay you will be rewarded with a frame containing the complete list of merit files. Copy and paste this list (or part of it) into an ordinary text file, one filename per line, e.g.,

root://glast-rdr//glast/mc/ServiceChallenge/backgnd-GR-v13r9/merit/backgnd-GR-v13r9-000000-merit.root
root://glast-rdr//glast/mc/ServiceChallenge/backgnd-GR-v13r9/merit/backgnd-GR-v13r9-000001-merit.root
root://glast-rdr//glast/mc/ServiceChallenge/backgnd-GR-v13r9/merit/backgnd-GR-v13r9-000002-merit.root
root://glast-rdr//glast/mc/ServiceChallenge/backgnd-GR-v13r9/merit/backgnd-GR-v13r9-000003-merit.root
root://glast-rdr//glast/mc/ServiceChallenge/backgnd-GR-v13r9/merit/backgnd-GR-v13r9-000004-merit.root

Note that the DataCatalog gives you all files for a task (perhaps a future enhancement will allow one to search/select, but for now it is all-or-nothing). However, you may edit the file you just created leaving only the subset of files desired. You may also combine files so created from different tasks (as long as the file contents are mutually compatible).

I'll call the resulting file filelist.txt

2. From within ROOT, read in the list of files and add them to your TChain.

root [0] TChain *c = new TChain("MeritTuple") 
root [1] TList *filelist = TFileInfo::CreateList("filelist.txt") 
root [2] c.AddFileInfoList(filelist)   
(Int_t)(1)
root [3] delete filelist

The "root [1]" line must refer to the file created in the previous step, including a full file path if it is not in your current working directory.

Voila!

3. Now you can work with the TChain as expected, e.g.,

root [4] c->ls()
root://glast-rdr//glast/mc/ServiceChallenge/backgnd-GR-v13r9/merit/backgnd-GR-v13r9-000000-merit.root tree:MeritTuple entries=1234567890
root://glast-rdr//glast/mc/ServiceChallenge/backgnd-GR-v13r9/merit/backgnd-GR-v13r9-000001-merit.root tree:MeritTuple entries=1234567890
root://glast-rdr//glast/mc/ServiceChallenge/backgnd-GR-v13r9/merit/backgnd-GR-v13r9-000002-merit.root tree:MeritTuple entries=1234567890
root://glast-rdr//glast/mc/ServiceChallenge/backgnd-GR-v13r9/merit/backgnd-GR-v13r9-000003-merit.root tree:MeritTuple entries=1234567890
root://glast-rdr//glast/mc/ServiceChallenge/backgnd-GR-v13r9/merit/backgnd-GR-v13r9-000004-merit.root tree:MeritTuple entries=1234567890

root [5] c->GetEntries()
(const Long64_t)126434

root [6] MeritTuple->Draw("PtMagLat")
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1

etc.