CMS 3D CMS Logo

Functions
hltSMPPostProcessors_cff Namespace Reference

Functions

def make_efficiency_string (objtype, plot_type, triggerpath)
 
def make_smp_postprocessor (analysis_name, plot_types=["TurnOn1", TurnOn2, EffEta, EffPhi, object_types=["Mu", Ele, Photon, MET, PFMET, PFTau, Jet, extra_str_templates=[])
 

Function Documentation

def hltSMPPostProcessors_cff.make_efficiency_string (   objtype,
  plot_type,
  triggerpath 
)

Definition at line 6 of file hltSMPPostProcessors_cff.py.

Referenced by make_smp_postprocessor().

6 def make_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 == "PFTau":
18  objtypeLatex="#tau"
19  else:
20  objtypeLatex=objtype
21 
22  numer_description = "# gen %s passed the %s" % (objtypeLatex,triggerpath)
23  denom_description = "# gen %s " % (objtypeLatex)
24 
25  if plot_type == "TurnOn1":
26  title = "pT Turn-On"
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)
41 
42  yAxis = "%s / %s" % (numer_description, denom_description)
43  all_titles = "%s for trigger %s; %s; %s" % (title, triggerpath,
44  xAxis, yAxis)
45  return "Eff_%s_%s '%s' %s_%s %s" % (input_type,triggerpath,
46  all_titles,input_type,triggerpath,input_type)
47 
def make_efficiency_string(objtype, plot_type, triggerpath)
def hltSMPPostProcessors_cff.make_smp_postprocessor (   analysis_name,
  plot_types = ["TurnOn1",
  TurnOn2,
  EffEta,
  EffPhi,
  object_types = ["Mu",
  Ele,
  Photon,
  MET,
  PFMET,
  PFTau,
  Jet,
  extra_str_templates = [] 
)

Definition at line 49 of file hltSMPPostProcessors_cff.py.

References make_efficiency_string(), and python.rootplot.root2matplotlib.replace().

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 = [] # List of plots to look for. This is quite a bit larger than the number of plots that will be made.
53 
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"))
57 
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]:
61  this_efficiency_string = make_efficiency_string(object_type, plot_type, trigger)
62  efficiency_strings.append(this_efficiency_string)
63  efficiency_strings.append(this_efficiency_string.replace("Generated", "Reconstructed").replace("Gen", "Reco").replace("gen", "rec"))
64 
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"))
69 
70  postprocessor.efficiencyProfile = efficiency_strings
71  return postprocessor
72 
73 
def make_efficiency_string(objtype, plot_type, triggerpath)
def make_smp_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)