Fork me on GitHub

Ticket #1159: new.py

File new.py, 510 bytes (added by Miles R, 7 years ago)

python script

Line 
1import ROOT
2#import math
3#import array
4#import numpy
5
6
7ROOT.gInterpreter.Declare('#include "MG5_aMC_v2_6_0/Delphes/classes/DelphesClasses.h"')
8ROOT.gInterpreter.Declare('#include "MG5_aMC_v2_6_0/Delphes/external/ExRootAnalysis/ExRootTreeReader.h"')
9
10#Load Delphes library
11ROOT.gSystem.Load("libDelphes.so")
12
13#Load the TFile and branch
14f = ROOT.TFile("signal.root")
15t = f.Get("Delphes;1")
16
17#Loop over events in the branch
18t.SetAlias("ParticlePID","Particle.PID")
19for event in t:
20 print(event.ParticlePID[0])