Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-25 02:29:49

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