CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/HLTriggerOffline/Higgs/python/hltHiggsPostProcessors_cff.py

Go to the documentation of this file.
00001 import FWCore.ParameterSet.Config as cms
00002 
00003 from HLTriggerOffline.Higgs.hltHiggsPostProcessor_cfi import *
00004 
00005 # Build the standard strings to the DQM
00006 def efficiency_string(objtype,plot_type,triggerpath):
00007     # --- IMPORTANT: Add here a elif if you are introduce a new collection
00008     #                (see EVTColContainer::getTypeString) 
00009     if objtype == "Mu" :
00010         objtypeLatex="#mu"
00011     elif objtype == "Photon": 
00012         objtypeLatex="#gamma"
00013     elif objtype == "Ele": 
00014         objtypeLatex="e"
00015     elif objtype == "MET" :
00016         objtypeLatex="MET"
00017     elif objtype == "PFTau": 
00018         objtypeLatex="#tau"
00019     else:
00020         objtypeLatex=objtype
00021 
00022     numer_description = "# gen %s passed the %s" % (objtypeLatex,triggerpath)
00023     denom_description = "# gen %s " % (objtypeLatex)
00024 
00025     if plot_type == "TurnOn1":
00026         title = "pT Turn-On"
00027         xAxis = "p_{T} of Leading Generated %s (GeV/c)" % (objtype)
00028         input_type = "gen%sMaxPt1" % (objtype)
00029     if plot_type == "TurnOn2":
00030         title = "Next-to-Leading pT Turn-On"
00031         xAxis = "p_{T} of Next-to-Leading Generated %s (GeV/c)" % (objtype)
00032         input_type = "gen%sMaxPt2" % (objtype)
00033     if plot_type == "EffEta":
00034         title = "#eta Efficiency"
00035         xAxis = "#eta of Generated %s " % (objtype)
00036         input_type = "gen%sEta" % (objtype)
00037     if plot_type == "EffPhi":
00038         title = "#phi Efficiency"
00039         xAxis = "#phi of Generated %s " % (objtype)
00040         input_type = "gen%sPhi" % (objtype)
00041 
00042     yAxis = "%s / %s" % (numer_description, denom_description)
00043     all_titles = "%s for trigger %s; %s; %s" % (title, triggerpath,
00044                                         xAxis, yAxis)
00045     return "Eff_%s_%s '%s' %s_%s %s" % (input_type,triggerpath,
00046                     all_titles,input_type,triggerpath,input_type)
00047 
00048 # Adding the reco objects
00049 def add_reco_strings(strings):
00050     reco_strings = []
00051     for entry in strings:
00052         reco_strings.append(entry
00053                             .replace("Generated", "Reconstructed")
00054                             .replace("Gen", "Reco")
00055                             .replace("gen", "rec"))
00056     strings.extend(reco_strings)
00057 
00058 
00059 plot_types = ["TurnOn1", "TurnOn2", "EffEta", "EffPhi"]
00060 #--- IMPORTANT: Update this collection whenever you introduce a new object
00061 #               in the code (from EVTColContainer::getTypeString)
00062 obj_types  = ["Mu","Ele","Photon","MET","PFTau"]
00063 #--- IMPORTANT: Trigger are extracted from the hltHiggsValidator_cfi.py module
00064 triggers = [ ] 
00065 efficiency_strings = []
00066 
00067 # Extract the triggers used in the hltHiggsValidator 
00068 from HLTriggerOffline.Higgs.hltHiggsValidator_cfi import hltHiggsValidator as config
00069 triggers = set([])
00070 for an in config.analysis:
00071         s = config.__getattribute__(an)
00072         vstr = s.__getattribute__("hltPathsToCheck")
00073         map(lambda x: triggers.add(x.replace("_v","")),vstr)
00074 triggers = list(triggers)
00075 #------------------------------------------------------------
00076 
00077 # Generating the list with all the efficiencies
00078 for type in plot_types:
00079     for obj in obj_types:
00080         for trig in triggers:
00081             efficiency_strings.append(efficiency_string(obj,type,trig))
00082 
00083 add_reco_strings(efficiency_strings)
00084 
00085 hltHiggsPostHTauNu = hltHiggsPostProcessor.clone()
00086 hltHiggsPostHTauNu.subDirs = ['HLT/Higgs/Htaunu']
00087 hltHiggsPostHTauNu.efficiencyProfile = efficiency_strings
00088 
00089 hltHiggsPostHWW = hltHiggsPostProcessor.clone()
00090 hltHiggsPostHWW.subDirs = ['HLT/Higgs/HWW']
00091 hltHiggsPostHWW.efficiencyProfile = efficiency_strings
00092 
00093 hltHiggsPostHZZ = hltHiggsPostProcessor.clone()
00094 hltHiggsPostHZZ.subDirs = ['HLT/Higgs/HZZ']
00095 hltHiggsPostHZZ.efficiencyProfile = efficiency_strings
00096 
00097 hltHiggsPostHgg = hltHiggsPostProcessor.clone()
00098 hltHiggsPostHgg.subDirs = ['HLT/Higgs/Hgg']
00099 hltHiggsPostHgg.efficiencyProfile = efficiency_strings
00100 
00101 hltHiggsPostH2tau = hltHiggsPostProcessor.clone()
00102 hltHiggsPostH2tau.subDirs = ['HLT/Higgs/H2tau']
00103 hltHiggsPostH2tau.efficiencyProfile = efficiency_strings
00104 
00105 hltHiggsPostHtaunu = hltHiggsPostProcessor.clone()
00106 hltHiggsPostHtaunu.subDirs = ['HLT/Higgs/Htaunu']
00107 hltHiggsPostHtaunu.efficiencyProfile = efficiency_strings
00108 
00109 
00110 hltHiggsPostProcessors = cms.Sequence(
00111                 hltHiggsPostHWW+
00112                 hltHiggsPostHZZ+
00113                 hltHiggsPostHgg+
00114                 hltHiggsPostHtaunu+
00115                 hltHiggsPostH2tau
00116 )