File indexing completed on 2024-11-25 02:29:51
0001 from PhysicsTools.PythonAnalysis import *
0002 import ROOT
0003 from ROOT import gSystem, TFile
0004
0005 gSystem.Load("libFWCoreFWLite.so")
0006 ROOT.FWLiteEnabler.enable()
0007
0008
0009 theFile = TFile("generatorOutput.root")
0010
0011 events = theFile.Get("Events")
0012
0013
0014 events.GetEntry()
0015
0016
0017
0018
0019
0020
0021 source = edm.HepMCProduct()
0022 sourceBranch = events.GetBranch(events.GetAlias("source"))
0023 sourceBranch.SetAddress(source)
0024
0025
0026 for index in all(events):
0027
0028
0029
0030 sourceBranch.GetEntry(index)
0031 events.GetEntry(index,0)
0032
0033
0034 genEvent = source.GetEvent();
0035 print(genEvent.event_number())