Df 0 3 3_ Describe

Get information about the dataframe with the convenience method Describe.

Author: Stefan Wunsch (KIT, CERN)
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, June 15, 2021 at 07:23 AM.

In [ ]:
import ROOT

Create a dataframe

In [ ]:
path = 'root://eospublic.cern.ch//eos/opendata/cms/derived-data/AOD2NanoAODOutreachTool/Run2012BC_DoubleMuParked_Muons.root'
df = ROOT.RDataFrame('Events', path)

Describe the state of the dataframe. Note that this operation is not running the event loop.

In [ ]:
print(df.Describe())

Build a small analysis studying the invariant mass of dimuon systems. See tutorial df102_NanoAODDimuonAnalysis for more information.

In [ ]:
df = df.Filter('nMuon == 2')\
       .Filter('Muon_charge[0] != Muon_charge[1]')\
       .Define('Dimuon_mass', 'InvariantMass(Muon_pt, Muon_eta, Muon_phi, Muon_mass)')\
       .Filter('Dimuon_mass > 70')\
       .Range(1000)

Trigger the event loop by asking for the mean of the dimuon mass.

In [ ]:
print('\nApproximate mass of the Z boson: {:.2f} GeV\n'.format(
    df.Mean('Dimuon_mass').GetValue()))

Describe again the state of the dataframe.

In [ ]:
print(df.Describe())

Draw all canvases

In [ ]:
from ROOT import gROOT 
gROOT.GetListOfCanvases().Draw()