Hi,
Is there a way to specify pattern so that TTree::SetBranchStatus(pattern,0) would set the status to 0 for branches not matching the pattern ?
Thanks,
Hi,
Is there a way to specify pattern so that TTree::SetBranchStatus(pattern,0) would set the status to 0 for branches not matching the pattern ?
Thanks,
Not directly.
I suspect the following should work:tree->SetBranchStatus("*",0);
tree->SetBranchStatus(pattern,1);
Cheers,
Philippe
Hi,
Yes, but I was trying to find if there’s a way to minimize the number of times you have to loop over all branches…
[quote]Yes, but I was trying to find if there’s a way to minimize the number of times you have to loop over all branches…[/quote]The SetBranchStatus should be done only once per TTree (so it should not be significant).
Also the pattern matching is done on the branch name using a TRegexp object so you might be able to write a negative pattern …
Philippe
Well, the problem is that in our framework (AliRoot), we do have one Tree per event, with a single entry, so the overhead of the branch selection is not negligible…
This was my original question, in fact : how to write a negative pattern ?
[/quote]
[quote]This was my original question, in fact : how to write a negative pattern[/quote]Depends on your pattern of course .
For example if you want to set zero for all the branch not match ‘a.’, you could write '[^a].’
Philippe
What about MUONLocalTrigger ?
I guess you mean all but the MUONLocalTrigger branch?
Philippe
Yes, sorry.
I indeed would like to disable all branches but “MUONLocalTrigger*” ones, and also all but “MUONDigits*” ones.
Ok, in this case (it seems you only want 2 read 2 top level branches) it might be more efficient/safe to forgo using SetBranchStatus and replacemytree->GetEntry(i);
bytentry = mychain->LoadTree(i);
pointer_to_MUONLocalTrigger_branch->GetEntry(tentry);
Cheers,
Philippe