The Gaudi Framework  v36r1 (3e2fb5a8)
SuperAlgorithm.py
Go to the documentation of this file.
1 
11 from __future__ import print_function
12 
15 
16 from Gaudi.Configuration import *
17 from Configurables import ParentAlg, StopperAlg, TimingAuditor, HelloWorld
18 from Configurables import EventLoopMgr
19 
20 from GaudiConfig.ControlFlow import seq
21 
22 from Configurables import GaudiExamplesCommonConf
23 # see implementation of Gaudi_Test_MySuperAlg in GaudiExamples/Configuration.py
24 from Configurables import Gaudi_Test_MySuperAlg as MySuperAlg
25 
26 GaudiExamplesCommonConf()
27 
28 s1 = MySuperAlg('s1', OutputLevel=INFO)
29 s2 = MySuperAlg('s2', OutputLevel=WARNING)
30 top = s1 >> s2
31 
32 MySuperAlg('s2', PercentPass=75, OutputLevel=DEBUG)
33 
34 # -----------------------------------------------------------------
35 # Testing the new GaudiSequencer
36 # -----------------------------------------------------------------
37 sand = HelloWorld('AND') & EventCounter('ANDCounter')
38 sor = HelloWorld('OR') | EventCounter('ORCounter')
39 
40 try:
41  MySuperAlg('AND')
42  raise RuntimeError('we should not be able to retype to SuperAlgorithm')
43 except AssertionError:
44  pass # it's expected
45 
46 all = ParentAlg() >> StopperAlg(StopCount=20) >> top >> sand >> sor
47 
48 print('# --- Configured Control Flow Expression:')
49 print('#', all)
50 print('# ---')
51 EventLoopMgr(PrintControlFlowExpression=True)
52 
53 # -----------------------------------------------------------------
55  TopAlg=[all],
56  EvtMax=10, # events to be processed (default is 10)
57  EvtSel='NONE', # do not use any event input
58  ExtSvc=['ToolSvc', 'AuditorSvc'],
59  AuditAlgorithms=True)
60 
61 AuditorSvc().Auditors.append(TimingAuditor("TIMER"))
GaudiConfig.ControlFlow
Definition: ControlFlow.py:1
EventCounter
Definition: EventCounter.h:14
AuditorSvc
Definition: AuditorSvc.h:28
Gaudi.Configuration
Definition: Configuration.py:1
ApplicationMgr
Definition: ApplicationMgr.h:57