CMS 3D CMS Logo

hltSMPPostProcessors_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 == "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 
48 # Adding the reco objects
49 def add_reco_strings(strings):
50  reco_strings = []
51  for entry in strings:
52  reco_strings.append(entry
53  .replace("Generated", "Reconstructed")
54  .replace("Gen", "Reco")
55  .replace("gen", "rec"))
56  strings.extend(reco_strings)
57 
58 
59 plot_types = ["TurnOn1", "TurnOn2", "EffEta", "EffPhi"]
60 #--- IMPORTANT: Update this collection whenever you introduce a new object
61 # in the code (from EVTColContainer::getTypeString)
62 obj_types = ["Mu","Ele","Photon","MET","PFTau"]
63 #--- IMPORTANT: Trigger are extracted from the hltSMPValidator_cfi.py module
64 triggers = [ ]
65 efficiency_strings = []
66 
67 # Extract the triggers used in the hltSMPValidator
68 from HLTriggerOffline.SMP.hltSMPValidator_cfi import hltSMPValidator as _config
69 triggers = set([])
70 for an in _config.analysis:
71  s = _config.__getattribute__(an)
72  vstr = s.__getattribute__("hltPathsToCheck")
73  map(lambda x: triggers.add(x.replace("_v","")),vstr)
74 triggers = list(triggers)
75 #------------------------------------------------------------
76 
77 # Generating the list with all the efficiencies
78 for type in plot_types:
79  for obj in obj_types:
80  for trig in triggers:
81  efficiency_strings.append(efficiency_string(obj,type,trig))
82 
83 
84 #add the summary plots
85 for an in _config.analysis:
86  efficiency_strings.append("EffSummaryPaths_"+an+"_gen ' Efficiency of paths used in "+an+" ; trigger path ' SummaryPaths_"+an+"_gen_passingHLT SummaryPaths_"+an+"_gen")
87  for trig in triggers:
88  efficiency_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")
89 
90 add_reco_strings(efficiency_strings)
91 
92 
93 
94 hltSMPPostSingleEle = hltSMPPostProcessor.clone()
95 hltSMPPostSingleEle.subDirs = ['HLT/SMP/SingleEle']
96 hltSMPPostSingleEle.efficiencyProfile = efficiency_strings
97 
98 # hltSMPPostSingleMu = hltSMPPostProcessor.clone()
99 # hltSMPPostSingleMu.subDirs = ['HLT/SMP/SingleMu']
100 # hltSMPPostSingleMu.efficiencyProfile = efficiency_strings
101 
102 hltSMPPostSinglePhoton = hltSMPPostProcessor.clone()
103 hltSMPPostSinglePhoton.subDirs = ['HLT/SMP/SinglePhoton']
104 hltSMPPostSinglePhoton.efficiencyProfile = efficiency_strings
105 
106 hltSMPPostProcessors = cms.Sequence(
107  hltSMPPostSingleEle+
108 # hltSMPPostSingleMu+
109  hltSMPPostSinglePhoton
110 )
111 
112 
def replace(string, replacements)
def efficiency_string(objtype, plot_type, triggerpath)
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