The Gaudi Framework  master (37c0b60a)
tests.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 
19 """
20 The set of basic decorators for objects from GaudiPartProp package
21 """
22 
23 # =============================================================================
24 __author__ = "Vanya BELYAEV Ivan.Belyaev@nikhef.nl"
25 __version__ = ""
26 # =============================================================================
27 
28 from GaudiPartProp.decorators import Gaudi
29 
30 pp1 = Gaudi.ParticleProperty("NAME1", Gaudi.ParticleID(121), 1.0, 501.0, 0.1, 0.001)
31 pp2 = Gaudi.ParticleProperty("NAME2", Gaudi.ParticleID(122), -1, 502.0, 0.1, 0.001)
32 pp3 = Gaudi.ParticleProperty("NAME3", Gaudi.ParticleID(123), 0, 503.0, 0.1, 0.001)
33 
34 pp1.setAntiParticle(pp2)
35 pp2.setAntiParticle(pp1)
36 
37 lst = [pp3, pp2, pp1]
38 
40 
41 v1.fromLst(lst)
42 
43 for pp in v1:
44  print(pp)
45 
46 print(v1)
47 
48 lst.sort()
49 v1.clear()
50 v1.fromLst(lst)
51 print(v1)
52 
53 pid1 = Gaudi.ParticleID(121)
54 pid2 = Gaudi.ParticleID(122)
55 pid3 = Gaudi.ParticleID(123)
56 
57 lst2 = [pid3, pid2, pid1]
58 
59 v2 = Gaudi.ParticleIDs()
60 v2.fromLst(lst2)
61 print(v2)
62 
63 lst2.sort()
64 
65 v2 = Gaudi.ParticleIDs()
66 v2.fromLst(lst2)
67 print(v2)
68 
69 for pid in lst2:
70  print(pid, pid.pid())
71 
72 
73 def checkPID(pid):
74  print(pid)
75  print(" isValid ", pid.isValid())
76  print(" isMeson ", pid.isMeson())
77  print(" isBaryon ", pid.isBaryon())
78  print(" isDiQuark ", pid.isDiQuark())
79  print(" isHadron ", pid.isHadron())
80  print(" isLepton ", pid.isLepton())
81  print(" isNucleus ", pid.isNucleus())
82  print(" hasUp ", pid.hasUp())
83  print(" hasDown ", pid.hasDown())
84  print(" hasStrange ", pid.hasStrange())
85  print(" hasCharm ", pid.hasCharm())
86  print(" hasBottom ", pid.hasBottom())
87  print(" hasTop ", pid.hasTop())
88  print(" hasQuarks ", pid.hasQuarks())
89  print(" isQuark ", pid.isQuark())
90  print(" threeCharge ", pid.threeCharge())
91  print(" jSpin ", pid.jSpin())
92  print(" sSpin ", pid.sSpin())
93  print(" lSpin ", pid.lSpin())
94  print(" fundamental ", pid.fundamentalID())
95  print(" extra ", pid.extraBits())
96  print(" A ", pid.A())
97  print(" Z ", pid.Z())
98  print(" nLambda ", pid.nLambda())
99 
100 
102 
103 checkPID(lb)
104 
105 c = Gaudi.ParticleID(Gaudi.ParticleID.charm)
106 
107 checkPID(c)
108 
109 nuc = [2212, 1000020040, 1000822080, 450000000]
110 for i in nuc:
112  checkPID(id)
113 
114 # =============================================================================
115 # The END
116 # =============================================================================
std::vector
STL class.
GaudiPartProp.decorators
Definition: decorators.py:1
Gaudi::ParticleProperty
Definition: ParticleProperty.h:37
Gaudi::ParticleID
Definition: ParticleID.h:43
GaudiPartProp.tests.checkPID
def checkPID(pid)
Definition: tests.py:73