Belle II Software development
pyroot_tfile.py
1#!/usr/bin/env python3
2
3
10
11# This test catches a regression in PyRoot (in root 5.34/19+?, fixed in 5.34/23)
12from basf2 import find_file
13import ROOT
14
15path = find_file('framework/tests/chaintest_2.root')
16
17with ROOT.TFile(path) as f:
18 tree = f.Get('tree')
19 hits = ROOT.TClonesArray('Belle2::PXDSimHit')
20 tree.SetBranchAddress('PXDSimHits', hits)
21 tree.GetEntry(0)
22 assert (hits.GetEntriesFast() > 0)
23 hit = hits[0]
24 hit.Dump()