Skip to content

Commit

Permalink
Merge pull request cms-sw#15421 from cms-btv-pog/bTagHIPMitigation-PR…
Browse files Browse the repository at this point in the history
…_from-CMSSW_8_1_X_2016-08-10-1100

btag HIP mitigation + ctag bugfix
  • Loading branch information
davidlange6 authored Aug 30, 2016
2 parents d5eb24d + 633bf1f commit 7e2b68e
Show file tree
Hide file tree
Showing 9 changed files with 251 additions and 99 deletions.
24 changes: 24 additions & 0 deletions PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,30 @@ def miniAOD_customizeCommon(process):
process.patJets.userData.userFunctionLabels = cms.vstring('vtxMass','vtxNtracks','vtx3DVal','vtx3DSig','vtxPx','vtxPy','vtxPz','vtxPosX','vtxPosY','vtxPosZ')
process.patJets.tagInfoSources = cms.VInputTag(cms.InputTag("pfSecondaryVertexTagInfos"))
process.patJets.addTagInfos = cms.bool(True)

## Legacy tight b-tag track selection
## (this will run below-specified taggers with the tight b-tag track selection enabled
## and will add an extra set of b-tag discriminators to 'selectedPatJets'
## with the 'tight' prefix added to the usual discriminator names)
from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection
updateJetCollection(
process,
jetSource = cms.InputTag('selectedPatJets'),
## updateJetCollection defaults to MiniAOD inputs. Here, this needs to be changed to RECO/AOD inputs
pvSource = cms.InputTag('offlinePrimaryVertices'),
pfCandidates = cms.InputTag('particleFlow'),
svSource = cms.InputTag('inclusiveCandidateSecondaryVertices'),
muSource = cms.InputTag('muons'),
elSource = cms.InputTag('gedGsfElectrons'),
##
jetCorrections = ('AK4PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'], ''),
btagDiscriminators = ["pfCombinedSecondaryVertexV2BJetTags", "pfCombinedInclusiveSecondaryVertexV2BJetTags",
"pfCombinedCvsLJetTags", "pfCombinedCvsBJetTags"],
runIVF = True,
tightBTagNTkHits = True,
btagPrefix = 'tight',
postfix = 'BTAG' # added to avoid problems with unrunnable schedule
)
#
## PU JetID
process.load("RecoJets.JetProducers.PileupJetID_cfi")
Expand Down
2 changes: 1 addition & 1 deletion PhysicsTools/PatAlgos/python/slimming/slimmedJets_cfi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import FWCore.ParameterSet.Config as cms

slimmedJets = cms.EDProducer("PATJetSlimmer",
src = cms.InputTag("selectedPatJets"),
src = cms.InputTag("selectedUpdatedPatJetsBTAG"),
packedPFCandidates = cms.InputTag("packedPFCandidates"),
dropJetVars = cms.string("1"),
dropDaughters = cms.string("0"),
Expand Down
20 changes: 13 additions & 7 deletions PhysicsTools/PatAlgos/python/tools/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ def addESProducers(process,config):
if 'ESProducer' in item.type_():
setattr(process,name,item)

def loadWithPrefix(process,moduleName,prefix=''):
loadWithPrePostfix(process,moduleName,prefix,'')

def loadWithPostfix(process,moduleName,postfix=''):
loadWithPrePostfix(process,moduleName,'',postfix)

def loadWithPrePostfix(process,moduleName,prefix='',postfix=''):
moduleName = moduleName.replace("/",".")
module = __import__(moduleName)
#print module.PatAlgos.patSequences_cff.patDefaultSequence
extendWithPostfix(process,sys.modules[moduleName],postfix)
extendWithPrePostfix(process,sys.modules[moduleName],prefix,postfix)

def extendWithPostfix(process,other,postfix,items=()):
def extendWithPrePostfix(process,other,prefix,postfix,items=()):
"""Look in other and find types which we can use"""
# enable explicit check to avoid overwriting of existing objects
#__dict__['_Process__InExtendCall'] = True
Expand All @@ -46,26 +52,26 @@ def extendWithPostfix(process,other,postfix,items=()):
elif isinstance(item,cms._Labelable):
if not item.hasLabel_():
item.setLabel(name)
if postfix != '':
if prefix != '' or postfix != '':
newModule = item.clone()
if isinstance(item,cms.ESProducer):
newLabel = item.label()
newName =name
else:
if 'TauDiscrimination' in name:
process.__setattr__(name,item)
newLabel = item.label()+postfix
newName = name+postfix
newLabel = prefix+item.label()+postfix
newName = prefix+name+postfix
process.__setattr__(newName,newModule)
if isinstance(newModule, cms._Sequenceable) and not newName == name:
sequence +=getattr(process,newName)
sequence._moduleLabels.append(item.label())
else:
process.__setattr__(name,item)

if postfix != '':
if prefix != '' or postfix != '':
for label in sequence._moduleLabels:
massSearchReplaceAnyInputTag(sequence, label, label+postfix,verbose=False,moduleLabelOnly=True)
massSearchReplaceAnyInputTag(sequence, label, prefix+label+postfix,verbose=False,moduleLabelOnly=True)

def applyPostfix(process, label, postfix):
result = None
Expand Down
287 changes: 203 additions & 84 deletions PhysicsTools/PatAlgos/python/tools/jetTools.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions PhysicsTools/RecoAlgos/python/btvTracks_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
maxRapidity = 9.0,
quality = [],
minLayer = 0,
minHit = 8,
minPixelHit = 2,
minHit = 0,
minPixelHit = 1,
usePV = True,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
computeProbabilities = cms.bool(True),
computeGhostTrack = cms.bool(True),
ghostTrackPriorDeltaR = cms.double(0.03),
minimumNumberOfPixelHits = cms.int32(2),
minimumNumberOfHits = cms.int32(8),
minimumNumberOfPixelHits = cms.int32(1),
minimumNumberOfHits = cms.int32(0),
maximumTransverseImpactParameter = cms.double(0.2),
minimumTransverseMomentum = cms.double(1.0),
maximumChiSquared = cms.double(5.0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
extSVDeltaRToJet = cms.double(0.3)

)

secondaryVertexTagInfos.trackSelection.pixelHitsMin = cms.uint32(2)
secondaryVertexTagInfos.trackSelection.totalHitsMin = cms.uint32(8)
4 changes: 2 additions & 2 deletions RecoBTag/SecondaryVertex/python/vertexTrackSelection_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
vertexTrackSelectionBlock = cms.PSet(
trackSelection = cms.PSet(
variableJTAPars,
totalHitsMin = cms.uint32(8),
totalHitsMin = cms.uint32(0),
jetDeltaRMax = cms.double(0.3),
qualityClass = cms.string('any'),
pixelHitsMin = cms.uint32(2),
pixelHitsMin = cms.uint32(1),
maxDistToAxis = cms.double(0.2),
maxDecayLen = cms.double(99999.9),
sip3dSigMin = cms.double(-99999.9),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
beamSpot = cms.InputTag("offlineBeamSpot"),
primaryVertices = cms.InputTag("offlinePrimaryVertices"),
tracks = cms.InputTag("particleFlow"),
minHits = cms.uint32(8),
minHits = cms.uint32(0),
maximumLongitudinalImpactParameter = cms.double(0.3),
minPt = cms.double(0.8),
maxNTracks = cms.uint32(30),
Expand Down

0 comments on commit 7e2b68e

Please sign in to comment.