Logo ROOT  
Reference Guide
df024_Display.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_dataframe
3/// \notebook
4/// This tutorial shows how to use the Display action
5///
6/// \macro_code
7/// \macro_output
8///
9/// \date August 2018
10/// \author Enrico Guiraud, Danilo Piparo, Enric Tejedor Saavedra CERN, Massimo Tumolo Politecnico di Torino
11
12void df024_Display()
13{
14 // Setting up a Dataframe with some data
15 unsigned long long y = 1;
16 int x = 1;
17 double w = 1;
18 double z = 1;
19 ROOT::RDataFrame df(10);
20 auto d = df.Define("y", [&y]() { return y *= 100; }) // A column with ulongs
21 .Define("x",
22 [&x]() {
23 return std::vector<int>({x++, x++, x++, x++});
24 }) // A column with four-elements collection
25 .Define("w", [&w]() { return w *= 1.8; }) // A column with doubles
26 .Define("z", [&z]() {
27 z *= 1.1;
28 return std::vector<std::vector<double>>({{z, ++z}, {z, ++z}, {z, ++z}});
29 }); // A column of matrices
30
31 // Preparing the RResultPtr<RDisplay> object with all columns and default number of entries
32 auto d1 = d.Display("");
33 // Preparing the RResultPtr<RDisplay> object with two columns and default number of entries
34 auto d2 = d.Display({"x", "y"});
35
36 // Printing the short representations, the event loop will run
37 std::cout << "The following is the representation of all columns with the default nr of entries" << std::endl;
38 d1->Print();
39 std::cout << "\n\nThe following is the representation of two columns with the default nr of entries" << std::endl;
40 d2->Print();
41}
#define d(i)
Definition: RSha256.hxx:102
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...
Definition: RDataFrame.hxx:42
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17