Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
df000_simple.C File Reference

Detailed Description

View in nbviewer Open in SWAN Simple RDataFrame example in C++.

This tutorial shows a minimal example of RDataFrame. It starts without input data, generates a new column x with random numbers, and finally draws a histogram for x.

{
// Create a data frame with 100 rows
ROOT::RDataFrame rdf(100);
// Define a new column `x` that contains random numbers
auto rdf_x = rdf.Define("x", [](){ return gRandom->Rndm(); });
// Create a histogram from `x`
auto h = rdf_x.Histo1D("x");
// At the end of this function, the histogram pointed to by `h` will be deleted.
// Draw a copy of the histogram object instead:
h->DrawClone();
}
#define h(i)
Definition RSha256.hxx:106
R__EXTERN TRandom * gRandom
Definition TRandom.h:62
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTree,...
virtual Double_t Rndm()
Machine independent random number generator.
Definition TRandom.cxx:552
Date
September 2021
Author
Enric Tejedor (CERN)

Definition in file df000_simple.C.