Skip to content

Commit

Permalink
Merge pull request #21387 from DryRun/CMSSW_9_4_0_pre3_exo_effstr_fix
Browse files Browse the repository at this point in the history
Fix for large number of efficiency_strings in HLT harvesting
  • Loading branch information
cmsbuild committed Dec 7, 2017
2 parents 3544062 + 2ceb5c5 commit bbe74e7
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 436 deletions.
199 changes: 58 additions & 141 deletions HLTriggerOffline/Exotica/python/hltExoticaPostProcessors_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from HLTriggerOffline.Exotica.hltExoticaPostProcessor_cfi import *

# Build the standard strings to the DQM
def efficiency_string(objtype,plot_type,triggerpath):
def make_efficiency_string(objtype, plot_type, triggerpath):
# --- IMPORTANT: Add here a elif if you are introduce a new collection
# (see EVTColContainer::getTypeString)
if objtype == "Mu" :
Expand Down Expand Up @@ -56,150 +56,62 @@ def efficiency_string(objtype,plot_type,triggerpath):
return "Eff_%s_%s '%s' %s_%s %s" % (input_type,triggerpath,
all_titles,input_type,triggerpath,input_type)

# Adding the reco objects
def add_reco_strings(strings):
reco_strings = []
for entry in strings:
reco_strings.append(entry
.replace("Generated", "Reconstructed")
.replace("Gen", "Reco")
.replace("gen", "rec"))
strings.extend(reco_strings)


plot_types = ["TurnOn1", "TurnOn2", "TurnOn3", "TurnOn4", "EffEta", "EffPhi", "EffDxy"]
#--- IMPORTANT: Update this collection whenever you introduce a new object
# in the code (from EVTColContainer::getTypeString)
obj_types = ["Mu","refittedStandAloneMuons","Track","Ele","Photon","PFTau","PFJet","MET","PFMET","PFMHT","GenMET","CaloJet"
,"CaloMET","CaloMHT","l1MET"]
#--- IMPORTANT: Trigger are extracted from the hltExoticaValidator_cfi.py module
triggers = [ ]
efficiency_strings = []

# Extract the triggers used in the hltExoticaValidator, for each path
from HLTriggerOffline.Exotica.hltExoticaValidator_cfi import hltExoticaValidator as _config
triggers = set([])
for an in _config.analysis:
s = _config.__getattribute__(an)
vstr = s.__getattribute__("hltPathsToCheck")
map(lambda x: triggers.add(x.replace("_v","")),vstr)
triggers = list(triggers)
#------------------------------------------------------------

# Generating the list with all the efficiencies
for type in plot_types:
for obj in obj_types:
for trig in triggers:
efficiency_strings.append(efficiency_string(obj,type,trig))
#for item in efficiency_strings:
# print item

add_reco_strings(efficiency_strings)

#--- IMPORTANT: Here you have to add the analyses one by one.
hltExoticaPostLowPtTrimuon = hltExoticaPostProcessor.clone()
hltExoticaPostLowPtTrimuon.subDirs = ['HLT/Exotica/LowPtTrimuon']
hltExoticaPostLowPtTrimuon.efficiencyProfile = efficiency_strings

hltExoticaPostHighPtDimuon = hltExoticaPostProcessor.clone()
hltExoticaPostHighPtDimuon.subDirs = ['HLT/Exotica/HighPtDimuon']
hltExoticaPostHighPtDimuon.efficiencyProfile = efficiency_strings

hltExoticaPostHighPtDielectron = hltExoticaPostProcessor.clone()
hltExoticaPostHighPtDielectron.subDirs = ['HLT/Exotica/HighPtDielectron']
hltExoticaPostHighPtDielectron.efficiencyProfile = efficiency_strings

hltExoticaPostHighPtElectron = hltExoticaPostProcessor.clone()
hltExoticaPostHighPtElectron.subDirs = ['HLT/Exotica/HighPtElectron']
hltExoticaPostHighPtElectron.efficiencyProfile = efficiency_strings

hltExoticaPostLowPtElectron = hltExoticaPostProcessor.clone()
hltExoticaPostLowPtElectron.subDirs = ['HLT/Exotica/LowPtElectron']
hltExoticaPostLowPtElectron.efficiencyProfile = efficiency_strings

