Logo ROOT   6.12/07
Reference Guide
tdf010_trivialDataSource.py
Go to the documentation of this file.
1 ## \file
2 ## \ingroup tutorial_tdataframe
3 ## \notebook
4 ## This tutorial illustrates how use the TDataFrame in combination with a
5 ## TDataSource. In this case we use a TTrivialDS, which is nothing more
6 ## than a simple generator: it does not interface to any existing dataset.
7 ## The TTrivialDS has a single column, col0, which has value n for entry n.
8 ##
9 ## \macro_code
10 ##
11 ## \date September 2017
12 ## \author Danilo Piparo
13 
14 import ROOT
15 
16 # Create the data frame
17 MakeTrivialDataFrame = ROOT.ROOT.Experimental.TDF.MakeTrivialDataFrame
18 
19 nEvents = 128
20 
21 d_s = MakeTrivialDataFrame(nEvents)
22 
23 # Now we have a regular TDataFrame: the ingestion of data is delegated to
24 # the TDataSource. At this point everything works as before.
25 h_s = d_s.Define("x", "1./(1. + col0)").Histo1D(("h_s", "h_s", 128, 0, .6), "x")
26 
27 c = ROOT.TCanvas()
28 c.SetLogy()
29 h_s.Draw()
30 
TDataFrame MakeTrivialDataFrame(ULong64_t size)
Definition: TTrivialDS.cxx:82