ROOT
6.10/09
Reference Guide
tutorials
dataframe
tdf008_createDataSetFromScratch.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_tdataframe
3
/// \notebook -nodraw
4
/// This tutorial shows how to create a dataset from scratch with TDataFrame
5
/// \macro_code
6
///
7
/// \date June 2017
8
/// \author Danilo Piparo
9
10
void
tdf008_createDataSetFromScratch()
11
{
12
// We create an empty data frame of 100 entries
13
ROOT::Experimental::TDataFrame
tdf(100);
14
15
// We now fill it with random numbers
16
TRandom3
rnd(1);
17
auto
tdf_1 = tdf.Define(
"rnd"
, [&rnd](){
return
rnd.Gaus();});
18
19
// We plot these numbers
20
auto
hgaus = tdf_1.Histo1D(
"rnd"
);
21
22
// And we write out the dataset on disk
23
tdf_1.Snapshot(
"randomNumbers"
,
"tdf008_createDataSetFromScratch.root"
);
24
25
}
TRandom3
Random number generator class based on M.
Definition:
TRandom3.h:27
ROOT::Experimental::TDataFrame
ROOT's TDataFrame offers a high level interface for analyses of data stored in TTrees.
Definition:
TDataFrame.hxx:36