The Gaudi Framework  v38r1 (3af3a718)
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 210 of file decorators.py.

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

◆ _abs_2_()

def GaudiPartProp.decorators._abs_2_ (   self)
private

abs for ParticleProperty

Absolute value for the ParticleProperty

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

Definition at line 224 of file decorators.py.

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

◆ _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 37 of file decorators.py.

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

◆ _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 151 of file decorators.py.

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

◆ _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 252 of file decorators.py.

252 def _get_pid_(self, cut):
253  """
254  Get particleID objects which satisfy some criteria
255 
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
259 
260  """
261  size = self.size()
262  index = 0
263  result = []
264  while index < size:
265  pid = self.at(index)
266  if cut(pid):
267  result.append(pid)
268  index += 1
269  return result
270 
271 

◆ _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 56 of file decorators.py.

56 def _get_pp_(self, cut, asList=False):
57  """
58  Simple 'get' method for Gaudi::Interfaces::IParticlePropertySvc
59  service to extract the properties which satisfy some criteria
60 
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
64 
65  """
66  _all = self.all()
67  return _all.get(cut, asList)
68 
69 

◆ _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 71 of file decorators.py.

71 def _get_ppv_(self, cut, asList=False):
72  """
73  Simple 'get' method for Gaudi::Interfaces::IParticlePropertySvc
74  service to extract the properties which satisfy some criteria
75 
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
79 
80  """
81  result = []
82  for pp in self:
83  if cut(pp):
84  result.append(pp)
85  if asList:
86  return result
88  vct.fromList(result)
89  return vct
90 
91 
92 # ## decorate service
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
97 )
98 
99 
100 # =============================================================================

◆ _pp_cmp_()

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

Definition at line 192 of file decorators.py.

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

◆ _pp_lt_()

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

Definition at line 200 of file decorators.py.

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

◆ _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 102 of file decorators.py.

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

◆ _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 122 of file decorators.py.

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

◆ _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 139 of file decorators.py.

139 def _prnt_as_table_(self, *args):
140  """
141  Print vector of particle properties in a form of table
142 
143  >>> print vct.asTable()
144 
145  """
146  return Gaudi.ParticleProperties.printAsTable(self, *args)
147 
148 
149 # ============================================================================
150 # 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 346 of file decorators.py.

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

◆ _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 330 of file decorators.py.

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

◆ _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 308 of file decorators.py.

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

Variable Documentation

◆ __author__

GaudiPartProp.decorators.__author__
private

Definition at line 23 of file decorators.py.

◆ __getattr__

GaudiPartProp.decorators.__getattr__
private

decorate the attribute access for Gaudi.ParticleProperty

Definition at line 185 of file decorators.py.

◆ __len__

GaudiPartProp.decorators.__len__
private

Definition at line 176 of file decorators.py.

◆ __repr__

GaudiPartProp.decorators.__repr__
private

decorate the vector of properties

Definition at line 172 of file decorators.py.

◆ __str__

GaudiPartProp.decorators.__str__
private

decorate the printout for Gaudi::ParticleProperty

decorate the printout for Gaudi::ParticleID

Definition at line 175 of file decorators.py.

◆ __version__

GaudiPartProp.decorators.__version__
private

Definition at line 24 of file decorators.py.

◆ _decays

GaudiPartProp.decorators._decays
private

Definition at line 295 of file decorators.py.

◆ _items

GaudiPartProp.decorators._items
private

Definition at line 290 of file decorators.py.

◆ _old_particles_

GaudiPartProp.decorators._old_particles_
private

Definition at line 327 of file decorators.py.

◆ _old_symbols_

GaudiPartProp.decorators._old_symbols_
private

Definition at line 326 of file decorators.py.

◆ all

GaudiPartProp.decorators.all

decorate service

Definition at line 52 of file decorators.py.

◆ cpp

GaudiPartProp.decorators.cpp

Definition at line 30 of file decorators.py.

◆ Decay

GaudiPartProp.decorators.Decay

Definition at line 304 of file decorators.py.

◆ Decays

GaudiPartProp.decorators.Decays

Definition at line 32 of file decorators.py.

◆ fromList

GaudiPartProp.decorators.fromList

decorate the vector of properties

Definition at line 169 of file decorators.py.

◆ fromLst

GaudiPartProp.decorators.fromLst

Definition at line 170 of file decorators.py.

◆ Gaudi

GaudiPartProp.decorators.Gaudi

Definition at line 33 of file decorators.py.

◆ get

GaudiPartProp.decorators.get

decorate the vector of properties

Definition at line 282 of file decorators.py.

◆ Item

GaudiPartProp.decorators.Item

Definition at line 305 of file decorators.py.

◆ Items

GaudiPartProp.decorators.Items

Definition at line 303 of file decorators.py.

◆ ParticleIDs

GaudiPartProp.decorators.ParticleIDs

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

Definition at line 248 of file decorators.py.

◆ std

GaudiPartProp.decorators.std

Definition at line 31 of file decorators.py.

◆ Symbols

GaudiPartProp.decorators.Symbols

instance:

Definition at line 365 of file decorators.py.

◆ toList

GaudiPartProp.decorators.toList

decorate the vector of properties

Definition at line 166 of file decorators.py.

◆ toLst

GaudiPartProp.decorators.toLst

Definition at line 167 of file decorators.py.

GaudiPartProp.decorators._sym_iter_
def _sym_iter_(self)
Definition: decorators.py:346
Gaudi::ParticleProperties::allProperties
Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties allProperties(const Gaudi::Interfaces::IParticlePropertySvc *service)
get all the properties at once
Definition: IParticlePropertySvc.cpp:201
std::vector
STL class.
GaudiPartProp.decorators._abs_1_
def _abs_1_(self)
abs for ParticleID
Definition: decorators.py:210
GaudiPartProp.decorators._abs_2_
def _abs_2_(self)
abs for ParticleProperty
Definition: decorators.py:224
GaudiPartProp.decorators._get_ppv_
def _get_ppv_(self, cut, asList=False)
simple "get" method for the service
Definition: decorators.py:71
GaudiPartProp.decorators._prnt_as_table_
def _prnt_as_table_(self, *args)
Print vector of particle properties in a form of table.
Definition: decorators.py:139
GaudiPartProp.decorators._old_symbols_
_old_symbols_
Definition: decorators.py:326
GaudiPartProp.decorators._symbols_
def _symbols_(self)
Definition: decorators.py:330
GaudiPartProp.decorators._get_pid_
def _get_pid_(self, cut)
get particleID objects whcih satisfy some criteria
Definition: decorators.py:252
GaudiPartProp.decorators._pp_lt_
def _pp_lt_(pp1, pp2)
Definition: decorators.py:200
GaudiPartProp.decorators._pp_cmp_
def _pp_cmp_(pp1, pp2)
Definition: decorators.py:192
GaudiPartProp.decorators._get_pp_
def _get_pp_(self, cut, asList=False)
simple "get" method for the service
Definition: decorators.py:56
GaudiPartProp.decorators._get_attr_from_PID_
def _get_attr_from_PID_(self, attr)
Definition: decorators.py:151
GaudiPartProp.decorators._ppv_2_list_
def _ppv_2_list_(self)
Convert Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties into python list.
Definition: decorators.py:102
GaudiPartProp.decorators._get_all_
def _get_all_(self, asList=False)
get all particle properties form the service
Definition: decorators.py:37
GaudiPartProp.decorators._validate_
def _validate_(self, svc)
Definition: decorators.py:308
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:122