Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Mix.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 
18 """
19 Simple example to illustrate the problem for task #13911
20 https://savannah.cern.ch/task/?13911
21 """
22 # =============================================================================
23 __author__ = "Vanya BELYAEV Ivan.Belyaev@itep.ru"
24 __date__ = "2010-04-24"
25 # =============================================================================
26 import sys
27 
28 from Configurables import GaudiSequencer, HelloWorld
29 from Gaudi.Configuration import ApplicationMgr, importOptions
30 from GaudiPython.Bindings import AppMgr
31 from GaudiPython.GaudiAlgs import SUCCESS, GaudiAlgo
32 
33 # =============================================================================
34 # @class SimpleAlgo
35 # very simple (empty) python algorith
36 # @author Vanya BELYAEV Ivan.Belyaev@itep.ru
37 # @date 2010-04-24
38 
39 
41  def execute(self):
42 
43  print("I am SimpleAlgo.execute! ", self.name())
44  sys.stdout.flush()
45 
46  return SUCCESS
47 
48 
49 # =============================================================================
50 # configure the application :
51 
52 
53 def configure():
54 
55  importOptions("Common.opts")
56 
57  ApplicationMgr(
58  TopAlg=[
59  HelloWorld(),
60  GaudiSequencer(
61  "MySequencer",
62  MeasureTime=True,
63  Members=[HelloWorld("Hello1"), HelloWorld("Hello2")],
64  ),
65  ],
66  # do not use any event input
67  EvtSel="NONE",
68  )
69 
70  gaudi = AppMgr()
71 
72  # create two "identical" algorithms:
73 
74  myAlg1 = SimpleAlgo("Simple1")
75  myAlg2 = SimpleAlgo("Simple2")
76 
77  # Adding something into TopAlg-sequence is OK:
78  gaudi.setAlgorithms([myAlg1] + gaudi.TopAlg)
79 
80  # Extending of "other"-sequences causes failures:
81  seq = gaudi.algorithm("MySequencer")
82 
83  seq.Members += ["HelloWorld/Hello3"] # it is ok
84  seq.Members += [myAlg2.name()] # it fails
85 
86 
87 if "__main__" == __name__:
88 
89  # make printout of the own documentations
90  print("*" * 120)
91  print(__doc__)
92  print(" Author : %s " % __author__)
93  print(" Date : %s " % __date__)
94  print("*" * 120)
95  sys.stdout.flush()
96 
97  configure()
98 
99  gaudi = AppMgr()
100 
101  gaudi.run(4)
102 
103  # add 'late' algorithms
104 
105  myAlg3 = SimpleAlgo("Simple3")
106 
107  seq = gaudi.algorithm("MySequencer")
108  seq.Members += ["HelloWorld/Hello4"]
109 
110  gaudi.run(8)
111 
112  seq.Members += [myAlg3.name()]
113 
114  gaudi.run(3)
115 
116 # =============================================================================
117 # The END
118 # =============================================================================
Mix.configure
def configure()
Definition: Mix.py:53
Mix.SimpleAlgo
Definition: Mix.py:40
GaudiPython.Bindings.AppMgr
Definition: Bindings.py:869
Mix.SimpleAlgo.execute
def execute(self)
Definition: Mix.py:41
GaudiPython.GaudiAlgs.GaudiAlgo
Definition: GaudiAlgs.py:638
GaudiPython.Bindings
Definition: Bindings.py:1
Gaudi.Configuration
Definition: Configuration.py:1
GaudiKernel.ProcessJobOptions.importOptions
def importOptions(optsfile)
Definition: ProcessJobOptions.py:541
GaudiPython.GaudiAlgs
Definition: GaudiAlgs.py:1