The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
ExtendedProperties2.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2
13"""
14*******************************************************************************
15* *
16* Simple example which illustrate the extended job-properties and their *
17* *
18*******************************************************************************
19"""
20
21# =============================================================================
22__author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu"
23# Flag to check if we are running on Windows, where LorentzVectors cannot be used as properties
24import sys
25
26from Configurables import ApplicationMgr
27from Configurables import Gaudi__TestSuite__ExtendedProperties2 as EP2
28
29# =============================================================================
30# @file
31# Simple example (identical to C++ ExtendedProperties.opts) which illustrates
32# the extended job-properties and their C++/Python intercommunication
33# @author Vanya BELYAEV ibelyaev@physics.syr.edu
34# @date 2007-02-13
35# =============================================================================
36
37isWin = sys.platform.startswith("win")
38
39ep2 = EP2("xProps2", Point3D=(10, 40, 55), Points3D=[(10, 40, 55), (1, 2, 3)])
40
41ApplicationMgr(EvtSel="NONE", TopAlg=[ep2], EvtMax=10)
42
43# =============================================================================
44# The actual job excution
45# =============================================================================
46if "__main__" == __name__:
47 print(__doc__, __author__)
48
49 # make sure cling can generate all required methods in Gaudi::Property
50 # Workaround for ROOT-10769
51 import warnings
52
53 with warnings.catch_warnings():
54 warnings.simplefilter("ignore")
55 import cppyy
56 for h in ("GaudiKernel/SVectorAsProperty.h", "GaudiKernel/VectorsAsProperty.h"):
57 cppyy.gbl.gInterpreter.Declare('#include "%s"' % h)
58
59 from GaudiPython.Bindings import AppMgr
60
61 gaudi = AppMgr()
62
63 gaudi.run(5)
64
65 xp2 = gaudi.algorithm("xProps2")
66
67 xp2.Point3D = "(-10,3, Z : 24)"
68 xp2.Vector3D = [-120, -30, -40]
69 if not isWin:
70 xp2.Vector4D = [-100, -200, -300, 400]
71 xp2.Vector4D = (-100, -200, -300, 400)
72 xp2.Vector4D = [(-100, -200, -300), 400]
73 xp2.Vector4D = [[-100, -200, -300], 400]
74 xp2.Vector4D = ((-100, -200, -300), 400)
75 xp2.Vector4D = ([-100, -200, -300], 400)
76
77 xp2.SVector5 = (1, 2, 3, 4, 5)
78
79 xp2.SVector5 = [1, 2, 3, 4, 5]
80
81 try:
82 xp2.SVector5 = [1, 2, 3, 4, 5, 6]
83 except Exception as e:
84 print(" Exception: ", e)
85
86 try:
87 xp2.Point3D = (1, 2, 3, 4)
88 except Exception as e:
89 print(" Exception: ", e)
90
91 if not isWin:
92 try:
93 xp2.Vector4D = (1, 2, 3)
94 except Exception as e:
95 print(" Exception: ", e)
96
97 xp2.Vectors3D = [(1, 2, 3), (4, 5, 6), [7, 8, 9]]
98 if not isWin:
99 xp2.Vectors4D = ((1, 2, 3, 4), [4, 5, 6, 7])
100
101 xp2.PropertiesPrint = True
102
103# =============================================================================
104# The END
105# =============================================================================
The Application Manager class.