The Gaudi Framework  v36r1 (3e2fb5a8)
AlgSequencer.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, Prescaler, HelloWorld, TimingAuditor
18 from Configurables import EventLoopMgr
19 
20 from GaudiConfig.ControlFlow import seq
21 
22 from Configurables import GaudiExamplesCommonConf
23 GaudiExamplesCommonConf()
24 
25 # --------------------------------------------------------------
26 # Testing Sequencers
27 # --------------------------------------------------------------
28 p1 = Prescaler('Prescaler1', PercentPass=50., OutputLevel=WARNING)
29 p2 = Prescaler('Prescaler2', PercentPass=10., OutputLevel=WARNING)
30 h = HelloWorld(OutputLevel=DEBUG)
31 c1 = EventCounter('Counter1')
32 c2 = EventCounter('Counter2')
33 
34 s1 = seq(p1 & h & c1)
35 s2 = seq(p2 & h & c2)
36 top = s1 >> s2
37 #s1 = Sequencer('Sequence1', Members = [p1, h, c1] )
38 #s2 = Sequencer('Sequence2', Members = [p2, h, c2] )
39 #top = Sequencer('TopSequence', Members = [s1, s2], StopOverride = True )
40 
41 # -----------------------------------------------------------------
42 # Testing the new GaudiSequencer
43 # -----------------------------------------------------------------
44 sand = HelloWorld('AND') & EventCounter('ANDCounter')
45 sor = HelloWorld('OR') | EventCounter('ORCounter')
46 # sand = GaudiSequencer( 'ANDSequence',
47 # Members = [ HelloWorld('AND'), EventCounter('ANDCounter') ],
48 # MeasureTime = 1 )
49 # sor = GaudiSequencer( 'ORSequence',
50 # Members = [ HelloWorld('OR'), EventCounter('ORCounter') ],
51 # MeasureTime = 1,
52 # ModeOR = 1 )
53 
54 all = ParentAlg() >> StopperAlg(StopCount=20) >> top >> sand >> sor
55 
56 print('# --- Configured Control Flow Expression:')
57 print('#', all)
58 print('# ---')
59 EventLoopMgr(PrintControlFlowExpression=True)
60 # -----------------------------------------------------------------
62  TopAlg=[all],
63  EvtMax=10, # events to be processed (default is 10)
64  EvtSel='NONE', # do not use any event input
65  ExtSvc=['ToolSvc', 'AuditorSvc'],
66  AuditAlgorithms=True)
67 
68 AuditorSvc().Auditors += [TimingAuditor("TIMER")]
GaudiConfig.ControlFlow
Definition: ControlFlow.py:1
EventCounter
Definition: EventCounter.h:14
AuditorSvc
Definition: AuditorSvc.h:28
Gaudi.Configuration
Definition: Configuration.py:1
HelloWorld
Definition: HelloWorld.h:24
HistogramsTiming.seq
seq
Definition: HistogramsTiming.py:24
ApplicationMgr
Definition: ApplicationMgr.h:57
Prescaler
Definition: Prescaler.h:15