Skip to content

Align behaviour of SetBranchStatus of TChain and TTree #19221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2025

Conversation

vepadulano
Copy link
Member

@vepadulano vepadulano commented Jun 27, 2025

When a user calls SetBranchStatus("*", false) it means that all branches of the dataset should be deactivated, no matter what other method is called, except if then the user calls SetBranchStatus(someBranch, true) to activate a branch.

So, if a user calls SetBranchStatus to deactivate all branches and then calls SetBranchAddress, this should have no effect. No data should be read because the branch related to SetBranchAddress should not have been activated.

Before this commit, TTree was respecting this rule, but TChain was not. This commit ensures that TChain only sets the status of the branch of the current TTree if the corresponding TChainElement was explicitly provided with a status by the user.

Fixes #19220

@vepadulano vepadulano self-assigned this Jun 27, 2025
@vepadulano vepadulano requested a review from pcanal as a code owner June 27, 2025 20:20
Copy link
Member

@pcanal pcanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

When a user calls SetBranchStatus("*", false) it means that all branches of the
dataset should be deactivated, no matter what other method is called, except if
then the user calls SetBranchStatus(someBranch, true) to activate a branch.

So, if a user calls SetBranchStatus to deactivate all branches and then calls
SetBranchAddress, this should have no effect. No data should be read because the
branch related to SetBranchAddress should not have been activated.

Before this commit, TTree was respecting this rule, but TChain was not. This
commit ensures that TChain only sets the status of the branch of the current
TTree if the corresponding TChainElement was explicitly provided with a status
by the user.
Copy link

Test Results

    20 files      20 suites   3d 4h 38m 38s ⏱️
 3 066 tests  3 061 ✅ 0 💤 5 ❌
59 673 runs  59 668 ✅ 0 💤 5 ❌

For more details on these failures, see this check.

Results for commit 2699e55.

@vepadulano vepadulano merged commit 6a31f76 into root-project:master Jun 28, 2025
23 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent behaviour of SetBranchStatus between TTree and TChain
2 participants