hltExoticaPostLowPtDimuon = hltExoticaPostProcessor.clone()
hltExoticaPostLowPtDimuon.subDirs = ['HLT/Exotica/LowPtDimuon']
hltExoticaPostLowPtDimuon.efficiencyProfile = efficiency_strings

hltExoticaPostLowPtDielectron = hltExoticaPostProcessor.clone()
hltExoticaPostLowPtDielectron.subDirs = ['HLT/Exotica/LowPtDielectron']
hltExoticaPostLowPtDielectron.efficiencyProfile = efficiency_strings

hltExoticaPostHighPtPhoton = hltExoticaPostProcessor.clone()
hltExoticaPostHighPtPhoton.subDirs = ['HLT/Exotica/HighPtPhoton']
hltExoticaPostHighPtPhoton.efficiencyProfile = efficiency_strings

hltExoticaPostDiPhoton = hltExoticaPostProcessor.clone()
hltExoticaPostDiPhoton.subDirs = ['HLT/Exotica/DiPhoton']
hltExoticaPostDiPhoton.efficiencyProfile = efficiency_strings

hltExoticaPostSingleMuon = hltExoticaPostProcessor.clone()
hltExoticaPostSingleMuon.subDirs = ['HLT/Exotica/SingleMuon']
hltExoticaPostSingleMuon.efficiencyProfile = efficiency_strings

hltExoticaPostPFHT = hltExoticaPostProcessor.clone()
hltExoticaPostPFHT.subDirs = ['HLT/Exotica/PFHT']
hltExoticaPostPFHT.efficiencyProfile = efficiency_strings

hltExoticaPostCaloHT = hltExoticaPostProcessor.clone()
hltExoticaPostCaloHT.subDirs = ['HLT/Exotica/CaloHT']
hltExoticaPostCaloHT.efficiencyProfile = efficiency_strings

hltExoticaPostJetNoBptx = hltExoticaPostProcessor.clone()
hltExoticaPostJetNoBptx.subDirs = ['HLT/Exotica/JetNoBptx']
hltExoticaPostJetNoBptx.efficiencyProfile = efficiency_strings

hltExoticaPostMuonNoBptx = hltExoticaPostProcessor.clone()
hltExoticaPostMuonNoBptx.subDirs = ['HLT/Exotica/MuonNoBptx']
hltExoticaPostMuonNoBptx.efficiencyProfile = efficiency_strings

hltExoticaPostDisplacedMuEG = hltExoticaPostProcessor.clone()
hltExoticaPostDisplacedMuEG.subDirs = ['HLT/Exotica/DisplacedMuEG']
hltExoticaPostDisplacedMuEG.efficiencyProfile = efficiency_strings

hltExoticaPostDisplacedDimuon = hltExoticaPostProcessor.clone()
hltExoticaPostDisplacedDimuon.subDirs = ['HLT/Exotica/DisplacedDimuon']
hltExoticaPostDisplacedDimuon.efficiencyProfile = efficiency_strings

hltExoticaPostMonojet = hltExoticaPostProcessor.clone()
hltExoticaPostMonojet.subDirs = ['HLT/Exotica/Monojet']
hltExoticaPostMonojet.efficiencyProfile = efficiency_strings

hltExoticaPostMonojetBackup = hltExoticaPostProcessor.clone()
hltExoticaPostMonojetBackup.subDirs = ['HLT/Exotica/MonojetBackup']
hltExoticaPostMonojetBackup.efficiencyProfile = efficiency_strings

hltExoticaPostPureMET = hltExoticaPostProcessor.clone()
hltExoticaPostPureMET.subDirs = ['HLT/Exotica/PureMET']
hltExoticaPostPureMET.efficiencyProfile = efficiency_strings

hltExoticaPostMETplusTrack = hltExoticaPostProcessor.clone()
hltExoticaPostMETplusTrack.subDirs = ['HLT/Exotica/METplusTrack']
hltExoticaPostMETplusTrack.efficiencyProfile = efficiency_strings

hltExoticaEleMu = hltExoticaPostProcessor.clone()
hltExoticaEleMu.subDirs = ['HLT/Exotica/EleMu']
hltExoticaEleMu.efficiencyProfile = efficiency_strings

