ATLAS Offline Software
test_interactive_athena.py
Go to the documentation of this file.
1 # testing interactive athena scriptability
2 # @author Sebastien Binet
3 # @date April 2010
4 
5 import AthenaCommon.AlgSequence as acas
6 job = acas.AlgSequence()
7 
8 import AthenaPython.PyAthena as PyAthena
9 StatusCode = PyAthena.StatusCode
10 
12 
13  def initialize(self):
14  self.msg.info("initialize...")
15  self.nevts = 0
16  self.ievt = 0
17  self.msg.info("initialize... [ok]")
18  return StatusCode.Success
19 
20  def execute(self):
21  self.msg.info("execute...")
22  self.nevts += 1
23  self.ievt = self.nevts - 1
24  self.msg.info("--> evt: %s/%s", self.ievt, self.nevts)
25  self.msg.info("execute... [ok]")
26  return StatusCode.Success
27 
28  def finalize(self):
29  self.msg.info("finalize...")
30  self.msg.info("processed [%s] evts", self.nevts)
31  self.msg.info("finalize... [ok]")
32  return StatusCode.Success
33 
34  pass # class TestAlg
35 
36 def test_lock():
37  print ('test lock')
38  sg = PyAthena.py_svc('StoreGateSvc')
39  ei = PyAthena.EventInfo()
40  sg.record (ei, 'EventInfo')
41  sg.setConst (ei).ignore()
42 
43  ll = PyAthena.MyLockableDataObj()
44  assert (not ll.m_locked)
45  sg.record (ll, 'lockable')
46  assert (not ll.m_locked)
47  sg.setConst (ll).ignore()
48  assert (ll.m_locked)
49  print ('done test lock')
50  import sys
51  sys.stdout.flush()
52  return
53 
54 job += TestAlg("pyalg")
55 
56 theApp.initialize()
57 theApp.nextEvent()
58 
59 for _ in range(10):
60  theApp.nextEvent()
61 
62 test_lock()
63 
64 theApp.finalize().ignore()
65 print ("="*80)
66 print ("test [OK]")
67 print ("="*80)
68 theApp.exit()
69 
70 
grepfile.info
info
Definition: grepfile.py:38
PyAthena::Alg::initialize
virtual StatusCode initialize() override
Definition: PyAthenaAlg.cxx:60
PyAthena::Alg::execute
virtual StatusCode execute() override
Definition: PyAthenaAlg.cxx:93
test_interactive_athena.test_lock
def test_lock()
Definition: test_interactive_athena.py:36
PyAthena::Alg::finalize
virtual StatusCode finalize() override
Definition: PyAthenaAlg.cxx:86
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
test_interactive_athena.TestAlg
Definition: test_interactive_athena.py:11
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
test_interactive_athena.TestAlg.nevts
nevts
Definition: test_interactive_athena.py:15
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
PyAthena::Alg
Definition: PyAthenaAlg.h:33
test_interactive_athena.TestAlg.ievt
ievt
Definition: test_interactive_athena.py:16