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