The Gaudi Framework  master (d98a2936)
GaudiPartProp.decorators Namespace Reference

Functions

def _get_all_ (self, asList=False)
 get all particle properties form the service More...
 
def _get_pp_ (self, cut, asList=False)
 simple "get" method for the service More...
 
def _get_ppv_ (self, cut, asList=False)
 simple "get" method for the service More...
 
def _ppv_2_list_ (self)
 Convert Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties into python list. More...
 
def _ppv_from_lst_ (self, lst)
 convert python list into Gaudi.IParticlePropertisvc.ParticleProperties More...
 
def _prnt_as_table_ (self, *args)
 Print vector of particle properties in a form of table. More...
 
def _get_attr_from_PID_ (self, attr)
 
def _pp_cmp_ (pp1, pp2)
 
def _pp_lt_ (pp1, pp2)
 
def _abs_1_ (self)
 abs for ParticleID More...
 
def _abs_2_ (self)
 abs for ParticleProperty More...
 
def _get_pid_ (self, cut)
 get particleID objects whcih satisfy some criteria More...
 
def _validate_ (self, svc)
 
def _symbols_ (self)
 
def _sym_iter_ (self)
 

Variables

 __author__
 
 __version__
 
 cpp
 
 std
 
 Decays
 
 Gaudi
 
 all
 decorate service More...
 
 toList
 decorate the vector of properties More...
 
 toLst
 
 fromList
 decorate the vector of properties More...
 
 fromLst
 
 __repr__
 decorate the vector of properties More...
 
 __str__
 decorate the printout for Gaudi::ParticleProperty More...
 
 __len__
 
 __getattr__
 decorate the attribute access for Gaudi.ParticleProperty More...
 
 ParticleIDs
 define the type for std::vector<Gaudi::ParticleID> More...
 
 get
 decorate the vector of properties More...
 
 _items
 
 _decays
 
 Items
 
 Decay
 
 Item
 
 _old_symbols_
 
 _old_particles_
 
 Symbols
 instance: More...
 

Function Documentation

◆ _abs_1_()

def GaudiPartProp.decorators._abs_1_ (   self)
private

abs for ParticleID

Absolute value for the PID

>>> p  = ...
>>> pa = abs ( p  )

Definition at line 211 of file decorators.py.

211 def _abs_1_(self):
212  """
213  Absolute value for the PID
214 
215  >>> p = ...
216  >>> pa = abs ( p )
217 
218  """
219  if 0 <= self.pid():
220  return self
221  return Gaudi.ParticleID(self.abspid())
222 
223 

◆ _abs_2_()

def GaudiPartProp.decorators._abs_2_ (   self)
private

abs for ParticleProperty

Absolute value for the ParticleProperty

>>> p  = ...
>>> pa = abs ( p  )

Definition at line 225 of file decorators.py.

225 def _abs_2_(self):
226  """
227  Absolute value for the ParticleProperty
228 
229  >>> p = ...
230  >>> pa = abs ( p )
231 
232  """
233 
234  _pid = self.particleID()
235  if self.selfcc() or 0 <= _pid.pid():
236  return self
237 
238  _anti = self.anti()
239  if _anti and 0 <= _anti.particleID().pid():
240  return _anti
241 
242  return self
243 
244 
245 Gaudi.ParticleID.__abs__ = _abs_1_
246 Gaudi.ParticleProperty.__abs__ = _abs_2_
247 

◆ _get_all_()

def GaudiPartProp.decorators._get_all_ (   self,
  asList = False 
)
private

get all particle properties form the service

Get all particle properties from the service

>>> svc = ... # get the service
>>> all = svc.all ()  # get all properties

Definition at line 38 of file decorators.py.

38 def _get_all_(self, asList=False):
39  """
40  Get all particle properties from the service
41 
42  >>> svc = ... # get the service
43  >>> all = svc.all () # get all properties
44 
45  """
47  if not asList:
48  return _all
49  return _all.toList()
50 
51 

◆ _get_attr_from_PID_()

