Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:23:27

0001 from __future__ import absolute_import
0002 from PhysicsTools.Heppy.analyzers.core.TreeAnalyzerNumpy import TreeAnalyzerNumpy
0003 from . import ntuple
0004 
0005 class ZJetsTreeAnalyzer(TreeAnalyzerNumpy):
0006     
0007     def beginLoop(self, setup):
0008         super(ZJetsTreeAnalyzer, self).beginLoop(setup)
0009         ntuple.bookParticle(self.tree, 'jet1')
0010         ntuple.bookParticle(self.tree, 'jet1_gen')
0011         ntuple.bookParticle(self.tree, 'jet2')
0012         ntuple.bookParticle(self.tree, 'jet2_gen')
0013         ntuple.bookParticle(self.tree, 'dimuon')
0014         ntuple.bookParticle(self.tree, 'dimuon_leg1')
0015         ntuple.bookParticle(self.tree, 'dimuon_leg2')
0016 
0017         
0018     def process(self, event):
0019         self.tree.reset()
0020         if len(event.jets)>0:
0021             ntuple.fillParticle(self.tree, 'jet1', event.jets[0])
0022             if event.jets[0].gen:
0023                 ntuple.fillParticle(self.tree, 'jet1_gen', event.jets[0].gen)
0024         if len(event.jets)>1:
0025             ntuple.fillParticle(self.tree, 'jet2', event.jets[1])
0026             if event.jets[1].gen:
0027                 ntuple.fillParticle(self.tree, 'jet2_gen', event.jets[1].gen)
0028         if len(event.dimuons)>1:
0029             ntuple.fillParticle(self.tree, 'dimuon', event.dimuons[0])
0030             ntuple.fillParticle(self.tree, 'dimuon_leg1', event.dimuons[0].leg1)
0031             ntuple.fillParticle(self.tree, 'dimuon_leg2', event.dimuons[0].leg2)
0032         self.tree.tree.Fill()
0033 
0034