The Gaudi Framework  master (2df85225)
Loading...
Searching...
No Matches
GaudiPartProp.decorators Namespace Reference

Functions

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

Variables

str __author__ = "Vanya BELYAEV <Ivan.Belyaev@nikhef.nl>"
 
str __version__ = ""
 
 cpp = GaudiPython.gbl
 
 std = GaudiPython.gbl.std
 
 Decays = GaudiPython.gbl.Gaudi.Decays
 
 Gaudi = GaudiPython.gbl.Gaudi
 
 all
 decorate service
 
 get
 decorate the vector of properties
 
 __len__
 
 toList
 decorate the vector of properties
 
 toLst
 
 fromList
 decorate the vector of properties
 
 fromLst
 
 __repr__
 decorate the vector of properties
 
 __str__
 decorate the printout for Gaudi.ParticleProperty
 
 __getattr__
 decorate the attribute access for Gaudi.ParticleProperty
 
 __cmp__
 
 __lt__
 
 __abs__
 
 ParticleIDs
 define the type for std::vector<Gaudi::ParticleID>
 
 _items = std.vector(Decays.Decay.Item)
 
 _decays = std.vector(Decays.Decay)
 
 Items
 
 Decay
 
 Item
 
 validate
 
 _old_symbols_ = Decays.Symbols.symbols
 
 _old_particles_ = Decays.Symbols.particles
 
 symbols
 
 __iter__
 
 Symbols = Decays.Symbols.instance()
 instance:
 

Function Documentation

◆ _abs_1_()

GaudiPartProp.decorators._abs_1_ ( self)
protected

abs for ParticleID

Absolute value for the PID

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

Definition at line 211 of file decorators.py.

211def _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
Holds PDG + LHCb extension particle code, following the PDG particle numbering scheme (pdg....
Definition ParticleID.h:43

◆ _abs_2_()

GaudiPartProp.decorators._abs_2_ ( self)
protected

abs for ParticleProperty

Absolute value for the ParticleProperty

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

Definition at line 225 of file decorators.py.

225def _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

◆ _get_all_()

GaudiPartProp.decorators._get_all_ ( self,
asList = False )
protected

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.

38def _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
Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties allProperties(const Gaudi::Interfaces::IParticlePropertySvc *service)
get all the properties at once

◆ _get_attr_from_PID_()

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

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

Definition at line 152 of file decorators.py.

152def _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_()

GaudiPartProp.decorators._get_pid_ ( self,
cut )
protected

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.

253def _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_()

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

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.

57def _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_()

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

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.

72def _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
std::vector< const Gaudi::ParticleProperty * > ParticleProperties
the actual type of (ordered) container of particle properties

◆ _pp_cmp_()

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

Definition at line 193 of file decorators.py.

193def _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
The comparison criteria for particle properties.

◆ _pp_lt_()

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

Definition at line 201 of file decorators.py.

201def _pp_lt_(pp1, pp2):
202 """Comparison `<` for ParticleProperty objects."""
203 return _pp_cmp_(pp1, pp2) < 0
204
205

◆ _ppv_2_list_()

GaudiPartProp.decorators._ppv_2_list_ ( self)
protected

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.

103def _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_()

GaudiPartProp.decorators._ppv_from_lst_ ( self,
lst )
protected

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.

123def _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_()

GaudiPartProp.decorators._prnt_as_table_ ( self,
* args )
protected

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.

140def _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
GAUDI_API std::string printAsTable(const std::vector< const Gaudi::ParticleProperty * > &particles, const Gaudi::Interfaces::IParticlePropertySvc *service=0)
print a list of properties in a form of the table

◆ _sym_iter_()

GaudiPartProp.decorators._sym_iter_ ( self)
protected
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.

347def _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

◆ _symbols_()

GaudiPartProp.decorators._symbols_ ( self)
protected
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.

331def _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_()

GaudiPartProp.decorators._validate_ ( self,
svc )
protected
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.

309def _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

Variable Documentation

◆ __abs__

GaudiPartProp.decorators.__abs__
private

Definition at line 245 of file decorators.py.

◆ __author__

str GaudiPartProp.decorators.__author__ = "Vanya BELYAEV <Ivan.Belyaev@nikhef.nl>"
private

Definition at line 24 of file decorators.py.

◆ __cmp__

GaudiPartProp.decorators.__cmp__
private

Definition at line 206 of file decorators.py.

◆ __getattr__

GaudiPartProp.decorators.__getattr__
private

decorate the attribute access for Gaudi.ParticleProperty

Definition at line 186 of file decorators.py.

◆ __iter__

GaudiPartProp.decorators.__iter__
private

Definition at line 363 of file decorators.py.

◆ __len__

GaudiPartProp.decorators.__len__
private

Definition at line 96 of file decorators.py.

◆ __lt__

GaudiPartProp.decorators.__lt__
private

Definition at line 207 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__

str GaudiPartProp.decorators.__version__ = ""
private

Definition at line 25 of file decorators.py.

◆ _decays

GaudiPartProp.decorators._decays = std.vector(Decays.Decay)
protected

Definition at line 296 of file decorators.py.

◆ _items

GaudiPartProp.decorators._items = std.vector(Decays.Decay.Item)
protected

Definition at line 291 of file decorators.py.

◆ _old_particles_

GaudiPartProp.decorators._old_particles_ = Decays.Symbols.particles
protected

Definition at line 328 of file decorators.py.

◆ _old_symbols_

GaudiPartProp.decorators._old_symbols_ = Decays.Symbols.symbols
protected

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 = GaudiPython.gbl

Definition at line 31 of file decorators.py.

◆ Decay

GaudiPartProp.decorators.Decay

Definition at line 305 of file decorators.py.

◆ Decays

GaudiPartProp.decorators.Decays = GaudiPython.gbl.Gaudi.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 = GaudiPython.gbl.Gaudi

Definition at line 34 of file decorators.py.

◆ get

GaudiPartProp.decorators.get

decorate the vector of properties

Definition at line 94 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 = GaudiPython.gbl.std

Definition at line 32 of file decorators.py.

◆ Symbols

GaudiPartProp.decorators.Symbols = Decays.Symbols.instance()

instance:

Definition at line 366 of file decorators.py.

◆ symbols

GaudiPartProp.decorators.symbols

Definition at line 362 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.

◆ validate

GaudiPartProp.decorators.validate

Definition at line 324 of file decorators.py.