def GaudiPartProp.decorators._get_attr_from_PID_ (   self,
  attr 
)
private
Delegate the evaluation of unknown atrributes to Gaudi.ParticleID class

>>> pp = ...
>>> print pp.jSpin()

Definition at line 152 of file decorators.py.

152 def _get_attr_from_PID_(self, attr):
153  """
154  Delegate the evaluation of unknown atrributes to Gaudi.ParticleID class
155 
156  >>> pp = ...
157  >>> print pp.jSpin()
158 
159  """
160  _pid = self.pid()
161  if hasattr(_pid, attr):
162  return getattr(_pid, attr)
163  raise AttributeError("Unknown attribute: %s " % attr)
164 
165 

◆ _get_pid_()

def GaudiPartProp.decorators._get_pid_ (   self,
  cut 
)
private

get particleID objects whcih satisfy some criteria

Get particleID objects which satisfy some criteria

>>> pids   = ...  # vector of LCHb::ParticleID objects
>>> good   = pids.get( lambda s :   s.isLepton() )  # get leptons
>>> scalar = pids.get( lambda s : 1 == s.jSpin() )  # get scalars

Definition at line 253 of file decorators.py.

253 def _get_pid_(self, cut):
254  """
255  Get particleID objects which satisfy some criteria
256 
257  >>> pids = ... # vector of LCHb::ParticleID objects
258  >>> good = pids.get( lambda s : s.isLepton() ) # get leptons
259  >>> scalar = pids.get( lambda s : 1 == s.jSpin() ) # get scalars
260 
261  """
262  size = self.size()
263  index = 0
264  result = []
265  while index < size:
266  pid = self.at(index)
267  if cut(pid):
268  result.append(pid)
269  index += 1
270  return result
271 
272 

◆ _get_pp_()

def GaudiPartProp.decorators._get_pp_ (   self,
  cut,
  asList = False 
)
private

simple "get" method for the service

Simple 'get' method for Gaudi::Interfaces::IParticlePropertySvc
service to extract the properties which satisfy some criteria

>>> svc = ...  # get service (Gaudi::Interfaces::IParticlePropertySvc) or vector
>>> leptons   = svc.get ( lambda s : s.pid().isLepton() )  # get all leptons
>>> longlived = svc.get ( lambda s : s.ctau() > 0.001   )  # get longlived

Definition at line 57 of file decorators.py.

57 def _get_pp_(self, cut, asList=False):
58  """
59  Simple 'get' method for Gaudi::Interfaces::IParticlePropertySvc
60  service to extract the properties which satisfy some criteria
61 
62  >>> svc = ... # get service (Gaudi::Interfaces::IParticlePropertySvc) or vector
63  >>> leptons = svc.get ( lambda s : s.pid().isLepton() ) # get all leptons
64  >>> longlived = svc.get ( lambda s : s.ctau() > 0.001 ) # get longlived
65 
66  """
67  _all = self.all()
68  return _all.get(cut, asList)
69 
70 

◆ _get_ppv_()

def GaudiPartProp.decorators._get_ppv_ (   self,
  cut,
  asList = False 
)
private

simple "get" method for the service

Simple 'get' method for Gaudi::Interfaces::IParticlePropertySvc
service to extract the properties which satisfy some criteria

>>> svc = ...  # get service (Gaudi::Interfaces::IParticlePropertySvc) or vector
>>> leptons   = svc.get ( lambda s : s.pid().isLepton() )  # get all leptons
>>> longlived = svc.get ( lambda s : s.ctau() > 0.001   )  # get longlived

Definition at line 72 of file decorators.py.

72 def _get_ppv_(self, cut, asList=False):
73  """
74  Simple 'get' method for Gaudi::Interfaces::IParticlePropertySvc
75  service to extract the properties which satisfy some criteria
76 
77  >>> svc = ... # get service (Gaudi::Interfaces::IParticlePropertySvc) or vector
78  >>> leptons = svc.get ( lambda s : s.pid().isLepton() ) # get all leptons
79  >>> longlived = svc.get ( lambda s : s.ctau() > 0.001 ) # get longlived
80 
81  """
82  result = []
83  for pp in self:
84  if cut(pp):
85  result.append(pp)
86  if asList:
87  return result
89  vct.fromList(result)
90  return vct
91 
92 
93 # ## decorate service
94 Gaudi.Interfaces.IParticlePropertySvc.get = _get_pp_
95 Gaudi.Interfaces.IParticlePropertySvc.ParticleProperties.get = _get_ppv_
96 Gaudi.Interfaces.IParticlePropertySvc.__len__ = (
97  Gaudi.Interfaces.IParticlePropertySvc.size
98 )
99 
100 
101 # =============================================================================

