#!/usr/bin/env python # Based on P.Onyisi example import sys,os,string if len(sys.argv)<2: print "Usage: python test.py file.root" print "Exit.." sys.exit() from ROOT import * TH1D.SetDefaultSumw2() gSystem.Load('libDelphes.so') f=TFile(sys.argv[1]) t=f.Delphes # extract the tree h=TH1D('ele','Electron #eta',8,-4,4) # initialize a histogram c1=TCanvas() # build a canvas n=0 for e in t: # loop over all events if n%100==0: print "Event=",n n=n+1 for electron in e.Electron: # loop over all electrons h.Fill(electron.Eta) h.Draw() c1.Print('electron.pdf') if (raw_input("Press any key to exit") != "-9999"): c1.Close(); sys.exit(1);