1 from PhysicsTools.Heppy.analyzers.core.Analyzer
import Analyzer
3 import PhysicsTools.HeppyCore.framework.config
as cfg
7 """Classify and filter events according to Higgs boson decays
13 event.genHiggsDecayMode = 0 for non-Higgs or multi-higgs
18 If filterHiggsDecays is set to a list of Higgs decay modes,
19 it will filter events that have those decay modes.
20 e.g. [0, 15, 23, 24] will keep data, non-Higgs MC and Higgs decays to (tau, Z, W)
21 but will drop Higgs decays to other particles (e.g. bb).
24 def __init__(self, cfg_ana, cfg_comp, looperName ):
25 super(HiggsDecayModeAnalyzer,self).
__init__(cfg_ana,cfg_comp,looperName)
33 super(HiggsDecayModeAnalyzer,self).
beginLoop(setup)
36 self.readCollections( event.input )
39 if not self.cfg_comp.isMC:
42 higgsBosons = event.genHiggsBosons
43 if len(higgsBosons) != 1:
44 event.genHiggsDecayMode = 0
45 event.genHiggsBoson =
None
47 event.genHiggsBoson = higgsBosons[0]
48 event.genHiggsDecayMode =
abs( event.genHiggsBoson.daughter(0).
pdgId() )
52 if self.cfg_ana.filterHiggsDecays:
53 if event.genHiggsDecayMode
not in self.cfg_ana.filterHiggsDecays:
58 setattr(HiggsDecayModeAnalyzer,
"defaultConfig",
59 cfg.Analyzer(HiggsDecayModeAnalyzer,
60 filterHiggsDecays =
False,