From 860e10d4df4c504fd031137f6cb1491c68492d76 Mon Sep 17 00:00:00 2001 From: Mario Masciovecchio Date: Mon, 7 Oct 2024 09:28:09 -0700 Subject: [PATCH 1/4] Update MTV plot style to improve visibility/readability: line colors are set to the same colors as markers, and labels are increased for timing plots --- .../RecoTrack/python/plotting/plotting.py | 2 +- .../python/plotting/trackingPlots.py | 34 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Validation/RecoTrack/python/plotting/plotting.py b/Validation/RecoTrack/python/plotting/plotting.py index c1c74c39ae021..7c053b0672b2b 100644 --- a/Validation/RecoTrack/python/plotting/plotting.py +++ b/Validation/RecoTrack/python/plotting/plotting.py @@ -1995,7 +1995,7 @@ def _styleMarker(h, msty, col): h.SetMarkerStyle(msty) h.SetMarkerColor(col) h.SetMarkerSize(0.7) - h.SetLineColor(1) + h.SetLineColor(col) h.SetLineWidth(1) def _styleHist(h, msty, col): diff --git a/Validation/RecoTrack/python/plotting/trackingPlots.py b/Validation/RecoTrack/python/plotting/trackingPlots.py index b88dac7bcbf81..1976a6eaa894a 100644 --- a/Validation/RecoTrack/python/plotting/trackingPlots.py +++ b/Validation/RecoTrack/python/plotting/trackingPlots.py @@ -1444,11 +1444,11 @@ def other(self): return self._other def modules(self): - return [("ClusterMask", self.clusterMasking()), - ("Seeding", self.seeding()), - ("Building", self.building()), + return [("Cluster Mask", self.clusterMasking()), + ("Seed", self.seeding()), + ("Build", self.building()), ("Fit", self.fit()), - ("Selection", self.selection()), + ("Select", self.selection()), ("Other", self.other())] @@ -1650,11 +1650,11 @@ def getProp(prop): return ret return collections.OrderedDict([ - ("ClusterMask", getProp("clusterMasking")), - ("Seeding", getProp("seeding")), - ("Building", getProp("building")), - ("Fitting", getProp("fit")), - ("Selection", getProp("selection")), + ("Cluster Mask", getProp("clusterMasking")), + ("Seed", getProp("seeding")), + ("Build", getProp("building")), + ("Fit", getProp("fit")), + ("Select", getProp("selection")), ("Other", getProp("other")) ]) @@ -1877,6 +1877,9 @@ def headers(self): _time_per_iter_cpu = AggregateBins("iteration", _time_per_event_cpu, _iterModuleMap(), ignoreMissingBins=True, reorder=_iteration_reorder) _time_per_iter_real = AggregateBins("iteration", _time_per_event_real, _iterModuleMap(), ignoreMissingBins=True, reorder=_iteration_reorder) +_timing_common = _common.copy() +_timing_common["xbinlabelsize"] = 17 +_timing_common["xbinlabeloption"] = "d" _timing_summaryCPU = PlotGroup("summaryCPU", [ Plot(_time_per_iter_cpu, ytitle="Average CPU time (ms)", title="Average CPU time / event", legendDx=-0.4, **_common), @@ -1884,9 +1887,9 @@ def headers(self): ytitle="Fraction", title="", normalizeToUnitArea=True, **_common), # Plot(AggregateBins("step", _time_per_event_cpu, _stepModuleMap(), ignoreMissingBins=True), - ytitle="Average CPU time (ms)", title="Average CPU time / event", **_common), + ytitle="Average CPU time (ms)", title="Average CPU time / event", **_timing_common), Plot(AggregateBins("step_fraction", _time_per_event_cpu, _stepModuleMap(), ignoreMissingBins=True), - ytitle="Fraction", title="", normalizeToUnitArea=True, **_common), + ytitle="Fraction", title="", normalizeToUnitArea=True, **_timing_common), # Plot(TimePerTrackPlot("iteration_track", _time_per_iter_cpu, selectedTracks=False), ytitle="Average CPU time / built track (ms)", title="Average CPU time / built track", **_common), @@ -1901,9 +1904,9 @@ def headers(self): ytitle="Fraction", title="", normalizeToUnitArea=True, **_common), # Plot(AggregateBins("step", _time_per_event_real, _stepModuleMap(), ignoreMissingBins=True), - ytitle="Average real time (ms)", title="Average real time / event", **_common), + ytitle="Average real time (ms)", title="Average real time / event", **_timing_common), Plot(AggregateBins("step_fraction", _time_per_event_real, _stepModuleMap(), ignoreMissingBins=True), - ytitle="Fraction", title="", normalizeToUnitArea=True, **_common), + ytitle="Fraction", title="", normalizeToUnitArea=True, **_timing_common), # Plot(TimePerTrackPlot("iteration_track", _time_per_iter_real, selectedTracks=False), ytitle="Average real time / built track (ms)", title="Average real time / built track", **_common), @@ -1911,17 +1914,16 @@ def headers(self): ytitle="Average real time / selected track (ms)", title="Average real time / selected HP track by algoMask", **_common), ], ) - _timing_iterationsCPU = PlotGroup("iterationsCPU", [ Plot(AggregateBins(i.name(), _time_per_event_cpu, collections.OrderedDict(i.modules()), ignoreMissingBins=True), - ytitle="Average CPU time (ms)", title=i.name(), **_common) + ytitle="Average CPU time (ms)", title=i.name(), **_timing_common) for i in _iterations ], ncols=4, legend=False ) _timing_iterationsReal = PlotGroup("iterationsReal", [ Plot(AggregateBins(i.name(), _time_per_event_real, collections.OrderedDict(i.modules()), ignoreMissingBins=True), - ytitle="Average real time (ms)", title=i.name(), **_common) + ytitle="Average real time (ms)", title=i.name(), **_timing_common) for i in _iterations ], ncols=4, legend=False From ad73592721b02d30b99bc3330583f0edcdc5742c Mon Sep 17 00:00:00 2001 From: Mario Masciovecchio Date: Wed, 9 Oct 2024 07:54:04 -0700 Subject: [PATCH 2/4] Add resolution plots per iteration, for tracks byOriginalAlgo, to allow for improved per-iteration optimization --- Validation/RecoTrack/python/TrackValidation_cff.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Validation/RecoTrack/python/TrackValidation_cff.py b/Validation/RecoTrack/python/TrackValidation_cff.py index fe9c14ea83fbd..eefacbd2f5536 100644 --- a/Validation/RecoTrack/python/TrackValidation_cff.py +++ b/Validation/RecoTrack/python/TrackValidation_cff.py @@ -388,12 +388,12 @@ def _getMVASelectors(postfix): "cutsRecoTracksBtvLike", "cutsRecoTracksAK4PFJets" ], - doResolutionPlotsForLabels = [ - "generalTracks", - locals()["_generalTracksHp"+_postfix], - "generalTracksPt09", + doResolutionPlotsForLabels = ["generalTracks", locals()["_generalTracksHp"+_postfix]] + + locals()["_selectorsByOriginalAlgo"+_postfix] + + ["generalTracksPt09"] + + [ "cutsRecoTracksBtvLike", - "cutsRecoTracksJetCoreRegionalStepByOriginalAlgo", + "cutsRecoTracksJetCoreRegionalStepByOriginalAlgo" ] ) _setForEra(trackValidator.histoProducerAlgoBlock, _eraName, _era, seedingLayerSets=locals()["_seedingLayerSets"+_postfix]) @@ -534,12 +534,12 @@ def _getMVASelectors(postfix): dodEdxPlots = False, doPVAssociationPlots = False, doSimPlots = False, - doResolutionPlotsForLabels = ["disabled"], + doResolutionPlotsForLabels = ["disabled"] ) trackValidatorBuilding = _trackValidatorSeedingBuilding.clone( dirName = "Tracking/TrackBuilding/", doMVAPlots = True, - doResolutionPlotsForLabels = ['jetCoreRegionalStepTracks'], + doResolutionPlotsForLabels = ['jetCoreRegionalStepTracks'] ) trackValidatorBuildingPreSplitting = trackValidatorBuilding.clone( associators = ["quickTrackAssociatorByHitsPreSplitting"], From 86682227ce9ac4365801466da462bb419ee4dc8d Mon Sep 17 00:00:00 2001 From: Mario Masciovecchio Date: Wed, 9 Oct 2024 07:55:04 -0700 Subject: [PATCH 3/4] Use extended tracking particle pseudorapidity range for tracking efficiency in phase-2 --- ...ckingParticleSelectionForEfficiency_cfi.py | 15 ++++++-- ...kingParticleSelectionsForEfficiency_cff.py | 36 +++++++++++++------ 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/Validation/RecoTrack/python/TrackingParticleSelectionForEfficiency_cfi.py b/Validation/RecoTrack/python/TrackingParticleSelectionForEfficiency_cfi.py index 1a306d166ecc3..110c94184e1c8 100644 --- a/Validation/RecoTrack/python/TrackingParticleSelectionForEfficiency_cfi.py +++ b/Validation/RecoTrack/python/TrackingParticleSelectionForEfficiency_cfi.py @@ -22,10 +22,19 @@ def _modifyForPhase1(pset): pset.minRapidityTP = -3 pset.maxRapidityTP = 3 + from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel phase1Pixel.toModify(TrackingParticleSelectionForEfficiency, _modifyForPhase1) + +def _modifyForPhase2(pset): + pset.minRapidityTP = -4.5 + pset.maxRapidityTP = 4.5 + from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker -phase2_tracker.toModify(TrackingParticleSelectionForEfficiency, minRapidityTP = -4.5, maxRapidityTP = 4.5) +phase2_tracker.toModify(TrackingParticleSelectionForEfficiency, _modifyForPhase2) + +def _modifyForFastSim(pset): + pset.stableOnlyTP = True + from Configuration.Eras.Modifier_fastSim_cff import fastSim -fastSim.toModify(TrackingParticleSelectionForEfficiency, stableOnlyTP = True) - +fastSim.toModify(TrackingParticleSelectionForEfficiency, _modifyForFastSim) diff --git a/Validation/RecoTrack/python/TrackingParticleSelectionsForEfficiency_cff.py b/Validation/RecoTrack/python/TrackingParticleSelectionsForEfficiency_cff.py index c020d894c8d4b..8482aaff8a132 100644 --- a/Validation/RecoTrack/python/TrackingParticleSelectionsForEfficiency_cff.py +++ b/Validation/RecoTrack/python/TrackingParticleSelectionsForEfficiency_cff.py @@ -1,4 +1,6 @@ import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel +from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker generalTpSelectorBlock = cms.PSet( lip = cms.double(30.0), @@ -21,26 +23,38 @@ from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toModify(generalTpSelectorBlock, stableOnly = True) -TpSelectorForEfficiencyVsEtaBlock = generalTpSelectorBlock.clone() -TpSelectorForEfficiencyVsPhiBlock = generalTpSelectorBlock.clone() -TpSelectorForEfficiencyVsPtBlock = generalTpSelectorBlock.clone(ptMin = 0.050 ) -TpSelectorForEfficiencyVsVTXRBlock = generalTpSelectorBlock.clone(tip = 60.0) -TpSelectorForEfficiencyVsVTXZBlock = generalTpSelectorBlock.clone() +generalTpSelectorForEfficiencyBlock = generalTpSelectorBlock.clone() # TP selector block for efficiency (with additional selections) + +def _modifyForPhase1Efficiency(pset): + pset.tip = 2.5 # beampipe is around 2.0, BPIX1 is at 2.9 + +phase1Pixel.toModify(generalTpSelectorForEfficiencyBlock, _modifyForPhase1Efficiency) + +def _modifyForPhase2Efficiency(pset): + pset.minRapidity = -3.5 # within efficient eta range in phase-2 + pset.maxRapidity = 3.5 # within efficient eta range in phase-2 + pset.tip = 2.5 # IT1 will be around 3.0 (as in Phase1) + +phase2_tracker.toModify(generalTpSelectorForEfficiencyBlock, _modifyForPhase2Efficiency) + +TpSelectorForEfficiencyVsEtaBlock = generalTpSelectorForEfficiencyBlock.clone() +TpSelectorForEfficiencyVsPhiBlock = generalTpSelectorForEfficiencyBlock.clone() +TpSelectorForEfficiencyVsPtBlock = generalTpSelectorForEfficiencyBlock.clone(ptMin = 0.050 ) +TpSelectorForEfficiencyVsVTXRBlock = generalTpSelectorForEfficiencyBlock.clone(tip = 60.0) +TpSelectorForEfficiencyVsVTXZBlock = generalTpSelectorForEfficiencyBlock.clone() def _modifyForPhase1(pset): pset.minRapidity = -3 pset.maxRapidity = 3 pset.tip = 2.5 # beampipe is around 2.0, BPIX1 is at 2.9 -from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel -phase1Pixel.toModify(generalTpSelectorBlock, _modifyForPhase1) -phase1Pixel.toModify(TpSelectorForEfficiencyVsEtaBlock, _modifyForPhase1) +phase1Pixel.toModify(generalTpSelectorBlock, _modifyForPhase1) # for general TP selector, extend eta to full acceptance +phase1Pixel.toModify(TpSelectorForEfficiencyVsEtaBlock, _modifyForPhase1) # for efficiency vs eta, also extend eta to full acceptance def _modifyForPhase2(pset): pset.minRapidity = -4.5 pset.maxRapidity = 4.5 pset.tip = 2.5 # IT1 will be around 3.0 (as in Phase1) -from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker -phase2_tracker.toModify(generalTpSelectorBlock, _modifyForPhase2) -phase2_tracker.toModify(TpSelectorForEfficiencyVsEtaBlock, _modifyForPhase2) +phase2_tracker.toModify(generalTpSelectorBlock, _modifyForPhase2) # for general TP selector, extend eta to full acceptance +phase2_tracker.toModify(TpSelectorForEfficiencyVsEtaBlock, _modifyForPhase2) # for efficiency vs eta, also extend eta to full acceptance From 04e97ebe861340d29eb6234c0cc39edb30744830 Mon Sep 17 00:00:00 2001 From: Mario Masciovecchio Date: Tue, 15 Oct 2024 05:14:18 -0700 Subject: [PATCH 4/4] Only add resolution plots for trackingOnly workflows --- Validation/RecoTrack/python/TrackValidation_cff.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Validation/RecoTrack/python/TrackValidation_cff.py b/Validation/RecoTrack/python/TrackValidation_cff.py index eefacbd2f5536..268e83f743db2 100644 --- a/Validation/RecoTrack/python/TrackValidation_cff.py +++ b/Validation/RecoTrack/python/TrackValidation_cff.py @@ -388,10 +388,10 @@ def _getMVASelectors(postfix): "cutsRecoTracksBtvLike", "cutsRecoTracksAK4PFJets" ], - doResolutionPlotsForLabels = ["generalTracks", locals()["_generalTracksHp"+_postfix]] + - locals()["_selectorsByOriginalAlgo"+_postfix] + - ["generalTracksPt09"] + - [ + doResolutionPlotsForLabels = [ + "generalTracks", + locals()["_generalTracksHp"+_postfix], + "generalTracksPt09", "cutsRecoTracksBtvLike", "cutsRecoTracksJetCoreRegionalStepByOriginalAlgo" ] @@ -932,6 +932,7 @@ def _uniqueFirstLayers(layerList): # MTV instances trackValidatorTrackingOnly = trackValidatorStandalone.clone( label = [ x for x in trackValidatorStandalone.label if x != "cutsRecoTracksAK4PFJets"], + doResolutionPlotsForLabels = trackValidatorStandalone.doResolutionPlotsForLabels + locals()["_selectorsByOriginalAlgo"+_postfix], cores = "highPtJetsForTrk" )