Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 from PhysicsTools.Heppy.physicsobjects.PhysicsObject import *
0002 
0003 #add __str__ to reco::GenParticle python wrapper
0004 import ROOT
0005 def printGenParticle(self):
0006         tmp = '{className} : {pdgId:>3}, pt = {pt:5.1f}, eta = {eta:5.2f}, phi = {phi:5.2f}, mass = {mass:5.2f}'
0007         base= tmp.format( className = self.__class__.__name__,
0008                            pdgId = self.pdgId(),
0009                            pt = self.pt(),
0010                            eta = self.eta(),
0011                            phi = self.phi(),
0012                            mass = self.mass() )
0013         theStr = '{base}, status = {status:>2}'.format(base=base, status=self.status())
0014         return theStr
0015 setattr(ROOT.reco.GenParticle,"__str__",printGenParticle)
0016 
0017 #from ROOT.reco import GenParticle   # sometimes doesn't work
0018 GenParticle = ROOT.reco.GenParticle  # this instead does