Logo ROOT   6.18/05
Reference Guide
df008_createDataSetFromScratch.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_dataframe
3/// \notebook -nodraw
4/// This tutorial shows how to create a dataset from scratch with RDataFrame
5///
6/// \macro_code
7///
8/// \date June 2017
9/// \author Danilo Piparo
10
12{
13 // We create an empty data frame of 100 entries
14 ROOT::RDataFrame tdf(100);
15
16 // We now fill it with random numbers
17 gRandom->SetSeed(1);
18 auto tdf_1 = tdf.Define("rnd", []() { return gRandom->Gaus(); });
19
20 // And we write out the dataset on disk
21 tdf_1.Snapshot("randomNumbers", "df008_createDataSetFromScratch.root");
22}
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...
Definition: RDataFrame.hxx:42
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
Definition: TRandom.cxx:263
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
Definition: TRandom.cxx:597