Skip to content

Commit

Permalink
Merge pull request #34098 from mmusich/swapOfflinePrimaryVerticesWithBS
Browse files Browse the repository at this point in the history
add customization function to swap offlinePrimaryVertices to offlinePrimaryVerticesWithBS
  • Loading branch information
cmsbuild committed Jun 18, 2021
2 parents 714b1a1 + 50245e5 commit 9fccdcd
Showing 1 changed file with 26 additions and 0 deletions.
@@ -0,0 +1,26 @@
import FWCore.ParameterSet.Config as cms
from FWCore.ParameterSet.MassReplace import massReplaceInputTag as MassReplaceInputTag
#
# mass replace OfflinePrimaryVertices with OfflinePrimaryVerticesWithBS
# (doesn't affect defaults in the source code, e.g. provided by fillDescriptions)
#
def massReplaceOfflinePrimaryVerticesToUseBeamSpot(process):
# swap all occurrences
process = MassReplaceInputTag(process,"offlinePrimaryVertices","offlinePrimaryVerticesWithBS")

# excepted of course for the primary source...
if hasattr(process,'offlinePrimaryVerticesWithBS'):
process.offlinePrimaryVerticesWithBS.src = cms.InputTag("offlinePrimaryVertices","WithBS")

return process

#
# makes OfflinePrimaryVertices equivalent to OfflinePrimaryVerticesWithBS
# by changing the input vertices collection of the sorted PV
# see file https://github.com/cms-sw/cmssw/blob/master/RecoVertex/Configuration/python/RecoVertex_cff.py
#
def swapOfflinePrimaryVerticesToUseBeamSpot(process):
if hasattr(process,'offlinePrimaryVertices'):
process.offlinePrimaryVertices.vertices="unsortedOfflinePrimaryVertices:WithBS"

return process

0 comments on commit 9fccdcd

Please sign in to comment.