19 Simple 'decorator for nodes'
21 from __future__
import print_function
24 __author__ =
"Vanya BELYAEV <Ivan.Belyaev@nikhef.nl>"
31 with warnings.catch_warnings():
32 warnings.simplefilter(
"ignore")
38 Decays = cppyy.gbl.Gaudi.Decays
40 Gaudi = GaudiPython.gbl.Gaudi
47 Decorate the functions
51 if hasattr(opers,
"__call__"):
53 def _call_(self, arg):
57 >>> fun = ... # get the functor
58 >>> arg = ... # get the argument
61 result = opers.__call__(self, arg)
62 return True if result
else False
64 _call_.__doc__ = opers.__call__.__doc__
67 if hasattr(opers,
"__or__"):
73 >>> fun1 = ... # get the functor
74 >>> fun2 = ... # get the functor
77 return opers.__or__(self, arg)
79 _or_.__doc__ = opers.__or__.__doc__
82 if hasattr(opers,
"__ror__"):
88 >>> fun1 = ... # get the functor
89 >>> fun2 = ... # get the functor
92 return opers.__ror__(self, arg)
94 _or_.__doc__ = opers.__or__.__doc__
97 if hasattr(opers,
"__and__"):
103 >>> fun1 = ... # get the functor
104 >>> fun2 = ... # get the functor
105 >>> fun = fun1 & fun2
107 return opers.__and__(self, arg)
109 _and_.__doc__ = opers.__and__.__doc__
112 if hasattr(opers,
"__rand__"):
114 def _rand_(self, arg):
118 >>> fun1 = ... # get the functor
119 >>> fun2 = ... # get the functor
120 >>> fun = fun1 & fun2
122 return opers.__rand__(self, arg)
124 _rand_.__doc__ = opers.__rand__.__doc__
127 if hasattr(opers,
"__invert__"):
129 def _invert_(self, *arg):
133 >>> fun1 = ... # get the functor
136 return opers.__invert__(self, *arg)
138 _invert_.__doc__ = opers.__invert__.__doc__
141 if hasattr(opers,
"__rshift__"):
143 def _rshift_(self, arg):
147 >>> fun1 = ... # get the functor
148 >>> fun1 = ... # get the functor
149 >>> fun = fun1 >> fun2
151 return opers.__rshift__(self, arg)
153 _rshift_.__doc__ = opers.__rshift__.__doc__
156 if hasattr(opers,
"__rrshift__"):
158 def _rrshift_(self, arg):
160 Evaluate the functor as streametr shift
162 >>> fun = ... # get the functor
163 >>> arg = ... # get the argument
166 result = opers.__rrshift__(self, arg)
167 return True if result
else False
169 _rrshift_.__doc__ = opers.__rrshift__.__doc__
173 node.__call__ = _call_
181 node.__rand__ = _rand_
183 node.__rshift__ = _rshift_
185 node.__rrshift__ = _rrshift_
187 node.__invert__ = _invert_
189 node.__repr__ =
lambda s: s.toString()
190 node.__str__ =
lambda s: s.toString()
208 Decays.Nodes.EllPlus,
209 Decays.Nodes.EllMinus,
213 Decays.Nodes.Charged,
214 Decays.Nodes.Positive,
215 Decays.Nodes.Negative,
216 Decays.Nodes.Neutral,
217 Decays.Nodes.HasQuark,
221 Decays.Nodes.Nucleus,
223 Decays.Nodes.ShortLived_,
224 Decays.Nodes.LongLived_,
226 Decays.Nodes.StableCharged,
232 Decays.Nodes.Invalid,
240 opers=Decays.Dict.NodeOps,
248 Any = Decays.Nodes.Any()
249 Pid = Decays.Nodes.Pid
251 Lepton = Decays.Nodes.Lepton()
252 Nu = Decays.Nodes.Nu()
253 Ell = Decays.Nodes.Ell()
254 EllPlus = Decays.Nodes.EllPlus()
255 EllMinus = Decays.Nodes.EllMinus()
256 Hadron = Decays.Nodes.Hadron()
257 Meson = Decays.Nodes.Meson()
258 Baryon = Decays.Nodes.Baryon()
259 Charged = Decays.Nodes.Charged()
260 Positive = Decays.Nodes.Positive()
261 Negative = Decays.Nodes.Negative()
262 Neutral = Decays.Nodes.Neutral()
263 HasQuark = Decays.Nodes.HasQuark
264 JSpin = Decays.Nodes.JSpin
265 SSpin = Decays.Nodes.SSpin
266 LSpin = Decays.Nodes.LSpin
267 Nucleus = Decays.Nodes.Nucleus()
269 And = Decays.Nodes.And
270 Not = Decays.Nodes.Not
271 Invalid = Decays.Nodes.Invalid()
272 _Node = Decays.Nodes._Node
274 PosId = Decays.Nodes.PosID()
275 NegId = Decays.Nodes.NegID()
290 Xb =
HasQuark(Gaudi.ParticleID.bottom)
302 CTau = Decays.Nodes.CTau
303 LongLived_ = Decays.Nodes.LongLived_
304 LongLived = Decays.Nodes.LongLived_()
305 ShortLived_ = Decays.Nodes.ShortLived_
306 ShortLived = Decays.Nodes.ShortLived_()
307 Stable = Decays.Nodes.Stable()
308 StableCharged = Decays.Nodes.StableCharged()
309 Mass = Decays.Nodes.Mass
310 Light = Decays.Nodes.Light
311 Heavy = Decays.Nodes.Heavy
312 Symbol = Decays.Nodes.Symbol
316 if "__main__" == __name__:
317 print(
" decorated objects: %s " % str(_decorated))