TTree:SetBranchStatus() TRegex

Hi,

I would like to use regular expressions in setting the branch status of a TTree. I envision this as being useful for skimming and slimming ntuples. According to the documentation:

root.cern.ch/root/html/TTree.htm … anchStatus

I should be able to use TRegex to pick which branches to set the status of. So I try this:

t->SetBranchStatus("",0);
t->SetBranchStatus("^tau_.
",1);

But nothing is left. I also try this:
t->SetBranchStatus(“tau_.*”,1);

still no connected branches. Finally I do this:

t->SetBranchStatus(“tau_*”); and this works. But I really want the regex.

Is root thinking that I am trying to split branches by adding the ‘.’? If so then this should be documented more clearly. This does work:

t->SetBranchStatus("^tau_[a-zA-Z0-9_]*",1);

I do see the ‘WARNING WARNING WARNING’ but this does not immediately tell me that the ‘.’ will not work in the SetBranchStatus command the way I might expect. A blurb about ‘.*’ would help. Also I am confused how this works:

t->SetBranchStatus(“tau_*”);

is ‘’ converted '.’?

Thanks,
Justin

Hi,

SetBranchStatus does not use full regular expression but use Wildcarding. See root.cern.ch/root/html/TRegexp.h … keWildcard.

Cheers,
Philippe.

Thanks Philippe,

Upon closer inspection I see that the documentation says that. I just saw the regular expression and was excited. Ok it is easy enough to loop over all branches and use regular expressions myself.

Cheers,
justin