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