From 3cb2459b31024656d4b75eb3ec7a8d5d6438dc62 Mon Sep 17 00:00:00 2001 From: mmusich Date: Thu, 17 Feb 2022 19:43:19 +0100 Subject: [PATCH] use auto-generated fillDescription methods where possible and finalize CCC fillDescriptions --- .../interface/ClusterChargeCut.h | 22 ++++++++++++------- .../ClusterShapeHitFilterESProducer.cc | 12 +++++----- .../ClusterShapeHitFilterESProducer_cfi.py | 12 +++++----- ...hi2ChargeMeasurementEstimatorESProducer.cc | 2 +- ...ransientTrackingRecHitBuilderESProducer.cc | 14 +++++------- .../python/TTRHBuilderWithFake_cfi.py | 13 +++++------ .../python/TTRHBuilderWithTemplate_cfi.py | 15 ++++++------- ...ntTrackingRecHitBuilderWithoutRefit_cfi.py | 15 ++++++------- .../TransientTrackingRecHitBuilder_cfi.py | 15 ++++++------- .../MaxCCCLostHitsTrajectoryFilter.h | 2 +- .../src/MaxCCCLostHitsTrajectoryFilter.cc | 1 - 11 files changed, 60 insertions(+), 63 deletions(-) delete mode 100644 TrackingTools/TrajectoryFiltering/src/MaxCCCLostHitsTrajectoryFilter.cc diff --git a/RecoLocalTracker/SiStripClusterizer/interface/ClusterChargeCut.h b/RecoLocalTracker/SiStripClusterizer/interface/ClusterChargeCut.h index a3d4d04a9c544..8bf84b73e1c1f 100644 --- a/RecoLocalTracker/SiStripClusterizer/interface/ClusterChargeCut.h +++ b/RecoLocalTracker/SiStripClusterizer/interface/ClusterChargeCut.h @@ -8,19 +8,25 @@ inline float clusterChargeCut(const edm::ParameterSet& conf, const char* name = return conf.getParameter(name).getParameter("value"); } -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -inline edm::ParameterSetDescription getFilledConfigurationDescription4CCC() { - // HLTSiStripClusterChargeCutNone: -1.0 - // HLTSiStripClusterChargeCutTiny: 800.0 - // HLTSiStripClusterChargeCutLoose: 1620.0 - // HLTSiStripClusterChargeCutTight: 1945.0 +namespace CCC { + // SiStripClusterChargeCutNone: -1.0 + // SiStripClusterChargeCutTiny: 800.0 + // SiStripClusterChargeCutLoose: 1620.0 + // SiStripClusterChargeCutTight: 1945.0 + + enum OP { kNone = 0, kTiny = 1, kLoose = 2, kTight = 3 }; + static constexpr std::array cuts = {{-1.0, 800.0, 1620.0, 1945.0}}; +} // namespace CCC +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +inline edm::ParameterSetDescription getConfigurationDescription4CCC(const CCC::OP& op) { edm::ParameterSetDescription desc; - desc.add("value", 1620.0); + desc.add("value", CCC::cuts[op]); return desc; } -inline edm::ParameterSetDescription getFilledConfigurationDescription4CCCNoDefault() { +// this is needed to validate the configuration without explicitly setting a cut +inline edm::ParameterSetDescription getConfigurationDescription4CCCNoDefault() { edm::ParameterSetDescription desc; desc.add("value"); return desc; diff --git a/RecoPixelVertexing/PixelLowPtUtilities/plugins/ClusterShapeHitFilterESProducer.cc b/RecoPixelVertexing/PixelLowPtUtilities/plugins/ClusterShapeHitFilterESProducer.cc index 5a1b4a2629b27..84471aafa3557 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/plugins/ClusterShapeHitFilterESProducer.cc +++ b/RecoPixelVertexing/PixelLowPtUtilities/plugins/ClusterShapeHitFilterESProducer.cc @@ -97,16 +97,14 @@ ClusterShapeHitFilterESProducer::ReturnType ClusterShapeHitFilterESProducer::pro /*****************************************************************************/ void ClusterShapeHitFilterESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("PixelShapeFile"); - desc.add("PixelShapeFileL1"); - desc.add("ComponentName"); + desc.add("PixelShapeFile", "RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase0.par"); + desc.add("PixelShapeFileL1", "RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase0.par"); + desc.add("ComponentName", ""); desc.add("isPhase2", false); desc.add("doPixelShapeCut", true); desc.add("doStripShapeCut", true); - - desc.add("clusterChargeCut", getFilledConfigurationDescription4CCCNoDefault()); - - descriptions.addDefault(desc); + desc.add("clusterChargeCut", getConfigurationDescription4CCC(CCC::kNone)); + descriptions.addWithDefaultLabel(desc); } DEFINE_FWK_EVENTSETUP_MODULE(ClusterShapeHitFilterESProducer); diff --git a/RecoPixelVertexing/PixelLowPtUtilities/python/ClusterShapeHitFilterESProducer_cfi.py b/RecoPixelVertexing/PixelLowPtUtilities/python/ClusterShapeHitFilterESProducer_cfi.py index e9ab76a1c9d18..34dffaef6a2bc 100644 --- a/RecoPixelVertexing/PixelLowPtUtilities/python/ClusterShapeHitFilterESProducer_cfi.py +++ b/RecoPixelVertexing/PixelLowPtUtilities/python/ClusterShapeHitFilterESProducer_cfi.py @@ -1,11 +1,11 @@ import FWCore.ParameterSet.Config as cms -ClusterShapeHitFilterESProducer = cms.ESProducer("ClusterShapeHitFilterESProducer", - ComponentName = cms.string('ClusterShapeHitFilter'), - PixelShapeFile= cms.string('RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase0.par'), - PixelShapeFileL1= cms.string('RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase0.par'), - clusterChargeCut = cms.PSet(refToPSet_ = cms.string('SiStripClusterChargeCutNone')), - isPhase2 = cms.bool(False)) +from RecoPixelVertexing.PixelLowPtUtilities.clusterShapeHitFilterESProducer_cfi import clusterShapeHitFilterESProducer +ClusterShapeHitFilterESProducer = clusterShapeHitFilterESProducer.clone(ComponentName = 'ClusterShapeHitFilter', + PixelShapeFile = 'RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase0.par', + PixelShapeFileL1 = 'RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase0.par', + clusterChargeCut = cms.PSet(refToPSet_ = cms.string('SiStripClusterChargeCutNone')), + isPhase2 = False) from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel phase1Pixel.toModify(ClusterShapeHitFilterESProducer, diff --git a/RecoTracker/MeasurementDet/plugins/Chi2ChargeMeasurementEstimatorESProducer.cc b/RecoTracker/MeasurementDet/plugins/Chi2ChargeMeasurementEstimatorESProducer.cc index b2951594662e8..db8bd9dd03b84 100644 --- a/RecoTracker/MeasurementDet/plugins/Chi2ChargeMeasurementEstimatorESProducer.cc +++ b/RecoTracker/MeasurementDet/plugins/Chi2ChargeMeasurementEstimatorESProducer.cc @@ -111,7 +111,7 @@ namespace { auto desc = chi2MeasurementEstimatorParams::getFilledConfigurationDescription(); desc.add("ComponentName", "Chi2Charge"); desc.add("pTChargeCutThreshold", -1.); - edm::ParameterSetDescription descCCC = getFilledConfigurationDescription4CCC(); + edm::ParameterSetDescription descCCC = getConfigurationDescription4CCC(CCC::kLoose); desc.add("clusterChargeCut", descCCC); descriptions.add("Chi2ChargeMeasurementEstimatorDefault", desc); } diff --git a/RecoTracker/TransientTrackingRecHit/plugins/TkTransientTrackingRecHitBuilderESProducer.cc b/RecoTracker/TransientTrackingRecHit/plugins/TkTransientTrackingRecHitBuilderESProducer.cc index 951629e26fa11..6ad6be14078a9 100644 --- a/RecoTracker/TransientTrackingRecHit/plugins/TkTransientTrackingRecHitBuilderESProducer.cc +++ b/RecoTracker/TransientTrackingRecHit/plugins/TkTransientTrackingRecHitBuilderESProducer.cc @@ -110,15 +110,13 @@ std::unique_ptr TkTransientTrackingRecHitBuilder void TkTransientTrackingRecHitBuilderESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - - desc.add("ComponentName"); - desc.add("ComputeCoarseLocalPositionFromDisk"); - desc.add("StripCPE")->setComment("Using \"Fake\" disables use of StripCPE"); - desc.add("PixelCPE")->setComment("Using \"Fake\" disables use of PixelCPE"); - desc.add("Matcher")->setComment("Using \"Fake\" disables use of SiStripRecHitMatcher"); + desc.add("ComponentName", "Fake"); + desc.add("ComputeCoarseLocalPositionFromDisk", false); + desc.add("StripCPE", "Fake")->setComment("Using \"Fake\" disables use of StripCPE"); + desc.add("PixelCPE", "Fake")->setComment("Using \"Fake\" disables use of PixelCPE"); + desc.add("Matcher", "Fake")->setComment("Using \"Fake\" disables use of SiStripRecHitMatcher"); desc.add("Phase2StripCPE", "")->setComment("Using empty string disables use of Phase2StripCPE"); - - descriptions.addDefault(desc); + descriptions.addWithDefaultLabel(desc); } DEFINE_FWK_EVENTSETUP_MODULE(TkTransientTrackingRecHitBuilderESProducer); diff --git a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithFake_cfi.py b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithFake_cfi.py index 5994318aa493f..338b22ee3860c 100644 --- a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithFake_cfi.py +++ b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithFake_cfi.py @@ -10,11 +10,10 @@ ComponentType = 'FakeStripCPE' ) -TTRHBuilderFake = cms.ESProducer("TkTransientTrackingRecHitBuilderESProducer", - StripCPE = cms.string('FakeStripCPE'), - ComponentName = cms.string('Fake'), - PixelCPE = cms.string('FakePixelCPE'), - Matcher = cms.string('StandardMatcher'), - ComputeCoarseLocalPositionFromDisk = cms.bool(False), -) +from RecoTracker.TransientTrackingRecHit.tkTransientTrackingRecHitBuilderESProducer_cfi import tkTransientTrackingRecHitBuilderESProducer +TTRHBuilderFake = tkTransientTrackingRecHitBuilderESProducer.clone(StripCPE = 'FakeStripCPE', + ComponentName = 'Fake', + PixelCPE = 'FakePixelCPE', + Matcher = 'StandardMatcher', + ComputeCoarseLocalPositionFromDisk = False) diff --git a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py index 35c7f89a80cd0..c90663dbef468 100644 --- a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py +++ b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py @@ -1,13 +1,12 @@ import FWCore.ParameterSet.Config as cms -TTRHBuilderAngleAndTemplate = cms.ESProducer("TkTransientTrackingRecHitBuilderESProducer", - StripCPE = cms.string('StripCPEfromTrackAngle'), - Phase2StripCPE = cms.string(''), - ComponentName = cms.string('WithAngleAndTemplate'), - PixelCPE = cms.string('PixelCPETemplateReco'), - Matcher = cms.string('StandardMatcher'), - ComputeCoarseLocalPositionFromDisk = cms.bool(False), -) +from RecoTracker.TransientTrackingRecHit.tkTransientTrackingRecHitBuilderESProducer_cfi import tkTransientTrackingRecHitBuilderESProducer +TTRHBuilderAngleAndTemplate = tkTransientTrackingRecHitBuilderESProducer.clone(StripCPE = 'StripCPEfromTrackAngle', + Phase2StripCPE = '', + ComponentName = 'WithAngleAndTemplate', + PixelCPE = 'PixelCPETemplateReco', + Matcher = 'StandardMatcher', + ComputeCoarseLocalPositionFromDisk = False) from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 trackingPhase2PU140.toModify(TTRHBuilderAngleAndTemplate, diff --git a/RecoTracker/TransientTrackingRecHit/python/TransientTrackingRecHitBuilderWithoutRefit_cfi.py b/RecoTracker/TransientTrackingRecHit/python/TransientTrackingRecHitBuilderWithoutRefit_cfi.py index 5e252b0570fb3..8306fa78ad075 100644 --- a/RecoTracker/TransientTrackingRecHit/python/TransientTrackingRecHitBuilderWithoutRefit_cfi.py +++ b/RecoTracker/TransientTrackingRecHit/python/TransientTrackingRecHitBuilderWithoutRefit_cfi.py @@ -1,13 +1,12 @@ import FWCore.ParameterSet.Config as cms -ttrhbwor = cms.ESProducer("TkTransientTrackingRecHitBuilderESProducer", - StripCPE = cms.string('Fake'), - Phase2StripCPE = cms.string(''), - ComponentName = cms.string('WithoutRefit'), - PixelCPE = cms.string('Fake'), - Matcher = cms.string('Fake'), - ComputeCoarseLocalPositionFromDisk = cms.bool(False), -) +from RecoTracker.TransientTrackingRecHit.tkTransientTrackingRecHitBuilderESProducer_cfi import tkTransientTrackingRecHitBuilderESProducer +ttrhbwor = tkTransientTrackingRecHitBuilderESProducer.clone(StripCPE = 'Fake', + Phase2StripCPE = '', + ComponentName = 'WithoutRefit', + PixelCPE = 'Fake', + Matcher = 'Fake', + ComputeCoarseLocalPositionFromDisk = False) from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 trackingPhase2PU140.toModify(ttrhbwor, diff --git a/RecoTracker/TransientTrackingRecHit/python/TransientTrackingRecHitBuilder_cfi.py b/RecoTracker/TransientTrackingRecHit/python/TransientTrackingRecHitBuilder_cfi.py index df2cdaf9dba76..1cb63f93b4f85 100644 --- a/RecoTracker/TransientTrackingRecHit/python/TransientTrackingRecHitBuilder_cfi.py +++ b/RecoTracker/TransientTrackingRecHit/python/TransientTrackingRecHitBuilder_cfi.py @@ -1,13 +1,12 @@ import FWCore.ParameterSet.Config as cms -ttrhbwr = cms.ESProducer("TkTransientTrackingRecHitBuilderESProducer", - StripCPE = cms.string('StripCPEfromTrackAngle'), - Phase2StripCPE = cms.string(''), - ComponentName = cms.string('WithTrackAngle'), - PixelCPE = cms.string('PixelCPEGeneric'), - Matcher = cms.string('StandardMatcher'), - ComputeCoarseLocalPositionFromDisk = cms.bool(False), -) +from RecoTracker.TransientTrackingRecHit.tkTransientTrackingRecHitBuilderESProducer_cfi import tkTransientTrackingRecHitBuilderESProducer +ttrhbwr = tkTransientTrackingRecHitBuilderESProducer.clone(StripCPE = 'StripCPEfromTrackAngle', + Phase2StripCPE = '', + ComponentName = 'WithTrackAngle', + PixelCPE = 'PixelCPEGeneric', + Matcher = 'StandardMatcher', + ComputeCoarseLocalPositionFromDisk = False) from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 trackingPhase2PU140.toModify(ttrhbwr, diff --git a/TrackingTools/TrajectoryFiltering/interface/MaxCCCLostHitsTrajectoryFilter.h b/TrackingTools/TrajectoryFiltering/interface/MaxCCCLostHitsTrajectoryFilter.h index e130744a8407b..3ea53ad976042 100644 --- a/TrackingTools/TrajectoryFiltering/interface/MaxCCCLostHitsTrajectoryFilter.h +++ b/TrackingTools/TrajectoryFiltering/interface/MaxCCCLostHitsTrajectoryFilter.h @@ -17,7 +17,7 @@ class MaxCCCLostHitsTrajectoryFilter final : public TrajectoryFilter { static void fillPSetDescription(edm::ParameterSetDescription& iDesc) { iDesc.add("maxCCCLostHits", 9999); - iDesc.add("minGoodStripCharge", getFilledConfigurationDescription4CCC()); + iDesc.add("minGoodStripCharge", getConfigurationDescription4CCC(CCC::kLoose)); } bool qualityFilter(const Trajectory& traj) const override { return TrajectoryFilter::qualityFilterIfNotContributing; } diff --git a/TrackingTools/TrajectoryFiltering/src/MaxCCCLostHitsTrajectoryFilter.cc b/TrackingTools/TrajectoryFiltering/src/MaxCCCLostHitsTrajectoryFilter.cc deleted file mode 100644 index 6da6dacf3d14a..0000000000000 --- a/TrackingTools/TrajectoryFiltering/src/MaxCCCLostHitsTrajectoryFilter.cc +++ /dev/null @@ -1 +0,0 @@ -#include "TrackingTools/TrajectoryFiltering/interface/MaxCCCLostHitsTrajectoryFilter.h"