Re: the second branch in the split mode

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Apr 22 1999 - 18:26:03 MEST


Hi Valeri,
If you look carefully at the release notes of 2.21/08, you will find
the following paragraph:


- Changes in classes TTree, TBranchClones and TBranchObject to support
  branches with leaves having the same name.
  Support case of objects with different addresses at each Fill.
  In case a Tree branch is a TObject and split mode , one can force
  the specified branch name to preceed the object data member name
  by terminating the branch name with a "."
  For example, if one wants two branches in a TTree referencing
  two objects of the same class Track, one can do:
  Track *track1=0, *track2=0;
  T->Branch("track1.","Track",&track1,16000,1);
  T->Branch("track2.","Track",&track2,16000,1);

This should fix your problems.

Rene Brun


Tioukov Valeri wrote:
> 
> Hi rooters,
> 
> When one store into tree 2 branches with 2 objects which have the common
> name of members (for example o1:{a,b,u} o2:{x,y,u}) the storing now
> (Version 2.21/08) is fine.
> 
> But the access to this data is a bit misleading:
> 3 cases of access:
> 1)  Num *n1 = new Num();
>     Num *n2 = new Num();
>     tree->SetBranchAddress("o1",&n1);
>     tree->SetBranchAddress("o2",&n2);
>     tree->GetEvent(3);
>     n1->Print();
>     n2->Print();
> 
>     works correct
> 
> 2) If one try to do it from browser: double click on the leaf "u" to draw
>    histogram it always drawn the values of the 1-st stored branch!!!
>    It is very surprising on the first sight because two different
>    branches looks really different. But most probably the using mechanizm
>    is the same as in case 3)
> 
> 3) tree->Draw("u");  Always drawn the values of the 1-st stored branch.
>    In fact the way to address to the separate branch in the sintacsis of
>    this call is not exist.
> 
> I think that something should be corrected here. Especially the case 2)
> is really dangerous, because compleatly misleading.
> 
> All files used for test could be found in
> http://chorusdq.na.infn.it/root/
> 
> Best regards
> Valeri



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:32 MET