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