14def fill_tree(treeName, fileName):
16 df.Define(
"b1",
"(int) rdfentry_")\
17 .Define(
"b2",
"(float) rdfentry_ * rdfentry_").Snapshot(treeName, fileName)
21fileName =
"df006_ranges_py.root"
24fill_tree(treeName, fileName)
34d_0_30 = d.Range(0, 30)
35c_0_30 = d_0_30.Count()
38d_15_end = d.Range(15, 0)
39c_15_end = d_15_end.Count()
42d_15_end_3 = d.Range(15, 0, 3)
43c_15_end_3 = d_15_end_3.Count()
47d_0_50 = d.Range(0, 50)
48c_0_50_odd_b1 = d_0_50.Filter(
"1 == b1 % 2").Count()
53c_0_3_after_even_b1 = d.Filter(
"0 == b1 % 2").
Range(0, 3).Count()
56print(
"Usage of ranges:")
57print(
" - All entries:", c_all.GetValue())
58print(
" - Entries from 0 to 30:", c_0_30.GetValue())
59print(
" - Entries from 15 onwards:", c_15_end.GetValue())
60print(
" - Entries from 15 onwards in steps of 3:", c_15_end_3.GetValue())
61print(
" - Entries from 0 to 50, odd only:", c_0_50_odd_b1.GetValue())
62print(
" - First three entries of all even entries:", c_0_3_after_even_b1.GetValue())
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...