Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:32:28

0001 import copy
0002 from PhysicsTools.Heppy.physicsobjects.Particle import Particle
0003 
0004 class PhysicsObject(Particle):
0005     '''Wrapper to particle-like C++ objects.'''
0006 
0007     def __init__(self, physObj):
0008         self.physObj = physObj
0009         super(PhysicsObject, self).__init__()
0010 
0011     def __copy__(self):
0012         '''Very dirty trick, the physObj is deepcopied...'''
0013         physObj = copy.deepcopy( self.physObj )
0014         newone = type(self)(physObj)
0015         newone.__dict__.update(self.__dict__)
0016         newone.physObj = physObj
0017         return newone        
0018 
0019     def scaleEnergy( self, scale ):
0020         p4 = self.physObj.p4()
0021         p4 *= scale 
0022         self.physObj.setP4( p4 )  
0023         
0024         
0025     def __getattr__(self,name):
0026         '''Makes all attributes and methods of the wrapped physObj
0027         directly available.'''
0028         return getattr(self.physObj, name)
0029