From ca5c370bb45359fdc83b23b881ad0b5280fa24ed Mon Sep 17 00:00:00 2001 From: Fabio Cossutti Date: Thu, 15 Feb 2024 14:23:57 +0100 Subject: [PATCH] Squashed commit of the following: commit 8b4a47eb18a17da710b85a68df092415694bb5f8 Author: Fabio Cossutti Date: Thu Feb 15 10:20:08 2024 +0100 Restore original values, for phase2 4D no further overwriting by python commit 8a0bedbaab4abdce2045ca9e3dbe20b52a478e37 Author: Fabio Cossutti Date: Wed Feb 14 14:00:23 2024 +0100 Adopt a fillDescription default based python solution, with no explicit declaration where not strictly needed commit 0b331590955ec73305ae50b06a01d8a2e2462f1e Author: Fabio Cossutti Date: Sun Feb 11 19:27:53 2024 +0100 Apply suggestions from code review Co-authored-by: Matti Kortelainen commit a3e12cf549d78996978855e8461116ec670ed1a7 Author: Fabio Cossutti Date: Fri Feb 9 17:30:57 2024 +0100 Update RecoVertex/Configuration/python/RecoVertex_phase2_timing_cff.py Co-authored-by: Matti Kortelainen commit 324847b5b59bb1aa5f5e8048a55c15359903187c Author: Fabio Cossutti Date: Fri Feb 9 16:43:28 2024 +0100 Update also RecoHI/HiTracking commit 122b97c50db7cf2a81162b65d7b0ce1f8c5c1cf3 Author: Fabio Cossutti Date: Tue Feb 6 09:48:13 2024 +0100 scram b code-format commit aa629174257e7995444a5d6b98c5ca0504006dfc Author: Fabio Cossutti Date: Tue Feb 6 09:33:05 2024 +0100 Fix definition of TkFilterParameters commit 8eea08599cb5e4ef170dcd6d02c927e92cd91dda Author: Fabio Cossutti Date: Fri Feb 2 15:01:16 2024 +0100 Add a default PrimaryVertexProducer config including all possible options with ifValue Address Slava's comments on vertexCollections definition Add in fillDescription TkClusParameters conditional definition, xor for TkFilterParameters, do not build dynamically cfi but just use AddDefaults commit 5f2258f048b90cde664f3bddb2d019c30c9848c4 Author: Fabio Cossutti Date: Mon Jan 29 16:37:00 2024 +0100 Restore situation previous to RecoVertex/PrimaryVertexProducer configuration updates Co-authored-by: Matti Kortelainen --- .../plugins/PrimaryVertexValidation.cc | 6 +- .../python/HIPixelAdaptiveVertex_cfi.py | 11 +- .../python/RecoVertex_phase2_timing_cff.py | 18 ++- .../interface/HITrackFilterForPVFinding.h | 1 + .../plugins/PrimaryVertexProducer.cc | 22 ++-- .../OfflinePixel3DPrimaryVertices_cfi.py | 4 +- ...linePrimaryVerticesFromCosmicTracks_cfi.py | 16 +-- .../python/OfflinePrimaryVertices_cfi.py | 109 ++++++++++++++---- .../RecoVertex/python/pvRecoSequence_cff.py | 6 +- 9 files changed, 132 insertions(+), 61 deletions(-) diff --git a/Alignment/OfflineValidation/plugins/PrimaryVertexValidation.cc b/Alignment/OfflineValidation/plugins/PrimaryVertexValidation.cc index 22e4050ef707a..8c7547f55e457 100644 --- a/Alignment/OfflineValidation/plugins/PrimaryVertexValidation.cc +++ b/Alignment/OfflineValidation/plugins/PrimaryVertexValidation.cc @@ -55,9 +55,7 @@ #include "Geometry/TrackerGeometryBuilder/interface/PixelTopologyMap.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "RecoVertex/PrimaryVertexProducer/interface/TrackFilterForPVFinding.h" -#include "RecoVertex/PrimaryVertexProducer/interface/HITrackFilterForPVFinding.h" #include "RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZ_vect.h" -#include "RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZT_vect.h" #include "RecoVertex/PrimaryVertexProducer/interface/GapClusterizerInZ.h" #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" @@ -3696,7 +3694,7 @@ void PrimaryVertexValidation::fillDescriptions(edm::ConfigurationDescriptions& d // track filtering edm::ParameterSetDescription psd0; TrackFilterForPVFinding::fillPSetDescription(psd0); - HITrackFilterForPVFinding::fillPSetDescription(psd0); // HI only + psd0.add("numTracksThreshold", 0); // HI only desc.add("TkFilterParameters", psd0); // PV Clusterization @@ -3704,7 +3702,7 @@ void PrimaryVertexValidation::fillDescriptions(edm::ConfigurationDescriptions& d edm::ParameterSetDescription psd0; { edm::ParameterSetDescription psd1; - DAClusterizerInZT_vect::fillPSetDescription(psd1); + DAClusterizerInZ_vect::fillPSetDescription(psd1); psd0.add("TkDAClusParameters", psd1); edm::ParameterSetDescription psd2; diff --git a/RecoHI/HiTracking/python/HIPixelAdaptiveVertex_cfi.py b/RecoHI/HiTracking/python/HIPixelAdaptiveVertex_cfi.py index 294813318faae..5a17072004864 100644 --- a/RecoHI/HiTracking/python/HIPixelAdaptiveVertex_cfi.py +++ b/RecoHI/HiTracking/python/HIPixelAdaptiveVertex_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms -import RecoVertex.PrimaryVertexProducer.primaryVertexProducer_cfi as _mod +from RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi import offlinePrimaryVertices -hiPixelAdaptiveVertex = _mod.primaryVertexProducer.clone( +hiPixelAdaptiveVertex = offlinePrimaryVertices.clone( verbose = False, TkFilterParameters = dict( algorithm = 'filterWithThreshold', @@ -11,13 +11,12 @@ maxD0Significance = 3.0, ## keep most primary tracks (was 5.0) minPt = 0.0, ## better for softish events maxEta = 100., - numTracksThreshold = 2 ), # label of tracks to be used TrackLabel = "hiSelectedProtoTracks", # clustering - TkClusParameters = dict( - algorithm = "gap", + TkClusParameters = cms.PSet( + algorithm = cms.string("gap"), TkGapClusParameters = cms.PSet( zSeparation = cms.double(1.0) ## 1 cm max separation between clusters ) @@ -33,3 +32,5 @@ ) ) ) + +hiPixelAdaptiveVertex.TkFilterParameters.numTracksThreshold = cms.int32(2) diff --git a/RecoVertex/Configuration/python/RecoVertex_phase2_timing_cff.py b/RecoVertex/Configuration/python/RecoVertex_phase2_timing_cff.py index 37f196eabaa1b..799fc453408f6 100644 --- a/RecoVertex/Configuration/python/RecoVertex_phase2_timing_cff.py +++ b/RecoVertex/Configuration/python/RecoVertex_phase2_timing_cff.py @@ -2,19 +2,18 @@ from RecoVertex.Configuration.RecoVertex_cff import unsortedOfflinePrimaryVertices, trackWithVertexRefSelector, trackRefsForJets, sortedPrimaryVertices, offlinePrimaryVertices, offlinePrimaryVerticesWithBS,vertexrecoTask unsortedOfflinePrimaryVertices4D = unsortedOfflinePrimaryVertices.clone( - TkClusParameters = dict( - algorithm = "DA2D_vect", - TkDAClusParameters = dict( - Tmin = 4.0, - Tpurge = 4.0, - Tstop = 2.0 - ), + TkClusParameters = cms.PSet(algorithm = cms.string("DA2D_vect"), + TkDAClusParameters = cms.PSet( + Tmin = cms.double(4.0), + Tpurge = cms.double(4.0), + Tstop = cms.double(2.0), + ) ), TrackTimesLabel = cms.InputTag("trackTimeValueMapProducer","generalTracksConfigurableFlatResolutionModel"), TrackTimeResosLabel = cms.InputTag("trackTimeValueMapProducer","generalTracksConfigurableFlatResolutionModelResolution"), vertexCollections = {0: dict(vertexTimeParameters = cms.PSet( algorithm = cms.string('legacy4D'))), 1: dict(vertexTimeParameters = cms.PSet( algorithm = cms.string('legacy4D')))} -) + ) trackWithVertexRefSelectorBeforeSorting4D = trackWithVertexRefSelector.clone( vertexTag = "unsortedOfflinePrimaryVertices4D", ptMax = 9e99, @@ -68,8 +67,7 @@ from Configuration.Eras.Modifier_phase2_timing_layer_cff import phase2_timing_layer phase2_timing_layer.toModify(tofPID, vtxsSrc='unsortedOfflinePrimaryVertices4D', vertexReassignment=False) phase2_timing_layer.toModify(tofPID3D, vertexReassignment=False) -phase2_timing_layer.toModify(unsortedOfflinePrimaryVertices, +phase2_timing_layer.toModify(unsortedOfflinePrimaryVertices, vertexCollections = {0: dict(vertexTimeParameters = cms.PSet( algorithm = cms.string('fromTracksPID'))), 1: dict(vertexTimeParameters = cms.PSet( algorithm = cms.string('fromTracksPID')))} ) - diff --git a/RecoVertex/PrimaryVertexProducer/interface/HITrackFilterForPVFinding.h b/RecoVertex/PrimaryVertexProducer/interface/HITrackFilterForPVFinding.h index 7018aac859c6b..65964e09cfd88 100644 --- a/RecoVertex/PrimaryVertexProducer/interface/HITrackFilterForPVFinding.h +++ b/RecoVertex/PrimaryVertexProducer/interface/HITrackFilterForPVFinding.h @@ -39,6 +39,7 @@ class HITrackFilterForPVFinding : public TrackFilterForPVFinding { } static void fillPSetDescription(edm::ParameterSetDescription& desc) { + TrackFilterForPVFinding::fillPSetDescription(desc); desc.add("numTracksThreshold", 0); // HI only desc.add("maxNumTracksThreshold", std::numeric_limits::max()); desc.add("minPtTight", 0.0); diff --git a/RecoVertex/PrimaryVertexProducer/plugins/PrimaryVertexProducer.cc b/RecoVertex/PrimaryVertexProducer/plugins/PrimaryVertexProducer.cc index eb27d0ccf8167..decfaf4dc05ca 100644 --- a/RecoVertex/PrimaryVertexProducer/plugins/PrimaryVertexProducer.cc +++ b/RecoVertex/PrimaryVertexProducer/plugins/PrimaryVertexProducer.cc @@ -421,8 +421,7 @@ void PrimaryVertexProducer::fillDescriptions(edm::ConfigurationDescriptions& des desc.addUntracked("verbose", false); { edm::ParameterSetDescription psd0; - TrackFilterForPVFinding::fillPSetDescription(psd0); - HITrackFilterForPVFinding::fillPSetDescription(psd0); // HI only + HITrackFilterForPVFinding::fillPSetDescription(psd0); // extension of TrackFilterForPVFinding desc.add("TkFilterParameters", psd0); } desc.add("beamSpotLabel", edm::InputTag("offlineBeamSpot")); @@ -435,14 +434,21 @@ void PrimaryVertexProducer::fillDescriptions(edm::ConfigurationDescriptions& des edm::ParameterSetDescription psd0; { edm::ParameterSetDescription psd1; - DAClusterizerInZT_vect::fillPSetDescription(psd1); - psd0.add("TkDAClusParameters", psd1); + DAClusterizerInZ_vect::fillPSetDescription(psd1); edm::ParameterSetDescription psd2; - GapClusterizerInZ::fillPSetDescription(psd2); - psd0.add("TkGapClusParameters", psd2); + DAClusterizerInZT_vect::fillPSetDescription(psd2); + + edm::ParameterSetDescription psd3; + GapClusterizerInZ::fillPSetDescription(psd3); + + psd0.ifValue( + edm::ParameterDescription("algorithm", "DA_vect", true), + "DA_vect" >> edm::ParameterDescription("TkDAClusParameters", psd1, true) or + "DA2D_vect" >> + edm::ParameterDescription("TkDAClusParameters", psd2, true) or + "gap" >> edm::ParameterDescription("TkGapClusParameters", psd3, true)); } - psd0.add("algorithm", "DA_vect"); desc.add("TkClusParameters", psd0); } @@ -451,7 +457,7 @@ void PrimaryVertexProducer::fillDescriptions(edm::ConfigurationDescriptions& des desc.add("useMVACut", false); desc.add("minTrackTimeQuality", 0.8); - descriptions.add("primaryVertexProducer", desc); + descriptions.addDefault(desc); } //define this as a plug-in diff --git a/RecoVertex/PrimaryVertexProducer/python/OfflinePixel3DPrimaryVertices_cfi.py b/RecoVertex/PrimaryVertexProducer/python/OfflinePixel3DPrimaryVertices_cfi.py index 745f3f2f9bd0e..b6ad7e2ed8eec 100644 --- a/RecoVertex/PrimaryVertexProducer/python/OfflinePixel3DPrimaryVertices_cfi.py +++ b/RecoVertex/PrimaryVertexProducer/python/OfflinePixel3DPrimaryVertices_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms -import RecoVertex.PrimaryVertexProducer.primaryVertexProducer_cfi as _mod +from RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi import offlinePrimaryVertices -pixelVertices = _mod.primaryVertexProducer.clone( +pixelVertices = offlinePrimaryVertices.clone( TrackLabel = "pixelTracks", TkFilterParameters = dict( diff --git a/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVerticesFromCosmicTracks_cfi.py b/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVerticesFromCosmicTracks_cfi.py index 85826d38cb01d..3c8527e46d20f 100644 --- a/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVerticesFromCosmicTracks_cfi.py +++ b/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVerticesFromCosmicTracks_cfi.py @@ -1,10 +1,10 @@ import FWCore.ParameterSet.Config as cms -import RecoVertex.PrimaryVertexProducer.primaryVertexProducer_cfi as _mod +from RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi import offlinePrimaryVertices -offlinePrimaryVerticesFromCosmicTracks = _mod.primaryVertexProducer.clone( +offlinePrimaryVerticesFromCosmicTracks = offlinePrimaryVertices.clone( TrackLabel = "ctfWithMaterialTracksP5", beamSpotLabel = "offlineBeamSpot", - + TkFilterParameters = dict( maxNormalizedChi2 = 5.0, minSiliconLayersWithHits = 7, ## hits > 7 @@ -15,11 +15,11 @@ minPixelLayersWithHits = 2, ## hits > 2 ), - TkClusParameters = dict( - algorithm = "gap", - TkGapClusParameters = dict( - zSeparation = 0.1 ## 1 mm max separation betw. clusters - ) + TkClusParameters = cms.PSet( + algorithm = cms.string("gap"), + TkGapClusParameters = cms.PSet( + zSeparation = cms.double(0.1) ## 1 mm max separation betw. clusters + ) ), vertexCollections = cms.VPSet( diff --git a/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVertices_cfi.py b/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVertices_cfi.py index cff8dbaebaa1e..35b69fb7a2232 100644 --- a/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVertices_cfi.py +++ b/RecoVertex/PrimaryVertexProducer/python/OfflinePrimaryVertices_cfi.py @@ -1,29 +1,90 @@ import FWCore.ParameterSet.Config as cms -from RecoVertex.PrimaryVertexProducer.primaryVertexProducer_cfi import primaryVertexProducer +offlinePrimaryVertices = cms.EDProducer( + "PrimaryVertexProducer", -offlinePrimaryVertices = primaryVertexProducer.clone() + verbose = cms.untracked.bool(False), + TrackLabel = cms.InputTag("generalTracks"), + beamSpotLabel = cms.InputTag("offlineBeamSpot"), -DA_vectParameters = cms.PSet(primaryVertexProducer.TkClusParameters.clone()) + TkFilterParameters = cms.PSet( + algorithm=cms.string('filter'), + maxNormalizedChi2 = cms.double(10.0), + minPixelLayersWithHits=cms.int32(2), + minSiliconLayersWithHits = cms.int32(5), + maxD0Significance = cms.double(4.0), + maxD0Error = cms.double(1.0), + maxDzError = cms.double(1.0), + minPt = cms.double(0.0), + maxEta = cms.double(2.4), + trackQuality = cms.string("any") + ), + + TkClusParameters = cms.PSet( + algorithm = cms.string("DA_vect"), + TkDAClusParameters = cms.PSet( + coolingFactor = cms.double(0.6), # moderate annealing speed + zrange = cms.double(4.), # consider only clusters within 4 sigma*sqrt(T) of a track + delta_highT = cms.double(1.e-2), # convergence requirement at high T + delta_lowT = cms.double(1.e-3), # convergence requirement at low T + convergence_mode = cms.int32(0), # 0 = two steps, 1 = dynamic with sqrt(T) + Tmin = cms.double(2.0), # end of vertex splitting + Tpurge = cms.double(2.0), # cleaning + Tstop = cms.double(0.5), # end of annealing + vertexSize = cms.double(0.006), # added in quadrature to track-z resolutions + d0CutOff = cms.double(3.), # downweight high IP tracks + dzCutOff = cms.double(3.), # outlier rejection after freeze-out (T