1 from __future__
import print_function
2 from PhysicsTools.Heppy.analyzers.core.Analyzer
import Analyzer
3 from PhysicsTools.HeppyCore.statistics.tree
import Tree
as Tree
7 """Base TreeAnalyzerNumpy, to create flat TTrees.
9 Check out TestTreeAnalyzer for a concrete example.
10 IMPORTANT: FOR NOW, CANNOT RUN SEVERAL TreeAnalyzers AT THE SAME TIME!
11 Anyway, you want only one TTree, don't you?"""
13 def __init__(self, cfg_ana, cfg_comp, looperName):
14 super(TreeAnalyzerNumpy,self).
__init__(cfg_ana, cfg_comp, looperName)
16 self.
treename = getattr(cfg_ana,
"treename",
"tree")
20 super(TreeAnalyzerNumpy, self).
beginLoop(setup)
25 fileName =
'/'.
join([self.dirName,
27 isCompressed = self.cfg_ana.isCompressed
if hasattr(self.cfg_ana,
'isCompressed')
else 1
28 print(
'Compression', isCompressed)
29 self.
file = TFile( fileName,
'recreate',
'', isCompressed )
32 raise RuntimeError(
"You are booking two Trees with the same name in the same file")
34 self.
tree.setDefaultFloatType(getattr(self.cfg_ana,
'defaultFloatType',
'D'));
38 print(
'TreeAnalyzerNumpy.declareVariables : overload this function.')
42 super(TreeAnalyzerNumpy, self).
write(setup)