1 import FWCore.ParameterSet.Config
as cms
11 elif objtype ==
"Photon":
13 elif objtype ==
"Ele":
15 elif objtype ==
"MET" :
17 elif objtype ==
"PFTau":
22 numer_description =
"# gen %s passed the %s" % (objtypeLatex,triggerpath)
23 denom_description =
"# gen %s " % (objtypeLatex)
25 if plot_type ==
"TurnOn1":
27 xAxis =
"p_{T} of Leading Generated %s (GeV/c)" % (objtype)
28 input_type =
"gen%sMaxPt1" % (objtype)
29 if plot_type ==
"TurnOn2":
30 title =
"Next-to-Leading pT Turn-On"
31 xAxis =
"p_{T} of Next-to-Leading Generated %s (GeV/c)" % (objtype)
32 input_type =
"gen%sMaxPt2" % (objtype)
33 if plot_type ==
"EffEta":
34 title =
"#eta Efficiency"
35 xAxis =
"#eta of Generated %s " % (objtype)
36 input_type =
"gen%sEta" % (objtype)
37 if plot_type ==
"EffPhi":
38 title =
"#phi Efficiency"
39 xAxis =
"#phi of Generated %s " % (objtype)
40 input_type =
"gen%sPhi" % (objtype)
42 yAxis =
"%s / %s" % (numer_description, denom_description)
43 all_titles =
"%s for trigger %s; %s; %s" % (title, triggerpath,
45 return "Eff_%s_%s '%s' %s_%s %s" % (input_type,triggerpath,
46 all_titles,input_type,triggerpath,input_type)
49 def make_smp_postprocessor(analysis_name, plot_types=["TurnOn1", "TurnOn2", "EffEta", "EffPhi"], object_types=["Mu","Ele","Photon","MET","PFMET","PFTau","Jet"], extra_str_templates=[]):
50 postprocessor = hltSMPPostProcessor.clone()
51 postprocessor.subDirs = [
"HLT/SMP/" + analysis_name]
52 efficiency_strings = []
54 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"
55 efficiency_strings.append(efficiency_summary_string)
56 efficiency_strings.append(efficiency_summary_string.replace(
"Generated",
"Reconstructed").
replace(
"Gen",
"Reco").
replace(
"gen",
"rec"))
58 for plot_type
in plot_types:
59 for object_type
in object_types:
60 for trigger
in [x.replace(
"_v",
"")
for x
in _config.__getattribute__(analysis_name).hltPathsToCheck]:
62 efficiency_strings.append(this_efficiency_string)
63 efficiency_strings.append(this_efficiency_string.replace(
"Generated",
"Reconstructed").
replace(
"Gen",
"Reco").
replace(
"gen",
"rec"))
65 for str_template
in extra_str_templates:
66 this_extra_string = str_template.replace(
"@ANALYSIS@", analysis_name).
replace(
"@TRIGGER@", trigger)
67 efficiency_strings.append(this_extra_string)
68 efficiency_strings.append(this_extra_string.replace(
"Generated",
"Reconstructed").
replace(
"Gen",
"Reco").
replace(
"gen",
"rec"))
70 postprocessor.efficiencyProfile = efficiency_strings
74 plot_types = [
"TurnOn1",
"TurnOn2",
"EffEta",
"EffPhi"]
77 object_types = [
"Mu",
"Ele",
"Photon",
"MET",
"PFTau"]
78 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"
81 hltSMPPostSingleEle =
make_smp_postprocessor(
"SingleEle", plot_types=plot_types, object_types=object_types, extra_str_templates=[truevtx_string_template])
83 hltSMPPostSinglePhoton =
make_smp_postprocessor(
"SinglePhoton", plot_types=plot_types, object_types=object_types, extra_str_templates=[truevtx_string_template])
89 hltSMPPostProcessors = cms.Sequence(
92 hltSMPPostSinglePhoton