00001
00002
00003
00004
00005
00006
00007 """
00008 *******************************************************************************
00009 * *
00010 * Simple example (identical to C++ Properties.opts) which illustrated *
00011 * the basic job-properties and theinr C++/Python intercommunication *
00012 * *
00013 *******************************************************************************
00014 """
00015
00016 __author__ = 'Vanya BELYAEV ibelyaev@physics.syr.edu'
00017
00018
00019
00020
00021
00022
00023
00024
00025 import gaudimodule
00026
00027 SUCCESS = gaudimodule.SUCCESS
00028
00029
00030
00031 def configure ( gaudi = None ) :
00032 """ the configurtaion of the job """
00033
00034
00035 if not gaudi : gaudi = gaudimodule.AppMgr()
00036
00037
00038 gaudi.config ( files = [ '../options/Common.opts' ] )
00039
00040
00041
00042 gaudi.TopAlg = [ 'PropertyAlg' ]
00043
00044
00045 gaudi.TopAlg += [ "PropertyAlg", "PropertyProxy" ]
00046
00047
00048 gaudi.TopAlg.remove("PropertyAlg")
00049
00050
00051
00052 msgSvc = gaudi.service('MessageSvc')
00053 msgSvc.OutputLevel = 3
00054
00055
00056 gaudi.EvtSel = 'NONE'
00057 gaudi.HistogramPersistency = 'NONE'
00058
00059
00060
00061 alg = gaudi.algorithm('PropertyAlg')
00062
00063 alg.OutputLevel = 3;
00064
00065 alg.Int = 101
00066 alg.Double = 101.1e+10
00067 alg.String = "hundred one"
00068 alg.Bool = False
00069
00070 alg.IntArray = [ 1, 2, 3, 5 ]
00071 alg.DoubleArray = [ -11.0 , 2., 3.3, 0.4e-03 ]
00072 alg.StringArray = [ "one" , "two" , "four" ]
00073 alg.BoolArray = [ False , True , False ]
00074 alg.EmptyArray = []
00075
00076 alg.PInt = 101
00077 alg.PDouble = 101.E5
00078 alg.PString = "hundred one"
00079 alg.PBool = True
00080
00081
00082 alg.PIntArray = [ 1, 2, 3, 5 ]
00083 alg.PDoubleArray = [ 1.1 , 2., 3.3 ]
00084 alg.PStringArray = [ "one", "two", "four" ]
00085 alg.PBoolArray = [ True , False , True , False ]
00086
00087 proxy = gaudi.algorithm( "PropertyProxy" )
00088 proxy.String = "This is set by the proxy"
00089
00090 msgSvc.setDebug = [ "EventLoopMgr" ]
00091 msgSvc.setVerbose = [ "MsgTest" ]
00092
00093 return SUCCESS
00094
00095
00096
00097
00098
00099
00100 if '__main__' == __name__ :
00101
00102 print __doc__ , __author__
00103
00104 gaudi = gaudimodule.AppMgr()
00105 configure( gaudi )
00106 gaudi.run(1)
00107
00108 alg = gaudi.algorithm( 'PropertyAlg' )
00109
00110 props = alg.properties()
00111 print 'Properties of %s ' % alg.name()
00112 for p in props :
00113 v = props[p].value()
00114 print "Python: Name/Value: '%s' / '%s' "%(p,v)
00115
00116
00117
00118