◆ _pp_cmp_()

def GaudiPartProp.decorators._pp_cmp_ (   pp1,
  pp2 
)
private
Comparison for ParticleProperty objects.

Definition at line 193 of file decorators.py.

193 def _pp_cmp_(pp1, pp2):
194  """Comparison for ParticleProperty objects."""
195  if pp1 == pp2:
196  return 0
197  comparator = Gaudi.ParticleProperty.Compare()
198  return -1 if comparator(pp1, pp2) else 1
199 
200 

◆ _pp_lt_()

def GaudiPartProp.decorators._pp_lt_ (   pp1,
  pp2 
)
private
Comparison `<` for ParticleProperty objects.

Definition at line 201 of file decorators.py.

201 def _pp_lt_(pp1, pp2):
202  """Comparison `<` for ParticleProperty objects."""
203  return _pp_cmp_(pp1, pp2) < 0
204 
205 
206 Gaudi.ParticleProperty.__cmp__ = _pp_cmp_
207 Gaudi.ParticleProperty.__lt__ = _pp_lt_
208 
209 

◆ _ppv_2_list_()

def GaudiPartProp.decorators._ppv_2_list_ (   self)
private

Convert Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties into python list.

Convert Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties into python list

>>> ppv = ...   # get the vector
>>> lst = ppv.toList () # convert it to the list

Definition at line 103 of file decorators.py.

103 def _ppv_2_list_(self):
104  """
105  Convert Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties into python list
106 
107  >>> ppv = ... # get the vector
108  >>> lst = ppv.toList () # convert it to the list
109 
110  """
111  result = []
112  size = self.size()
113  index = 0
114  while index < size:
115  pp = self.at(index)
116  result.append(pp)
117  index += 1
118  return result
119 
120 
121 # ==============================================================================

◆ _ppv_from_lst_()

def GaudiPartProp.decorators._ppv_from_lst_ (   self,
  lst 
)
private

convert python list into Gaudi.IParticlePropertisvc.ParticleProperties

Append the iterable sequence 'lst' to the vector of
particle properties:

>>> Vct = std.vector('const Gaudi::ParticleProperty*')
>>> lst = [ pp1 , pp2 , pp3 ]
>>> vct = Vct()
>>> vct.fromList ( lst )

Definition at line 123 of file decorators.py.

123 def _ppv_from_lst_(self, lst):
124  """
125  Append the iterable sequence 'lst' to the vector of
126  particle properties:
127 
128  >>> Vct = std.vector('const Gaudi::ParticleProperty*')
129  >>> lst = [ pp1 , pp2 , pp3 ]
130  >>> vct = Vct()
131  >>> vct.fromList ( lst )
132 
133  """
134  for item in lst:
135  self.push_back(item)
136 
137 
138 # =============================================================================

◆ _prnt_as_table_()

def GaudiPartProp.decorators._prnt_as_table_ (   self,
args 
)
private

Print vector of particle properties in a form of table.

Print vector of particle properties in a form of table

>>> print vct.asTable()

Definition at line 140 of file decorators.py.

140 def _prnt_as_table_(self, *args):
141  """
142  Print vector of particle properties in a form of table
143 
144  >>> print vct.asTable()
145 
146  """
147  return Gaudi.ParticleProperties.printAsTable(self, *args)
148 
149 
150 # ============================================================================
151 # delegate the evaluation of unknown atrributes to Gaudi.ParticleID class

◆ _sym_iter_()

def GaudiPartProp.decorators._sym_iter_ (   self)
private
Iteration over all known symbols

