Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:18:55

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 from HLTriggerOffline.Muon.hltMuonPostProcessor_cfi import *
0004 
0005 def efficiency_string(numer_label, denom_label,
0006                       plot_type, output_label=None):
0007     
0008     if output_label is None:
0009         output_label = numer_label
0010     if denom_label == "All" and numer_label != "L1":
0011         output_description = "Full Path"
0012     else:
0013         output_description = numer_label
0014     if denom_label == "All":
0015         denom_description = "# Gen #mu"
0016     else:
0017         denom_description = "# Gen #mu Matched to %s" % (denom_label)
0018     numer_description     = "# Gen #mu Matched to %s" % (numer_label)
0019 
0020     if plot_type == "TurnOn1":
0021         title = "pT Turn-On"
0022         xAxis = "p_{T} of Leading Generated Muon (GeV)"
0023         input_type = "PassMaxPt1"
0024     if plot_type == "TurnOn2":
0025         title = "Next-to-Leading pT Turn-On"
0026         xAxis = "p_{T} of Next-to-Leading Generated Muon (GeV)"
0027         input_type = "PassMaxPt2"
0028     if plot_type == "EffEta":
0029         title = "#eta Efficiency"
0030         xAxis = "#eta of Generated Muon (GeV)"
0031         input_type = "PassEta"
0032     if plot_type == "EffPhi":
0033         title = "#phi Efficiency"
0034         xAxis = "#phi of Generated Muon (GeV)"
0035         input_type = "PassPhi"
0036 
0037     yAxis = "%s / %s" % (numer_description, denom_description)
0038     all_titles = "%s for %s; %s; %s" % (title, output_description,
0039                                         xAxis, yAxis)
0040     return "gen%s_%s '%s' gen%s_%s gen%s_%s" % (plot_type, output_label,
0041                                                 all_titles, input_type,
0042                                                 numer_label, input_type,
0043                                                 denom_label)
0044 
0045 
0046 def add_reco_strings(strings):
0047     reco_strings = []
0048     for entry in strings:
0049         reco_strings.append(entry
0050                             .replace("Generated", "Reconstructed")
0051                             .replace("Gen", "Reco")
0052                             .replace("gen", "rec"))
0053     strings.extend(reco_strings)
0054 
0055 
0056 plot_types = ["TurnOn1", "TurnOn2", "EffEta", "EffPhi"] 
0057 efficiency_strings = []
0058 iso_strings = []
0059 noniso_strings = []
0060 
0061 for type in plot_types:
0062     efficiency_strings.append(efficiency_string("L1", "All", type))
0063     for step in ["L2", "L2Iso", "L3", "Tk", "L3EcalIso", "L3HcalIso", "L3TkIso"]:
0064         efficiency_strings.append(efficiency_string(step, "L1", type))
0065     noniso_strings.append(efficiency_string("L3", "All", type, "Total"))
0066     iso_strings.append(efficiency_string("L3EcalIso", "All", type, "Total"))
0067     iso_strings.append(efficiency_string("L3HcalIso", "All", type, "Total"))
0068     iso_strings.append(efficiency_string("L3TkIso", "All", type, "Total"))
0069 
0070 add_reco_strings(efficiency_strings)
0071 add_reco_strings(noniso_strings)
0072 add_reco_strings(iso_strings)
0073 
0074 hltMuonPostMain = hltMuonPostProcessor.clone()
0075 hltMuonPostMain.subDirs = ['HLT/Muon/Distributions/*']
0076 hltMuonPostMain.efficiencyProfile = efficiency_strings
0077 
0078 hltMuonPostNonIso = hltMuonPostMain.clone()
0079 #hltMuonPostNonIso.subDirs = ['HLT/Muon/Distributions/^(?:[^I]+|I(?!so))*$']
0080 hltMuonPostNonIso.subDirs = ['HLT/Muon/Distributions/((?!Iso).)*$']
0081 hltMuonPostNonIso.efficiencyProfile = noniso_strings
0082 
0083 hltMuonPostIso = hltMuonPostMain.clone()
0084 hltMuonPostIso.subDirs = ['HLT/Muon/Distributions/.*Iso.*$']
0085 hltMuonPostIso.efficiencyProfile = iso_strings
0086 
0087 hltMuonPostProcessors = cms.Sequence(
0088     hltMuonPostNonIso *
0089     hltMuonPostIso    *
0090     hltMuonPostMain
0091 )