The Gaudi Framework  v37r1 (a7f61348)
AlgSequencer.py
Go to the documentation of this file.
1 
11 from __future__ import print_function
12 
13 from Configurables import AlgTimingAuditor, ApplicationMgr, AuditorSvc, EventLoopMgr
14 from Configurables import Gaudi__Examples__EventCounter as EventCounter
15 from Configurables import Gaudi__Examples__Prescaler as Prescaler
16 from Configurables import GaudiExamplesCommonConf, HelloWorld, ParentAlg, StopperAlg
17 from Gaudi.Configuration import DEBUG
18 from GaudiConfig.ControlFlow import seq
19 
20 
23 
24 
25 GaudiExamplesCommonConf()
26 
27 # --------------------------------------------------------------
28 # Testing Sequencers
29 # --------------------------------------------------------------
30 p1 = Prescaler("Prescaler1", PercentPass=50.0)
31 p2 = Prescaler("Prescaler2", PercentPass=10.0)
32 h = HelloWorld(OutputLevel=DEBUG)
33 c1 = EventCounter("Counter1")
34 c2 = EventCounter("Counter2")
35 
36 s1 = seq(p1 & h & c1)
37 s2 = seq(p2 & h & c2)
38 top = s1 >> s2
39 # s1 = Sequencer('Sequence1', Members = [p1, h, c1] )
40 # s2 = Sequencer('Sequence2', Members = [p2, h, c2] )
41 # top = Sequencer('TopSequence', Members = [s1, s2], ShortCircuit = False )
42 
43 # -----------------------------------------------------------------
44 # Testing the new GaudiSequencer
45 # -----------------------------------------------------------------
46 sand = HelloWorld("AND") & EventCounter("ANDCounter")
47 sor = HelloWorld("OR") | EventCounter("ORCounter")
48 # sand = GaudiSequencer( 'ANDSequence',
49 # Members = [ HelloWorld('AND'), EventCounter('ANDCounter') ],
50 # MeasureTime = 1 )
51 # sor = GaudiSequencer( 'ORSequence',
52 # Members = [ HelloWorld('OR'), EventCounter('ORCounter') ],
53 # MeasureTime = 1,
54 # ModeOR = 1 )
55 
56 all = ParentAlg() >> StopperAlg(StopCount=20) >> top >> sand >> sor
57 
58 print("# --- Configured Control Flow Expression:")
59 print("#", all)
60 print("# ---")
61 EventLoopMgr(PrintControlFlowExpression=True)
62 # -----------------------------------------------------------------
63 ApplicationMgr(
64  TopAlg=[all],
65  EvtMax=10, # events to be processed (default is 10)
66  EvtSel="NONE", # do not use any event input
67  ExtSvc=["ToolSvc", "AuditorSvc", "Gaudi::Monitoring::MessageSvcSink"],
68  AuditAlgorithms=True,
69 )
70 
71 AuditorSvc().Auditors += [AlgTimingAuditor("TIMER")]
GaudiConfig.ControlFlow
Definition: ControlFlow.py:1
EventCounter
Definition: EventCounter.h:14
GaudiConfig.ControlFlow.seq
Definition: ControlFlow.py:201
Gaudi.Configuration
Definition: Configuration.py:1
Prescaler
Definition: Prescaler.h:15