1 from __future__
import print_function
3 from PhysicsTools.HeppyCore.statistics.tree
import Tree
as Tree
10 if hasattr(other,
'integer'):
23 def add(self, trigger, run, lumi):
24 nEv = self.
dict.setdefault( (trigger, run, lumi),
MyInteger(0) )
29 for rlt, count
in six.iteritems(self.
dict):
30 lines.append(
': '.
join( [
str(rlt),
str(count)] ))
31 return '\n'.
join(lines)
33 def write(self, dirName, fileName='RLTInfo.root'):
34 f = TFile(
'/'.
join( [dirName, fileName]),
'RECREATE')
35 t = Tree(
'RLTInfo',
'HLT/Run/Lumi information')
39 t.var(
'trigger', int )
40 for rlt, count
in six.iteritems(self.
dict):
42 t.fill(
'lumi', rlt[2])
43 t.fill(
'counts', count.integer)
48 if __name__ ==
'__main__':
51 rltinfo.add(
'HLT1', 128, 1)
52 rltinfo.add(
'HLT1', 128, 1)
53 rltinfo.add(
'HLT1', 128, 2)
54 rltinfo.add(
'HLT1', 129, 2)
55 rltinfo.add(
'HLT2', 129, 2)
57 for rlt, count
in six.iteritems(rltinfo.dict):