Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:32:27

0001 from PhysicsTools.Heppy.analyzers.TreeAnalyzerNumpy import TreeAnalyzerNumpy
0002 
0003 def var( tree, varName, type=float ):
0004     tree.var(varName, type)
0005 
0006 def fill( tree, varName, value ):
0007     tree.fill( varName, value )
0008 
0009 
0010 class MetTreeProducer( TreeAnalyzerNumpy ):
0011     def declareVariables(self):
0012         tr = self.tree
0013         var( tr, 'u1')
0014         var( tr, 'u2')
0015         var( tr, 'met')
0016         var( tr, 'sumet')
0017         var( tr, 'zpt')
0018         var( tr, 'zeta')
0019         var( tr, 'weight')
0020 
0021     def process(self, iEvent, event):
0022         
0023         tr = self.tree
0024         tr.reset()
0025         fill( tr, 'u1', event.u1)
0026         fill( tr, 'u2', event.u2)
0027         fill( tr, 'met', event.met.pt())
0028         fill( tr, 'sumet', event.met.sumEt())
0029         fill( tr, 'zpt', event.diLepton.pt())
0030         fill( tr, 'zeta', event.diLepton.eta())
0031         fill( tr, 'weight', event.vertexWeight)
0032         self.tree.tree.Fill()
0033