Reading TRefArray from PyROOT

Hello

I am new to ROOT and working on extracting Jet information from leaf with TRefArray formation. Following is a specific leaf information when I do Print()

`*............................................................................*
*Br  240 :Jet.Constituents : TRefArray Constituents[Jet_]                    *
*Entries :    10000 : Total  Size=    2008930 bytes  File Size  =     788086 *
*Baskets :       23 : Basket Size=     184320 bytes  Compression=   2.55     *
*............................................................................*`

I did find some macro that can extract around line 174
https://github.com/delphes/delphes/blob/master/examples/Example3.C#l196

This shows a way to extract information from TRefArray but I would like to know if there is a way to convert into PyROOT or to use PyROOT command that can do the same

Also, how can I read a leaf as an array?

This is what I tried so far in python

import ROOT

f = ROOT.TFile("wj_delphes_events.root", "read")
myTree = f.Get("Delphes")
entry = myTree.GetEntry()

for entr in myTree:
    print(entr.Jet)
    break

but result was

<ROOT.TClonesArray object ("Jets") at 0x7f85d86d4420>

Hi @Tae,

Your Jet branch is a TClonesArray of jets, and what you want is to extract information from those jets in Python, right?

You can try this:

import ROOT

f = ROOT.TFile("wj_delphes_events.root")
myTree = f.Delphes

for entr in myTree:
    arrayOfJets = entr.Jet
    for jet in arrayOfJets:
        print(jet.Constituents)