ATLAS Offline Software
BindingsTest.py
Go to the documentation of this file.
1 
7 
8 
9 # load dict for MyCutClass
10 pylcgdict.load_library("libPyAnalysisExamplesDict")
11 
12 # instantiate a C++ class from python
13 cut = g.AthPyEx.MyCutClass(30*GeV)
14 
15 # init application mgr
16 theApp.initialize()
17 
18 #import ROOT
19 import ROOT
20 
21 # create hist
22 ha = ROOT.TH1F ('accept','Test Acc',100,0,100000)
23 hr = ROOT.TH1F ('reject','Test Rej',100,0,100000)
24 
25 # loop over 5 events
26 for 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 
41 ha.Draw()
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195