15 void tdf012_DefinesAndFiltersAsStrings()
24 size_t npoints = 10000000;
35 auto pidf = tdf.Define(
"x",
"gRandom->Uniform(-1.0, 1.0)")
36 .Define(
"y",
"gRandom->Uniform(-1.0, 1.0)")
37 .Define(
"p",
"std::array<double, 2> v{x, y}; return v;")
38 .Define(
"r",
"double r2 = 0.0; for (auto&& x : p) r2 += x*x; return sqrt(r2);");
50 auto incircle = *(pidf.Filter(
"r <= 1.0").Count());
52 double pi_approx = 4.0 *
incircle / npoints;
54 std::cout <<
"pi is approximately equal to " << pi_approx << std::endl;
REAL incircle(struct mesh *m, struct behavior *b, vertex pa, vertex pb, vertex pc, vertex pd)
ROOT's TDataFrame offers a high level interface for analyses of data stored in TTrees.