The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Properties.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 
13 """
14 *******************************************************************************
15 * *
16 * Simple example (identical to C++ Properties.opts) which illustrated *
17 * the basic job-properties and theinr C++/Python intercommunication *
18 * *
19 *******************************************************************************
20 """
21 from __future__ import print_function
22 
23 # =============================================================================
24 __author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu"
25 # =============================================================================
26 # @file
27 # Simple example (identical to C++ Properties.opts) which illustrated
28 # the basic job-properties and theinr C++/Python intercommunication
29 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
30 # @date 2007-02-13
31 # =============================================================================
32 
33 import gaudimodule
34 
35 SUCCESS = gaudimodule.SUCCESS
36 
37 # =============================================================================
38 # the configurtaion of the job
39 
40 
41 def configure(gaudi=None):
42  """the configurtaion of the job"""
43 
44  # create applictaion manager if not done yet
45  if not gaudi:
46  gaudi = gaudimodule.AppMgr()
47 
48  # read main configuration files
49  gaudi.config(files=["../options/Common.opts"])
50 
51  # private algorithm configuration options
52 
53  gaudi.TopAlg = ["PropertyAlg"]
54 
55  # test for the multiple inclusion of the same alg
56  gaudi.TopAlg += ["PropertyAlg", "PropertyProxy"]
57 
58  # test for the removal of an algorithm
59  gaudi.TopAlg.remove("PropertyAlg")
60 
61  # Set output level threshold
62  # (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
63  msgSvc = gaudi.service("MessageSvc")
64  msgSvc.OutputLevel = 3
65 
66  # event related parameters
67  gaudi.EvtSel = "NONE"
68  gaudi.HistogramPersistency = "NONE"
69 
70  # Algorithms Private Options
71 
72  alg = gaudi.algorithm("PropertyAlg")
73 
74  alg.OutputLevel = 3
75 
76  alg.Int = 101
77  alg.Double = 101.1e10
78  alg.String = "hundred one"
79  alg.Bool = False
80 
81  alg.IntArray = [1, 2, 3, 5]
82  alg.DoubleArray = [-11.0, 2.0, 3.3, 0.4e-03]
83  alg.StringArray = ["one", "two", "four"]
84  alg.BoolArray = [False, True, False]
85  alg.EmptyArray = []
86 
87  alg.PInt = 101
88  alg.PDouble = 101.0e5
89  alg.PString = "hundred one"
90  alg.PBool = True
91 
92  alg.PIntArray = [1, 2, 3, 5]
93  alg.PDoubleArray = [1.1, 2.0, 3.3]
94  alg.PStringArray = ["one", "two", "four"]
95  alg.PBoolArray = [True, False, True, False]
96 
97  proxy = gaudi.algorithm("PropertyProxy")
98  proxy.String = "This is set by the proxy"
99 
100  msgSvc.setDebug = ["EventLoopMgr"]
101  msgSvc.setVerbose = ["MsgTest"]
102 
103  return SUCCESS
104 
105 
106 # =============================================================================
107 
108 # =============================================================================
109 # The actual job excution
110 # =============================================================================
111 if "__main__" == __name__:
112 
113  print(__doc__, __author__)
114 
116  configure(gaudi)
117  gaudi.run(1)
118 
119  alg = gaudi.algorithm("PropertyAlg")
120 
121  props = alg.properties()
122  print("Properties of %s " % alg.name())
123  for p in props:
124  v = props[p].value()
125  print("Python: Name/Value: '%s' / '%s' " % (p, v))
126 
127 # =============================================================================
128 # The END
129 # =============================================================================
GaudiPython.Bindings.AppMgr
Definition: Bindings.py:869
Properties.configure
def configure(gaudi=None)
Definition: Properties.py:41