Access TTree in Python using PyROOT and fill a histogram

In [1]:
from ROOTaaS.iPyROOT import ROOT
Welcome to ROOTaas Beta

Open a file which is located on the web. No type is to be specified for "f".

In [2]:
f = ROOT.TFile.Open("");

Loop over the TTree called "events" in the file. It is accessed with the dot operator. Same holds for the access to the branches: no need to set them up - they are just accessed by name, again with the dot operator.

In [3]:
h = ROOT.TH1F("TracksPt","Tracks;Pt [GeV/c];#",128,0,64)
for event in
    for track in event.tracks:
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
In [ ]: