18coordDefineCode =
'''ROOT::RVecD {0}(len);
19 std::transform({0}.begin(), {0}.end(), {0}.begin(), [](double){{return gRandom->Uniform(-1.0, 1.0);}});
21d = df.Define(
"len",
"gRandom->Uniform(0, 16)")\
22 .Define(
"x", coordDefineCode.format(
"x"))\
23 .Define(
"y", coordDefineCode.format(
"y"))
29d1 = d.Define(
"r",
"sqrt(x*x + y*y)")
34ring_h = d1.Define(
"rInFig",
"r > .5 && r < 1 && x*y < 0")\
35 .Define(
"yFig",
"y[rInFig]")\
36 .Define(
"xFig",
"x[rInFig]")\
37 .Histo2D((
"fig",
"Two quarters of a ring", 64, -1.1, 1.1, 64, -1.1, 1.1),
"xFig",
"yFig")
41cring.SaveAs(
"df016_ring.png")
43print(
"Saved figure to df016_ring.png")
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...