1 from __future__
import print_function
3 from PhysicsTools.HeppyCore.statistics.tree
import Tree
as Tree
9 if hasattr(other,
'integer'):
22 def add(self, trigger, run, lumi):
23 nEv = self.dict.setdefault( (trigger, run, lumi),
MyInteger(0) )
28 for rlt, count
in self.dict.items():
29 lines.append(
': '.
join( [
str(rlt),
str(count)] ))
30 return '\n'.
join(lines)
32 def write(self, dirName, fileName='RLTInfo.root'):
33 f = TFile(
'/'.
join( [dirName, fileName]),
'RECREATE')
34 t = Tree(
'RLTInfo',
'HLT/Run/Lumi information')
38 t.var(
'trigger', int )
39 for rlt, count
in self.dict.items():
41 t.fill(
'lumi', rlt[2])
42 t.fill(
'counts', count.integer)
47 if __name__ ==
'__main__':
50 rltinfo.add(
'HLT1', 128, 1)
51 rltinfo.add(
'HLT1', 128, 1)
52 rltinfo.add(
'HLT1', 128, 2)
53 rltinfo.add(
'HLT1', 129, 2)
54 rltinfo.add(
'HLT2', 129, 2)
56 for rlt, count
in rltinfo.dict.items():
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
static std::string join(char **cmd)