>>> syms = ...  # get the table of symbols
>>> for s in syms :
...    print ' help for %s :' % s , syms.symbol ( s )

Definition at line 347 of file decorators.py.

347 def _sym_iter_(self):
348  """
349  Iteration over all known symbols
350 
351  >>> syms = ... # get the table of symbols
352  >>> for s in syms :
353  ... print ' help for %s :' % s , syms.symbol ( s )
354  """
355  _list = self.symbols()
356  _i = 0
357  while _i < len(_list):
358  yield _list[_i]
359  _i += 1
360 
361 
362 Decays.Symbols.symbols = _symbols_
363 Decays.Symbols.__iter__ = _sym_iter_
364 

◆ _symbols_()

def GaudiPartProp.decorators._symbols_ (   self)
private
Get all known predefined symbols:

>>> syms = ...         # get the table of symbols
>>> s = syms.symbols() # get the list of symbols

Definition at line 331 of file decorators.py.

331 def _symbols_(self):
332  """
333  Get all known predefined symbols:
334 
335  >>> syms = ... # get the table of symbols
336  >>> s = syms.symbols() # get the list of symbols
337 
338  """
339  strings = std.vector("std::string")()
340  _old_symbols_(self, strings)
341  res = []
342  for s in strings:
343  res.append(s)
344  return res
345 
346 

◆ _validate_()

def GaudiPartProp.decorators._validate_ (   self,
  svc 
)
private
Validate the vector of items/decays

>>> vct = ...            # get the vector of items/decays
>>> svc = ...            # get the service
>>> vcs.vaildate ( svc ) # validate

Definition at line 309 of file decorators.py.

309 def _validate_(self, svc):
310  """
311  Validate the vector of items/decays
312 
313  >>> vct = ... # get the vector of items/decays
314  >>> svc = ... # get the service
315  >>> vcs.vaildate ( svc ) # validate
316  """
317  for o in self:
318  sc = o.validate(svc)
319  if sc.isFailure():
320  return sc
321  return cpp.StatusCode(cpp.StatusCode.SUCCESS)
322 
323 
324 _decays.validate = _validate_
325 _items.validate = _validate_
326 

Variable Documentation

◆ __author__

GaudiPartProp.decorators.__author__
private

Definition at line 24 of file decorators.py.

◆ __getattr__

GaudiPartProp.decorators.__getattr__
private

decorate the attribute access for Gaudi.ParticleProperty

Definition at line 186 of file decorators.py.

◆ __len__

GaudiPartProp.decorators.__len__
private

Definition at line 177 of file decorators.py.

◆ __repr__

GaudiPartProp.decorators.__repr__
private

decorate the vector of properties

Definition at line 173 of file decorators.py.

◆ __str__

GaudiPartProp.decorators.__str__
private

decorate the printout for Gaudi::ParticleProperty

decorate the printout for Gaudi::ParticleID

Definition at line 176 of file decorators.py.

◆ __version__

GaudiPartProp.decorators.__version__
private

Definition at line 25 of file decorators.py.

◆ _decays

GaudiPartProp.decorators._decays
private

Definition at line 296 of file decorators.py.

◆ _items

GaudiPartProp.decorators._items
private

Definition at line 291 of file decorators.py.

◆ _old_particles_

GaudiPartProp.decorators._old_particles_
private

Definition at line 328 of file decorators.py.

◆ _old_symbols_

GaudiPartProp.decorators._old_symbols_
private

Definition at line 327 of file decorators.py.

◆ all

GaudiPartProp.decorators.all

decorate service

Definition at line 53 of file decorators.py.

◆ cpp

GaudiPartProp.decorators.cpp

Definition at line 31 of file decorators.py.

◆ Decay

GaudiPartProp.decorators.Decay

Definition at line 305 of file decorators.py.

◆ Decays

GaudiPartProp.decorators.Decays

Definition at line 33 of file decorators.py.

◆ fromList

GaudiPartProp.decorators.fromList

decorate the vector of properties

Definition at line 170 of file decorators.py.

◆ fromLst

