29pidf = df.Define(
"x",
"gRandom->Uniform(-1.0, 1.0)") \
30 .Define(
"y",
"gRandom->Uniform(-1.0, 1.0)") \
31 .Define(
"p",
"std::array<double, 2> v{x, y}; return v;") \
32 .Define(
"r",
"double r2 = 0.0; for (auto&& w : p) r2 += w*w; return sqrt(r2);")
44incircle = pidf.Filter(
"r <= 1.0").Count().GetValue()
46pi_approx = 4.0 * incircle / npoints
48print(
"pi is approximately equal to %g" % (pi_approx))
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...