hltExoticaPhotonMET = hltExoticaPostProcessor.clone()
hltExoticaPhotonMET.subDirs = ['HLT/Exotica/PhotonMET']
hltExoticaPhotonMET.efficiencyProfile = efficiency_strings

hltExoticaHTDisplacedJets = hltExoticaPostProcessor.clone()
hltExoticaHTDisplacedJets.subDirs = ['HLT/Exotica/HTDisplacedJets']
hltExoticaHTDisplacedJets.efficiencyProfile = efficiency_strings

hltExoticaDSTJets = hltExoticaPostProcessor.clone()
hltExoticaDSTJets.subDirs = ['HLT/Exotica/DSTJets']
hltExoticaDSTJets.efficiencyProfile = efficiency_strings

hltExoticaDSTMuons = hltExoticaPostProcessor.clone()
hltExoticaDSTMuons.subDirs = ['HLT/Exotica/DSTMuons']
hltExoticaDSTMuons.efficiencyProfile = efficiency_strings

hltExoticaTracklessJets = hltExoticaPostProcessor.clone()
hltExoticaTracklessJets.subDirs = ['HLT/Exotica/TracklessJets']
hltExoticaTracklessJets.efficiencyProfile = efficiency_strings
#--- IMPORTANT: Update this collection whenever you introduce a new object
# in the code (from EVTColContainer::getTypeString)
def make_exo_postprocessor(analysis_name, plot_types=["TurnOn1", "TurnOn2", "TurnOn3", "TurnOn4", "EffEta", "EffPhi", "EffDxy"], object_types=["Mu","refittedStandAloneMuons","Track","Ele","Photon","PFTau","PFJet","MET","PFMET","PFMHT","GenMET","CaloJet","CaloMET","CaloMHT","l1MET"], extra_str_templates=[]):
postprocessor = hltExoticaPostProcessor.clone()
postprocessor.subDirs = ["HLT/Exotica/" + analysis_name]
efficiency_strings = [] # List of plots to look for. This is quite a bit larger than the number of plots that will be made.

# Higgs and SMP postprocessors use this string, but exo does not, for now.
#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"
#efficiency_strings.append(efficiency_summary_string)
#efficiency_strings.append(efficiency_summary_string.replace("Generated", "Reconstructed").replace("Gen", "Reco").replace("gen", "rec"))

for plot_type in plot_types:
for object_type in object_types:
for trigger in [x.replace("_v", "") for x in _config.__getattribute__(analysis_name).hltPathsToCheck]:
this_efficiency_string = make_efficiency_string(object_type, plot_type, trigger)
efficiency_strings.append(this_efficiency_string)
efficiency_strings.append(this_efficiency_string.replace("Generated", "Reconstructed").replace("Gen", "Reco").replace("gen", "rec"))

for str_template in extra_str_templates:
this_extra_string = str_template.replace("@ANALYSIS@", analysis_name).replace("@TRIGGER@", trigger)
efficiency_strings.append(this_extra_string)
efficiency_strings.append(this_extra_stringreplace("Generated", "Reconstructed").replace("Gen", "Reco").replace("gen", "rec"))
postprocessor.efficiencyProfile = efficiency_strings
return postprocessor

