1 import FWCore.ParameterSet.Config
as cms
11 elif objtype ==
"Photon":
13 elif objtype ==
"Ele":
15 elif objtype ==
"MET" :
17 elif objtype ==
"PFMET" :
19 elif objtype ==
"PFTau":
21 elif objtype ==
"Jet":
26 numer_description =
"# gen %s passed the %s" % (objtypeLatex,triggerpath)
27 denom_description =
"# gen %s " % (objtypeLatex)
29 if plot_type ==
"TurnOn1":
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)
78 yAxis =
"%s / %s" % (numer_description, denom_description)
79 all_titles =
"%s for trigger %s; %s; %s" % (title, triggerpath,
81 return "Eff_%s_%s '%s' %s_%s %s" % (input_type,triggerpath,
82 all_titles,input_type,triggerpath,input_type)
86 def make_higgs_postprocessor(analysis_name, plot_types=["TurnOn1", "TurnOn2", "EffEta", "EffPhi"], object_types=["Mu","Ele","Photon","MET","PFMET","PFTau","Jet"], extra_str_templates=[]):
87 postprocessor = hltHiggsPostProcessor.clone()
88 postprocessor.subDirs = [
"HLT/Higgs/" + analysis_name]
89 efficiency_strings = []
91 efficiency_summary_string =
"EffSummaryPaths_" + analysis_name +
"_gen ' Efficiency of paths used in " + analysis_name +
" ; trigger path ' SummaryPaths_" + analysis_name +
"_gen_passingHLT SummaryPaths_" + analysis_name +
"_gen" 92 efficiency_strings.append(efficiency_summary_string)
93 efficiency_strings.append(efficiency_summary_string.replace(
"Generated",
"Reconstructed").
replace(
"Gen",
"Reco").
replace(
"gen",
"rec"))
95 for plot_type
in plot_types:
96 for object_type
in object_types:
97 for trigger
in [x.replace(
"_v",
"")
for x
in _config.__getattribute__(analysis_name).hltPathsToCheck]:
99 efficiency_strings.append(this_efficiency_string)
100 efficiency_strings.append(this_efficiency_string.replace(
"Generated",
"Reconstructed").
replace(
"Gen",
"Reco").
replace(
"gen",
"rec"))
102 for str_template
in extra_str_templates:
103 this_extra_string = str_template.replace(
"@ANALYSIS@", analysis_name).
replace(
"@TRIGGER@", trigger)
104 efficiency_strings.append(this_extra_string)
105 efficiency_strings.append(this_extra_string.replace(
"Generated",
"Reconstructed").
replace(
"Gen",
"Reco").
replace(
"gen",
"rec"))
107 postprocessor.efficiencyProfile = efficiency_strings
110 truevtx_string_template =
"Eff_trueVtxDist_@ANALYSIS@_gen_@TRIGGER@ ' Efficiency of @TRIGGER@ vs nb of interactions ; nb events passing each path ' trueVtxDist_@ANALYSIS@_gen_@TRIGGER@ trueVtxDist_@ANALYSIS@_gen" 123 TTHbbej_HtDist_template =
"Eff_HtDist_@ANALYSIS@_gen_@TRIGGER@ ' Efficiency of @TRIGGER@ vs sum pT of jets ; sum pT of jets ' HtDist_@ANALYSIS@_gen_@TRIGGER@ HtDist_@ANALYSIS@_gen" 129 NminOneCutNames = (
"EffdEtaqq",
"Effmqq",
"EffdPhibb",
"EffCSV1",
"EffCSV2",
"EffCSV3",
"EffmaxCSV",
"",
"",
"TurnOn1",
"TurnOn2",
"TurnOn3",
"TurnOn4")
130 VBFHbb_2btag_plot_types = []
131 NminOneCuts =_config.VBFHbb_2btag.NminOneCuts
133 for iCut
in range(0,len(NminOneCuts)):
134 if( NminOneCuts[iCut]
and NminOneCutNames[iCut] ):
135 if( NminOneCutNames[iCut] ==
"EffmaxCSV" ):
136 VBFHbb_2btag_plot_types.pop()
137 VBFHbb_2btag_plot_types.append(NminOneCutNames[iCut])
138 hltHiggsPostVBFHbb_2btag =
make_higgs_postprocessor(
"VBFHbb_2btag", object_types=[
"Jet"], plot_types=VBFHbb_2btag_plot_types, extra_str_templates=[truevtx_string_template])
142 VBFHbb_1btag_plot_types = []
143 NminOneCuts = _config.VBFHbb_1btag.NminOneCuts
145 for iCut
in range(0,len(NminOneCuts)):
146 if( NminOneCuts[iCut]
and NminOneCutNames[iCut] ):
147 if( NminOneCutNames[iCut] ==
"EffmaxCSV" ):
148 VBFHbb_1btag_plot_types.pop()
149 VBFHbb_1btag_plot_types.append(NminOneCutNames[iCut])
150 hltHiggsPostVBFHbb_1btag =
make_higgs_postprocessor(
"VBFHbb_1btag", plot_types=VBFHbb_1btag_plot_types, object_types=[
"Jet"], extra_str_templates=[truevtx_string_template])
154 VBFHbb_0btag_plot_types = []
155 NminOneCuts = _config.VBFHbb_0btag.NminOneCuts
157 for iCut
in range(0,len(NminOneCuts)):
158 if( NminOneCuts[iCut]
and NminOneCutNames[iCut] ):
159 if( NminOneCutNames[iCut] ==
"EffmaxCSV" ):
160 VBFHbb_0btag_plot_types.pop()
161 VBFHbb_0btag_plot_types.append(NminOneCutNames[iCut])
162 hltHiggsPostVBFHbb_0btag =
make_higgs_postprocessor(
"VBFHbb_0btag", plot_types=VBFHbb_0btag_plot_types, object_types=[
"Jet"], extra_str_templates=[truevtx_string_template])
166 ZnnHbb_plot_types = [
"EffEta",
"EffPhi",
"TurnOn1"]
167 NminOneCuts = _config.ZnnHbb.NminOneCuts
169 for iCut
in range(0,len(NminOneCuts)):
170 if( NminOneCuts[iCut]
and NminOneCutNames[iCut] ):
171 ZnnHbb_plot_types.append(NminOneCutNames[iCut])
172 hltHiggsPostZnnHbb =
make_higgs_postprocessor(
"ZnnHbb", plot_types=ZnnHbb_plot_types, object_types=[
"Jet",
"PFMET"], extra_str_templates=[truevtx_string_template])
176 X4b_plot_types = [
"EffEta",
"EffPhi",
"TurnOn1"]
177 NminOneCuts = _config.X4b.NminOneCuts
179 for iCut
in range(0,len(NminOneCuts)):
180 if( NminOneCuts[iCut]
and NminOneCutNames[iCut] ):
181 X4b_plot_types.append(NminOneCutNames[iCut])
182 hltHiggsPostX4b =
make_higgs_postprocessor(
"X4b", plot_types=X4b_plot_types, object_types=[
"Jet"], extra_str_templates=[truevtx_string_template])
185 hltHiggsPostWHToENuBB =
make_higgs_postprocessor(
"WHToENuBB", extra_str_templates=[truevtx_string_template, TTHbbej_HtDist_template])
187 hltHiggsPostProcessors = cms.Sequence(
190 hltHiggsPostHZZControlPaths+
198 hltHiggsPostVBFHbb_0btag+
199 hltHiggsPostVBFHbb_1btag+
200 hltHiggsPostVBFHbb_2btag+
202 hltHiggsPostDoubleHinTaus+
203 hltHiggsPostHiggsDalitz+
205 hltHiggsPostWHToENuBB+
206 hltHiggsPostVBFHToInv
def make_higgs_postprocessor(analysis_name, plot_types=["TurnOn1", TurnOn2, EffEta, EffPhi, object_types=["Mu", Ele, Photon, MET, PFMET, PFTau, Jet, extra_str_templates=[])
def replace(string, replacements)
def make_efficiency_string(objtype, plot_type, triggerpath)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)