Add a TWebFile to a TChain?

Is it possible to create a TChain with a TFile or TWebFile object rather than with a filename?

E.g. instead of doing something like:

TChain* ch = new TChain(“EGAMMA”);

(would this even work?)

I would like to:

TChain* ch = new TChain(“EGAMMA”);
TWebFile* tf = new TWebFile(“http://my.server/remote.root”);

or something …!

I have a feeling this may be a dumb question, but I’ve not found any answers in the doc.


Hi Julian

A TChain can contain mixtures of local files, webfiles, remote files served by rootd, xrootd, etc. In your case you should replace

TWebFile* tf = new TWebFile("http://my.server/remote.root"); ch->AddFile(tf); by


Hi Rene,

Thanks. But I really need to add a TFile to the chain … in fact I need to add an instance of my own class which is derived from TFile. Specifically, we have a TCWebFile class which allows access to a remote root file hosted on a Clarens server. I want to add a TCWebFile to my chain.

The TChain “Add” method presumably looks at the string to determine if the file to be added is local or served by rootd, http etc… and then calls the appropriate TFile derived class (?)


Hi Julian,

Proceed like we do for all types of files using the plug-in manager.
You can open a clarens file with something like
TFile *file = TFile::Open(“clarens://somewhere/myfile.root”);
And add your plug-in for clarens in $ROOTSYS/etc/system.rootrc.
See in this file, teh lines like

Plugin.TFile: ^rfio: TRFIOFile RFIO "TRFIOFile(const char*,Option_t*,const char*,Int_t)" +Plugin.TFile: ^castor: TCastorFile RCastor "TCastorFile(const char*,Option_t*,const char*,Int_t,Int_t)" +Plugin.TFile: ^dcache: TDCacheFile DCache "TDCacheFile(const char*,Option_t*,const char*,Int_t)" +Plugin.TFile: ^dcap: TDCacheFile DCache "TDCacheFile(const char*,Option_t*,const char*,Int_t)" +Plugin.TFile: ^gfal: TGFALFile GFAL "TGFALFile(const char*,Option_t*,const char*,Int_t)" +Plugin.TFile: ^chirp: TChirpFile Chirp "TChirpFile(const char*,Option_t*,const char*,Int_t)"

You must have a dictionary for your class TCWebFile.