23def read_ttree_from_rfile(fileName):
28 tree = file.Get(
"tree")
29 floatVal = array.array(
"f", [0])
30 tree.SetBranchAddress(
"floatBranch", floatVal)
32 for i
in range(tree.GetEntries()):
34 print(f
"value[{i}] = {floatVal[0]}")
37fileName =
"rfile_ttree_py.root"
40 ROOT.RDataFrame(10).Define(
"floatBranch",
"static_cast<float>(rdfentry_)").Snapshot(
"tree", fileName)
42 read_ttree_from_rfile(fileName)
44except FileNotFoundError:
static std::unique_ptr< RFile > Open(std::string_view path, const ROpenOptions &opts=ROpenOptions())
Opens the file for reading.
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...