[ROOT] Re: Why does GetEntries stop split branches working with TChains?

From: koblitz@poly.in2p3.fr
Date: Fri Jul 18 2003 - 15:29:45 MEST


Hi Rene,

I can understand that you are frustrated that people don't read the 
documentation, on the other hand people should not be forced to read every 
bit of documentation. Especially, people expect software to work in a 
certain way and start to read only documentation if it does not work as 
expected.

On Fri, 18 Jul 2003, Rene Brun wrote:
> 
> The documentation of TChain::GetBranch says:
>   "Return pointer to the branch name in the current tree"
> 
> You are misusing the branch pointer.

Yes, this is true, but you see I had the software running with TTrees 
nicely in the beginning and then I switched to TChain. It was now working 
subtly in a wrong way: it did not crash but it simply gave the wrong 
results. And by the way, the documentation does not say that the TBranch 
object is not updated automatically when the next file is being read, 
since you do not own the TBranch I think a "well behaved" might do that, 
since also the tree has changed it does not make much sense to have the 
TBranch be not updated.

I _expected_ the TChain to work as a TTree, I did not even notice that 
TChain re-implements GetBranch. In terms of documentation I read:
TBranch* TTree::GetBranch(const char *name)

 Return pointer to the branch with name in this Tree or the list
 of friends of this tree.

Sounds fine to me, maybe "this" should be more stressed.

Maybe it would help to add to the documentation that TChain reimplements 
this method, for example doxygen generated documentation has this 
automatically.

You should know that from: "Oops, the mean of the distribution is strange"  
to "This is because I should have used SetBranchAddress" it is a long way
and it took lots of debugging time to pin down the problem.


-- 
 Birger Koblitz                Tel: +33/1 69 33 31 73
 Ecole Polytechnique - LLR
 Route de Saclay
 F-91128 Palaiseau



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET