Object not accessible

Dear ROOT community,
I’m trying to access an object stored in a ROOT file.
In the file there is a TTree, CollectionTree, which contains a branch I’m interested in, ptcone30. When I do CollectionTree->Print() one of the branches reads:

*Br  194 :TruthMuonsAuxDyn.ptcone30 : vector<float>                          *
*Entries :     3968 : Total  Size=     105667 bytes  File Size  =      48214 *
*Baskets :       15 : Basket Size=       8192 bytes  Compression=   2.18     *
*............................................................................*

Thus far I’ve accessed many variables of this file successfully by running through t.GetEntries() (i.e. events) and then running through t.TruthMuons (i.e. muons in an event) where t=CollectionTree. I could do

for mu in t.TruthMuons():
  print (mu.pt())

successfully. Mind that if I do print (t.GetBranch("TruthMuons")) I get <ROOT.TBranchObject object ("TruthMuons") at 0xbc23f80> i.e. a valid memory slot. Nonetheless when I do the same for a branch named TruthMuonsAuxDyn I get <ROOT.TBranch object at 0x(nil)>. This indicates accessing this isn’t obvious. Ideally I would have done

for mu in t.TruthMuons():
  print (mu.ptcone30())

but if this had worked I wouldn’t have been here.
Any help would be highly appreciated!


_ROOT Version: 21.2.160
_Platform: Linux
_Compiler: g++

May be @pcanal will have an idea.

As the name of the branch is TruthMuonsAuxDyn.ptcone30
maybe this will work:

for ptcone30 in t.TruthMuonsAuxDyn.ptcone30
    print (ptcone30)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.