Home | News | Documentation | Download

TChain and wildcard

TChain.Add() should enable globbing so that we can easily chain
TTrees that reside in different subdirectories.
The code to do it is given in
Problem using wildcards in TChain->Add
but I think it will be of general interest to anybody that this is done by the method TChain.Add and not
asking everybody to do it by hand each time.
It also reduce the surprise factor and the puzzlement that
TChain->Add(“a//.root”) give no warnings but does not add all the intended file.

Thanks

@pcanal would you like to comment on this proposal?

This is a good idea. I opened https://sft.its.cern.ch/jira/browse/ROOT-10371 to keep track of the progress. Would you be interested in proposing a patch/implementation?

Hi,
what I do is the following but I don’t know if this is portable to non unix systems:
TString command = Form("/bin/bash -c ‘ls -1 %s 2>/dev/null’",pattern.Data());
FILE* f=gSystem->OpenPipe(command,“r”);
while (help.Gets(f)){
fchain->Add(help)
gSystem->ClosePipe(f);

But the solution using glob in the other discussion looks nicer.
I think code is simple it is more a portability problem.