Logo ROOT  
Reference Guide
Data Frame tutorials

These examples show the functionalities of RDataFrame: ROOT's declarative analysis interface.

ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees, CSV files and other data formats.

In addition, multi-threading and other low-level optimisations allow users to exploit all the resources available on their machines transparently.

In a nutshell:

ROOT::EnableImplicitMT(); // Tell ROOT you want to go parallel
ROOT::RDataFrame d("myTree", "file_*.root"); // Interface to TTree and TChain
auto myHisto = d.Histo1D("Branch_A"); // This happens in parallel!
myHisto->Draw();
#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
void EnableImplicitMT(UInt_t numthreads=0)
Enable ROOT's implicit multi-threading for all objects and methods that provide an internal paralleli...
Definition: TROOT.cxx:580

Explore the examples below or go to RDataFrame user guide.

Files

file  df001_introduction.C
  View in nbviewer Open in SWAN This tutorial illustrates the basic features of the RDataFrame class, a utility which allows to interact with data stored in TTrees following a functional-chain like approach.
 
file  df001_introduction.py
  View in nbviewer Open in SWAN This tutorial illustrates the basic features of the RDataFrame class, a utility which allows to interact with data stored in TTrees following a functional-chain like approach.
 
file  df002_dataModel.C
  View in nbviewer Open in SWAN This tutorial shows the possibility to use data models which are more complex than flat ntuples with RDataFrame
 
file  df002_dataModel.py
  View in nbviewer Open in SWAN This tutorial shows the possibility to use data models which are more complex than flat ntuples with RDataFrame
 
file  df003_profiles.C
  View in nbviewer Open in SWAN This tutorial illustrates how to use TProfiles in combination with the RDataFrame.
 
file  df003_profiles.py
  View in nbviewer Open in SWAN This tutorial illustrates how to use TProfiles in combination with the RDataFrame.
 
file  df004_cutFlowReport.C
  View in nbviewer Open in SWAN This tutorial shows how to get information about the efficiency of the filters applied
 
file  df004_cutFlowReport.py
  View in nbviewer Open in SWAN This tutorial shows how to get information about the efficiency of the filters applied
 
file  df005_fillAnyObject.C
  View in nbviewer Open in SWAN This tutorial shows how to fill any object the class of which exposes a Fill method.
 
file  df006_ranges.C
  View in nbviewer Open in SWAN This tutorial shows how to express the concept of ranges when working with the RDataFrame.
 
file  df006_ranges.py
  View in nbviewer Open in SWAN This tutorial shows how to express the concept of ranges when working with the RDataFrame.
 
file  df007_snapshot.C
  View in nbviewer Open in SWAN This tutorial shows how to write out datasets in ROOT formatusing the RDataFrame
 
file  df007_snapshot.py
  View in nbviewer Open in SWAN This tutorial shows how to write out datasets in ROOT formatusing the RDataFrame
 
file  df008_createDataSetFromScratch.C
  View in nbviewer Open in SWAN This tutorial shows how to create a dataset from scratch with RDataFrame
 
file  df008_createDataSetFromScratch.py
  View in nbviewer Open in SWAN This tutorial shows how to create a dataset from scratch with RDataFrame
 
file  df009_FromScratchVSTTree.C
  View in nbviewer Open in SWAN This tutorial illustrates how simpler it can be to use a RDataFrame to create a dataset with respect to the usage of the TTree interfaces.
 
file  df010_trivialDataSource.C
  View in nbviewer Open in SWAN This tutorial illustrates how use the RDataFrame in combination with a RDataSource.
 
file  df010_trivialDataSource.py
  View in nbviewer Open in SWAN This tutorial illustrates how use the RDataFrame in combination with a RDataSource.
 
file  df011_ROOTDataSource.C
  View in nbviewer Open in SWAN This tutorial illustrates how use the RDataFrame in combination with a RDataSource.
 
file  df011_ROOTDataSource.py
  View in nbviewer Open in SWAN This tutorial illustrates how use the RDataFrame in combination with a RDataSource.
 
file  df012_DefinesAndFiltersAsStrings.C
  View in nbviewer Open in SWAN
 
file  df012_DefinesAndFiltersAsStrings.py
  View in nbviewer Open in SWAN
 
file  df013_InspectAnalysis.C
  View in nbviewer Open in SWAN Showcase registration of callback functions that act on partial results while the event-loop is running using OnPartialResult and OnPartialResultSlot.
 
file  df014_CSVDataSource.C
  View in nbviewer Open in SWAN This tutorial illustrates how use the RDataFrame in combination with a RDataSource.
 
file  df014_CSVDataSource.py
  View in nbviewer Open in SWAN This tutorial illustrates how use the RDataFrame in combination with a RDataSource.
 
