python::TChain::AddFriend(chain) have no result

Hi! I have the following data structure: multiple root files, each file having a directory that have a set of trees. (each file have a different directory name)
It is assumed that for a set of files, the directory content will have the same trees.
I managed to do a chain with a given tree but i would like to add the rest of trees as friends,
so i reparse the filelist as many trees are in directory, create a chain for each and AddFriend it to the previous main chain. the problem is that nothing happens :slight_smile:
my tryout is here https://github.com/adriansev/AO2Dproto/blob/master/ao2d_process.py#L63
i really hope that is not a problem of ownership and persistence as i would assume that from the moment a chain is added as a friend, it’s persistence would be assured …
Any idea what is going on?
Thanks a lot!!

Hello,

i really hope that is not a problem of ownership and persistence as i would assume that from the moment a chain is added as a friend, it’s persistence would be assured …

I would try adding all the friend chains to a list to make them survive the loop, that will tell us if it’s an early garbage collection problem.

Please let us know how it goes!

so, i tried and no joy … see https://github.com/adriansev/AO2Dproto/blob/master/ao2d_process.py#L72
while the chains to be added are seen, adding them as friends show nothing when i try to print the chain with “all” that is supposed to show also all connected friends. the scan("*") also does not shows any other branches…

@pcanal can you spot any problem in the code that is adding the friends? Any thoughts on why their branches don’t show in chain.Scan(*)?

Any thoughts on why their branches don’t show in chain.Scan(*)?

Scan("*") does not implement prints the friend’s branches.

When printing the content of the list of friends, does it actually list of the friend you expect?

no, this part https://github.com/adriansev/AO2Dproto/blob/master/ao2d_process.py#L80
shows nothing …
but this https://github.com/adriansev/AO2Dproto/blob/master/ao2d_process.py#L72
show the proper content of the tree to be added as a chain, while the friend element is valid (i can call the ls method on it) but it show the empty message of:
Friend Tree: in file:

i would think that if the addition to the chain is unsuccessful, the returned friend element to be invalid/nullptr and method calling on it to break

well, never mind, looking over https://github.com/root-project/root/issues/9137 and checking entries
it seem that my “friends” have different number of entries so, my approach is invalid.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.