15filename = ROOT.gROOT.GetTutorialDir().Data() +
"/dataframe/df017_vecOpsHEP.root"
18def WithPyROOT(filename):
20 f = ROOT.TFile(filename)
21 h = ROOT.TH1F(
"pt",
"pt", 16, 0, 4)
22 for event
in f.myDataset:
23 for E, px, py
in zip(event.E, event.px, event.py):
25 h.Fill(
sqrt(px*px + py*py))
28def WithRDataFrameVecOpsJit(treename, filename):
30 h = f.Define(
"good_pt",
"sqrt(px*px + py*py)[E>100]")\
31 .Histo1D((
"pt",
"pt", 16, 0, 4),
"good_pt")
41WithRDataFrameVecOpsJit(treename, filename)
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...