You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RDataFrame d6("myTree", "file*.root"); // the glob is passed as-is to TChain's constructor
306
-
RDataFrame d7(chain);
304
+
ROOT::RDataFrame d5("myTree", files);
305
+
ROOT::RDataFrame d6("myTree", "file*.root"); // the glob is passed as-is to TChain's constructor
306
+
ROOT::RDataFrame d7(chain);
307
307
~~~
308
308
Additionally, users can construct an RDataFrame with no data source by passing an integer number. This is the number of rows that
309
309
will be generated by this RDataFrame.
310
310
~~~{.cpp}
311
-
RDataFrame d(10); // a RDF with 10 entries (and no columns/branches, for now)
311
+
ROOT::RDataFrame d(10); // a RDF with 10 entries (and no columns/branches, for now)
312
312
d.Foreach([] { static int i = 0; std::cout << i++ << std::endl; }); // silly example usage: count to ten
313
313
~~~
314
314
This is useful to generate simple datasets on the fly: the contents of each event can be specified with Define() (explained below). For example, we have used this method to generate [Pythia](https://pythia.org/) events and write them to disk in parallel (with the Snapshot action).
@@ -324,7 +324,7 @@ auto df = ROOT::RDF::FromCSV("input.csv");
324
324
Let's now tackle a very common task, filling a histogram:
325
325
~~~{.cpp}
326
326
// Fill a TH1D with the "MET" branch
327
-
RDataFrame d("myTree", "file.root");
327
+
ROOT::RDataFrame d("myTree", "file.root");
328
328
auto h = d.Histo1D("MET");
329
329
h->Draw();
330
330
~~~
@@ -340,7 +340,7 @@ possible [actions](\ref cheatsheet), and all their results are wrapped in smart
340
340
### Applying a filter
341
341
Let's say we want to cut over the value of branch "MET" and count how many events pass this cut. This is one way to do it:
342
342
~~~{.cpp}
343
-
RDataFrame d("myTree", "file.root");
343
+
ROOT::RDataFrame d("myTree", "file.root");
344
344
auto c = d.Filter("MET > 4.").Count(); // computations booked, not run
345
345
std::cout << *c << std::endl; // computations run here, upon first access to the result
346
346
~~~
@@ -358,7 +358,7 @@ runtime performance is very important, a C++ callable can be specified instead (
358
358
but it can be any kind of function or even a functor class), together with a list of column names.
359
359
This snippet is analogous to the one above:
360
360
~~~{.cpp}
361
-
RDataFrame d("myTree", "file.root");
361
+
ROOT::RDataFrame d("myTree", "file.root");
362
362
auto metCut = [](double x) { return x > 4.; }; // a C++11 lambda function checking "x > 4"
363
363
auto c = d.Filter(metCut, {"MET"}).Count();
364
364
std::cout << *c << std::endl;
@@ -367,7 +367,7 @@ std::cout << *c << std::endl;
367
367
An example of a more complex filter expressed as a string containing C++ code is shown below
0 commit comments