CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SimpleTreeProducer.py
Go to the documentation of this file.
1 from PhysicsTools.HeppyCore.framework.analyzer import Analyzer
2 from PhysicsTools.HeppyCore.statistics.tree import Tree
3 from ROOT import TFile
4 
5 class SimpleTreeProducer(Analyzer):
6 
7  def beginLoop(self, setup):
8  super(SimpleTreeProducer, self).beginLoop(setup)
9  self.rootfile = TFile('/'.join([self.dirName,
10  'simple_tree.root']),
11  'recreate')
12  self.tree = Tree( self.cfg_ana.tree_name,
13  self.cfg_ana.tree_title )
14  self.tree.var('test_variable')
15 
16  def process(self, event):
17  self.tree.fill('test_variable', event.input.var1)
18  self.tree.tree.Fill()
19 
20  def write(self, setup):
21  self.rootfile.Write()
22  self.rootfile.Close()
23 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18