PhysicsTools
Heppy
python
physicsobjects
GenParticle.py
Go to the documentation of this file.
1
from
PhysicsTools.Heppy.physicsobjects.PhysicsObject
import
*
2
3
#add __str__ to reco::GenParticle python wrapper
4
import
ROOT
5
def
printGenParticle
(self):
6
tmp =
'{className} : {pdgId:>3}, pt = {pt:5.1f}, eta = {eta:5.2f}, phi = {phi:5.2f}, mass = {mass:5.2f}'
7
base= tmp.format( className = self.__class__.__name__,
8
pdgId = self.pdgId(),
9
pt = self.pt(),
10
eta = self.eta(),
11
phi = self.phi(),
12
mass = self.mass() )
13
theStr =
'{base}, status = {status:>2}'
.
format
(base=base, status=self.status())
14
return
theStr
15
setattr(ROOT.reco.GenParticle,
"__str__"
,printGenParticle)
16
17
#from ROOT.reco import GenParticle # sometimes doesn't work
18
GenParticle = ROOT.reco.GenParticle
# this instead does
PhysicsObject
format
GenParticle.printGenParticle
def printGenParticle(self)
Definition:
GenParticle.py:5
Generated for CMSSW Reference Manual by
1.8.16