CMS 3D CMS Logo

HiggsDecayModeAnalyzer.py
Go to the documentation of this file.
1 from PhysicsTools.Heppy.analyzers.core.Analyzer import Analyzer
2 
3 import PhysicsTools.HeppyCore.framework.config as cfg
4 
5 
7  """Classify and filter events according to Higgs boson decays
8 
9  Reads:
10  event.genHiggsBosons
11 
12  Creates in the event:
13  event.genHiggsDecayMode = 0 for non-Higgs or multi-higgs
14  15 for H -> tau tau
15  23 for H -> Z Z
16  24 for H -> W W
17  xx for H -> xx yy zzz
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).
22 
23  """
24  def __init__(self, cfg_ana, cfg_comp, looperName ):
25  super(HiggsDecayModeAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName)
26  #---------------------------------------------
27 
28 
29  def declareHandles(self):
30  super(HiggsDecayModeAnalyzer, self).declareHandles()
31 
32  def beginLoop(self, setup):
33  super(HiggsDecayModeAnalyzer,self).beginLoop(setup)
34 
35  def process(self, event):
36  self.readCollections( event.input )
37 
38  # if not MC, nothing to do
39  if not self.cfg_comp.isMC:
40  return True
41 
42  higgsBosons = event.genHiggsBosons
43  if len(higgsBosons) != 1:
44  event.genHiggsDecayMode = 0
45  event.genHiggsBoson = None
46  else:
47  event.genHiggsBoson = higgsBosons[0]
48  event.genHiggsDecayMode = abs( event.genHiggsBoson.daughter(0).pdgId() )
49 
50  # if MC and filtering on the Higgs decay mode,
51  # them do filter events
52  if self.cfg_ana.filterHiggsDecays:
53  if event.genHiggsDecayMode not in self.cfg_ana.filterHiggsDecays:
54  return False
55 
56  return True
57 
58 setattr(HiggsDecayModeAnalyzer,"defaultConfig",
59  cfg.Analyzer(HiggsDecayModeAnalyzer,
60  filterHiggsDecays = False,
61  )
62 )
gen.HiggsDecayModeAnalyzer.HiggsDecayModeAnalyzer.declareHandles
def declareHandles(self)
Definition: HiggsDecayModeAnalyzer.py:29
remoteMonitoring_LED_IterMethod_cfg.Analyzer
Analyzer
Definition: remoteMonitoring_LED_IterMethod_cfg.py:32
gen.HiggsDecayModeAnalyzer.HiggsDecayModeAnalyzer
Definition: HiggsDecayModeAnalyzer.py:6
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:118
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
gen.HiggsDecayModeAnalyzer.HiggsDecayModeAnalyzer.beginLoop
def beginLoop(self, setup)
Definition: HiggsDecayModeAnalyzer.py:32
gen.HiggsDecayModeAnalyzer.HiggsDecayModeAnalyzer.process
def process(self, event)
Definition: HiggsDecayModeAnalyzer.py:35
gen.HiggsDecayModeAnalyzer.HiggsDecayModeAnalyzer.__init__
def __init__(self, cfg_ana, cfg_comp, looperName)
Definition: HiggsDecayModeAnalyzer.py:24