How do you use TEntryList from ROOT with UPROOT

152 Views Asked by At

I have two root files, and am using uproot 3.12 right now.

td = uproot.open("data.root")
tc = uproot.open("cuts.root")

tc contains a few TEntryLists that provide selected events for td. Using uproot I can load tc and can see the event-lists. The methods available

tc.read
tc.classname

I do not know how to use these, and it does not seem to be documented... Since uproot uses numpy, I would expect somehow to get a bool array or index array to apply as a cut or to iterate over.

a = tc["EventList"]
a.read

returns

<bound method ROOTObject.read of <class 'uproot.rootio.TEntryList'>>

And

a.read()

returns

TypeError: read() missing 4 required positional arguments: 'source', 'cursor', 'context', and 'parent'

The following attributes are available to a TEntryList, but none seem to be an array of bools or indices that I can use to apply the event list to the tree. _fN returns a reasonable number of entries, _fFileName points to the correct file, _fTreeName is right...

a = tc["EventList"]
dir(a)

returns

 '_bases',
 '_classname',
 '_classversion',
 '_copycontext',
 '_fBlocks',
 '_fEntriesToProcess',
 '_fFileName',
 '_fLists',
 '_fN',
 '_fNBlocks',
 '_fName',
 '_fReapply',
 '_fTitle',
 '_fTreeName',
 '_fields',
 '_format1',
 '_format2',
 '_format3',
 '_hasreadobjany',
 '_int32',
 '_members',
 '_methods',
 '_postprocess',
 '_pycode',
 '_readinto',
 '_recarray',
 '_recarray_dtype',
 '_versions',
 'classname',
 'read'
0

There are 0 best solutions below