Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34098 from mmusich/swapOfflinePrimaryVerticesWithBS
add customization function to swap offlinePrimaryVertices to offlinePrimaryVerticesWithBS
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
RecoVertex/Configuration/python/replaceOfflinePrimaryVerticesWithBS.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |