如何使用连根拔起的TEntryList

2024-05-15 06:17:46 发布

您现在位置:Python中文网/ 问答频道 /正文

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

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

tc包含一些十位列表,它们为td提供选定的事件。使用“根除”,我可以加载tc,并可以查看事件列表。可用的方法

tc.read
tc.classname

我不知道如何使用这些,它似乎没有记录。。。 由于Outlot使用numpy,所以我希望以某种方式获得一个bool数组或索引数组,以应用为cut或迭代

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'

Tags: 文件列表read事件root数组opentd

热门问题