Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 from HLTriggerOffline.Higgs.hltHiggsPostProcessor_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 == "PFMET" :
0018         objtypeLatex="PFMET"
0019     elif objtype == "PFTau": 
0020         objtypeLatex="#tau"
0021     elif objtype == "Jet": 
0022         objtypeLatex="jet"
0023     else:
0024         objtypeLatex=objtype
0025 
0026     numer_description = "# gen %s passed the %s" % (objtypeLatex,triggerpath)
0027     denom_description = "# gen %s " % (objtypeLatex)
0028 
0029     if plot_type == "TurnOn1":
0030         title = "pT Turn-On"
0031         xAxis = "p_{T} of Leading Generated %s (GeV/c)" % (objtype)
0032         input_type = "gen%sMaxPt1" % (objtype)
0033     elif plot_type == "TurnOn2":
0034         title = "Next-to-Leading pT Turn-On"
0035         xAxis = "p_{T} of Next-to-Leading Generated %s (GeV/c)" % (objtype)
0036         input_type = "gen%sMaxPt2" % (objtype)
0037     elif plot_type == "EffEta":
0038         title = "#eta Efficiency"
0039         xAxis = "#eta of Generated %s " % (objtype)
0040         input_type = "gen%sEta" % (objtype)
0041     elif plot_type == "EffPhi":
0042         title = "#phi Efficiency"
0043         xAxis = "#phi of Generated %s " % (objtype)
0044         input_type = "gen%sPhi" % (objtype)     
0045     elif "TurnOn" in plot_type:
0046         title = "%sth Leading pT Turn-On" % (plot_type[-1])
0047         xAxis = "p_{T} of %sth Leading Generated %s (GeV/c)" % (plot_type[-1], objtype)
0048         input_type = "gen%sMaxPt%s" % (objtype, plot_type[-1])
0049     elif plot_type == "EffdEtaqq":
0050         title = "#Delta #eta_{qq} Efficiency"
0051         xAxis = "#Delta #eta_{qq} of Generated %s " % (objtype)
0052         input_type = "gen%sdEtaqq" % (objtype)
0053     elif plot_type == "Effmqq":
0054         title = "m_{qq} Efficiency"
0055         xAxis = "m_{qq} of Generated %s " % (objtype)
0056         input_type = "gen%smqq" % (objtype)
0057     elif plot_type == "EffdPhibb":
0058         title = "#Delta #phi_{bb} Efficiency"
0059         xAxis = "#Delta #phi_{bb} of Generated %s " % (objtype)
0060         input_type = "gen%sdPhibb" % (objtype)
0061     elif plot_type == "EffCSV1":
0062         title = "CSV1 Efficiency"
0063         xAxis = "CSV1 of Generated %s " % (objtype)
0064         input_type = "gen%sCSV1" % (objtype)
0065     elif plot_type == "EffCSV2":
0066         title = "CSV2 Efficiency"
0067         xAxis = "CSV2 of Generated %s " % (objtype)
0068         input_type = "gen%sCSV2" % (objtype)
0069     elif plot_type == "EffCSV3":
0070         title = "CSV3 Efficiency"
0071         xAxis = "CSV3 of Generated %s " % (objtype)
0072         input_type = "gen%sCSV3" % (objtype)
0073     elif plot_type == "EffmaxCSV":
0074         title = "max CSV Efficiency"
0075         xAxis = "max CSV of Generated %s " % (objtype)
0076         input_type = "gen%smaxCSV" % (objtype)
0077         
0078     yAxis = "%s / %s" % (numer_description, denom_description)
0079     all_titles = "%s for trigger %s; %s; %s" % (title, triggerpath,
0080                                         xAxis, yAxis)
0081     return "Eff_%s_%s '%s' %s_%s %s" % (input_type,triggerpath,
0082             all_titles,input_type,triggerpath,input_type)
0083 
0084 #--- IMPORTANT: Trigger are extracted from the hltHiggsValidator_cfi.py module
0085 from HLTriggerOffline.Higgs.hltHiggsValidator_cfi import hltHiggsValidator as _config
0086 def make_higgs_postprocessor(analysis_name, plot_types=["TurnOn1", "TurnOn2", "EffEta", "EffPhi"], object_types=["Mu","Ele","Photon","MET","PFMET","PFTau","Jet"], extra_str_templates=[]):
0087     postprocessor = hltHiggsPostProcessor.clone()
0088     postprocessor.subDirs = ["HLT/Higgs/" + analysis_name]
0089     efficiency_strings = [] # List of plots to look for. This is quite a bit larger than the number of plots that will be made.
0090 
0091     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"
0092     efficiency_strings.append(efficiency_summary_string)
0093     efficiency_strings.append(efficiency_summary_string.replace("Generated", "Reconstructed").replace("Gen", "Reco").replace("gen", "rec"))
0094 
0095     for plot_type in plot_types:
0096         for object_type in object_types:
0097             for trigger in [x.replace("_v", "") for x in _config.__getattribute__(analysis_name).hltPathsToCheck]:
0098                 this_efficiency_string = make_efficiency_string(object_type, plot_type, trigger)
0099                 efficiency_strings.append(this_efficiency_string)
0100                 efficiency_strings.append(this_efficiency_string.replace("Generated", "Reconstructed").replace("Gen", "Reco").replace("gen", "rec"))
0101 
0102                 for str_template in extra_str_templates:
0103                     this_extra_string = str_template.replace("@ANALYSIS@", analysis_name).replace("@TRIGGER@", trigger)
0104                     efficiency_strings.append(this_extra_string)
0105                     efficiency_strings.append(this_extra_string.replace("Generated", "Reconstructed").replace("Gen", "Reco").replace("gen", "rec"))
0106 
0107     postprocessor.efficiencyProfile = efficiency_strings
0108     return postprocessor
0109 
0110 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"
0111 hltHiggsPostHWW = make_higgs_postprocessor("HWW", extra_str_templates=[truevtx_string_template])
0112 hltHiggsPostHZZControlPaths = make_higgs_postprocessor("HZZControlPaths", extra_str_templates=[truevtx_string_template])
0113 hltHiggsPostHZZ = make_higgs_postprocessor("HZZ", extra_str_templates=[truevtx_string_template])
0114 hltHiggsPostHgg = make_higgs_postprocessor("Hgg", extra_str_templates=[truevtx_string_template])
0115 #hltHiggsPostHggControlPaths = make_higgs_postprocessor("HggControlPaths", extra_str_templates=[truevtx_string_template])
0116 hltHiggsPostMuonJet = make_higgs_postprocessor("MuonJet", extra_str_templates=[truevtx_string_template])
0117 hltHiggsPostDoubleHinTaus = make_higgs_postprocessor("DoubleHinTaus", extra_str_templates=[truevtx_string_template])
0118 hltHiggsPostHiggsDalitz = make_higgs_postprocessor("HiggsDalitz", extra_str_templates=[truevtx_string_template])
0119 hltHiggsPostH2tau = make_higgs_postprocessor("H2tau", extra_str_templates=[truevtx_string_template])
0120 hltHiggsPostHtaunu = make_higgs_postprocessor("Htaunu", extra_str_templates=[truevtx_string_template])
0121 hltHiggsPostVBFHToInv = make_higgs_postprocessor("VBFHToInv", extra_str_templates=[truevtx_string_template])
0122 
0123 TTHbbej_HtDist_template = "Eff_HtDist_@ANALYSIS@_gen_@TRIGGER@ ' Efficiency of @TRIGGER@ vs sum pT of jets ; sum pT of jets ' HtDist_@ANALYSIS@_gen_@TRIGGER@ HtDist_@ANALYSIS@_gen"
0124 hltHiggsPostTTHbbej = make_higgs_postprocessor("TTHbbej", extra_str_templates=[truevtx_string_template, TTHbbej_HtDist_template])
0125 hltHiggsPostAHttH = make_higgs_postprocessor("AHttH", extra_str_templates=[truevtx_string_template, TTHbbej_HtDist_template])
0126 
0127 #Specific plots for VBFHbb_2btag  
0128 #dEtaqq, mqq, dPhibb, CVS1, maxCSV_jets, maxCSV_E, MET, pt1, pt2, pt3, pt4
0129 NminOneCutNames = ("EffdEtaqq", "Effmqq", "EffdPhibb", "EffCSV1", "EffCSV2", "EffCSV3",  "EffmaxCSV", "", "", "TurnOn1", "TurnOn2", "TurnOn3", "TurnOn4")
0130 VBFHbb_2btag_plot_types = []
0131 NminOneCuts =_config.VBFHbb_2btag.NminOneCuts
0132 if NminOneCuts: 
0133     for iCut in range(0,len(NminOneCuts)):
0134         if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
0135             if( NminOneCutNames[iCut] == "EffmaxCSV" ):
0136                 VBFHbb_2btag_plot_types.pop()
0137             VBFHbb_2btag_plot_types.append(NminOneCutNames[iCut])
0138 hltHiggsPostVBFHbb_2btag = make_higgs_postprocessor("VBFHbb_2btag", object_types=["Jet"], plot_types=VBFHbb_2btag_plot_types, extra_str_templates=[truevtx_string_template])
0139 
0140 #Specific plots for VBFHbb_1btag  
0141 #dEtaqq, mqq, dPhibb, CVS1, maxCSV_jets, maxCSV_E, MET, pt1, pt2, pt3, pt4
0142 VBFHbb_1btag_plot_types = []
0143 NminOneCuts = _config.VBFHbb_1btag.NminOneCuts
0144 if NminOneCuts: 
0145     for iCut in range(0,len(NminOneCuts)):
0146         if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
0147             if( NminOneCutNames[iCut] == "EffmaxCSV" ):
0148                 VBFHbb_1btag_plot_types.pop()
0149             VBFHbb_1btag_plot_types.append(NminOneCutNames[iCut])
0150 hltHiggsPostVBFHbb_1btag = make_higgs_postprocessor("VBFHbb_1btag", plot_types=VBFHbb_1btag_plot_types, object_types=["Jet"], extra_str_templates=[truevtx_string_template])
0151 
0152 #Specific plots for VBFHbb_0btag  
0153 #dEtaqq, mqq, dPhibb, CVS1, maxCSV_jets, maxCSV_E, MET, pt1, pt2, pt3, pt4
0154 VBFHbb_0btag_plot_types = []
0155 NminOneCuts = _config.VBFHbb_0btag.NminOneCuts
0156 if NminOneCuts: 
0157     for iCut in range(0,len(NminOneCuts)):
0158         if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
0159             if( NminOneCutNames[iCut] == "EffmaxCSV" ):
0160                 VBFHbb_0btag_plot_types.pop()
0161             VBFHbb_0btag_plot_types.append(NminOneCutNames[iCut])
0162 hltHiggsPostVBFHbb_0btag = make_higgs_postprocessor("VBFHbb_0btag", plot_types=VBFHbb_0btag_plot_types, object_types=["Jet"], extra_str_templates=[truevtx_string_template])
0163 
0164 
0165 #Specific plots for ZnnHbb
0166 ZnnHbb_plot_types = ["EffEta", "EffPhi", "TurnOn1"]
0167 NminOneCuts = _config.ZnnHbb.NminOneCuts
0168 if NminOneCuts: 
0169     for iCut in range(0,len(NminOneCuts)):
0170         if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
0171             ZnnHbb_plot_types.append(NminOneCutNames[iCut])
0172 hltHiggsPostZnnHbb = make_higgs_postprocessor("ZnnHbb", plot_types=ZnnHbb_plot_types, object_types=["Jet", "PFMET"], extra_str_templates=[truevtx_string_template])
0173 
0174 #Specific plots for X4b
0175 #Jet plots
0176 X4b_plot_types = ["EffEta", "EffPhi", "TurnOn1"]
0177 NminOneCuts = _config.X4b.NminOneCuts
0178 if NminOneCuts: 
0179     for iCut in range(0,len(NminOneCuts)):
0180         if( NminOneCuts[iCut] and NminOneCutNames[iCut] ):
0181             X4b_plot_types.append(NminOneCutNames[iCut])
0182 hltHiggsPostX4b = make_higgs_postprocessor("X4b", plot_types=X4b_plot_types, object_types=["Jet"], extra_str_templates=[truevtx_string_template])
0183 
0184 #Specific plots for WH -> ev + bb
0185 hltHiggsPostWHToENuBB = make_higgs_postprocessor("WHToENuBB", extra_str_templates=[truevtx_string_template, TTHbbej_HtDist_template])
0186 
0187 hltHiggsPostProcessors = cms.Sequence(
0188         hltHiggsPostHWW+
0189         hltHiggsPostHZZ+
0190         hltHiggsPostHZZControlPaths+
0191         hltHiggsPostHgg+
0192         #hltHiggsPostHggControlPaths+
0193         hltHiggsPostMuonJet+
0194         hltHiggsPostHtaunu+
0195         hltHiggsPostH2tau+
0196         hltHiggsPostTTHbbej+
0197         hltHiggsPostAHttH+
0198         hltHiggsPostVBFHbb_0btag+
0199         hltHiggsPostVBFHbb_1btag+
0200         hltHiggsPostVBFHbb_2btag+
0201         hltHiggsPostZnnHbb+
0202         hltHiggsPostDoubleHinTaus+
0203         hltHiggsPostHiggsDalitz+
0204         hltHiggsPostX4b+
0205         hltHiggsPostWHToENuBB+
0206         hltHiggsPostVBFHToInv
0207 )
0208 
0209