PhysicsTools
Heppy
python
analyzers
examples
ZJetsTreeAnalyzer.py
Go to the documentation of this file.
1
from
__future__
import
absolute_import
2
from
PhysicsTools.Heppy.analyzers.core.TreeAnalyzerNumpy
import
TreeAnalyzerNumpy
3
from
.
import
ntuple
4
5
class
ZJetsTreeAnalyzer
(TreeAnalyzerNumpy):
6
7
def
beginLoop
(self, setup):
8
super(ZJetsTreeAnalyzer, self).
beginLoop
(setup)
9
ntuple.bookParticle
(self.tree,
'jet1'
)
10
ntuple.bookParticle
(self.tree,
'jet1_gen'
)
11
ntuple.bookParticle
(self.tree,
'jet2'
)
12
ntuple.bookParticle
(self.tree,
'jet2_gen'
)
13
ntuple.bookParticle
(self.tree,
'dimuon'
)
14
ntuple.bookParticle
(self.tree,
'dimuon_leg1'
)
15
ntuple.bookParticle
(self.tree,
'dimuon_leg2'
)
16
17
18
def
process
(self, event):
19
self.tree.
reset
()
20
if
len(event.jets)>0:
21
ntuple.fillParticle
(self.tree,
'jet1'
, event.jets[0])
22
if
event.jets[0].gen:
23
ntuple.fillParticle
(self.tree,
'jet1_gen'
, event.jets[0].gen)
24
if
len(event.jets)>1:
25
ntuple.fillParticle
(self.tree,
'jet2'
, event.jets[1])
26
if
event.jets[1].gen:
27
ntuple.fillParticle
(self.tree,
'jet2_gen'
, event.jets[1].gen)
28
if
len(event.dimuons)>1:
29
ntuple.fillParticle
(self.tree,
'dimuon'
, event.dimuons[0])
30
ntuple.fillParticle
(self.tree,
'dimuon_leg1'
, event.dimuons[0].leg1)
31
ntuple.fillParticle
(self.tree,
'dimuon_leg2'
, event.dimuons[0].leg2)
32
self.tree.tree.Fill()
33
34
ntuple.bookParticle
def bookParticle(tree, pName)
Definition:
ntuple.py:25
ntuple.fillParticle
def fillParticle(tree, pName, particle)
Definition:
ntuple.py:34
ZJetsTreeAnalyzer.ZJetsTreeAnalyzer.process
def process(self, event)
Definition:
ZJetsTreeAnalyzer.py:18
ZJetsTreeAnalyzer.ZJetsTreeAnalyzer
Definition:
ZJetsTreeAnalyzer.py:5
ZJetsTreeAnalyzer.ZJetsTreeAnalyzer.beginLoop
def beginLoop(self, setup)
Definition:
ZJetsTreeAnalyzer.py:7
reset
void reset(double vett[256])
Definition:
TPedValues.cc:11
Generated for CMSSW Reference Manual by
1.8.16