The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AlgSequencer.py
Go to the documentation of this file.
1 
11 from __future__ import print_function
12 
13 from Configurables import (
14  EventLoopMgr,
15  GaudiExamplesCommonConf,
16  HelloWorld,
17  ParentAlg,
18  Prescaler,
19  StopperAlg,
20  TimingAuditor,
21 )
22 from Gaudi.Configuration import *
23 from GaudiConfig.ControlFlow import seq
24 
25 
28 
29 
30 GaudiExamplesCommonConf()
31 
32 # --------------------------------------------------------------
33 # Testing Sequencers
34 # --------------------------------------------------------------
35 p1 = Prescaler("Prescaler1", PercentPass=50.0, OutputLevel=WARNING)
36 p2 = Prescaler("Prescaler2", PercentPass=10.0, OutputLevel=WARNING)
37 h = HelloWorld(OutputLevel=DEBUG)
38 c1 = EventCounter("Counter1")
39 c2 = EventCounter("Counter2")
40 
41 s1 = seq(p1 & h & c1)
42 s2 = seq(p2 & h & c2)
43 top = s1 >> s2
44 # s1 = Sequencer('Sequence1', Members = [p1, h, c1] )
45 # s2 = Sequencer('Sequence2', Members = [p2, h, c2] )
46 # top = Sequencer('TopSequence', Members = [s1, s2], StopOverride = True )
47 
48 # -----------------------------------------------------------------
49 # Testing the new GaudiSequencer
50 # -----------------------------------------------------------------
51 sand = HelloWorld("AND") & EventCounter("ANDCounter")
52 sor = HelloWorld("OR") | EventCounter("ORCounter")
53 # sand = GaudiSequencer( 'ANDSequence',
54 # Members = [ HelloWorld('AND'), EventCounter('ANDCounter') ],
55 # MeasureTime = 1 )
56 # sor = GaudiSequencer( 'ORSequence',
57 # Members = [ HelloWorld('OR'), EventCounter('ORCounter') ],
58 # MeasureTime = 1,
59 # ModeOR = 1 )
60 
61 all = ParentAlg() >> StopperAlg(StopCount=20) >> top >> sand >> sor
62 
63 print("# --- Configured Control Flow Expression:")
64 print("#", all)
65 print("# ---")
66 EventLoopMgr(PrintControlFlowExpression=True)
67 # -----------------------------------------------------------------
69  TopAlg=[all],
70  EvtMax=10, # events to be processed (default is 10)
71  EvtSel="NONE", # do not use any event input
72  ExtSvc=["ToolSvc", "AuditorSvc"],
73  AuditAlgorithms=True,
74 )
75 
76 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