diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index 7dbe8f9e08a53..ffe5022a29ebc 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -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") diff --git a/PhysicsTools/PatAlgos/python/slimming/slimmedJets_cfi.py b/PhysicsTools/PatAlgos/python/slimming/slimmedJets_cfi.py index bf6547dbe75d8..5b9606f6d17fe 100644 --- a/PhysicsTools/PatAlgos/python/slimming/slimmedJets_cfi.py +++ b/PhysicsTools/PatAlgos/python/slimming/slimmedJets_cfi.py @@ -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"), diff --git a/PhysicsTools/PatAlgos/python/tools/helpers.py b/PhysicsTools/PatAlgos/python/tools/helpers.py index f1b7d0f00e351..be1459cd4fc2d 100644 --- a/PhysicsTools/PatAlgos/python/tools/helpers.py +++ b/PhysicsTools/PatAlgos/python/tools/helpers.py @@ -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 @@ -46,7 +52,7 @@ 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() @@ -54,8 +60,8 @@ def extendWithPostfix(process,other,postfix,items=()): 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) @@ -63,9 +69,9 @@ def extendWithPostfix(process,other,postfix,items=()): 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 diff --git a/PhysicsTools/PatAlgos/python/tools/jetTools.py b/PhysicsTools/PatAlgos/python/tools/jetTools.py index c0f17c7ef91b6..e2c5b5f0bb74c 100644 --- a/PhysicsTools/PatAlgos/python/tools/jetTools.py +++ b/PhysicsTools/PatAlgos/python/tools/jetTools.py @@ -170,8 +170,8 @@ def setupSVClustering(btagInfo, svClustering, algo, rParam, fatJets=cms.InputTag btagInfo.groomedFatJets = groomedFatJets -def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, loadStdRecoBTag, svClustering, fatJets, groomedFatJets, - algo, rParam, btagDiscriminators, btagInfos, patJets, labelName, postfix): +def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, tightBTagNTkHits, loadStdRecoBTag, svClustering, fatJets, groomedFatJets, + algo, rParam, btagDiscriminators, btagInfos, patJets, labelName, btagPrefix, postfix): ## expand tagInfos to what is explicitely required by user + implicit ## requirements that come in from one or the other discriminator requiredTagInfos = list(btagInfos) @@ -201,6 +201,44 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou import RecoBTag.Configuration.RecoBTag_cff as btag import RecoJets.JetProducers.caTopTaggers_cff as toptag + if tightBTagNTkHits: + if not runIVF: + print "-------------------------------------------------------------------" + print " Warning: For a complete switch to the legacy tight b-tag track" + print " selection, please also enable the \'runIVF\' switch." + print "-------------------------------------------------------------------" + if btagPrefix == '': + print "-------------------------------------------------------------------" + print " Warning: With the tight b-tag track selection enabled, it is" + print " advisable to set \'btagPrefix\' to a non-empty string to" + print " avoid unintentional modifications to the default" + print " b tagging setup that might be loaded in the same job." + print "-------------------------------------------------------------------" + + ## define c tagging CvsL SV source (for now tied to the default SV source + ## in the first part of the module label, product instance label and process name) + svSourceCvsL = copy.deepcopy(svSource) + svSourceCvsL.setModuleLabel(svSource.getModuleLabel()+'CvsL') + + ## check if and under what conditions to re-run IVF + runIVFforCTagOnly = False + ivfcTagInfos = ['pfInclusiveSecondaryVertexFinderCvsLTagInfos', 'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos'] + ## if MiniAOD and running c tagging + if pfCandidates.getModuleLabel() == 'packedPFCandidates' and (i for i in ivfcTagInfos if i in requiredTagInfos) and not runIVF: + runIVFforCTagOnly = True + runIVF = True + print "-------------------------------------------------------------------" + print " Info: To run c tagging on MiniAOD, c-tag-specific IVF secondary" + print " vertices will be remade." + print "-------------------------------------------------------------------" + ## adjust svSources + if runIVF and btagPrefix != '': + if runIVFforCTagOnly: + svSourceCvsL.setModuleLabel(btagPrefix+svSourceCvsL.getModuleLabel()) + else: + svSource.setModuleLabel(btagPrefix+svSource.getModuleLabel()) + svSourceCvsL.setModuleLabel(btagPrefix+svSourceCvsL.getModuleLabel()) + ## setup all required btagInfos : we give a dedicated treatment for different ## types of tagInfos here. A common treatment is possible but might require a more ## general approach anyway in coordination with the btagging POG. @@ -208,105 +246,100 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou for btagInfo in requiredTagInfos: if hasattr(btag,btagInfo): if btagInfo == 'pfImpactParameterTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.pfImpactParameterTagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates)) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfImpactParameterTagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates)) if explicitJTA: - _btagInfo = getattr(process, btagInfo+labelName+postfix) + _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix) _btagInfo.explicitJTA = cms.bool(explicitJTA) + if tightBTagNTkHits: + _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix) + _btagInfo.minimumNumberOfPixelHits = cms.int32(2) + _btagInfo.minimumNumberOfHits = cms.int32(8) if btagInfo == 'pfImpactParameterAK8TagInfos': - setattr(process, btagInfo+labelName+postfix, btag.pfImpactParameterAK8TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates)) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfImpactParameterAK8TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates)) if explicitJTA: - _btagInfo = getattr(process, btagInfo+labelName+postfix) + _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix) _btagInfo.explicitJTA = cms.bool(explicitJTA) + if tightBTagNTkHits: + _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix) + _btagInfo.minimumNumberOfPixelHits = cms.int32(2) + _btagInfo.minimumNumberOfHits = cms.int32(8) if btagInfo == 'pfImpactParameterCA15TagInfos': - setattr(process, btagInfo+labelName+postfix, btag.pfImpactParameterCA15TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates)) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfImpactParameterCA15TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates)) if explicitJTA: - _btagInfo = getattr(process, btagInfo+labelName+postfix) + _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix) _btagInfo.explicitJTA = cms.bool(explicitJTA) + if tightBTagNTkHits: + _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix) + _btagInfo.minimumNumberOfPixelHits = cms.int32(2) + _btagInfo.minimumNumberOfHits = cms.int32(8) if btagInfo == 'pfSecondaryVertexTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.pfSecondaryVertexTagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix))) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfSecondaryVertexTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix))) + if tightBTagNTkHits: + _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix) + _btagInfo.trackSelection.pixelHitsMin = cms.uint32(2) + _btagInfo.trackSelection.totalHitsMin = cms.uint32(8) if btagInfo == 'pfInclusiveSecondaryVertexFinderTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderTagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix), extSVCollection=svSource)) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix), extSVCollection=svSource)) if svClustering or fatJets != cms.InputTag(''): - setupSVClustering(getattr(process, btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) + setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) if btagInfo == 'pfInclusiveSecondaryVertexFinderAK8TagInfos': - setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderAK8TagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterAK8TagInfos'+labelName+postfix), extSVCollection=svSource)) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderAK8TagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterAK8TagInfos'+labelName+postfix), extSVCollection=svSource)) if svClustering or fatJets != cms.InputTag(''): - setupSVClustering(getattr(process, btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) + setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) if btagInfo == 'pfInclusiveSecondaryVertexFinderCA15TagInfos': - setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderCA15TagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterCA15TagInfos'+labelName+postfix), extSVCollection=svSource)) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderCA15TagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterCA15TagInfos'+labelName+postfix), extSVCollection=svSource)) if svClustering or fatJets != cms.InputTag(''): - setupSVClustering(getattr(process, btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) + setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) if btagInfo == 'pfInclusiveSecondaryVertexFinderCvsLTagInfos': - setattr( - process, - btagInfo+labelName+postfix, - btag.pfInclusiveSecondaryVertexFinderCvsLTagInfos.clone( - trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix), - extSVCollection=svSource - ) - ) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderCvsLTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix), extSVCollection=svSourceCvsL)) if svClustering or fatJets != cms.InputTag(''): - setupSVClustering(getattr(process, btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) - if btagInfo == 'pfInclusiveSecondaryVertexFinderCvsBTagInfos': - setattr( - process, - btagInfo+labelName+postfix, - btag.pfInclusiveSecondaryVertexFinderCvsBTagInfos.clone( - trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix), - extSVCollection=svSource - ) - ) - if svClustering or fatJets != cms.InputTag(''): - setupSVClustering(getattr(process, btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) + setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) if btagInfo == 'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos': - setattr( - process, - btagInfo+labelName+postfix, - btag.pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos.clone( - trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix), - extSVCollection=svSource - ) - ) - if svClustering or fatJets != cms.InputTag(''): - setupSVClustering(getattr(process, btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix), extSVCollection=svSourceCvsL)) + if svClustering or fatJets != cms.InputTag(''): + setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) if btagInfo == 'pfGhostTrackVertexTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.pfGhostTrackVertexTagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix))) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfGhostTrackVertexTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix))) if btagInfo == 'pfGhostTrackTagVertexInfosAK8': - setattr(process, btagInfo+labelName+postfix, btag.pfGhostTrackVertexTagInfosAK8.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfosAK8'+labelName+postfix))) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfGhostTrackVertexTagInfosAK8.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfosAK8'+labelName+postfix))) if btagInfo == 'pfSecondaryVertexNegativeTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.pfSecondaryVertexNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix))) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfSecondaryVertexNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix))) + if tightBTagNTkHits: + _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix) + _btagInfo.trackSelection.pixelHitsMin = cms.uint32(2) + _btagInfo.trackSelection.totalHitsMin = cms.uint32(8) if btagInfo == 'pfInclusiveSecondaryVertexFinderNegativeTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix), extSVCollection=svSource)) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix), extSVCollection=svSource)) if svClustering or fatJets != cms.InputTag(''): - setupSVClustering(getattr(process, btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) + setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) if btagInfo == 'impactParameterTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.impactParameterTagInfos.clone(jetTracks = cms.InputTag('jetTracksAssociatorAtVertex'+labelName+postfix), primaryVertex=pvSource)) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.impactParameterTagInfos.clone(jetTracks = cms.InputTag('jetTracksAssociatorAtVertex'+labelName+postfix), primaryVertex=pvSource)) if btagInfo == 'secondaryVertexTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.secondaryVertexTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix))) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.secondaryVertexTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix))) if btagInfo == 'inclusiveSecondaryVertexFinderTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix))) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix))) if svClustering or fatJets != cms.InputTag(''): - setupSVClustering(getattr(process, btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) + setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) if btagInfo == 'inclusiveSecondaryVertexFinderFilteredTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderFilteredTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix))) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderFilteredTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix))) if svClustering or fatJets != cms.InputTag(''): - setupSVClustering(getattr(process, btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) + setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) if btagInfo == 'secondaryVertexNegativeTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.secondaryVertexNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix))) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.secondaryVertexNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix))) if btagInfo == 'inclusiveSecondaryVertexFinderNegativeTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix))) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix))) if svClustering or fatJets != cms.InputTag(''): - setupSVClustering(getattr(process, btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) + setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) if btagInfo == 'inclusiveSecondaryVertexFinderFilteredNegativeTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderFilteredNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix))) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderFilteredNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix))) if svClustering or fatJets != cms.InputTag(''): - setupSVClustering(getattr(process, btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) + setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets) if btagInfo == 'softMuonTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.softMuonTagInfos.clone(jets = jetSource, primaryVertex=pvSource)) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.softMuonTagInfos.clone(jets = jetSource, primaryVertex=pvSource)) if btagInfo == 'softPFMuonsTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.softPFMuonsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource)) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.softPFMuonsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource)) if btagInfo == 'softPFElectronsTagInfos': - setattr(process, btagInfo+labelName+postfix, btag.softPFElectronsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource)) + setattr(process, btagPrefix+btagInfo+labelName+postfix, btag.softPFElectronsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource)) acceptedTagInfos.append(btagInfo) elif hasattr(toptag, btagInfo) : acceptedTagInfos.append(btagInfo) @@ -316,20 +349,64 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou acceptedBtagDiscriminators = list() for btagDiscr in btagDiscriminators : if hasattr(btag,btagDiscr): - setattr(process, btagDiscr+labelName+postfix, getattr(btag, btagDiscr).clone(tagInfos = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix) for x in supportedBtagDiscr[btagDiscr] ] ))) + setattr(process, btagPrefix+btagDiscr+labelName+postfix, getattr(btag, btagDiscr).clone(tagInfos = cms.VInputTag( *[ cms.InputTag(btagPrefix+x+labelName+postfix) for x in supportedBtagDiscr[btagDiscr] ] ))) acceptedBtagDiscriminators.append(btagDiscr) else: print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr) ## replace corresponding tags for pat jet production - patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix) for x in acceptedTagInfos ] ) - patJets.discriminatorSources = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix) for x in acceptedBtagDiscriminators ] ) + patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(btagPrefix+x+labelName+postfix) for x in acceptedTagInfos ] ) + patJets.discriminatorSources = cms.VInputTag( *[ cms.InputTag(btagPrefix+x+labelName+postfix) for x in acceptedBtagDiscriminators ] ) if len(acceptedBtagDiscriminators) > 0 : patJets.addBTagInfo = True + ## if re-running IVF if runIVF: - rerunningIVF() - if 'pfInclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos: - if not hasattr( process, 'inclusiveCandidateVertexing' ): - process.load( 'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' ) + if not tightBTagNTkHits: + if pfCandidates.getModuleLabel() == 'packedPFCandidates': ## MiniAOD case + if not runIVFforCTagOnly: rerunningIVFMiniAOD() + else: + rerunningIVF() + from PhysicsTools.PatAlgos.tools.helpers import loadWithPrefix + ivfbTagInfos = ['pfInclusiveSecondaryVertexFinderTagInfos', 'pfInclusiveSecondaryVertexFinderAK8TagInfos', 'pfInclusiveSecondaryVertexFinderCA15TagInfos'] + if (i for i in ivfbTagInfos if i in acceptedTagInfos) and not runIVFforCTagOnly: + if not hasattr( process, btagPrefix+'inclusiveCandidateVertexFinder' ): + loadWithPrefix(process, 'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix) + if tightBTagNTkHits: + if hasattr( process, btagPrefix+'inclusiveCandidateVertexFinder' ): + _temp = getattr(process, btagPrefix+'inclusiveCandidateVertexFinder') + _temp.minHits = cms.uint32(8) + ## MiniAOD case + if pfCandidates.getModuleLabel() == 'packedPFCandidates': + if hasattr( process, btagPrefix+'inclusiveCandidateVertexFinder' ): + _temp = getattr(process, btagPrefix+'inclusiveCandidateVertexFinder') + _temp.primaryVertices = pvSource + _temp.tracks = pfCandidates + if hasattr( process, btagPrefix+'candidateVertexArbitrator' ): + _temp = getattr(process, btagPrefix+'candidateVertexArbitrator') + _temp.primaryVertices = pvSource + _temp.tracks = pfCandidates + _temp.trackMinLayers = cms.int32(0) ## number of layers not available in MiniAOD so this cut needs to be disabled + if hasattr( process, btagPrefix+'inclusiveCandidateSecondaryVertices' ) and not hasattr( process, svSource.getModuleLabel() ): + setattr(process, svSource.getModuleLabel(), getattr(process, btagPrefix+'inclusiveCandidateSecondaryVertices').clone() ) + if (i for i in ivfcTagInfos if i in acceptedTagInfos): + if not hasattr( process, btagPrefix+'inclusiveCandidateVertexFinderCvsL' ): + loadWithPrefix(process, 'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix) + if tightBTagNTkHits: + if hasattr( process, btagPrefix+'inclusiveCandidateVertexFinderCvsL' ): + _temp = getattr(process, btagPrefix+'inclusiveCandidateVertexFinderCvsL') + _temp.minHits = cms.uint32(8) + ## MiniAOD case + if pfCandidates.getModuleLabel() == 'packedPFCandidates': + if hasattr( process, btagPrefix+'inclusiveCandidateVertexFinderCvsL' ): + _temp = getattr(process, btagPrefix+'inclusiveCandidateVertexFinderCvsL') + _temp.primaryVertices = pvSource + _temp.tracks = pfCandidates + if hasattr( process, btagPrefix+'candidateVertexArbitratorCvsL' ): + _temp = getattr(process, btagPrefix+'candidateVertexArbitratorCvsL') + _temp.primaryVertices = pvSource + _temp.tracks = pfCandidates + _temp.trackMinLayers = cms.int32(0) ## number of layers not available in MiniAOD so this cut needs to be disabled + if hasattr( process, btagPrefix+'inclusiveCandidateSecondaryVerticesCvsL' ) and not hasattr( process, svSourceCvsL.getModuleLabel() ): + setattr(process, svSourceCvsL.getModuleLabel(), getattr(process, btagPrefix+'inclusiveCandidateSecondaryVerticesCvsL').clone() ) if 'inclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos: if not hasattr( process, 'inclusiveVertexing' ): process.load( 'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' ) @@ -363,6 +440,7 @@ def __init__(self): ## add all parameters that should be known to the class self.addParameter(self._defaultParameters,'labelName', 'UNDEFINED', "Label name of the new patJet collection.", str) self.addParameter(self._defaultParameters,'postfix','', "Postfix from usePF2PAT.", str) + self.addParameter(self._defaultParameters,'btagPrefix','', "Prefix to be added to b-tag discriminator and TagInfo names", str) self.addParameter(self._defaultParameters,'jetSource','', "Label of the input collection from which the new patJet collection should be created", cms.InputTag) self.addParameter(self._defaultParameters,'pfCandidates',cms.InputTag('particleFlow'), "Label of the input collection for candidatecandidatese used in b-tagging", cms.InputTag) self.addParameter(self._defaultParameters,'explicitJTA', False, "Use explicit jet-track association") @@ -371,6 +449,7 @@ def __init__(self): self.addParameter(self._defaultParameters,'elSource',cms.InputTag('gedGsfElectrons'), "Label of the input collection for electrons used in b-tagging", cms.InputTag) self.addParameter(self._defaultParameters,'muSource',cms.InputTag('muons'), "Label of the input collection for muons used in b-tagging", cms.InputTag) self.addParameter(self._defaultParameters,'runIVF', False, "Re-run IVF secondary vertex reconstruction") + self.addParameter(self._defaultParameters,'tightBTagNTkHits', False, "Enable legacy tight b-tag track selection") self.addParameter(self._defaultParameters,'loadStdRecoBTag', False, "Load the standard reconstruction b-tagging modules") self.addParameter(self._defaultParameters,'svClustering', False, "Secondary vertices ghost-associated to jets using jet clustering (mostly intended for subjets)") self.addParameter(self._defaultParameters,'fatJets', cms.InputTag(''), "Fat jet collection used for secondary vertex clustering", cms.InputTag) @@ -406,7 +485,7 @@ def __init__(self): self._parameters=copy.deepcopy(self._defaultParameters) ## add comments self._comment = "This is a tool to add more patJet collectinos to your PAT Tuple or to re-configure the default collection. You can add and embed additional information like jet\ - energy correction factors, btag infomration and generator match information to the new patJet collection depending on the parameters that you pass on to this function. Consult \ + energy correction factors, btag information and generator match information to the new patJet collection depending on the parameters that you pass on to this function. Consult \ the descriptions of each parameter for more information." def getDefaultParameters(self): @@ -415,7 +494,7 @@ def getDefaultParameters(self): """ return self._defaultParameters - def __call__(self,process,labelName=None,postfix=None,jetSource=None,pfCandidates=None,explicitJTA=None,pvSource=None,svSource=None,elSource=None,muSource=None,runIVF=None,loadStdRecoBTag=None,svClustering=None,fatJets=None,groomedFatJets=None,algo=None,rParam=None,getJetMCFlavour=None,genJetCollection=None,genParticles=None,jetCorrections=None,btagDiscriminators=None,btagInfos=None,jetTrackAssociation=None,outputModules=None): + def __call__(self,process,labelName=None,postfix=None,btagPrefix=None,jetSource=None,pfCandidates=None,explicitJTA=None,pvSource=None,svSource=None,elSource=None,muSource=None,runIVF=None,tightBTagNTkHits=None,loadStdRecoBTag=None,svClustering=None,fatJets=None,groomedFatJets=None,algo=None,rParam=None,getJetMCFlavour=None,genJetCollection=None,genParticles=None,jetCorrections=None,btagDiscriminators=None,btagInfos=None,jetTrackAssociation=None,outputModules=None): """ Function call wrapper. This will check the parameters and call the actual implementation that can be found in toolCode via the base class function apply. @@ -426,6 +505,9 @@ def __call__(self,process,labelName=None,postfix=None,jetSource=None,pfCandidate if postfix is None: postfix=self._defaultParameters['postfix'].value self.setParameter('postfix', postfix) + if btagPrefix is None: + btagPrefix=self._defaultParameters['btagPrefix'].value + self.setParameter('btagPrefix', btagPrefix) if jetSource is None: jetSource=self._defaultParameters['jetSource'].value self.setParameter('jetSource', jetSource) @@ -450,6 +532,9 @@ def __call__(self,process,labelName=None,postfix=None,jetSource=None,pfCandidate if runIVF is None: runIVF=self._defaultParameters['runIVF'].value self.setParameter('runIVF', runIVF) + if tightBTagNTkHits is None: + tightBTagNTkHits=self._defaultParameters['tightBTagNTkHits'].value + self.setParameter('tightBTagNTkHits', tightBTagNTkHits) if loadStdRecoBTag is None: loadStdRecoBTag=self._defaultParameters['loadStdRecoBTag'].value self.setParameter('loadStdRecoBTag', loadStdRecoBTag) @@ -501,6 +586,7 @@ def toolCode(self, process): ## initialize parameters labelName=self._parameters['labelName'].value postfix=self._parameters['postfix'].value + btagPrefix=self._parameters['btagPrefix'].value jetSource=self._parameters['jetSource'].value pfCandidates=self._parameters['pfCandidates'].value explicitJTA=self._parameters['explicitJTA'].value @@ -509,6 +595,7 @@ def toolCode(self, process): elSource=self._parameters['elSource'].value muSource=self._parameters['muSource'].value runIVF=self._parameters['runIVF'].value + tightBTagNTkHits=self._parameters['tightBTagNTkHits'].value loadStdRecoBTag=self._parameters['loadStdRecoBTag'].value svClustering=self._parameters['svClustering'].value fatJets=self._parameters['fatJets'].value @@ -706,8 +793,8 @@ def toolCode(self, process): _newPatJets.jetChargeSource='' ## run btagging if required by user if (bTagging): - setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, loadStdRecoBTag, svClustering, fatJets, groomedFatJets, - _algo, rParam, btagDiscriminators, btagInfos, _newPatJets, _labelName, postfix) + setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, tightBTagNTkHits, loadStdRecoBTag, svClustering, fatJets, groomedFatJets, + _algo, rParam, btagDiscriminators, btagInfos, _newPatJets, _labelName, btagPrefix, postfix) else: _newPatJets.addBTagInfo = False _newPatJets.addTagInfos = False @@ -743,6 +830,7 @@ def __init__(self): ConfigToolBase.__init__(self) ## add all parameters that should be known to the class self.addParameter(self._defaultParameters,'postfix','', "postfix from usePF2PAT") + self.addParameter(self._defaultParameters,'btagPrefix','', "Prefix to be added to b-tag discriminator and TagInfo names", str) self.addParameter(self._defaultParameters,'jetSource','', "Label of the input collection from which the new patJet collection should be created", cms.InputTag) self.addParameter(self._defaultParameters,'pfCandidates',cms.InputTag('particleFlow'), "Label of the input collection for candidatecandidatese used in b-tagging", cms.InputTag) self.addParameter(self._defaultParameters,'explicitJTA', False, "Use explicit jet-track association") @@ -751,6 +839,7 @@ def __init__(self): self.addParameter(self._defaultParameters,'elSource',cms.InputTag('gedGsfElectrons'), "Label of the input collection for electrons used in b-tagging", cms.InputTag) self.addParameter(self._defaultParameters,'muSource',cms.InputTag('muons'), "Label of the input collection for muons used in b-tagging", cms.InputTag) self.addParameter(self._defaultParameters,'runIVF', False, "Re-run IVF secondary vertex reconstruction") + self.addParameter(self._defaultParameters,'tightBTagNTkHits', False, "Enable legacy tight b-tag track selection") self.addParameter(self._defaultParameters,'loadStdRecoBTag', False, "Load the standard reconstruction b-tagging modules") self.addParameter(self._defaultParameters,'svClustering', False, "Secondary vertices ghost-associated to jets using jet clustering (mostly intended for subjets)") self.addParameter(self._defaultParameters,'fatJets', cms.InputTag(''), "Fat jet collection used for secondary vertex clustering", cms.InputTag) @@ -783,7 +872,7 @@ def __init__(self): self._parameters=copy.deepcopy(self._defaultParameters) ## add comments self._comment = "This is a tool to add more patJet collectinos to your PAT Tuple. You can add and embed additional information like jet energy correction factors, btag \ - infomration and generatro match information to the new patJet collection depending on the parameters that you pass on to this function. Consult the descriptions of each \ + information and generator match information to the new patJet collection depending on the parameters that you pass on to this function. Consult the descriptions of each \ parameter for more information." def getDefaultParameters(self): @@ -792,7 +881,7 @@ def getDefaultParameters(self): """ return self._defaultParameters - def __call__(self,process,postfix=None,jetSource=None,pfCandidates=None,explicitJTA=None,pvSource=None,svSource=None,elSource=None,muSource=None,runIVF=None,loadStdRecoBTag=None,svClustering=None,fatJets=None,groomedFatJets=None,algo=None,rParam=None,getJetMCFlavour=None,genJetCollection=None,genParticles=None,jetCorrections=None,btagDiscriminators=None,btagInfos=None,jetTrackAssociation=None,outputModules=None): + def __call__(self,process,postfix=None,btagPrefix=None,jetSource=None,pfCandidates=None,explicitJTA=None,pvSource=None,svSource=None,elSource=None,muSource=None,runIVF=None,tightBTagNTkHits=None,loadStdRecoBTag=None,svClustering=None,fatJets=None,groomedFatJets=None,algo=None,rParam=None,getJetMCFlavour=None,genJetCollection=None,genParticles=None,jetCorrections=None,btagDiscriminators=None,btagInfos=None,jetTrackAssociation=None,outputModules=None): """ Function call wrapper. This will check the parameters and call the actual implementation that can be found in toolCode via the base class function apply. @@ -800,6 +889,9 @@ def __call__(self,process,postfix=None,jetSource=None,pfCandidates=None,explicit if postfix is None: postfix=self._defaultParameters['postfix'].value self.setParameter('postfix', postfix) + if btagPrefix is None: + btagPrefix=self._defaultParameters['btagPrefix'].value + self.setParameter('btagPrefix', btagPrefix) if jetSource is None: jetSource=self._defaultParameters['jetSource'].value self.setParameter('jetSource', jetSource) @@ -824,6 +916,9 @@ def __call__(self,process,postfix=None,jetSource=None,pfCandidates=None,explicit if runIVF is None: runIVF=self._defaultParameters['runIVF'].value self.setParameter('runIVF', runIVF) + if tightBTagNTkHits is None: + tightBTagNTkHits=self._defaultParameters['tightBTagNTkHits'].value + self.setParameter('tightBTagNTkHits', tightBTagNTkHits) if loadStdRecoBTag is None: loadStdRecoBTag=self._defaultParameters['loadStdRecoBTag'].value self.setParameter('loadStdRecoBTag', loadStdRecoBTag) @@ -874,6 +969,7 @@ def toolCode(self, process): """ ## initialize parameters postfix=self._parameters['postfix'].value + btagPrefix=self._parameters['btagPrefix'].value jetSource=self._parameters['jetSource'].value pfCandidates=self._parameters['pfCandidates'].value explicitJTA=self._parameters['explicitJTA'].value @@ -882,6 +978,7 @@ def toolCode(self, process): elSource=self._parameters['elSource'].value muSource=self._parameters['muSource'].value runIVF=self._parameters['runIVF'].value + tightBTagNTkHits=self._parameters['tightBTagNTkHits'].value loadStdRecoBTag=self._parameters['loadStdRecoBTag'].value svClustering=self._parameters['svClustering'].value fatJets=self._parameters['fatJets'].value @@ -902,6 +999,7 @@ def toolCode(self, process): process, labelName='', postfix=postfix, + btagPrefix=btagPrefix, jetSource=jetSource, pfCandidates=pfCandidates, explicitJTA=explicitJTA, @@ -910,6 +1008,7 @@ def toolCode(self, process): elSource=elSource, muSource=muSource, runIVF=runIVF, + tightBTagNTkHits=tightBTagNTkHits, loadStdRecoBTag=loadStdRecoBTag, svClustering=svClustering, fatJets=fatJets, @@ -945,6 +1044,7 @@ def __init__(self): ## add all parameters that should be known to the class self.addParameter(self._defaultParameters,'labelName', '', "Label name of the new patJet collection.", str) self.addParameter(self._defaultParameters,'postfix','', "Postfix from usePF2PAT.", str) + self.addParameter(self._defaultParameters,'btagPrefix','', "Prefix to be added to b-tag discriminator and TagInfo names", str) self.addParameter(self._defaultParameters,'jetSource','', "Label of the input collection from which the new patJet collection should be created", cms.InputTag) self.addParameter(self._defaultParameters,'pfCandidates',cms.InputTag('packedPFCandidates'), "Label of the input collection for candidatecandidatese used in b-tagging", cms.InputTag) self.addParameter(self._defaultParameters,'explicitJTA', False, "Use explicit jet-track association") @@ -953,6 +1053,7 @@ def __init__(self): self.addParameter(self._defaultParameters,'elSource',cms.InputTag('slimmedElectrons'), "Label of the input collection for electrons used in b-tagging", cms.InputTag) self.addParameter(self._defaultParameters,'muSource',cms.InputTag('slimmedMuons'), "Label of the input collection for muons used in b-tagging", cms.InputTag) self.addParameter(self._defaultParameters,'runIVF', False, "Re-run IVF secondary vertex reconstruction") + self.addParameter(self._defaultParameters,'tightBTagNTkHits', False, "Enable legacy tight b-tag track selection") self.addParameter(self._defaultParameters,'loadStdRecoBTag', False, "Load the standard reconstruction b-tagging modules") self.addParameter(self._defaultParameters,'svClustering', False, "Secondary vertices ghost-associated to jets using jet clustering (mostly intended for subjets)") self.addParameter(self._defaultParameters,'fatJets', cms.InputTag(''), "Fat jet collection used for secondary vertex clustering", cms.InputTag) @@ -982,7 +1083,7 @@ def __init__(self): self._parameters=copy.deepcopy(self._defaultParameters) ## add comments self._comment = "This is a tool to add more patJet collectinos to your PAT Tuple or to re-configure the default collection. You can add and embed additional information like jet\ - energy correction factors, btag infomration and generator match information to the new patJet collection depending on the parameters that you pass on to this function. Consult \ + energy correction factors, btag information and generator match information to the new patJet collection depending on the parameters that you pass on to this function. Consult \ the descriptions of each parameter for more information." def getDefaultParameters(self): @@ -991,7 +1092,7 @@ def getDefaultParameters(self): """ return self._defaultParameters - def __call__(self,process,labelName=None,postfix=None,jetSource=None,pfCandidates=None,explicitJTA=None,pvSource=None,svSource=None,elSource=None,muSource=None,runIVF=None,loadStdRecoBTag=None,svClustering=None,fatJets=None,groomedFatJets=None,algo=None,rParam=None,jetCorrections=None,btagDiscriminators=None,btagInfos=None): + def __call__(self,process,labelName=None,postfix=None,btagPrefix=None,jetSource=None,pfCandidates=None,explicitJTA=None,pvSource=None,svSource=None,elSource=None,muSource=None,runIVF=None,tightBTagNTkHits=None,loadStdRecoBTag=None,svClustering=None,fatJets=None,groomedFatJets=None,algo=None,rParam=None,jetCorrections=None,btagDiscriminators=None,btagInfos=None): """ Function call wrapper. This will check the parameters and call the actual implementation that can be found in toolCode via the base class function apply. @@ -1002,6 +1103,9 @@ def __call__(self,process,labelName=None,postfix=None,jetSource=None,pfCandidate if postfix is None: postfix=self._defaultParameters['postfix'].value self.setParameter('postfix', postfix) + if btagPrefix is None: + btagPrefix=self._defaultParameters['btagPrefix'].value + self.setParameter('btagPrefix', btagPrefix) if jetSource is None: jetSource=self._defaultParameters['jetSource'].value self.setParameter('jetSource', jetSource) @@ -1026,6 +1130,9 @@ def __call__(self,process,labelName=None,postfix=None,jetSource=None,pfCandidate if runIVF is None: runIVF=self._defaultParameters['runIVF'].value self.setParameter('runIVF', runIVF) + if tightBTagNTkHits is None: + tightBTagNTkHits=self._defaultParameters['tightBTagNTkHits'].value + self.setParameter('tightBTagNTkHits', tightBTagNTkHits) if loadStdRecoBTag is None: loadStdRecoBTag=self._defaultParameters['loadStdRecoBTag'].value self.setParameter('loadStdRecoBTag', loadStdRecoBTag) @@ -1062,6 +1169,7 @@ def toolCode(self, process): ## initialize parameters labelName=self._parameters['labelName'].value postfix=self._parameters['postfix'].value + btagPrefix=self._parameters['btagPrefix'].value jetSource=self._parameters['jetSource'].value pfCandidates=self._parameters['pfCandidates'].value explicitJTA=self._parameters['explicitJTA'].value @@ -1070,6 +1178,7 @@ def toolCode(self, process): elSource=self._parameters['elSource'].value muSource=self._parameters['muSource'].value runIVF=self._parameters['runIVF'].value + tightBTagNTkHits=self._parameters['tightBTagNTkHits'].value loadStdRecoBTag=self._parameters['loadStdRecoBTag'].value svClustering=self._parameters['svClustering'].value fatJets=self._parameters['fatJets'].value @@ -1140,6 +1249,7 @@ def toolCode(self, process): elSource=elSource, muSource=muSource, runIVF=runIVF, + tightBTagNTkHits=tightBTagNTkHits, loadStdRecoBTag=loadStdRecoBTag, svClustering=svClustering, fatJets=fatJets, @@ -1147,12 +1257,13 @@ def toolCode(self, process): algo=algo, rParam=rParam, jetCorrections = jetCorrections, + btagPrefix = btagPrefix, postfix = postfix ) ## setup btagging _patJets=getattr(process, 'updatedPatJetsTransientCorrected'+_labelName+postfix) - setupBTagging(process, _jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, loadStdRecoBTag, svClustering, fatJets, groomedFatJets, - _algo, rParam, btagDiscriminators, btagInfos, _patJets, _labelName, postfix) + setupBTagging(process, _jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, tightBTagNTkHits, loadStdRecoBTag, svClustering, fatJets, groomedFatJets, + _algo, rParam, btagDiscriminators, btagInfos, _patJets, _labelName, btagPrefix, postfix) ## update final selected jets _newSelectedPatJets=getattr(process, 'selectedUpdatedPatJets'+_labelName+postfix) _newSelectedPatJets.src='updatedPatJetsTransientCorrected'+_labelName+postfix @@ -1309,7 +1420,15 @@ def unsupportedJetAlgorithm(obj): def rerunningIVF(): print "-------------------------------------------------------------------" print " Warning: You are attempting to remake the IVF secondary vertices" - print " already produced by the standard reconstruction. If that" - print " was your intention, note that they should be remade only" - print " from RECO and AOD, i.e., MiniAOD should not be used." + print " already produced by the standard reconstruction. This" + print " option is not enabled by default so please use it only if" + print " you know what you are doing." + print "-------------------------------------------------------------------" + +def rerunningIVFMiniAOD(): + print "-------------------------------------------------------------------" + print " Warning: You are attempting to remake IVF secondary vertices from" + print " MiniAOD. If that was your intention, note that secondary" + print " vertices remade from MiniAOD will have somewhat degraded" + print " performance compared to those remade from RECO/AOD." print "-------------------------------------------------------------------" diff --git a/PhysicsTools/RecoAlgos/python/btvTracks_cfi.py b/PhysicsTools/RecoAlgos/python/btvTracks_cfi.py index d41ce2dcfb337..b2bb51c14cca0 100644 --- a/PhysicsTools/RecoAlgos/python/btvTracks_cfi.py +++ b/PhysicsTools/RecoAlgos/python/btvTracks_cfi.py @@ -11,8 +11,8 @@ maxRapidity = 9.0, quality = [], minLayer = 0, - minHit = 8, - minPixelHit = 2, + minHit = 0, + minPixelHit = 1, usePV = True, ) diff --git a/RecoBTag/ImpactParameter/python/pfImpactParameterTagInfos_cfi.py b/RecoBTag/ImpactParameter/python/pfImpactParameterTagInfos_cfi.py index f1f27ff6b7e02..4dcb10eec2367 100644 --- a/RecoBTag/ImpactParameter/python/pfImpactParameterTagInfos_cfi.py +++ b/RecoBTag/ImpactParameter/python/pfImpactParameterTagInfos_cfi.py @@ -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), diff --git a/RecoBTag/SecondaryVertex/python/secondaryVertexTagInfos_cfi.py b/RecoBTag/SecondaryVertex/python/secondaryVertexTagInfos_cfi.py index d1c079be84731..8e89a7ebe31c8 100644 --- a/RecoBTag/SecondaryVertex/python/secondaryVertexTagInfos_cfi.py +++ b/RecoBTag/SecondaryVertex/python/secondaryVertexTagInfos_cfi.py @@ -21,3 +21,6 @@ extSVDeltaRToJet = cms.double(0.3) ) + +secondaryVertexTagInfos.trackSelection.pixelHitsMin = cms.uint32(2) +secondaryVertexTagInfos.trackSelection.totalHitsMin = cms.uint32(8) diff --git a/RecoBTag/SecondaryVertex/python/vertexTrackSelection_cff.py b/RecoBTag/SecondaryVertex/python/vertexTrackSelection_cff.py index deb146fcbec05..108f92a22b061 100644 --- a/RecoBTag/SecondaryVertex/python/vertexTrackSelection_cff.py +++ b/RecoBTag/SecondaryVertex/python/vertexTrackSelection_cff.py @@ -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), diff --git a/RecoVertex/AdaptiveVertexFinder/python/inclusiveCandidateVertexFinder_cfi.py b/RecoVertex/AdaptiveVertexFinder/python/inclusiveCandidateVertexFinder_cfi.py index 4359fb2289d84..827098df681dc 100644 --- a/RecoVertex/AdaptiveVertexFinder/python/inclusiveCandidateVertexFinder_cfi.py +++ b/RecoVertex/AdaptiveVertexFinder/python/inclusiveCandidateVertexFinder_cfi.py @@ -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),