In [1]:
import ROOT
Open a file which is located on the web. No type is to be specified for "f".
In [2]:
f = ROOT.TFile.Open("http://indico.cern.ch/event/395198/material/0/0.root")
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]:
maxPt=-1
for event in f.events:
maxPt=-1
for track in event.tracks:
pt = track.Pt()
if pt > maxPt: maxPt = pt
if event.evtNum % 100 == 0:
print "Processing event number %i" %event.evtNum
print "Max pt is %f" %maxPt