1

我有两个根文件,现在正在使用 uproot 3.12。

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

tc包含一些 TEntryList,它们为td. 使用 uproot 我可以加载tc并查看事件列表。可用的方法

tc.read
tc.classname

我不知道如何使用这些,而且它似乎没有被记录在案......由于 uproot 使用 numpy,我希望以某种方式获得一个 bool 数组或索引数组作为剪切或迭代应用。

a = tc["EventList"]
a.read

返回

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

a.read()

返回

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

以下属性可用于 TEntryList,但似乎没有一个是可用于将事件列表应用于树的布尔值或索引数组。 _fN返回合理数量的条目,_fFileName指向正确的文件,_fTreeName是正确的......

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

返回

 '_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'
4

0 回答 0