3 from PhysicsTools.Heppy.analyzers.core.Analyzer
import Analyzer
4 from PhysicsTools.Heppy.analyzers.core.AutoHandle
import AutoHandle
5 from PhysicsTools.Heppy.analyzers.core.AutoFillTreeProducer
import NTupleVariable
9 def __init__(self, cfg_ana, cfg_comp, looperName ):
10 super(TriggerBitAnalyzer,self).
__init__(cfg_ana,cfg_comp,looperName)
13 self.
unrollbits = ( hasattr(self.cfg_ana,
"unrollbits")
and self.cfg_ana.unrollbits )
18 self.handles[
'TriggerResults'] = AutoHandle( (
'TriggerResults',
'',self.
processName),
'edm::TriggerResults' )
21 super(TriggerBitAnalyzer,self).
beginLoop(setup)
27 for T, TL
in self.cfg_ana.triggerBits.iteritems():
28 trigVec = ROOT.vector(ROOT.string)()
33 self.allPaths.update(TP)
34 trigVecBit = ROOT.vector(ROOT.string)()
35 trigVecBit.push_back(TP)
37 if not hasattr(setup ,
"globalVariables") :
38 setup.globalVariables = []
39 if outname[-1] ==
'*' :
41 setup.globalVariables.append( NTupleVariable(outname, eval(
"lambda ev: ev.%s" % outname), help=
"Trigger bit %s"%TP) )
42 self.triggerBitCheckersSingleBits.append( (TP, ROOT.heppy.TriggerBitChecker(trigVecBit)) )
45 if not hasattr(setup ,
"globalVariables") :
46 setup.globalVariables = []
47 setup.globalVariables.append( NTupleVariable(outname, eval(
"lambda ev: ev.%s" % outname), help=
"OR of %s"%TL) )
48 self.triggerBitCheckers.append( (T, ROOT.heppy.TriggerBitChecker(trigVec)) )
52 self.readCollections( event.input )
53 triggerResults = self.handles[
'TriggerResults'].product()
56 setattr(event,outname, TC.check(event.input.object(), triggerResults))
60 if outname[-1] ==
'*' :
62 setattr(event,outname, TC.check(event.input.object(), triggerResults))
68 setattr(TriggerBitAnalyzer,
"defaultConfig",cfg.Analyzer(
69 TriggerBitAnalyzer, name=
"TriggerFlags",
76 setattr(TriggerBitAnalyzer,
"defaultEventFlagsConfig",cfg.Analyzer(
77 TriggerBitAnalyzer, name=
"EventFlags",
81 "HBHENoiseFilter" : [
"Flag_HBHENoiseFilter" ],
82 "CSCTightHaloFilter" : [
"Flag_CSCTightHaloFilter" ],
83 "hcalLaserEventFilter" : [
"Flag_hcalLaserEventFilter" ],
84 "EcalDeadCellTriggerPrimitiveFilter" : [
"Flag_EcalDeadCellTriggerPrimitiveFilter" ],
85 "goodVertices" : [
"Flag_goodVertices" ],
86 "trackingFailureFilter" : [
"Flag_trackingFailureFilter" ],
87 "eeBadScFilter" : [
"Flag_eeBadScFilter" ],
88 "ecalLaserCorrFilter" : [
"Flag_ecalLaserCorrFilter" ],
89 "trkPOGFilters" : [
"Flag_trkPOGFilters" ],
90 "trkPOG_manystripclus53X" : [
"Flag_trkPOG_manystripclus53X" ],
91 "trkPOG_toomanystripclus53X" : [
"Flag_trkPOG_toomanystripclus53X" ],
92 "trkPOG_logErrorTooManyClusters" : [
"Flag_trkPOG_logErrorTooManyClusters" ],
93 "METFilters" : [
"Flag_METFilters" ],
triggerBitCheckersSingleBits