Skip to content

Improve logic to refresh branch addresses of TChain friends #19322

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vepadulano
Copy link
Member

@vepadulano vepadulano commented Jul 9, 2025

Fixes #16805

Part of the logic of TChain::LoadTree deals with updating the status of friend
trees. First, the current entry is loaded on all friends. In case the friend
tree is a chain that needs to switch to a new tree, the branch addresses of the
friend are also updated.

This logic only considered the case of top-level friends of a TChain. Notably,
it did not consider the case of a main TChain where one (or more) of the trees
in the chain have themselves some friends, but not the main chain itself:

TChain c1
--> TTree t1 TChain c2

This commit condenses the logic that updates friends in a separate method of
TChain. The new method is called in TChain::LoadTree, either in the pre-existing
case of top-level friends or in the new case of friends of the current tree.

The new method, called RefreshFriendAddresses, needs to act:

  • On the main chain and on the current tree, in the case of top-level friends
  • On the current tree alone, in the case of friends of the current tree

In the two scenarios, either we load the global entry of the chain on the
friends, or the local entry of the current tree. This is done to conserve proper
alignment.

@vepadulano vepadulano self-assigned this Jul 9, 2025
Copy link

github-actions bot commented Jul 9, 2025

Test Results

    20 files      20 suites   3d 11h 8m 2s ⏱️
 3 199 tests  3 197 ✅ 0 💤 2 ❌
62 377 runs  62 373 ✅ 2 💤 2 ❌

For more details on these failures, see this check.

Results for commit 8dc827c.

♻️ This comment has been updated with latest results.

@vepadulano vepadulano changed the title WIP for #16805 Improve logic to refresh branch addresses of TChain friends Jul 10, 2025
@vepadulano vepadulano marked this pull request as ready for review July 10, 2025 15:43
@vepadulano vepadulano requested a review from bellenot as a code owner July 10, 2025 15:43
Part of the logic of TChain::LoadTree deals with updating the status of friend
trees. First, the current entry is loaded on all friends. In case the friend
tree is a chain that needs to switch to a new tree, the branch addresses of the
friend are also updated.

This logic only considered the case of top-level friends of a TChain. Notably,
it did not consider the case of a main TChain where one (or more) of the trees
in the chain have themselves some friends, but not the main chain itself:

TChain c1
--> TTree t1 <friendswith> TChain c2

This commit condenses the logic that updates friends in a separate method of
TChain. The new method is called in TChain::LoadTree, either in the pre-existing
case of top-level friends or in the new case of friends of the current tree.

The new method, called RefreshFriendAddresses, needs to act:
- On the main chain and on the current tree, in the case of top-level friends
- On the current tree alone, in the case of friends of the current tree

In the two scenarios, either we load the global entry of the chain on the
friends, or the local entry of the current tree. This is done to conserve proper
alignment.
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.

A TChain whose trees have friend TChains stops updating
2 participants