file  df015_LazyDataSource.C
  View in nbviewer Open in SWAN This tutorial illustrates how to take advantage of a lazy data source creating a data frame from columns of one or multiple parent dataframe(s), delaying the creation of the columns to the actual usage of the daughter data frame.
 
file  df016_vecOps.C
  View in nbviewer Open in SWAN This tutorial shows the potential of the VecOps approach for treating collections stored in datasets, a situation very common in HEP data analysis.
 
file  df016_vecOps.py
  View in nbviewer Open in SWAN This tutorial shows the potential of the VecOps approach for treating collections stored in datasets, a situation very common in HEP data analysis.
 
file  df017_vecOpsHEP.C
  View in nbviewer Open in SWAN This tutorial shows how VecOps can be used to slim down the programming model typically adopted in HEP for analysis.
 
file  df017_vecOpsHEP.py
  View in nbviewer Open in SWAN This tutorial shows how VecOps can be used to slim down the programming model typically adopted in HEP for analysis.
 
file  df018_customActions.C
  View in nbviewer Open in SWAN This tutorial shows how to implement a custom action.
 
file  df019_Cache.C
  View in nbviewer Open in SWAN This tutorial shows how the content of a data frame can be cached in memory in form of a data frame.
 
file  df019_Cache.py
  View in nbviewer Open in SWAN This tutorial shows how the content of a data frame can be cached in memory in form of a data frame.
 
file  df020_helpers.C
  View in nbviewer Open in SWAN This tutorial shows usage of the RDF helper tools, contained in ROOT/RDFHelpers.hxx
 
file  df021_createTGraph.C
  View in nbviewer Open in SWAN This tutorial shows how to fill a TGraph using the Dataframe.
 
file  df021_createTGraph.py
  View in nbviewer Open in SWAN This tutorial shows how to fill a TGraph using the Dataframe.
 
file  df022_useKahan.C
  View in nbviewer Open in SWAN This tutorial shows how to implement a Kahan summation custom action.
 
file  df023_aggregate.C
  View in nbviewer Open in SWAN This tutorial shows how to use the Aggregate action to evaluate the product of all the elements of a column.
 
file  df024_Display.C
  View in nbviewer Open in SWAN This tutorial shows how to use the Display action
 
file  df024_Display.py
  View in nbviewer Open in SWAN This tutorial shows how to use the Display action
 
file  df025_RNode.C
  View in nbviewer Open in SWAN RNode is a generic type which represents any transformation node in the computation graph.
 
file  df026_AsNumpyArrays.py
  View in nbviewer Open in SWAN This tutorial shows how read data of a RDataFrame into Numpy arrays.
 
file  df027_SQliteDependencyOverVersion.C
  View in nbviewer Open in SWAN Plot the ROOT downloads based on the version reading a remote sqlite3 file with RSqliteDS.
 
file  df028_SQliteIPLocation.C
  View in nbviewer Open in SWAN Plot the location of ROOT downloads reading a remote sqlite3 file with RSqliteDS.
 
file  df029_SQlitePlatformDistribution.C
  View in nbviewer Open in SWAN
 
file  df030_SQliteVersionsOfROOT.C
  View in nbviewer Open in SWAN Plot the downloads of different ROOT versions reading a remote sqlite3 file with RSqliteDS.
 
file  df031_Stats.C
  View in nbviewer Open in SWAN Extract the statistics relative to RDataFrame columns and store them in TStatistic instances.
 
file  df031_Stats.py
  View in nbviewer Open in SWAN
 
file  df101_h1Analysis.C
  View in nbviewer Open in SWAN This tutorial illustrates how to express the H1 analysis with a RDataFrame.
 
file  df102_NanoAODDimuonAnalysis.C
  View in nbviewer Open in SWAN This tutorial illustrates how NanoAOD files can be processed with ROOT dataframes.
 
file  df102_NanoAODDimuonAnalysis.py
  View in nbviewer Open in SWAN This tutorial illustrates how NanoAOD files can be processed with ROOT dataframes.
 
file  df103_NanoAODHiggsAnalysis.C
  View in nbviewer Open in SWAN This tutorial is a simplified but yet complex example of an analysis reconstructing the Higgs boson decaying to two Z bosons from events with four leptons.
 
file  df103_NanoAODHiggsAnalysis.py
  View in nbviewer Open in SWAN This tutorial is a simplified but yet complex example of an analysis reconstructing the Higgs boson decaying to two Z bosons from events with four leptons.
 
file  df103_NanoAODHiggsAnalysis_python.h
 Header file with functions needed to execute the Python version of the NanoAOD Higgs tutorial.