test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PhysicsObject.py
Go to the documentation of this file.
1 import copy
2 from PhysicsTools.Heppy.physicsobjects.Particle import Particle
3 
5  '''Wrapper to particle-like C++ objects.'''
6 
7  def __init__(self, physObj):
8  self.physObj = physObj
9  super(PhysicsObject, self).__init__()
10 
11  def __copy__(self):
12  '''Very dirty trick, the physObj is deepcopied...'''
13  physObj = copy.deepcopy( self.physObj )
14  newone = type(self)(physObj)
15  newone.__dict__.update(self.__dict__)
16  newone.physObj = physObj
17  return newone
18 
19  def scaleEnergy( self, scale ):
20  p4 = self.physObj.p4()
21  p4 *= scale
22  self.physObj.setP4( p4 )
23 
24 
25  def __getattr__(self,name):
26  '''Makes all attributes and methods of the wrapped physObj
27  directly available.'''
28  return getattr(self.physObj, name)
29