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