diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 9e4880dbb837e..68d1005e92a53 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -63,7 +63,7 @@ discNames = cms.vstring( "pfCombinedInclusiveSecondaryVertexV2BJetTags", "pfDeepCSVJetTags:probb+pfDeepCSVJetTags:probbb", #if multiple MiniAOD branches need to be summed up (e.g., DeepCSV b+bb), separate them using '+' delimiter - "pfCombinedMVAV2BJetTags" + "pfCombinedMVAV2BJetTags" ), discShortNames = cms.vstring( "CSVV2", @@ -72,7 +72,7 @@ ), weightFiles = cms.vstring( #default settings are for 2017 94X. toModify function is called later for other eras. btagSFdir+"CSVv2_94XSF_V2_B_F.csv", - btagSFdir+"DeepCSV_94XSF_V2_B_F.csv", + btagSFdir+"DeepCSV_94XSF_V2_B_F.csv", "unavailable" #if SFs for an algorithm in an era is unavailable, the corresponding branch will not be stored ), operatingPoints = cms.vstring("3","3","3"), #loose = 0, medium = 1, tight = 2, reshaping = 3 @@ -83,22 +83,22 @@ ) for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016: # to be updated when SF for Summer16MiniAODv3 MC will be available - modifier.toModify(btagWeightTable, + modifier.toModify(btagWeightTable, cut = cms.string("pt > 25. && abs(eta) < 2.4"), #80X corresponds to 2016, |eta| < 2.4 weightFiles = cms.vstring( #80X corresponds to 2016 SFs - btagSFdir+"CSVv2_Moriond17_B_H.csv", - "unavailable", - btagSFdir+"cMVAv2_Moriond17_B_H.csv" + btagSFdir+"CSVv2_Moriond17_B_H.csv", + "unavailable", + btagSFdir+"cMVAv2_Moriond17_B_H.csv" ) ) run2_nanoAOD_92X.toModify(btagWeightTable, #92X corresponds to MCv1, for which SFs are unavailable weightFiles = cms.vstring( "unavailable", - "unavailable", - "unavailable" + "unavailable", + "unavailable" ) -) +) genWeightsTable = cms.EDProducer("GenWeightsTableProducer", genEvent = cms.InputTag("generator"), @@ -114,20 +114,20 @@ namedWeightIDs = cms.vstring(), namedWeightLabels = cms.vstring(), lheWeightPrecision = cms.int32(14), - maxPdfWeights = cms.uint32(150), + maxPdfWeights = cms.uint32(150), debug = cms.untracked.bool(False), ) lheInfoTable = cms.EDProducer("LHETablesProducer", lheInfo = cms.InputTag("externalLHEProducer"), precision = cms.int32(14), - storeLHEParticles = cms.bool(True) + storeLHEParticles = cms.bool(True) ) l1bits=cms.EDProducer("L1TriggerResultsConverter", src=cms.InputTag("gtStage2Digis"), legacyL1=cms.bool(False)) nanoSequenceCommon = cms.Sequence( nanoMetadata + jetSequence + muonSequence + tauSequence + electronSequence+photonSequence+vertexSequence+ - isoTrackSequence + # must be after all the leptons + isoTrackSequence + # must be after all the leptons linkedObjects + jetTables + muonTables + tauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + isoTrackTables ) @@ -145,6 +145,17 @@ modifier.toModify(extraFlagsTable, variables= cms.PSet()) modifier.toModify(extraFlagsTable, variables = dict(Flag_ecalBadCalibFilterV2 = ExtVar(cms.InputTag("ecalBadCalibFilterNanoTagger"), bool, doc = "Bad ECAL calib flag (updated xtal list)"))) +# Add new tau IDs using runTauIdMVA tool +import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig +def nanoAOD_addTauIds(process): + updatedTauName = "slimmedTausUpdated" + tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, cms, debug = False, updatedTauName = updatedTauName, + toKeep = [ "2017v2", "newDM2017v2", "dR0p32017v2", "deepTau2017v2", "againstEle2018" ]) + tauIdEmbedder.runTauID() + process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(tauSequence), + cms.Sequence(process.rerunMvaIsolationSequence + getattr(process, updatedTauName))) + return process + from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection def nanoAOD_addDeepInfo(process,addDeepBTag,addDeepFlavour): _btagDiscriminators=[] @@ -268,6 +279,8 @@ def nanoAOD_customizeCommon(process): addDeepBTag=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBTag_switch, addDeepBoostedJet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBoostedJet_switch, jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload) + + process = nanoAOD_addTauIds(process) return process def nanoAOD_customizeData(process): @@ -286,7 +299,7 @@ def nanoAOD_customizeMC(process): ### Era dependent customization _80x_sequence = nanoSequenceCommon.copy() -#remove stuff +#remove stuff _80x_sequence.remove(isoTrackTables) _80x_sequence.remove(isoTrackSequence) #add stuff diff --git a/PhysicsTools/NanoAOD/python/taus_cff.py b/PhysicsTools/NanoAOD/python/taus_cff.py index 59b5bc9e09ff1..2db39f781df10 100644 --- a/PhysicsTools/NanoAOD/python/taus_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_cff.py @@ -1,43 +1,38 @@ import FWCore.ParameterSet.Config as cms from PhysicsTools.NanoAOD.common_cff import * from PhysicsTools.JetMCAlgos.TauGenJets_cfi import tauGenJets -from PhysicsTools.JetMCAlgos.TauGenJetsDecayModeSelectorAllHadrons_cfi import tauGenJetsSelectorAllHadrons - -##################### Updated tau collection with MVA-based tau-Ids rerun ####### -# Used only in some eras -from PhysicsTools.NanoAOD.taus_updatedMVAIds_cff import * +from PhysicsTools.JetMCAlgos.TauGenJetsDecayModeSelectorAllHadrons_cfi import tauGenJetsSelectorAllHadrons ##################### User floats producers, selectors ########################## - finalTaus = cms.EDFilter("PATTauRefSelector", src = cms.InputTag("slimmedTausUpdated"), - cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT2015') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2'))") + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (" + "tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || " + "tauID('byVVLooseIsolationMVArun2017v2DBoldDMwLT2017') || " + "tauID('byVVLooseIsolationMVArun2017v2DBnewDMwLT2017') || " + "tauID('byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017') || " + "tauID('byVVVLooseDeepTau2017v2VSjet'))") ) -for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: - era.toModify(finalTaus, - cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v1') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2'))") - ) -eras.run2_miniAOD_80XLegacy.toModify(finalTaus, - src = cms.InputTag("slimmedTaus"), - cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT'))") - ) - ##################### Tables for final output and docs ########################## def _tauIdWPMask(pattern, choices, doc=""): - return Var(" + ".join(["%d * tauID('%s')" % (pow(2,i), pattern % c) for (i,c) in enumerate(choices)]), "uint8", + return Var(" + ".join(["%d * tauID('%s')" % (pow(2,i), pattern % c) for (i,c) in enumerate(choices)]), "uint8", doc=doc+": bitmask "+", ".join(["%d = %s" % (pow(2,i),c) for (i,c) in enumerate(choices)])) def _tauId2WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("Loose","Tight"),doc=doc) + return _tauIdWPMask(pattern, choices=("Loose", "Tight"), doc=doc) def _tauId3WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("Loose","Medium","Tight"),doc=doc) + return _tauIdWPMask(pattern, choices=("Loose", "Medium", "Tight"), doc=doc) +def _tauId4WPMask(pattern,doc): + return _tauIdWPMask(pattern, choices=("VLoose", "Loose", "Medium", "Tight"), doc=doc) def _tauId5WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("VLoose","Loose","Medium","Tight","VTight"),doc=doc) + return _tauIdWPMask(pattern, choices=("VLoose", "Loose", "Medium", "Tight", "VTight"), doc=doc) def _tauId6WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) + return _tauIdWPMask(pattern, choices=("VLoose", "Loose", "Medium", "Tight", "VTight", "VVTight"), doc=doc) def _tauId7WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) + return _tauIdWPMask(pattern,choices=("VVLoose", "VLoose", "Loose", "Medium", "Tight", "VTight", "VVTight"), doc=doc) +def _tauId8WPMask(pattern,doc): + return _tauIdWPMask(pattern, choices=("VVVLoose", "VVLoose", "VLoose", "Loose", "Medium", "Tight", "VTight", "VVTight"), doc=doc) tauTable = cms.EDProducer("SimpleCandidateFlatTableProducer", src = cms.InputTag("linkedObjects","taus"), @@ -49,93 +44,97 @@ def _tauId7WPMask(pattern,doc): variables = cms.PSet() # PSet defined below in era dependent way ) _tauVarsBase = cms.PSet(P4Vars, - charge = Var("charge", int, doc="electric charge"), - jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"), + charge = Var("charge", int, doc="electric charge"), + jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, + doc="index of the associated jet (-1 if none)"), decayMode = Var("decayMode()",int), idDecayMode = Var("tauID('decayModeFinding')", bool), idDecayModeNewDMs = Var("tauID('decayModeFindingNewDMs')", bool), - leadTkPtOverTauPt = Var("leadChargedHadrCand.pt/pt ",float, doc="pt of the leading track divided by tau pt",precision=10), - leadTkDeltaEta = Var("leadChargedHadrCand.eta - eta ",float, doc="eta of the leading track, minus tau eta",precision=8), - leadTkDeltaPhi = Var("deltaPhi(leadChargedHadrCand.phi, phi) ",float, doc="phi of the leading track, minus tau phi",precision=8), + leadTkPtOverTauPt = Var("leadChargedHadrCand.pt/pt ", float, + doc="pt of the leading track divided by tau pt", precision=10), + leadTkDeltaEta = Var("leadChargedHadrCand.eta - eta ",float, + doc="eta of the leading track, minus tau eta", precision=8), + leadTkDeltaPhi = Var("deltaPhi(leadChargedHadrCand.phi, phi) ", float, + doc="phi of the leading track, minus tau phi", precision=8), - dxy = Var("leadChargedHadrCand().dxy()",float, doc="d_{xy} of lead track with respect to PV, in cm (with sign)",precision=10), - dz = Var("leadChargedHadrCand().dz()",float, doc="d_{z} of lead track with respect to PV, in cm (with sign)",precision=14), + dxy = Var("leadChargedHadrCand().dxy()", float, + doc="d_{xy} of lead track with respect to PV, in cm (with sign)", precision=10), + dz = Var("leadChargedHadrCand().dz()", float, + doc="d_{z} of lead track with respect to PV, in cm (with sign)", precision=14), # these are too many, we may have to suppress some - rawIso = Var( "tauID('byCombinedIsolationDeltaBetaCorrRaw3Hits')", float, doc = "combined isolation (deltaBeta corrections)", precision=10), - rawIsodR03 = Var( "(tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum')))", float, doc = "combined isolation (deltaBeta corrections, dR=0.3)", precision=10), - chargedIso = Var( "tauID('chargedIsoPtSum')", float, doc = "charged isolation", precision=10), - neutralIso = Var( "tauID('neutralIsoPtSum')", float, doc = "neutral (photon) isolation", precision=10), - puCorr = Var( "tauID('puCorrPtSum')", float, doc = "pileup correction", precision=10), - photonsOutsideSignalCone = Var( "tauID('photonPtSumOutsideSignalCone')", float, doc = "sum of photons outside signal cone", precision=10), - - rawAntiEle = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator", precision=10), - rawAntiEleCat = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category"), - - idAntiMu = _tauId2WPMask("againstMuon%s3", doc= "Anti-muon discriminator V3: "), - idAntiEle = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6"), - -# isoCI3hit = Var( "tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits")" doc="byCombinedIsolationDeltaBetaCorrRaw3Hits raw output discriminator"), -# photonOutsideSigCone = Var( "tauID("photonPtSumOutsideSignalCone")" doc="photonPtSumOutsideSignalCone raw output discriminator"), - + rawIso = Var("tauID('byCombinedIsolationDeltaBetaCorrRaw3Hits')", float, + doc="combined isolation (deltaBeta corrections)", precision=10), + rawIsodR03 = Var("(tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum')))", float, + doc="combined isolation (deltaBeta corrections, dR=0.3)", precision=10), + chargedIso = Var("tauID('chargedIsoPtSum')", float, doc="charged isolation", precision=10), + neutralIso = Var("tauID('neutralIsoPtSum')", float, doc="neutral (photon) isolation", precision=10), + puCorr = Var("tauID('puCorrPtSum')", float, doc="pileup correction", precision=10), + photonsOutsideSignalCone = Var("tauID('photonPtSumOutsideSignalCone')", float, + doc="sum of photons outside signal cone", precision=10), + + rawAntiEle = Var("tauID('againstElectronMVA6Raw')", float, + doc="Anti-electron MVA discriminator V6 raw output discriminator", precision=10), + rawAntiEleCat = Var("tauID('againstElectronMVA6category')", int, + doc="Anti-electron MVA discriminator V6 category"), + + rawAntiEle2018 = Var("tauID('againstElectronMVA6Raw2018')", float, + doc="Anti-electron MVA discriminator V6 2018 raw output discriminator", precision=10), + rawAntiEleCat2018 = Var("tauID('againstElectronMVA6category2018')", int, + doc="Anti-electron MVA discriminator V6 2018 category"), + + idAntiMu = _tauId2WPMask("againstMuon%s3", doc="Anti-muon discriminator V3"), + idAntiEle = _tauId5WPMask("againstElectron%sMVA6", doc="Anti-electron MVA discriminator V6"), + idAntiEle2018 = _tauId5WPMask("againstElectron%sMVA62018", doc="Anti-electron MVA discriminator V6 2018"), ) -_mvaIsoVars2015 = cms.PSet( - rawMVAnewDM = Var( "tauID('byIsolationMVArun2v1DBnewDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), - rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), - rawMVAoldDMdR03 = Var( "tauID('byIsolationMVArun2v1DBdR03oldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), - idMVAnewDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBnewDMwLT", doc="IsolationMVArun2v1DBnewDMwLT ID working point (2015)"), - idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)"), - idMVAoldDMdR03 = _tauId6WPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT", doc="IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2015)") -) -_mvaIsoVars2015Reduced = cms.PSet( - rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw2015')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), - idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2015", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)"), -) -_mvaIsoVars2017v1 = cms.PSet( - rawMVAoldDM2017v1 = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)",precision=10), - idMVAoldDM2017v1 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v1)") -) _mvaIsoVars2017v2 = cms.PSet( - rawMVAnewDM2017v2 = Var( "tauID('byIsolationMVArun2v1DBnewDMwLTraw2017v2')",float, doc="byIsolationMVArun2v1DBnewDMwLT raw output discriminator (2017v2)",precision=10), - rawMVAoldDM2017v2 = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw2017v2')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)",precision=10), - rawMVAoldDMdR032017v2 = Var( "tauID('byIsolationMVArun2v1DBdR03oldDMwLTraw2017v2')",float, doc="byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)",precision=10), - idMVAnewDM2017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBnewDMwLT2017v2", doc="IsolationMVArun2v1DBnewDMwLT ID working point (2017v2)"), - idMVAoldDM2017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v2)"), - idMVAoldDMdR032017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2017v2)") + rawMVAoldDM2017v2 = Var("tauID('byIsolationMVArun2017v2DBoldDMwLTraw2017')", float, + doc="byIsolationMVArun2017v2DBoldDMwLT2017 raw output discriminator (2017v2)", + precision=10), + rawMVAnewDM2017v2 = Var("tauID('byIsolationMVArun2017v2DBnewDMwLTraw2017')", float, + doc="byIsolationMVArun2017v2DBnewDMwLT2017 raw output discriminator (newDM2017v2)", + precision=10), + rawMVAoldDMdR032017v2 = Var("tauID('byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017')", float, + doc="byIsolationMVArun2017v2DBoldDMdR0p3wLT2017 raw output discriminator (dR0p32017v2)", + precision=10), + + idMVAoldDM2017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBoldDMwLT2017", + doc="byIsolationMVArun2017v2DBoldDMwLT2017 ID working points (2017v2)"), + idMVAnewDM2017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBnewDMwLT2017", + doc="byIsolationMVArun2017v2DBnewDMwLT2017 ID working points (newDM2017v2)"), + idMVAoldDMdR032017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBoldDMdR0p3wLT2017", + doc="byIsolationMVArun2017v2DBoldDMdR0p3wLT2017 ID working points (dR0p32017v2)"), ) -_variablesMiniV2 = cms.PSet( - _tauVarsBase, - _mvaIsoVars2015Reduced, - _mvaIsoVars2017v1, - _mvaIsoVars2017v2 +_deepTauVars2017v2 = cms.PSet( + rawDeepTau2017v2VSe = Var("tauID('byDeepTau2017v2VSeraw')", float, + doc="byDeepTau2017v2VSe raw output discriminator (deepTau2017v2)", precision=10), + rawDeepTau2017v2VSmu = Var("tauID('byDeepTau2017v2VSmuraw')", float, + doc="byDeepTau2017v2VSmu raw output discriminator (deepTau2017v2)", precision=10), + rawDeepTau2017v2VSjet = Var("tauID('byDeepTau2017v2VSjetraw')", float, + doc="byDeepTau2017v2VSjet raw output discriminator (deepTau2017v2)", precision=10), + + idDeepTau2017v2VSe = _tauId8WPMask("by%sDeepTau2017v2VSe", + doc="byDeepTau2017v2VSe ID working points (deepTau2017v2)"), + idDeepTau2017v2VSmu = _tauId4WPMask("by%sDeepTau2017v2VSmu", + doc="byDeepTau2017v2VSmu ID working points (deepTau2017v2)"), + idDeepTau2017v2VSjet = _tauId8WPMask("by%sDeepTau2017v2VSjet", + doc="byDeepTau2017v2VSjet ID working points (deepTau2017v2)"), ) -_variablesMiniV1 = _variablesMiniV2.clone() -_variablesMiniV1.rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10) -_variablesMiniV1.rawMVAoldDM2017v1 = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw2017v1')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)",precision=10) -_variablesMiniV1.idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)") -_variablesMiniV1.idMVAoldDM2017v1 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v1", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v1)") -_variables80X = cms.PSet( + +tauTable.variables = cms.PSet( _tauVarsBase, - _mvaIsoVars2015 + _mvaIsoVars2017v2, + _deepTauVars2017v2, ) -tauTable.variables=_variablesMiniV2 - -for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: - era.toModify(tauTable, - variables = _variablesMiniV1 - ) -eras.run2_miniAOD_80XLegacy.toModify(tauTable, - variables = _variables80X -) tauGenJets.GenParticles = cms.InputTag("prunedGenParticles") tauGenJets.includeNeutrinos = cms.bool(False) genVisTaus = cms.EDProducer("GenVisTauProducer", - src = cms.InputTag("tauGenJetsSelectorAllHadrons"), + src = cms.InputTag("tauGenJetsSelectorAllHadrons"), srcGenParticles = cms.InputTag("prunedGenParticles") ) @@ -150,7 +149,7 @@ def _tauId7WPMask(pattern,doc): pt = Var("pt", float,precision=8), phi = Var("phi", float,precision=8), eta = Var("eta", float,precision=8), - mass = Var("mass", float,precision=8), + mass = Var("mass", float,precision=8), charge = Var("charge", int), status = Var("status", int, doc="Hadronic tau decay mode. 0=OneProng0PiZero, 1=OneProng1PiZero, 2=OneProng2PiZero, 10=ThreeProng0PiZero, 11=ThreeProng1PiZero, 15=Other"), genPartIdxMother = Var("?numberOfMothers>0?motherRef(0).key():-1", int, doc="index of the mother particle"), @@ -184,7 +183,7 @@ def _tauId7WPMask(pattern,doc): tauMCTable = cms.EDProducer("CandMCMatchTableProducer", src = tauTable.src, mcMap = cms.InputTag("tausMCMatchLepTauForTable"), - mcMapVisTau = cms.InputTag("tausMCMatchHadTauForTable"), + mcMapVisTau = cms.InputTag("tausMCMatchHadTauForTable"), objName = tauTable.name, objType = tauTable.name, #cms.string("Tau"), branchName = cms.string("genPart"), @@ -192,9 +191,7 @@ def _tauId7WPMask(pattern,doc): ) -tauSequence = cms.Sequence(patTauMVAIDsSeq + finalTaus) +tauSequence = cms.Sequence(finalTaus) _tauSequence80X = cms.Sequence(finalTaus) -eras.run2_miniAOD_80XLegacy.toReplaceWith(tauSequence,_tauSequence80X) tauTables = cms.Sequence(tauTable) tauMC = cms.Sequence(tauGenJets + tauGenJetsSelectorAllHadrons + genVisTaus + genVisTauTable + tausMCMatchLepTauForTable + tausMCMatchHadTauForTable + tauMCTable) - diff --git a/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py b/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py deleted file mode 100644 index 11b054c40ef72..0000000000000 --- a/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py +++ /dev/null @@ -1,382 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -##################### Updated tau collection with MVA-based tau-Ids rerun ####### -# Used only in some eras -from Configuration.StandardSequences.Eras import eras -from RecoTauTag.Configuration.loadRecoTauTagMVAsFromPrepDB_cfi import * -from RecoTauTag.RecoTau.PATTauDiscriminationByMVAIsolationRun2_cff import * - -### MVAIso 2017v2 -## DBoldDM -# Raw -patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw = patDiscriminationByIsolationMVArun2v1raw.clone( - PATTauProducer = cms.InputTag('slimmedTaus'), - Prediscriminants = noPrediscriminants, - loadMVAfromDB = cms.bool(True), - mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"), # name of the training you want to use - mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) - requireDecayMode = cms.bool(True), - verbosity = cms.int32(0) -) -# VVLoose WP -patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT = patDiscriminationByIsolationMVArun2v1VLoose.clone( - PATTauProducer = cms.InputTag('slimmedTaus'), - Prediscriminants = noPrediscriminants, - toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw'), - key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw','category'), - loadMVAfromDB = cms.bool(True), - mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_mvaOutput_normalization"), # normalization fo the training you want to use - mapping = cms.VPSet( - cms.PSet( - category = cms.uint32(0), - cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff95"), # this is the name of the working point you want to use - variable = cms.string("pt"), - ) - ) -) -# VLoose WP -patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() -patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff90") -# Loose WP -patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() -patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff80") -# Medium WP -patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() -patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff70") -# Tight WP -patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() -patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff60") -# VTight WP -patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() -patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff50") -# VVTights WP -patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() -patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff40") -# MVAIso DBoldDM Seqeunce -patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTSeq = cms.Sequence( - patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw - + patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT - + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT - + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT - + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT - + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT - + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT - + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT -) -## DBnewDM -# Raw -patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw = patDiscriminationByIsolationMVArun2v1raw.clone( - PATTauProducer = cms.InputTag('slimmedTaus'), - Prediscriminants = noPrediscriminants, - loadMVAfromDB = cms.bool(True), - mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"), # name of the training you want to use - mvaOpt = cms.string("DBnewDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) - requireDecayMode = cms.bool(True), - verbosity = cms.int32(0) -) -# VVLoose WP -patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT = patDiscriminationByIsolationMVArun2v1VLoose.clone( - PATTauProducer = cms.InputTag('slimmedTaus'), - Prediscriminants = noPrediscriminants, - toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw'), - key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw','category'), - loadMVAfromDB = cms.bool(True), - mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"), # normalization fo the training you want to use - mapping = cms.VPSet( - cms.PSet( - category = cms.uint32(0), - cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff95"), # this is the name of the working point you want to use - variable = cms.string("pt"), - ) - ) -) -# VLoose WP -patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() -patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff90") -# Loose WP -patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() -patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff80") -# Medium WP -patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() -patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff70") -# Tight WP -patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() -patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff60") -# VTight WP -patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() -patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff50") -# VVTights WP -patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() -patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff40") -# MVAIso DBnewDM Seqeunce -patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTSeq = cms.Sequence( - patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw - + patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT - + patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT - + patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT - + patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT - + patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT - + patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT - + patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT -) -## DBoldDMdR0p3 -# Raw -patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw = patDiscriminationByIsolationMVArun2v1raw.clone( - PATTauProducer = cms.InputTag('slimmedTaus'), - Prediscriminants = noPrediscriminants, - loadMVAfromDB = cms.bool(True), - mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"), # name of the training you want to use - mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) - requireDecayMode = cms.bool(True), - srcChargedIsoPtSum = cms.string('chargedIsoPtSumdR03'), - srcFootprintCorrection = cms.string('footprintCorrectiondR03'), - srcNeutralIsoPtSum = cms.string('neutralIsoPtSumdR03'), - srcPUcorrPtSum = cms.string('puCorrPtSum'), - srcPhotonPtSumOutsideSignalCone = cms.string('photonPtSumOutsideSignalConedR03'), - verbosity = cms.int32(0) -) -# VVLoose WP -patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT = patDiscriminationByIsolationMVArun2v1VLoose.clone( - PATTauProducer = cms.InputTag('slimmedTaus'), - Prediscriminants = noPrediscriminants, - toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw'), - key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw','category'), - loadMVAfromDB = cms.bool(True), - mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"), # normalization fo the training you want to use - mapping = cms.VPSet( - cms.PSet( - category = cms.uint32(0), - cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff95"), # this is the name of the working point you want to use - variable = cms.string("pt"), - ) - ) -) -# VLoose WP -patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() -patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff90") -# Loose WP -patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() -patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff80") -# Medium WP -patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() -patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff70") -# Tight WP -patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() -patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff60") -# VTight WP -patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() -patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff50") -# VVTights WP -patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() -patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff40") -# MVAIso DBoldDMdR0p3 Seqeunce -patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTSeq = cms.Sequence( - patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw - + patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT - + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT - + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT - + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT - + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT - + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT - + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT -) -### MVAIso 2017v1 for Nano on top of MiniAODv1 -## DBoldDM -# Raw -patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1 = patDiscriminationByIsolationMVArun2v1raw.clone( - PATTauProducer = cms.InputTag('slimmedTaus'), - Prediscriminants = noPrediscriminants, - loadMVAfromDB = cms.bool(True), - mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"), # name of the training you want to use - mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) - requireDecayMode = cms.bool(True), - verbosity = cms.int32(0) -) -# VVLoose WP -patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = patDiscriminationByIsolationMVArun2v1VLoose.clone( - PATTauProducer = cms.InputTag('slimmedTaus'), - Prediscriminants = noPrediscriminants, - toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1'), - key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1','category'), - loadMVAfromDB = cms.bool(True), - mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"), # normalization fo the training you want to use - mapping = cms.VPSet( - cms.PSet( - category = cms.uint32(0), - cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff95"), # this is the name of the working point you want to use - variable = cms.string("pt"), - ) - ) -) -# VLoose WP -patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() -patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff90") -# Loose WP -patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() -patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff80") -# Medium WP -patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() -patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff70") -# Tight WP -patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() -patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff60") -# VTight WP -patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() -patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff50") -# VVTights WP -patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() -patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff40") -# MVAIso DBoldDM Seqeunce -patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1Seq = cms.Sequence( - patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1 - + patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1 - + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1 - + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1 - + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1 - + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1 - + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1 - + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1 -) -### MVAIso 2015 for Nano on top of MiniAODv2 -## DBoldDM -# Raw -patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015 = patDiscriminationByIsolationMVArun2v1raw.clone( - PATTauProducer = cms.InputTag('slimmedTaus'), - Prediscriminants = noPrediscriminants, - loadMVAfromDB = cms.bool(True), - mvaName = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1"), # name of the training you want to use - mvaOpt = cms.string("DBoldDMwLT"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) - requireDecayMode = cms.bool(True), - verbosity = cms.int32(0) -) -# VLoose WP -patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015 = patDiscriminationByIsolationMVArun2v1VLoose.clone( - PATTauProducer = cms.InputTag('slimmedTaus'), - Prediscriminants = noPrediscriminants, - toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015'), - key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015','category'), - loadMVAfromDB = cms.bool(True), - mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_mvaOutput_normalization"), # normalization fo the training you want to use - mapping = cms.VPSet( - cms.PSet( - category = cms.uint32(0), - cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff90"), # this is the name of the working point you want to use - variable = cms.string("pt"), - ) - ) -) -# Loose WP -patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() -patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff80") -# Medium WP -patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() -patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff70") -# Tight WP -patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() -patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff60") -# VTight WP -patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() -patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff50") -# VVTights WP -patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() -patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff40") -# MVAIso DBoldDM Seqeunce -patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015Seq = cms.Sequence( - patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015 - + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015 - + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015 - + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015 - + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015 - + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015 - + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015 -) - - -### FIXME: add other tau-Ids when ready - -### put all new MVA tau-Id stuff to one Sequence -_patTauMVAIDsSeq2017v2 = cms.Sequence( - patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTSeq - +patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTSeq - +patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTSeq -) -patTauMVAIDsSeq = _patTauMVAIDsSeq2017v2.copy() -patTauMVAIDsSeq += patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015Seq - -_patTauMVAIDsSeqWith2017v1 = _patTauMVAIDsSeq2017v2.copy() -_patTauMVAIDsSeqWith2017v1 += patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1Seq -for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: - era.toReplaceWith(patTauMVAIDsSeq,_patTauMVAIDsSeqWith2017v1) - -# embed new MVA tau-Ids into new tau collection -slimmedTausUpdated = cms.EDProducer("PATTauIDEmbedder", - src = cms.InputTag('slimmedTaus'), - tauIDSources = cms.PSet() # PSet defined below in era dependent way -) -_tauIDSources2017v2 = cms.PSet( - #oldDM - byIsolationMVArun2v1DBoldDMwLTraw2017v2 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw'), - byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT'), - byVLooseIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT'), - byLooseIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT'), - byMediumIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT'), - byTightIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT'), - byVTightIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT'), - byVVTightIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT'), - #newDM - byIsolationMVArun2v1DBnewDMwLTraw2017v2 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw'), - byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT'), - byVLooseIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT'), - byLooseIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT'), - byMediumIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT'), - byTightIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT'), - byVTightIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT'), - byVVTightIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT'), - #oldDMdR0p3 - byIsolationMVArun2v1DBdR03oldDMwLTraw2017v2 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw'), - byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT'), - byVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT'), - byLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT'), - byMediumIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT'), - byTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT'), - byVTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT'), - byVVTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT'), -) -_tauIDSources2017v1 = cms.PSet( - byIsolationMVArun2v1DBoldDMwLTraw2017v1 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1'), - byVVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1'), - byVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1'), - byLooseIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1'), - byMediumIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1'), - byTightIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1'), - byVTightIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1'), - byVVTightIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1') -) -_tauIDSourcesWith2017v1 = cms.PSet( - _tauIDSources2017v2.clone(), - _tauIDSources2017v1 -) -_tauIDSources2015 = cms.PSet( - byIsolationMVArun2v1DBoldDMwLTraw2015 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015'), - byVLooseIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015'), - byLooseIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015'), - byMediumIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015'), - byTightIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015'), - byVTightIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015'), - byVVTightIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015') -) -_tauIDSourcesWith2015 = cms.PSet( - _tauIDSources2017v2.clone(), - _tauIDSources2015 -) -slimmedTausUpdated.tauIDSources=_tauIDSourcesWith2015 - -for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: - era.toModify(slimmedTausUpdated, - tauIDSources = _tauIDSourcesWith2017v1 - ) - - - -patTauMVAIDsSeq += slimmedTausUpdated -