CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ZJetsTreeAnalyzer.py
Go to the documentation of this file.
1 from PhysicsTools.Heppy.analyzers.core.TreeAnalyzerNumpy import TreeAnalyzerNumpy
2 import ntuple
3 
4 class ZJetsTreeAnalyzer(TreeAnalyzerNumpy):
5 
6  def beginLoop(self, setup):
7  super(ZJetsTreeAnalyzer, self).beginLoop(setup)
8  ntuple.bookParticle(self.tree, 'jet1')
9  ntuple.bookParticle(self.tree, 'jet1_gen')
10  ntuple.bookParticle(self.tree, 'jet2')
11  ntuple.bookParticle(self.tree, 'jet2_gen')
12  ntuple.bookParticle(self.tree, 'dimuon')
13  ntuple.bookParticle(self.tree, 'dimuon_leg1')
14  ntuple.bookParticle(self.tree, 'dimuon_leg2')
15 
16 
17  def process(self, event):
18  self.tree.reset()
19  if len(event.jets)>0:
20  ntuple.fillParticle(self.tree, 'jet1', event.jets[0])
21  if event.jets[0].gen:
22  ntuple.fillParticle(self.tree, 'jet1_gen', event.jets[0].gen)
23  if len(event.jets)>1:
24  ntuple.fillParticle(self.tree, 'jet2', event.jets[1])
25  if event.jets[1].gen:
26  ntuple.fillParticle(self.tree, 'jet2_gen', event.jets[1].gen)
27  if len(event.dimuons)>1:
28  ntuple.fillParticle(self.tree, 'dimuon', event.dimuons[0])
29  ntuple.fillParticle(self.tree, 'dimuon_leg1', event.dimuons[0].leg1)
30  ntuple.fillParticle(self.tree, 'dimuon_leg2', event.dimuons[0].leg2)
31  self.tree.tree.Fill()
32 
33 
def fillParticle
Definition: ntuple.py:33
def bookParticle
Definition: ntuple.py:24