CMS 3D CMS Logo

MetTreeProducer.py
Go to the documentation of this file.
1 from PhysicsTools.Heppy.analyzers.TreeAnalyzerNumpy import TreeAnalyzerNumpy
2 
3 def var( tree, varName, type=float ):
4  tree.var(varName, type)
5 
6 def fill( tree, varName, value ):
7  tree.fill( varName, value )
8 
9 
10 class MetTreeProducer( TreeAnalyzerNumpy ):
11  def declareVariables(self):
12  tr = self.tree
13  var( tr, 'u1')
14  var( tr, 'u2')
15  var( tr, 'met')
16  var( tr, 'sumet')
17  var( tr, 'zpt')
18  var( tr, 'zeta')
19  var( tr, 'weight')
20 
21  def process(self, iEvent, event):
22 
23  tr = self.tree
24  tr.reset()
25  fill( tr, 'u1', event.u1)
26  fill( tr, 'u2', event.u2)
27  fill( tr, 'met', event.met.pt())
28  fill( tr, 'sumet', event.met.sumEt())
29  fill( tr, 'zpt', event.diLepton.pt())
30  fill( tr, 'zeta', event.diLepton.eta())
31  fill( tr, 'weight', event.vertexWeight)
32  self.tree.tree.Fill()
33 
MetTreeProducer.var
def var(tree, varName, type=float)
Definition: MetTreeProducer.py:3
MetTreeProducer.MetTreeProducer
Definition: MetTreeProducer.py:10
MetTreeProducer.MetTreeProducer.declareVariables
def declareVariables(self)
Definition: MetTreeProducer.py:11
MetTreeProducer.fill
def fill(tree, varName, value)
Definition: MetTreeProducer.py:6
MetTreeProducer.MetTreeProducer.process
def process(self, iEvent, event)
Definition: MetTreeProducer.py:21