[ROOT] MakeClass and variables names

From: Patois Yannick (patois@ganil.fr)
Date: Fri Jun 02 2000 - 18:26:14 MEST


Hi,

I got a TTree looking like :

tree--.
      |--branch1--.
      |           |--subbranch1a--.
      |           :               |-- T (leaf)
      |           .               :
      |
      |--branch2--.
      |           |--subbranch2a--.
      |           :               |-- T (leaf)
      |           .               :
      :
      .


When I run MakeClass, I got variables names like this :
subbranch1a_T
subbranch1b_T

It seems OK except that subbranch1a and subbranch1b has the same name.
There shouldnt be confusion anywhere as one is clearly part of the
branch1 and the other of branch 2 (in fact not only the name of the
variable is different, but also theyr type).

But MakeClass ignore that and duplicate the identifiers.

I know that over a certain complexity of the code I probably shouldnt
use 'MakeClass' and do it myself. Of course, it would be great to have a
MakeClass which would generate a code using the structured Class instead
of flatening everything...

But in the meantime, why is MakeClass starting naming objects one lever
below its root ? One would expect a naming like branch1_subbranch1a_T
that would be unambiguous.

Maybe I could do it myself except that I dont really understand how ROOT
connect "subbranch_T", because when I call :
   subbranch_T = fTree->GetBranch("subbranch.T");
there are two possible matchs, as subbranch1a and subbranch1b has the
same name.

If I try to start from the root for naming :
   fTree->SetBranchAddress("branch1.subbranch.T",&branch1_subbranch_T);

Error in <TTree::SetBranchAddress>: unknown branch -> branch1.subbranch.T

I use ROOT version 2.23/11 (and tried with 2.24/05) on linux i586.

	Yannick

PS: I solved the problem by loading the object itself :
   fTree->SetBranchAddress("branch1",&branch1);

Then I can access to any member of it with branch1->subbranch.T
Couldnt MakeClass use the same approach ?


 _/ Yannick Patois _________________ Address (home) __________________
| irc(undernet): Garp on #france25+ | La Villa des Sciences            |
| email : patois@ganil.fr           | 12, avenue de Cambridge          |
| web :http://www.sura.org/~patois/ | 14200 Herouville-Saint-Clair     |
| Tel/Fax-home:+33 (0)2 31 94 50 32 | FRANCE                           |
|___________________________________|__________________________________|



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:27 MET