Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v38r0 (2143aa4c)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 __author__ = "Vanya BELYAEV ibelyaev@physics.syr.edu"
22 # Flag to check if we are running on Windows, where LorentzVectors cannot be used as properties
23 import sys
24 
25 from Configurables import ApplicationMgr
26 from Configurables import Gaudi__Examples__ExtendedProperties2 as EP2
27 
28 # =============================================================================
29 # @file
30 # Simple example (identical to C++ ExtendedProperties.opts) which illustrates
31 # the extended job-properties and their C++/Python intercommunication
32 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
33 # @date 2007-02-13
34 # =============================================================================
35 
36 isWin = sys.platform.startswith("win")
37 
38 ep2 = EP2("xProps2", Point3D=(10, 40, 55), Points3D=[(10, 40, 55), (1, 2, 3)])
39 
40 ApplicationMgr(EvtSel="NONE", TopAlg=[ep2], EvtMax=10)
41 
42 # =============================================================================
43 # The actual job excution
44 # =============================================================================
45 if "__main__" == __name__:
46  print(__doc__, __author__)
47 
48  # make sure cling can generate all required methods in Gaudi::Property
49  # Workaround for ROOT-10769
50  import warnings
51 
52  with warnings.catch_warnings():
53  warnings.simplefilter("ignore")
54  import cppyy
55  for h in ("GaudiKernel/SVectorAsProperty.h", "GaudiKernel/VectorsAsProperty.h"):
56  cppyy.gbl.gInterpreter.Declare('#include "%s"' % h)
57 
58  from GaudiPython.Bindings import AppMgr
59 
60  gaudi = AppMgr()
61 
62  gaudi.run(5)
63 
64  xp2 = gaudi.algorithm("xProps2")
65 
66  xp2.Point3D = "(-10,3, Z : 24)"
67  xp2.Vector3D = [-120, -30, -40]
68  if not isWin:
69  xp2.Vector4D = [-100, -200, -300, 400]
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 
76  xp2.SVector5 = (1, 2, 3, 4, 5)
77 
78  xp2.SVector5 = [1, 2, 3, 4, 5]
79 
80  try:
81  xp2.SVector5 = [1, 2, 3, 4, 5, 6]
82  except Exception as e:
83  print(" Exception: ", e)
84 
85  try:
86  xp2.Point3D = (1, 2, 3, 4)
87  except Exception as e:
88  print(" Exception: ", e)
89 
90  if not isWin:
91  try:
92  xp2.Vector4D = (1, 2, 3)
93  except Exception as e:
94  print(" Exception: ", e)
95 
96  xp2.Vectors3D = [(1, 2, 3), (4, 5, 6), [7, 8, 9]]
97  if not isWin:
98  xp2.Vectors4D = ((1, 2, 3, 4), [4, 5, 6, 7])
99 
100  xp2.PropertiesPrint = True
101 
102 # =============================================================================
103 # The END
104 # =============================================================================
GaudiPython.Bindings.AppMgr
Definition: Bindings.py:884
GaudiPython.Bindings
Definition: Bindings.py:1