How to SetBranchStatus on subbranch?

Dear ROOT,

I have a tree created with several branches of the same class:

  Track* track = new Track();
  Track* trackRefit = new Track();
  Track* trackMcTruth = new Track();
  tree->Branch("muontrack", &track);
  tree->Branch("muontrackRefit", &trackRefit);
  tree->Branch("muontrackMcTruth", &trackMcTruth);

Now, upon reading of this tree, I would like to enable a specific subbranch of one of the 3 top branches.

I am trying something like this, which gives me an error:

root [2] tree->SetBranchStatus("muontrackRefit.m_constraints", 1); Error in <TTree::SetBranchStatus>: unknown branch -> muontrackRefit.m_constraints

Could you help me solve my problem?

Thanks

Pierre-François

well, it means that “muontrackRefit.m_constraints” is not the name of a branch.
To see the branch names use tree.Print()

Rene

Hi René,

well, tree->Print() shows me three branches with the same name “m_constraints”:

[code]root [2] muonaligntrk->Print()


*Tree :muonaligntrk: Fitted tracks *
*Entries : 28554 : Total = 749131221 bytes File Size = 214912477 *

  •    :          : Tree compression factor =   3.49                       *
    

*Branch :muontrack *
*Entries : 28554 : BranchElement (see below) *


*Br 1 :m_constraints : *
*Entries : 28554 : Total Size= 333223124 bytes File Size = 96496079 *
*Baskets : 1713 : Basket Size= 25600000 bytes Compression= 3.45 *


*Branch :muontrackRefit *
*Entries : 28554 : BranchElement (see below) *


*Br 10 :m_constraints : *
*Entries : 28554 : Total Size= 333223124 bytes File Size = 111637940 *
*Baskets : 1713 : Basket Size= 25600000 bytes Compression= 2.98 *


*Branch :muontrackMcTruth *
*Entries : 28554 : BranchElement (see below) *


*Br 19 :m_constraints : *
*Entries : 28554 : Total Size= 401942 bytes File Size = 44701 *
*Baskets : 16 : Basket Size= 51200 bytes Compression= 8.98 *


[/code]

How do I set the status for only one of the three “m_constraints”?

Pierre-François

see the following in the documenation of TTree::Branch

[quote] IMPORTANT NOTE about branch names
In case two or more master branches contain subbranches with
identical names, one must add a “.” (dot) character at the end
of the master branch name. This will force the name of the subbranch
to be master.subbranch instead of simply subbranch.
This situation happens when the top level object (say event)
has two or more members referencing the same class.
For example, if a Tree has two branches B1 and B2 corresponding
to objects of the same class MyClass, one can do:
tree.Branch(“B1.”,“MyClass”,&b1,8000,1);
tree.Branch(“B2.”,“MyClass”,&b2,8000,1);
if MyClass has 3 members a,b,c, the two instructions above will generate
subbranches called B1.a, B1.b ,B1.c, B2.a, B2.b, B2.c
[/quote]
Rene

Thanks René,

this is exactly what I needed.

Pierre-François