_ROOT Version:6.22 Platform: Not Provided Compiler: Not Provided
Hello,
I want to use chain->GetTreeNumber() in my proof code. Considering this example including ProofFriends.h and ProofFriends.C. I defined TreeNum() function in ProofFriends.h file: virtual Int_t TreeNum(){ return fChain->GetTreeNumber() ; }
I added ProofFriends::TreeNum() into the Process(entry) in the ProofFriends.C code but ProofFriends::TreeNum() returns 0.
What’s going wrong here? Isn’t it possible to get tree number of chain? If yes, how?
Thanks in advance
So if I understand correctly, you have a call to fChain->GetTreeNumber() in your Process method and that always returns 0, even though you are working with a chain with multiple trees?
Indeed that shouldn’t be the case, pinging @ganis in case he has a hint.
Hello etejedor,
not directly putting in fChain->GetTreeNumber() in Process but I defined a function as below in .h file:
virtual Int_t TreeNum(){ return fChain->GetTreeNumber() ; }
Can you print both the entry number and the tree number inside Process, to check that actually you are moving to another tree but you still get number of tree zero?
Could you detect in one of your workers a printed line where the entry number does not correspond to tree number zero, but to another tree? You can know that by checking how many entries every tree of the chain has.
I checked that for all workers it returns 0. It seems it’s not possible to get tree number in chain of trees, because the value of entry belongs to each trees not chain. Actually when i save the value of entry, then the entry numbers are repeated as many as number of trees.
Isn’t it the expected behavior? On each node, the tree number is that of the “local” chain and not of the whole chain. This means that each node will always start at tree number 0 even though it may (or may not) be a distinct file. You would see an increase the local tree number if and only there is enough files in the chain that a given node needs to process more than one file.