The Gaudi Framework  master (f31105fd)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Check.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 
19 """
20 The trivial example to inspect the particle data table from the data base
21 """
22 
23 # =============================================================================
24 __author__ = "Vanya BELYAEV vanya@nikhef.nl"
25 __verison__ = " "
26 # =============================================================================
27 
28 from Configurables import ApplicationMgr, Gaudi__ParticlePropertySvc
29 
30 
31 ApplicationMgr().ExtSvc += [Gaudi__ParticlePropertySvc()]
32 
33 # The following is misunderstood by flake8 - the import is needed as it
34 # has necessary side effects
35 import GaudiPartProp.Service # noqa: F401
36 from GaudiKernel.SystemOfUnits import micrometer
37 
38 
39 from GaudiPython.Bindings import AppMgr
40 
41 # instantiate the actual (C++) application manager
42 gaudi = AppMgr()
43 
44 # switch off all algorithms
45 gaudi.TopAlg = []
46 
47 # initialize everything properly
48 gaudi.run(1)
49 
50 # get the actual (C++) particle properties service
51 ppsvc = gaudi.gaudiPartProp()
52 
53 # finally: play with the service
54 
55 # get all a self-conjugated particles
56 print(" Self-charge conjugated particles ")
57 selfcc = ppsvc.get(lambda x: x.selfcc())
58 print(selfcc)
59 
60 # set self-charge conjugated conjugated mesons:
61 print(" CC-neutral mesons")
62 mesonscc = ppsvc.get(lambda x: (x.selfcc() and x.isMeson()))
63 print(mesonscc)
64 
65 # set self-charge conjugated conjugated mesons:
66 print(" CC-neutral beauty mesons")
67 mesonscc = ppsvc.get(lambda x: (x.isMeson() and x.hasBottom()))
68 print(mesonscc)
69 
70 # get "stable" particles ( lifetime in excess of 1 micrometer
71 print(" STABLE particles (c*tau> 1 um)")
72 stable = ppsvc.get(lambda x: (x.ctau() > micrometer))
73 print(stable)
GaudiPartProp.Service
Definition: Service.py:1
GaudiPython.Bindings.AppMgr
Definition: Bindings.py:887
GaudiPython.Bindings
Definition: Bindings.py:1
GaudiKernel.SystemOfUnits
Definition: SystemOfUnits.py:1