···11+import oxyroot
22+33+if __name__ == '__main__':
44+ import uproot
55+ import numpy as np
66+ import time
77+88+ file_name = "ntuples.root"
99+ tree_name = 'mu_mc'
1010+1111+ up_start_time = time.time()
1212+ up_tree = uproot.open(file_name)[tree_name]
1313+ for branch in up_tree.keys():
1414+ # print(branch, up_tree[branch].typename)
1515+ if up_tree[branch].typename != "std::string":
1616+ up_values = up_tree[branch].array(library="np")
1717+ print(f"Uproot read {branch} into a {type(up_values)} and it has a mean of {np.nanmean(up_values):.2f}")
1818+ up_end_time = time.time()
1919+2020+ print("\n")
2121+2222+ oxy_start_time = time.time()
2323+ oxy_branches = oxyroot.read_root(file_name, tree_name=tree_name)
2424+ for branch in oxy_branches:
2525+ oxyroot.read_root(file_name, tree_name=tree_name, branch=branch)
2626+ oxy_values = oxyroot.read_root(file_name, tree_name=tree_name, branch=branch)
2727+ if type(oxy_values) is np.ndarray:
2828+ print(f"Oxyroot read {branch} into a {type(oxy_values)} and it has a mean of {np.nanmean(oxy_values):.2f}")
2929+ else:
3030+ print(f"Oxyroot read {branch} into a {type(oxy_values)} and it has a length of {len(oxy_values)}")
3131+ oxy_end_time = time.time()
3232+3333+ print("\n Total time")
3434+ print(f"Uproot took: {up_end_time - up_start_time:.3}s")
3535+ print(f"Oxyroot took: {oxy_end_time - oxy_start_time:.3}s")