20 The set of basic decorators for objects from GaudiPartProp package
23 __author__ =
"Vanya BELYAEV <Ivan.Belyaev@nikhef.nl>"
31 std = GaudiPython.gbl.std
32 Decays = GaudiPython.gbl.Gaudi.Decays
33 Gaudi = GaudiPython.gbl.Gaudi
39 Get all particle properties from the service
41 >>> svc = ... # get the service
42 >>> all = svc.all () # get all properties
52 Gaudi.Interfaces.IParticlePropertySvc.all = _get_all_
58 Simple 'get' method for Gaudi::Interfaces::IParticlePropertySvc
59 service to extract the properties which satisfy some criteria
61 >>> svc = ... # get service (Gaudi::Interfaces::IParticlePropertySvc) or vector
62 >>> leptons = svc.get ( lambda s : s.pid().isLepton() ) # get all leptons
63 >>> longlived = svc.get ( lambda s : s.ctau() > 0.001 ) # get longlived
67 return _all.get(cut, asList)
73 Simple 'get' method for Gaudi::Interfaces::IParticlePropertySvc
74 service to extract the properties which satisfy some criteria
76 >>> svc = ... # get service (Gaudi::Interfaces::IParticlePropertySvc) or vector
77 >>> leptons = svc.get ( lambda s : s.pid().isLepton() ) # get all leptons
78 >>> longlived = svc.get ( lambda s : s.ctau() > 0.001 ) # get longlived
93 Gaudi.Interfaces.IParticlePropertySvc.get = _get_pp_
94 Gaudi.Interfaces.IParticlePropertySvc.ParticleProperties.get = _get_ppv_
95 Gaudi.Interfaces.IParticlePropertySvc.__len__ = (
96 Gaudi.Interfaces.IParticlePropertySvc.size
104 Convert Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties into python list
106 >>> ppv = ... # get the vector
107 >>> lst = ppv.toList () # convert it to the list
124 Append the iterable sequence 'lst' to the vector of
127 >>> Vct = std.vector('const Gaudi::ParticleProperty*')
128 >>> lst = [ pp1 , pp2 , pp3 ]
130 >>> vct.fromList ( lst )
141 Print vector of particle properties in a form of table
143 >>> print vct.asTable()
153 Delegate the evaluation of unknown atrributes to Gaudi.ParticleID class
160 if hasattr(_pid, attr):
161 return getattr(_pid, attr)
162 raise AttributeError(
"Unknown attribute: %s " % attr)
166 Gaudi.Interfaces.IParticlePropertySvc.ParticleProperties.toList = _ppv_2_list_
167 Gaudi.Interfaces.IParticlePropertySvc.ParticleProperties.toLst = _ppv_2_list_
169 Gaudi.Interfaces.IParticlePropertySvc.ParticleProperties.fromList = _ppv_from_lst_
170 Gaudi.Interfaces.IParticlePropertySvc.ParticleProperties.fromLst = _ppv_from_lst_
172 Gaudi.Interfaces.IParticlePropertySvc.ParticleProperties.__repr__ = (
175 Gaudi.Interfaces.IParticlePropertySvc.ParticleProperties.__str__ = _prnt_as_table_
176 Gaudi.Interfaces.IParticlePropertySvc.ParticleProperties.__len__ = (
177 Gaudi.Interfaces.IParticlePropertySvc.ParticleProperties.size
181 Gaudi.ParticleProperty.__str__ = Gaudi.ParticleProperty.toString
182 Gaudi.ParticleProperty.__repr__ = Gaudi.ParticleProperty.toString
185 Gaudi.ParticleProperty.__getattr__ = _get_attr_from_PID_
188 Gaudi.ParticleID.__str__ = Gaudi.ParticleID.toString
189 Gaudi.ParticleID.__repr__ = Gaudi.ParticleID.toString
193 """Comparison for ParticleProperty objects."""
197 return -1
if comparator(pp1, pp2)
else 1
201 """Comparison `<` for ParticleProperty objects."""
205 Gaudi.ParticleProperty.__cmp__ = _pp_cmp_
206 Gaudi.ParticleProperty.__lt__ = _pp_lt_
212 Absolute value for the PID
226 Absolute value for the ParticleProperty
233 _pid = self.particleID()
234 if self.selfcc()
or 0 <= _pid.pid():
238 if _anti
and 0 <= _anti.particleID().pid():
244 Gaudi.ParticleID.__abs__ = _abs_1_
245 Gaudi.ParticleProperty.__abs__ = _abs_2_
254 Get particleID objects which satisfy some criteria
256 >>> pids = ... # vector of LCHb::ParticleID objects
257 >>> good = pids.get( lambda s : s.isLepton() ) # get leptons
258 >>> scalar = pids.get( lambda s : 1 == s.jSpin() ) # get scalars
273 Gaudi.ParticleIDs.toList = _ppv_2_list_
274 Gaudi.ParticleIDs.toLst = _ppv_2_list_
276 Gaudi.ParticleIDs.fromList = _ppv_from_lst_
277 Gaudi.ParticleIDs.fromLst = _ppv_from_lst_
279 Gaudi.ParticleIDs.__repr__ =
lambda s: s.toList().
__repr__()
280 Gaudi.ParticleIDs.__str__ =
lambda s: s.toList().
__str__()
282 Gaudi.ParticleIDs.get = _get_pid_
284 Decays.Decay.Item.__str__ =
lambda s: s.name()
285 Decays.Decay.Item.__repr__ =
lambda s: s.name()
287 Decays.Decay.__str__ =
lambda s: s.toString()
288 Decays.Decay.__repr__ =
lambda s: s.toString()
291 _items.toList =
lambda s: [i
for i
in s]
292 _items.toLst =
lambda s: [i
for i
in s]
293 _items.__str__ =
lambda s: s.toList().
__str__()
294 _items.__repr__ =
lambda s: s.toList().
__repr__()
296 _decays.toList =
lambda s: [i
for i
in s]
297 _decays.toLst =
lambda s: [i
for i
in s]
298 _decays.__str__ =
lambda s: s.toList().
__str__()
299 _decays.__repr__ =
lambda s: s.toList().
__repr__()
301 Gaudi.Interfaces.IParticlePropertySvc.ParticleIDs = Gaudi.ParticleIDs
302 Gaudi.Interfaces.IParticlePropertySvc.Decays = _decays
303 Gaudi.Interfaces.IParticlePropertySvc.Items = _items
305 Gaudi.Interfaces.IParticlePropertySvc.Item = Decays.Decay.Item
310 Validate the vector of items/decays
312 >>> vct = ... # get the vector of items/decays
313 >>> svc = ... # get the service
314 >>> vcs.vaildate ( svc ) # validate
320 return cpp.StatusCode(cpp.StatusCode.SUCCESS)
323 _decays.validate = _validate_
324 _items.validate = _validate_
326 _old_symbols_ = Decays.Symbols.symbols
327 _old_particles_ = Decays.Symbols.particles
332 Get all known predefined symbols:
334 >>> syms = ... # get the table of symbols
335 >>> s = syms.symbols() # get the list of symbols
348 Iteration over all known symbols
350 >>> syms = ... # get the table of symbols
352 ... print ' help for %s :' % s , syms.symbol ( s )
354 _list = self.symbols()
356 while _i < len(_list):
361 Decays.Symbols.symbols = _symbols_
362 Decays.Symbols.__iter__ = _sym_iter_
365 Symbols = Decays.Symbols.instance()