hltExoticaPostLowPtTrimuon = make_exo_postprocessor("LowPtTrimuon")
hltExoticaPostHighPtDimuon = make_exo_postprocessor("HighPtDimuon")
hltExoticaPostHighPtDielectron = make_exo_postprocessor("HighPtDielectron")
hltExoticaPostHighPtElectron = make_exo_postprocessor("HighPtElectron")
hltExoticaPostLowPtElectron = make_exo_postprocessor("LowPtElectron")
hltExoticaPostLowPtDimuon = make_exo_postprocessor("LowPtDimuon")
hltExoticaPostLowPtDielectron = make_exo_postprocessor("LowPtDielectron")
hltExoticaPostHighPtPhoton = make_exo_postprocessor("HighPtPhoton")
hltExoticaPostDiPhoton = make_exo_postprocessor("DiPhoton")
hltExoticaPostSingleMuon = make_exo_postprocessor("SingleMuon")
hltExoticaPostPFHT = make_exo_postprocessor("PFHT")
hltExoticaPostCaloHT = make_exo_postprocessor("CaloHT")
hltExoticaPostJetNoBptx = make_exo_postprocessor("JetNoBptx")
hltExoticaPostMuonNoBptx = make_exo_postprocessor("MuonNoBptx")
hltExoticaPostDisplacedMuEG = make_exo_postprocessor("DisplacedMuEG")
hltExoticaPostDisplacedDimuon = make_exo_postprocessor("DisplacedDimuon")
hltExoticaPostMonojet = make_exo_postprocessor("Monojet")
hltExoticaPostMonojetBackup = make_exo_postprocessor("MonojetBackup")
hltExoticaPostPureMET = make_exo_postprocessor("PureMET")
hltExoticaPostMETplusTrack = make_exo_postprocessor("METplusTrack")
hltExoticaEleMu = make_exo_postprocessor("EleMu")
hltExoticaPhotonMET = make_exo_postprocessor("PhotonMET")
hltExoticaHTDisplacedJets = make_exo_postprocessor("HTDisplacedJets")
hltExoticaDSTJets = make_exo_postprocessor("DSTJets")
hltExoticaDSTMuons = make_exo_postprocessor("DSTMuons")
hltExoticaTracklessJets = make_exo_postprocessor("TracklessJets")

hltExoticaPostProcessors = cms.Sequence(
# Tri-lepton paths
Expand Down Expand Up @@ -237,3 +149,8 @@ def add_reco_strings(strings):
hltExoticaDSTJets +
hltExoticaDSTMuons
)


#for analysis in _config.analyses:
# hltExoticaPostProcessors *= analysis_postprocessors[analysis]

8 changes: 4 additions & 4 deletions HLTriggerOffline/Exotica/python/hltExoticaValidator_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from HLTriggerOffline.Exotica.analyses.hltExoticaLowPtDimuon_cff import LowPtDimuonPSet
from HLTriggerOffline.Exotica.analyses.hltExoticaLowPtDielectron_cff import LowPtDielectronPSet
from HLTriggerOffline.Exotica.analyses.hltExoticaHighPtElectron_cff import HighPtElectronPSet
#from HLTriggerOffline.Exotica.analyses.hltExoticaLowPtElectron_cff import LowPtElectronPSet
from HLTriggerOffline.Exotica.analyses.hltExoticaLowPtElectron_cff import LowPtElectronPSet
from HLTriggerOffline.Exotica.analyses.hltExoticaHighPtPhoton_cff import HighPtPhotonPSet
from HLTriggerOffline.Exotica.analyses.hltExoticaDiPhoton_cff import DiPhotonPSet
from HLTriggerOffline.Exotica.analyses.hltExoticaPFHT_cff import PFHTPSet
Expand Down Expand Up @@ -50,14 +50,14 @@
# -- The name of the analysis. This is the name that
# appears in Run summary/Exotica/ANALYSIS_NAME

analysis = cms.vstring(
analyses = cms.vstring(
"LowPtTrimuon",
"HighPtDimuon",
"HighPtDielectron",
"LowPtDimuon",
"LowPtDielectron",
"HighPtElectron",
#"LowPtElectron",
"LowPtElectron",
"HighPtPhoton",
"DiPhoton",
"SingleMuon",
Expand Down Expand Up @@ -210,7 +210,7 @@
LowPtDimuon = LowPtDimuonPSet,
LowPtDielectron = LowPtDielectronPSet,
HighPtElectron = HighPtElectronPSet,
#LowPtElectron = LowPtElectronPSet,
LowPtElectron = LowPtElectronPSet,
HighPtPhoton = HighPtPhotonPSet,
DiPhoton = DiPhotonPSet,
SingleMuon = SingleMuonPSet,
Expand Down
2 changes: 1 addition & 1 deletion HLTriggerOffline/Exotica/src/HLTExoticaValidator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// Constructor
HLTExoticaValidator::HLTExoticaValidator(const edm::ParameterSet& pset) :
_pset(pset),
_analysisnames(pset.getParameter<std::vector<std::string> >("analysis")),
_analysisnames(pset.getParameter<std::vector<std::string> >("analyses")),
_collections(nullptr)
{

Expand Down
Loading

0 comments on commit bbe74e7

Please sign in to comment.