GaudiPartProp.decorators.fromLst

Definition at line 171 of file decorators.py.

◆ Gaudi

GaudiPartProp.decorators.Gaudi

Definition at line 34 of file decorators.py.

◆ get

GaudiPartProp.decorators.get

decorate the vector of properties

Definition at line 283 of file decorators.py.

◆ Item

GaudiPartProp.decorators.Item

Definition at line 306 of file decorators.py.

◆ Items

GaudiPartProp.decorators.Items

Definition at line 304 of file decorators.py.

◆ ParticleIDs

GaudiPartProp.decorators.ParticleIDs

define the type for std::vector<Gaudi::ParticleID>

Definition at line 249 of file decorators.py.

◆ std

GaudiPartProp.decorators.std

Definition at line 32 of file decorators.py.

◆ Symbols

GaudiPartProp.decorators.Symbols

instance:

Definition at line 366 of file decorators.py.

◆ toList

GaudiPartProp.decorators.toList

decorate the vector of properties

Definition at line 167 of file decorators.py.

◆ toLst

GaudiPartProp.decorators.toLst

Definition at line 168 of file decorators.py.

GaudiPartProp.decorators._sym_iter_
def _sym_iter_(self)
Definition: decorators.py:347
Gaudi::ParticleProperties::allProperties
Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties allProperties(const Gaudi::Interfaces::IParticlePropertySvc *service)
get all the properties at once
Definition: IParticlePropertySvc.cpp:201
GaudiPartProp.decorators._abs_1_
def _abs_1_(self)
abs for ParticleID
Definition: decorators.py:211
GaudiPartProp.decorators._abs_2_
def _abs_2_(self)
abs for ParticleProperty
Definition: decorators.py:225
GaudiPartProp.decorators._get_ppv_
def _get_ppv_(self, cut, asList=False)
simple "get" method for the service
Definition: decorators.py:72
GaudiPartProp.decorators._prnt_as_table_
def _prnt_as_table_(self, *args)
Print vector of particle properties in a form of table.
Definition: decorators.py:140
GaudiPartProp.decorators._old_symbols_
_old_symbols_
Definition: decorators.py:327
GaudiPartProp.decorators._symbols_
def _symbols_(self)
Definition: decorators.py:331
GaudiPartProp.decorators._get_pid_
def _get_pid_(self, cut)
get particleID objects whcih satisfy some criteria
Definition: decorators.py:253
Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties
std::vector< const Gaudi::ParticleProperty * > ParticleProperties
the actual type of (ordered) container of particle properties
Definition: IParticlePropertySvc.h:34
GaudiPartProp.decorators._pp_lt_
def _pp_lt_(pp1, pp2)
Definition: decorators.py:201
GaudiPartProp.decorators._pp_cmp_
def _pp_cmp_(pp1, pp2)
Definition: decorators.py:193
GaudiPartProp.decorators._get_pp_
def _get_pp_(self, cut, asList=False)
simple "get" method for the service
Definition: decorators.py:57
GaudiPartProp.decorators._get_attr_from_PID_
def _get_attr_from_PID_(self, attr)
Definition: decorators.py:152
GaudiPartProp.decorators._ppv_2_list_
def _ppv_2_list_(self)
Convert Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties into python list.
Definition: decorators.py:103
GaudiPartProp.decorators._get_all_
def _get_all_(self, asList=False)
get all particle properties form the service
Definition: decorators.py:38
GaudiPartProp.decorators._validate_
def _validate_(self, svc)
Definition: decorators.py:309
Gaudi::ParticleID
Definition: ParticleID.h:43
Gaudi::ParticleProperty::Compare
Definition: ParticleProperty.h:44
Gaudi::ParticleProperties::printAsTable
MsgStream & printAsTable(const std::set< Gaudi::ParticleID, C_, A_ > &particles, MsgStream &stream, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
Definition: ParticleProperty.h:394
GaudiPartProp.decorators._ppv_from_lst_
def _ppv_from_lst_(self, lst)
convert python list into Gaudi.IParticlePropertisvc.ParticleProperties
Definition: decorators.py:123