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.SMP.hltSMPPostProcessor_cfi import *
0004 
0005 # Build the standard strings to the DQM
0006 def make_efficiency_string(objtype,plot_type,triggerpath):
0007     # --- IMPORTANT: Add here a elif if you are introduce a new collection
0008     #                (see EVTColContainer::getTypeString) 
0009     if objtype == "Mu" :
0010       objtypeLatex="#mu"
0011     elif objtype == "Photon": 
0012       objtypeLatex="#gamma"
0013     elif objtype == "Ele": 
0014       objtypeLatex="e"
0015     elif objtype == "MET" :
0016       objtypeLatex="MET"
0017     elif objtype == "PFTau": 
0018       objtypeLatex="#tau"
0019     else:
0020       objtypeLatex=objtype
0021 
0022     numer_description = "# gen %s passed the %s" % (objtypeLatex,triggerpath)
0023     denom_description = "# gen %s " % (objtypeLatex)
0024 
0025     if plot_type == "TurnOn1":
0026         title = "pT Turn-On"
0027         xAxis = "p_{T} of Leading Generated %s (GeV/c)" % (objtype)
0028         input_type = "gen%sMaxPt1" % (objtype)
0029     if plot_type == "TurnOn2":
0030         title = "Next-to-Leading pT Turn-On"
0031         xAxis = "p_{T} of Next-to-Leading Generated %s (GeV/c)" % (objtype)
0032         input_type = "gen%sMaxPt2" % (objtype)
0033     if plot_type == "EffEta":
0034         title = "#eta Efficiency"
0035         xAxis = "#eta of Generated %s " % (objtype)
0036         input_type = "gen%sEta" % (objtype)
0037     if plot_type == "EffPhi":
0038         title = "#phi Efficiency"
0039         xAxis = "#phi of Generated %s " % (objtype)
0040         input_type = "gen%sPhi" % (objtype)
0041 
0042     yAxis = "%s / %s" % (numer_description, denom_description)
0043     all_titles = "%s for trigger %s; %s; %s" % (title, triggerpath,
0044                                         xAxis, yAxis)
0045     return "Eff_%s_%s '%s' %s_%s %s" % (input_type,triggerpath,
0046                 all_titles,input_type,triggerpath,input_type)
0047 
0048 from HLTriggerOffline.SMP.hltSMPValidator_cfi import hltSMPValidator as _config
0049 def make_smp_postprocessor(analysis_name, plot_types=["TurnOn1", "TurnOn2", "EffEta", "EffPhi"], object_types=["Mu","Ele","Photon","MET","PFMET","PFTau","Jet"], extra_str_templates=[]):
0050     postprocessor = hltSMPPostProcessor.clone()
0051     postprocessor.subDirs = ["HLT/SMP/" + analysis_name]
0052     efficiency_strings = [] # List of plots to look for. This is quite a bit larger than the number of plots that will be made.
0053 
0054     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"
0055     efficiency_strings.append(efficiency_summary_string)
0056     efficiency_strings.append(efficiency_summary_string.replace("Generated", "Reconstructed").replace("Gen", "Reco").replace("gen", "rec"))
0057 
0058     for plot_type in plot_types:
0059         for object_type in object_types:
0060             for trigger in [x.replace("_v", "") for x in _config.__getattribute__(analysis_name).hltPathsToCheck]:
0061                 this_efficiency_string = make_efficiency_string(object_type, plot_type, trigger)
0062                 efficiency_strings.append(this_efficiency_string)
0063                 efficiency_strings.append(this_efficiency_string.replace("Generated", "Reconstructed").replace("Gen", "Reco").replace("gen", "rec"))
0064 
0065                 for str_template in extra_str_templates:
0066                     this_extra_string = str_template.replace("@ANALYSIS@", analysis_name).replace("@TRIGGER@", trigger)
0067                     efficiency_strings.append(this_extra_string)
0068                     efficiency_strings.append(this_extra_string.replace("Generated", "Reconstructed").replace("Gen", "Reco").replace("gen", "rec"))
0069 
0070     postprocessor.efficiencyProfile = efficiency_strings
0071     return postprocessor
0072 
0073 
0074 plot_types = ["TurnOn1", "TurnOn2", "EffEta", "EffPhi"]
0075 #--- IMPORTANT: Update this collection whenever you introduce a new object
0076 #               in the code (from EVTColContainer::getTypeString)
0077 object_types  = ["Mu","Ele","Photon","MET","PFTau"]
0078 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"
0079 
0080 
0081 hltSMPPostSingleEle = make_smp_postprocessor("SingleEle", plot_types=plot_types, object_types=object_types, extra_str_templates=[truevtx_string_template])
0082 #hltSMPPostSingleMu = make_smp_postprocessor("SingleMu", plot_types=plot_types, object_types=object_types, extra_str_templates=[truevtx_string_template])
0083 hltSMPPostSinglePhoton = make_smp_postprocessor("SinglePhoton", plot_types=plot_types, object_types=object_types, extra_str_templates=[truevtx_string_template])
0084 
0085 # hltSMPPostSingleMu = hltSMPPostProcessor.clone()
0086 # hltSMPPostSingleMu.subDirs = ['HLT/SMP/SingleMu']
0087 # hltSMPPostSingleMu.efficiencyProfile = efficiency_strings
0088 
0089 hltSMPPostProcessors = cms.Sequence(
0090     hltSMPPostSingleEle+
0091 #    hltSMPPostSingleMu+
0092     hltSMPPostSinglePhoton
0093 )
0094 
0095