ATLAS Offline Software
Loading...
Searching...
No Matches
BindingsTest.py
Go to the documentation of this file.
7
8
9# load dict for MyCutClass
10pylcgdict.load_library("libPyAnalysisExamplesDict")
11
12# instantiate a C++ class from python
13cut = g.AthPyEx.MyCutClass(30*GeV)
14
15# init application mgr
16theApp.initialize()
17
18#import ROOT
19import ROOT
20
21# create hist
22ha = ROOT.TH1F ('accept','Test Acc',100,0,100000)
23hr = ROOT.TH1F ('reject','Test Rej',100,0,100000)
24
25# loop over 5 events
26for ievent in range(5):
27 # run 1 event
28 theApp.nextEvent()
29
30 # get ElectronContainer
31 econ = PyParticleTools.getElectrons("ElectronCollection")
32 for ie in range(len(econ)):
33 eobj = econ[ie]
34 if cut.isAccepted(eobj):
35 print ("accept %f" % eobj.pt())
36 ha.Fill(eobj.pt())
37 else:
38 print ("reject %f" % eobj.pt())
39 hr.Fill(eobj.pt())
40
41ha.Draw()