CMS 3D CMS Logo

hltHiggsPostProcessors_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
4 
5 # Build the standard strings to the DQM
6 def efficiency_string(objtype,plot_type,triggerpath):
7  # --- IMPORTANT: Add here a elif if you are introduce a new collection
8  # (see EVTColContainer::getTypeString)
9  if objtype == "Mu":
10  objtypeLatex="#mu"
11  elif objtype == "Photon":
12  objtypeLatex="#gamma"
13  elif objtype == "Ele":
14  objtypeLatex="e"
15  elif objtype == "MET" :
16  objtypeLatex="MET"
17  elif objtype == "PFMET" :
18  objtypeLatex="PFMET"
19  elif objtype == "PFTau":
20  objtypeLatex="#tau"
21  elif objtype == "Jet":
22  objtypeLatex="jet"
23  else:
24  objtypeLatex=objtype
25 
26  numer_description = "# gen %s passed the %s" % (objtypeLatex,triggerpath)
27  denom_description = "# gen %s " % (objtypeLatex)
28 
29  if plot_type == "TurnOn1":
30  title = "pT Turn-On"
31  xAxis = "p_{T} of Leading Generated %s (GeV/c)" % (objtype)
32  input_type = "gen%sMaxPt1" % (objtype)
33  elif plot_type == "TurnOn2":
34  title = "Next-to-Leading pT Turn-On"
35  xAxis = "p_{T} of Next-to-Leading Generated %s (GeV/c)" % (objtype)
36  input_type = "gen%sMaxPt2" % (objtype)
37  elif plot_type == "EffEta":
38  title = "#eta Efficiency"
39  xAxis = "#eta of Generated %s " % (objtype)
40  input_type = "gen%sEta" % (objtype)
41  elif plot_type == "EffPhi":
42  title = "#phi Efficiency"
43  xAxis = "#phi of Generated %s " % (objtype)
44  input_type = "gen%sPhi" % (objtype)
45  elif "TurnOn" in plot_type:
46  title = "%sth Leading pT Turn-On" % (plot_type[-1])
47  xAxis = "p_{T} of %sth Leading Generated %s (GeV/c)" % (plot_type[-1], objtype)
48  input_type = "gen%sMaxPt%s" % (objtype, plot_type[-1])
49  elif plot_type == "EffdEtaqq":
50  title = "#Delta #eta_{qq} Efficiency"
51  xAxis = "#Delta #eta_{qq} of Generated %s " % (objtype)
52  input_type = "gen%sdEtaqq" % (objtype)
53  elif plot_type == "Effmqq":
54  title = "m_{qq} Efficiency"
55  xAxis = "m_{qq} of Generated %s " % (objtype)
56  input_type = "gen%smqq" % (objtype)
57  elif plot_type == "EffdPhibb":
58  title = "#Delta #phi_{bb} Efficiency"
59  xAxis = "#Delta #phi_{bb} of Generated %s " % (objtype)
60  input_type = "gen%sdPhibb" % (objtype)
61  elif plot_type == "EffCSV1":
62  title = "CSV1 Efficiency"
63  xAxis = "CSV1 of Generated %s " % (objtype)
64  input_type = "gen%sCSV1" % (objtype)
65  elif plot_type == "EffCSV2":
66  title = "CSV2 Efficiency"
67  xAxis = "CSV2 of Generated %s " % (objtype)
68  input_type = "gen%sCSV2" % (objtype)
69  elif plot_type == "EffCSV3":
70  title = "CSV3 Efficiency"
71  xAxis = "CSV3 of Generated %s " % (objtype)
72  input_type = "gen%sCSV3" % (objtype)
73  elif plot_type == "EffmaxCSV":
74  title = "max CSV Efficiency"
75  xAxis = "max CSV of Generated %s " % (objtype)
76  input_type = "gen%smaxCSV" % (objtype)
77 
78  yAxis = "%s / %s" % (numer_description, denom_description)
79  all_titles = "%s for trigger %s; %s; %s" % (title, triggerpath,
80  xAxis, yAxis)
81  return "Eff_%s_%s '%s' %s_%s %s" % (input_type,triggerpath,
82  all_titles,input_type,triggerpath,input_type)
83 
84 # Adding the reco objects
85 def get_reco_strings(strings):
86  reco_strings = []
87  for entry in strings:
88  reco_strings.append(entry
89  .replace("Generated", "Reconstructed")
90  .replace("Gen", "Reco")
91  .replace("gen", "rec"))
92  return reco_strings
93 
94 
95 plot_types = ["TurnOn1", "TurnOn2", "EffEta", "EffPhi"]
96 #--- IMPORTANT: Update this collection whenever you introduce a new object
97 # in the code (from EVTColContainer::getTypeString)
98 obj_types = ["Mu","Ele","Photon","MET","PFMET","PFTau","Jet"]
99 #--- IMPORTANT: Trigger are extracted from the hltHiggsValidator_cfi.py module
100 triggers = []
101 efficiency_strings = []
102 
103 # Extract the triggers used in the hltHiggsValidator
104 from HLTriggerOffline.Higgs.hltHiggsValidator_cfi import hltHiggsValidator as _config
105 triggers = set([])
106 for an in _config.analysis:
107  s = _config.__getattribute__(an)
108  vstr = s.__getattribute__("hltPathsToCheck")
109  map(lambda x: triggers.add(x.replace("_v","")),vstr)
110 triggers = list(triggers)
111 
112 #------------------------------------------------------------
113 
114 # Generating the list with all the efficiencies
115 for type in plot_types:
116  for obj in obj_types:
117  for trig in triggers:
118  efficiency_strings.append(efficiency_string(obj,type,trig))
119 
120 
121 #add the summary plots
122 efficiency_summary_strings = []
123 for an in _config.analysis:
124  efficiency_summary_strings.append("EffSummaryPaths_"+an+"_gen ' Efficiency of paths used in "+an+" ; trigger path ' SummaryPaths_"+an+"_gen_passingHLT SummaryPaths_"+an+"_gen")
125  for trig in triggers:
126  efficiency_summary_strings.append("Eff_trueVtxDist_"+an+"_gen_"+trig+" ' Efficiency of "+trig+" vs nb of interactions ; nb events passing each path ' trueVtxDist_"+an+"_gen_"+trig+" trueVtxDist_"+an+"_gen")
127 
128 efficiency_strings.extend(efficiency_summary_strings)
129 efficiency_strings.extend(get_reco_strings(efficiency_strings))
130 
131 hltHiggsPostHWW = hltHiggsPostProcessor.clone()
132 hltHiggsPostHWW.subDirs = ['HLT/Higgs/HWW']
133 hltHiggsPostHWW.efficiencyProfile = efficiency_strings
134 
135 hltHiggsPostHZZControlPaths = hltHiggsPostProcessor.clone()
136 hltHiggsPostHZZControlPaths.subDirs = ['HLT/Higgs/HZZControlPaths']
137 hltHiggsPostHZZControlPaths.efficiencyProfile = efficiency_strings
138 
139 hltHiggsPostHZZ = hltHiggsPostProcessor.clone()
140 hltHiggsPostHZZ.subDirs = ['HLT/Higgs/HZZ']
141 hltHiggsPostHZZ.efficiencyProfile = efficiency_strings
142 
143 hltHiggsPostHgg = hltHiggsPostProcessor.clone()
144 hltHiggsPostHgg.subDirs = ['HLT/Higgs/Hgg']
145 hltHiggsPostHgg.efficiencyProfile = efficiency_strings
146 
147 hltHiggsPostHggControlPaths = hltHiggsPostProcessor.clone()
148 hltHiggsPostHggControlPaths.subDirs = ['HLT/Higgs/HggControlPaths']
149 hltHiggsPostHggControlPaths.efficiencyProfile = efficiency_strings
150 
151 hltHiggsPostMuonJet = hltHiggsPostProcessor.clone()
152 hltHiggsPostMuonJet.subDirs = ['HLT/Higgs/MuonJet']
153 hltHiggsPostMuonJet.efficiencyProfile = efficiency_strings
154 
155 hltHiggsPostDoubleHinTaus = hltHiggsPostProcessor.clone()
156 hltHiggsPostDoubleHinTaus.subDirs = ['HLT/Higgs/DoubleHinTaus']
157 hltHiggsPostDoubleHinTaus.efficiencyProfile = efficiency_strings
158 
159 hltHiggsPostHiggsDalitz = hltHiggsPostProcessor.clone()
160 hltHiggsPostHiggsDalitz.subDirs = ['HLT/Higgs/HiggsDalitz']
161 hltHiggsPostHiggsDalitz.efficiencyProfile = efficiency_strings
162 
163 hltHiggsPostH2tau = hltHiggsPostProcessor.clone()
164 hltHiggsPostH2tau.subDirs = ['HLT/Higgs/H2tau']
165 hltHiggsPostH2tau.efficiencyProfile = efficiency_strings
166 
167 hltHiggsPostHtaunu = hltHiggsPostProcessor.clone()
168 hltHiggsPostHtaunu.subDirs = ['HLT/Higgs/Htaunu']
169 hltHiggsPostHtaunu.efficiencyProfile = efficiency_strings
170 
171 hltHiggsPostVBFHToInv = hltHiggsPostProcessor.clone()
172 hltHiggsPostVBFHToInv.subDirs = ['HLT/Higgs/VBFHToInv']
173 hltHiggsPostVBFHToInv.efficiencyProfile = efficiency_strings
174 
175 
176 efficiency_strings_TTHbbej = []
177 #add the summary plots
178 for an in _config.analysis:
179  for trig in triggers:
180  efficiency_strings_TTHbbej.append("Eff_HtDist_"+an+"_gen_"+trig+" ' Efficiency of "+trig+" vs sum pT of jets ; sum pT of jets ' HtDist_"+an+"_gen_"+trig+" HtDist_"+an+"_gen")
181 
182 efficiency_strings_TTHbbej.extend(get_reco_strings(efficiency_strings_TTHbbej))
183 efficiency_strings_TTHbbej.extend(efficiency_strings)
184 
185 hltHiggsPostTTHbbej = hltHiggsPostProcessor.clone()
186 hltHiggsPostTTHbbej.subDirs = ['HLT/Higgs/TTHbbej']
187 hltHiggsPostTTHbbej.efficiencyProfile = efficiency_strings_TTHbbej
188 
189 hltHiggsPostAHttH = hltHiggsPostProcessor.clone()
190 hltHiggsPostAHttH.subDirs = ['HLT/Higgs/AHttH']
191 hltHiggsPostAHttH.efficiencyProfile = efficiency_strings
192 
193 #Specific plots for VBFHbb_2btag
194 #dEtaqq, mqq, dPhibb, CVS1, maxCSV_jets, maxCSV_E, MET, pt1, pt2, pt3, pt4
195 NminOneCutNames = ("EffdEtaqq", "Effmqq", "EffdPhibb", "EffCSV1", "EffCSV2", "EffCSV3", "EffmaxCSV", "", "", "TurnOn1", "TurnOn2", "TurnOn3", "TurnOn4")
196 plot_types = []
197 NminOneCuts =_config.VBFHbb_2btag.NminOneCuts
198 if NminOneCuts:
199  for iCut in range(0,len(NminOneCuts)):
200  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
201  if( NminOneCutNames[iCut] == "EffmaxCSV" ):
202  plot_types.pop()
203  plot_types.append(NminOneCutNames[iCut])
204 
205 efficiency_strings = []
206 for type in plot_types:
207  for obj in ["Jet"]:
208  for trig in triggers:
209  efficiency_strings.append(efficiency_string(obj,type,trig))
210 
211 efficiency_strings = get_reco_strings(efficiency_strings)
212 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
213 
214 hltHiggsPostVBFHbb2btag = hltHiggsPostProcessor.clone()
215 hltHiggsPostVBFHbb2btag.subDirs = ['HLT/Higgs/VBFHbb_2btag']
216 hltHiggsPostVBFHbb2btag.efficiencyProfile = efficiency_strings
217 
218 #Specific plots for VBFHbb_1btag
219 #dEtaqq, mqq, dPhibb, CVS1, maxCSV_jets, maxCSV_E, MET, pt1, pt2, pt3, pt4
220 plot_types = []
221 NminOneCuts = _config.VBFHbb_1btag.NminOneCuts
222 if NminOneCuts:
223  for iCut in range(0,len(NminOneCuts)):
224  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
225  if( NminOneCutNames[iCut] == "EffmaxCSV" ):
226  plot_types.pop()
227  plot_types.append(NminOneCutNames[iCut])
228 
229 efficiency_strings = []
230 for type in plot_types:
231  for obj in ["Jet"]:
232  for trig in triggers:
233  efficiency_strings.append(efficiency_string(obj,type,trig))
234 
235 efficiency_strings = get_reco_strings(efficiency_strings)
236 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
237 
238 hltHiggsPostVBFHbb1btag = hltHiggsPostProcessor.clone()
239 hltHiggsPostVBFHbb1btag.subDirs = ['HLT/Higgs/VBFHbb_1btag']
240 hltHiggsPostVBFHbb1btag.efficiencyProfile = efficiency_strings
241 
242 #Specific plots for VBFHbb_0btag
243 #dEtaqq, mqq, dPhibb, CVS1, maxCSV_jets, maxCSV_E, MET, pt1, pt2, pt3, pt4
244 plot_types = []
245 NminOneCuts = _config.VBFHbb_0btag.NminOneCuts
246 if NminOneCuts:
247  for iCut in range(0,len(NminOneCuts)):
248  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
249  if( NminOneCutNames[iCut] == "EffmaxCSV" ):
250  plot_types.pop()
251  plot_types.append(NminOneCutNames[iCut])
252 
253 efficiency_strings = []
254 for type in plot_types:
255  for obj in ["Jet"]:
256  for trig in triggers:
257  efficiency_strings.append(efficiency_string(obj,type,trig))
258 
259 efficiency_strings = get_reco_strings(efficiency_strings)
260 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
261 
262 hltHiggsPostVBFHbb0btag = hltHiggsPostProcessor.clone()
263 hltHiggsPostVBFHbb0btag.subDirs = ['HLT/Higgs/VBFHbb_0btag']
264 hltHiggsPostVBFHbb0btag.efficiencyProfile = efficiency_strings
265 
266 
267 #Specific plots for ZnnHbb
268 #Jet plots
269 plot_types = ["EffEta", "EffPhi"]
270 NminOneCuts = _config.ZnnHbb.NminOneCuts
271 if NminOneCuts:
272  for iCut in range(0,len(NminOneCuts)):
273  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
274  plot_types.append(NminOneCutNames[iCut])
275 
276 efficiency_strings = []
277 for type in plot_types:
278  for obj in ["Jet"]:
279  for trig in triggers:
280  efficiency_strings.append(efficiency_string(obj,type,trig))
281 
282 efficiency_strings = get_reco_strings(efficiency_strings)
283 
284 #PFMET plots
285 plot_types = ["TurnOn1", "EffPhi"]
286 efficiency_strings2 = []
287 for type in plot_types:
288  for obj in ["PFMET"]:
289  for trig in triggers:
290  efficiency_strings2.append(efficiency_string(obj,type,trig))
291 
292 efficiency_strings2 = get_reco_strings(efficiency_strings2)
293 efficiency_strings += efficiency_strings2
294 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
295 
296 hltHiggsPostZnnHbb = hltHiggsPostProcessor.clone()
297 hltHiggsPostZnnHbb.subDirs = ['HLT/Higgs/ZnnHbb']
298 hltHiggsPostZnnHbb.efficiencyProfile = efficiency_strings
299 
300 
301 #Specific plots for X4b
302 #Jet plots
303 NminOneCuts = _config.X4b.NminOneCuts
304 if NminOneCuts:
305  for iCut in range(0,len(NminOneCuts)):
306  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
307  plot_types.append(NminOneCutNames[iCut])
308 
309 efficiency_strings = []
310 for type in plot_types:
311  for obj in ["Jet"]:
312  for trig in triggers:
313  efficiency_strings.append(efficiency_string(obj,type,trig))
314 
315 efficiency_strings = get_reco_strings(efficiency_strings)
316 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
317 
318 hltHiggsPostX4b = hltHiggsPostProcessor.clone()
319 hltHiggsPostX4b.subDirs = ['HLT/Higgs/X4b']
320 hltHiggsPostX4b.efficiencyProfile = efficiency_strings
321 
322 #Specific plots for WH -> ev + bb
323 efficiency_strings_WHToENuBB = list(efficiency_strings_TTHbbej)
324 #add the summary plots
325 for an in _config.analysis:
326  for trig in triggers:
327  efficiency_strings_WHToENuBB.append("Eff_HtDist_"+an+"_gen_"+trig+" ' Efficiency of "+trig+" vs sum pT of jets ; sum pT of jets ' HtDist_"+an+"_gen_"+trig+" HtDist_"+an+"_gen")
328 
329 efficiency_strings_WHToENuBB.extend(get_reco_strings(efficiency_strings_WHToENuBB))
330 
331 hltHiggsPostWHToENuBB = hltHiggsPostProcessor.clone()
332 hltHiggsPostWHToENuBB.subDirs = ['HLT/Higgs/WHToENuBB']
333 hltHiggsPostWHToENuBB.efficiencyProfile = efficiency_strings_WHToENuBB
334 
335 #Specific plots for MSSMHbb
336 #Jet plots
337 NminOneCuts = _config.MSSMHbb.NminOneCuts
338 if NminOneCuts:
339  for iCut in range(0,len(NminOneCuts)):
340  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
341  plot_types.append(NminOneCutNames[iCut])
342 
343 efficiency_strings = []
344 for type in plot_types:
345  for obj in ["Jet"]:
346  for trig in triggers:
347  efficiency_strings.append(efficiency_string(obj,type,trig))
348 
349 efficiency_strings = get_reco_strings(efficiency_strings)
350 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
351 
352 hltHiggsPostMSSMHbb = hltHiggsPostProcessor.clone()
353 hltHiggsPostMSSMHbb.subDirs = ['HLT/Higgs/MSSMHbb']
354 hltHiggsPostMSSMHbb.efficiencyProfile = efficiency_strings
355 
356 #Specific plots for MSSMHbbmu
357 NminOneCuts = _config.MSSMHbbmu.NminOneCuts
358 if NminOneCuts:
359  for iCut in range(0,len(NminOneCuts)):
360  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
361  plot_types.append(NminOneCutNames[iCut])
362 
363 efficiency_strings = []
364 for type in plot_types:
365  for obj in ["Jet"]:
366  for trig in triggers:
367  efficiency_strings.append(efficiency_string(obj,type,trig))
368 
369 efficiency_strings = get_reco_strings(efficiency_strings)
370 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
371 hltHiggsPostMSSMHbbmu = hltHiggsPostProcessor.clone()
372 hltHiggsPostMSSMHbbmu.subDirs = ['HLT/Higgs/MSSMHbbmu']
373 hltHiggsPostMSSMHbbmu.efficiencyProfile = efficiency_strings
374 
375 
376 hltHiggsPostProcessors = cms.Sequence(
377  hltHiggsPostHWW+
378  hltHiggsPostHZZ+
379  hltHiggsPostHZZControlPaths+
380  hltHiggsPostHgg+
381  hltHiggsPostHggControlPaths+
382  hltHiggsPostMuonJet+
383  hltHiggsPostHtaunu+
384  hltHiggsPostH2tau+
385  hltHiggsPostTTHbbej+
386  hltHiggsPostAHttH+
387  hltHiggsPostVBFHbb0btag+
388  hltHiggsPostVBFHbb1btag+
389  hltHiggsPostVBFHbb2btag+
390  hltHiggsPostZnnHbb+
391  hltHiggsPostDoubleHinTaus+
392  hltHiggsPostHiggsDalitz+
393  hltHiggsPostX4b+
394  hltHiggsPostWHToENuBB+
395  hltHiggsPostMSSMHbb+
396  hltHiggsPostMSSMHbbmu+
397  hltHiggsPostVBFHToInv
398 )
399 
400 
def efficiency_string(objtype, plot_type, triggerpath)
def replace(string, replacements)
if(dp >Float(M_PI)) dp-
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run