CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
hltHiggsPostProcessors_cff.py
Go to the documentation of this file.
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 hltHiggsPostHZZ = hltHiggsPostProcessor.clone()
136 hltHiggsPostHZZ.subDirs = ['HLT/Higgs/HZZ']
137 hltHiggsPostHZZ.efficiencyProfile = efficiency_strings
138 
139 hltHiggsPostHgg = hltHiggsPostProcessor.clone()
140 hltHiggsPostHgg.subDirs = ['HLT/Higgs/Hgg']
141 hltHiggsPostHgg.efficiencyProfile = efficiency_strings
142 
143 hltHiggsPostHggControlPaths = hltHiggsPostProcessor.clone()
144 hltHiggsPostHggControlPaths.subDirs = ['HLT/Higgs/HggControlPaths']
145 hltHiggsPostHggControlPaths.efficiencyProfile = efficiency_strings
146 
147 hltHiggsPostDoubleHinTaus = hltHiggsPostProcessor.clone()
148 hltHiggsPostDoubleHinTaus.subDirs = ['HLT/Higgs/DoubleHinTaus']
149 hltHiggsPostDoubleHinTaus.efficiencyProfile = efficiency_strings
150 
151 hltHiggsPostHiggsDalitz = hltHiggsPostProcessor.clone()
152 hltHiggsPostHiggsDalitz.subDirs = ['HLT/Higgs/HiggsDalitz']
153 hltHiggsPostHiggsDalitz.efficiencyProfile = efficiency_strings
154 
155 hltHiggsPostH2tau = hltHiggsPostProcessor.clone()
156 hltHiggsPostH2tau.subDirs = ['HLT/Higgs/H2tau']
157 hltHiggsPostH2tau.efficiencyProfile = efficiency_strings
158 
159 hltHiggsPostHtaunu = hltHiggsPostProcessor.clone()
160 hltHiggsPostHtaunu.subDirs = ['HLT/Higgs/Htaunu']
161 hltHiggsPostHtaunu.efficiencyProfile = efficiency_strings
162 
163 
164 efficiency_strings_TTHbbej = []
165 #add the summary plots
166 for an in _config.analysis:
167  for trig in triggers:
168  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")
169 
170 efficiency_strings_TTHbbej.extend(get_reco_strings(efficiency_strings_TTHbbej))
171 efficiency_strings_TTHbbej.extend(efficiency_strings)
172 
173 hltHiggsPostTTHbbej = hltHiggsPostProcessor.clone()
174 hltHiggsPostTTHbbej.subDirs = ['HLT/Higgs/TTHbbej']
175 hltHiggsPostTTHbbej.efficiencyProfile = efficiency_strings_TTHbbej
176 
177 hltHiggsPostAHttH = hltHiggsPostProcessor.clone()
178 hltHiggsPostAHttH.subDirs = ['HLT/Higgs/AHttH']
179 hltHiggsPostAHttH.efficiencyProfile = efficiency_strings
180 
181 #Specific plots for VBFHbb_2btag
182 #dEtaqq, mqq, dPhibb, CVS1, maxCSV_jets, maxCSV_E, MET, pt1, pt2, pt3, pt4
183 NminOneCutNames = ("EffdEtaqq", "Effmqq", "EffdPhibb", "EffCSV1", "EffCSV2", "EffCSV3", "EffmaxCSV", "", "", "TurnOn1", "TurnOn2", "TurnOn3", "TurnOn4")
184 plot_types = []
185 NminOneCuts = _config.VBFHbb_2btag.NminOneCuts
186 if NminOneCuts:
187  for iCut in range(0,len(NminOneCuts)):
188  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
189  if( NminOneCutNames[iCut] == "EffmaxCSV" ):
190  plot_types.pop()
191  plot_types.append(NminOneCutNames[iCut])
192 
193 efficiency_strings = []
194 for type in plot_types:
195  for obj in ["Jet"]:
196  for trig in triggers:
197  efficiency_strings.append(efficiency_string(obj,type,trig))
198 
199 efficiency_strings = get_reco_strings(efficiency_strings)
200 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
201 
202 hltHiggsPostVBFHbb_2btag = hltHiggsPostProcessor.clone()
203 hltHiggsPostVBFHbb_2btag.subDirs = ['HLT/Higgs/VBFHbb_2btag']
204 hltHiggsPostVBFHbb_2btag.efficiencyProfile = efficiency_strings
205 
206 #Specific plots for VBFHbb_1btag
207 #dEtaqq, mqq, dPhibb, CVS1, maxCSV_jets, maxCSV_E, MET, pt1, pt2, pt3, pt4
208 plot_types = []
209 NminOneCuts = _config.VBFHbb_1btag.NminOneCuts
210 if NminOneCuts:
211  for iCut in range(0,len(NminOneCuts)):
212  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
213  if( NminOneCutNames[iCut] == "EffmaxCSV" ):
214  plot_types.pop()
215  plot_types.append(NminOneCutNames[iCut])
216 
217 efficiency_strings = []
218 for type in plot_types:
219  for obj in ["Jet"]:
220  for trig in triggers:
221  efficiency_strings.append(efficiency_string(obj,type,trig))
222 
223 efficiency_strings = get_reco_strings(efficiency_strings)
224 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
225 
226 hltHiggsPostVBFHbb_1btag = hltHiggsPostProcessor.clone()
227 hltHiggsPostVBFHbb_1btag.subDirs = ['HLT/Higgs/VBFHbb_1btag']
228 hltHiggsPostVBFHbb_1btag.efficiencyProfile = efficiency_strings
229 
230 #Specific plots for VBFHbb_0btag
231 #dEtaqq, mqq, dPhibb, CVS1, maxCSV_jets, maxCSV_E, MET, pt1, pt2, pt3, pt4
232 plot_types = []
233 NminOneCuts = _config.VBFHbb_0btag.NminOneCuts
234 if NminOneCuts:
235  for iCut in range(0,len(NminOneCuts)):
236  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
237  if( NminOneCutNames[iCut] == "EffmaxCSV" ):
238  plot_types.pop()
239  plot_types.append(NminOneCutNames[iCut])
240 
241 efficiency_strings = []
242 for type in plot_types:
243  for obj in ["Jet"]:
244  for trig in triggers:
245  efficiency_strings.append(efficiency_string(obj,type,trig))
246 
247 efficiency_strings = get_reco_strings(efficiency_strings)
248 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
249 
250 hltHiggsPostVBFHbb_0btag = hltHiggsPostProcessor.clone()
251 hltHiggsPostVBFHbb_0btag.subDirs = ['HLT/Higgs/VBFHbb_0btag']
252 hltHiggsPostVBFHbb_0btag.efficiencyProfile = efficiency_strings
253 
254 
255 #Specific plots for ZnnHbb
256 #Jet plots
257 plot_types = ["EffEta", "EffPhi"]
258 NminOneCuts = _config.ZnnHbb.NminOneCuts
259 if NminOneCuts:
260  for iCut in range(0,len(NminOneCuts)):
261  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
262  plot_types.append(NminOneCutNames[iCut])
263 
264 efficiency_strings = []
265 for type in plot_types:
266  for obj in ["Jet"]:
267  for trig in triggers:
268  efficiency_strings.append(efficiency_string(obj,type,trig))
269 
270 efficiency_strings = get_reco_strings(efficiency_strings)
271 
272 #PFMET plots
273 plot_types = ["TurnOn1", "EffPhi"]
274 efficiency_strings2 = []
275 for type in plot_types:
276  for obj in ["PFMET"]:
277  for trig in triggers:
278  efficiency_strings2.append(efficiency_string(obj,type,trig))
279 
280 efficiency_strings2 = get_reco_strings(efficiency_strings2)
281 efficiency_strings += efficiency_strings2
282 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
283 
284 hltHiggsPostZnnHbb = hltHiggsPostProcessor.clone()
285 hltHiggsPostZnnHbb.subDirs = ['HLT/Higgs/ZnnHbb']
286 hltHiggsPostZnnHbb.efficiencyProfile = efficiency_strings
287 
288 
289 #Specific plots for X4b
290 #Jet plots
291 NminOneCuts = _config.X4b.NminOneCuts
292 if NminOneCuts:
293  for iCut in range(0,len(NminOneCuts)):
294  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
295  plot_types.append(NminOneCutNames[iCut])
296 
297 efficiency_strings = []
298 for type in plot_types:
299  for obj in ["Jet"]:
300  for trig in triggers:
301  efficiency_strings.append(efficiency_string(obj,type,trig))
302 
303 efficiency_strings = get_reco_strings(efficiency_strings)
304 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
305 
306 hltHiggsPostX4b = hltHiggsPostProcessor.clone()
307 hltHiggsPostX4b.subDirs = ['HLT/Higgs/X4b']
308 hltHiggsPostX4b.efficiencyProfile = efficiency_strings
309 
310 #Specific plots for WH -> ev + bb
311 efficiency_strings_WHToENuBB = list(efficiency_strings_TTHbbej)
312 #add the summary plots
313 for an in _config.analysis:
314  for trig in triggers:
315  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")
316 
317 efficiency_strings_WHToENuBB.extend(get_reco_strings(efficiency_strings_WHToENuBB))
318 
319 hltHiggsPostWHToENuBB = hltHiggsPostProcessor.clone()
320 hltHiggsPostWHToENuBB.subDirs = ['HLT/Higgs/WHToENuBB']
321 hltHiggsPostWHToENuBB.efficiencyProfile = efficiency_strings_WHToENuBB
322 
323 #Specific plots for MSSMHbb
324 #Jet plots
325 NminOneCuts = _config.MSSMHbb.NminOneCuts
326 if NminOneCuts:
327  for iCut in range(0,len(NminOneCuts)):
328  if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
329  plot_types.append(NminOneCutNames[iCut])
330 
331 efficiency_strings = []
332 for type in plot_types:
333  for obj in ["Jet"]:
334  for trig in triggers:
335  efficiency_strings.append(efficiency_string(obj,type,trig))
336 
337 efficiency_strings = get_reco_strings(efficiency_strings)
338 efficiency_strings.extend(get_reco_strings(efficiency_summary_strings))
339 
340 hltHiggsPostMSSMHbb = hltHiggsPostProcessor.clone()
341 hltHiggsPostMSSMHbb.subDirs = ['HLT/Higgs/MSSMHbb']
342 hltHiggsPostMSSMHbb.efficiencyProfile = efficiency_strings
343 hltHiggsPostProcessors = cms.Sequence(
344  hltHiggsPostHWW+
345  hltHiggsPostHZZ+
346  hltHiggsPostHgg+
347  hltHiggsPostHggControlPaths+
348  hltHiggsPostHtaunu+
349  hltHiggsPostH2tau+
350  hltHiggsPostTTHbbej+
351  hltHiggsPostAHttH+
352  hltHiggsPostVBFHbb_0btag+
353  hltHiggsPostVBFHbb_1btag+
354  hltHiggsPostVBFHbb_2btag+
355  hltHiggsPostZnnHbb+
356  hltHiggsPostDoubleHinTaus+
357  hltHiggsPostHiggsDalitz+
358  hltHiggsPostX4b+
359  hltHiggsPostWHToENuBB+
360  hltHiggsPostMSSMHbb
361 )
362 
363 
if(conf.exists("allCellsPositionCalc"))
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