diff --git a/PhysicsTools/NanoAOD/python/taus_cff.py b/PhysicsTools/NanoAOD/python/taus_cff.py index 1394b62b53bdf..9fd7377d7e08c 100644 --- a/PhysicsTools/NanoAOD/python/taus_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_cff.py @@ -15,9 +15,6 @@ cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT2015') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2') || tauID('byVVVLooseDeepTau2017v2VSjet'))") ) -from Configuration.Eras.Modifier_run2_nanoAOD_94X2016_cff import run2_nanoAOD_94X2016 -from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv2_cff import run2_nanoAOD_94XMiniAODv2 -from Configuration.Eras.Modifier_run2_nanoAOD_102Xv1_cff import run2_nanoAOD_102Xv1 for era in [run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1]: era.toModify(finalTaus, cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT2015') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2'))") @@ -83,11 +80,7 @@ def _tauId8WPMask(pattern,doc): 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"), @@ -118,10 +111,18 @@ def _tauId8WPMask(pattern,doc): idMVAoldDM2017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v2)"), idMVAoldDMdR032017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2017v2)") ) -_mvaAntiEVars2018 = cms.PSet( - rawAntiEle2018 = Var("tauID('againstElectronMVA6Raw2018')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10), - rawAntiEleCat2018 = Var("tauID('againstElectronMVA6category2018')", int, doc="Anti-electron MVA discriminator V6 category (2018)"), - idAntiEle2018 = _tauId5WPMask("againstElectron%sMVA62018", doc= "Anti-electron MVA discriminator V6 (2018)"), +_mvaAntiEVars = cms.PSet( + rawAntiEle2018 = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10), + rawAntiEleCat2018 = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category (2018)"), + idAntiEle2018 = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6 (2018)"), + rawAntiEle = Var("tauID('againstElectronMVA6Raw2015')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2015)", precision=10), + rawAntiEleCat = Var("tauID('againstElectronMVA6category2015')", int, doc="Anti-electron MVA discriminator V6 category (2015"), + idAntiEle = _tauId5WPMask("againstElectron%sMVA62015", doc= "Anti-electron MVA discriminator V6 (2015)"), +) +_mvaAntiEVars2015 = cms.PSet( + rawAntiEle = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2015)", precision=10), + rawAntiEleCat = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category (2015"), + idAntiEle = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6 (2015)"), ) _deepTauVars2017v2 = cms.PSet( rawDeepTau2017v2VSe = Var("tauID('byDeepTau2017v2VSeraw')", float, doc="byDeepTau2017v2VSe raw output discriminator (deepTau2017v2)", precision=10), @@ -134,7 +135,7 @@ def _tauId8WPMask(pattern,doc): _variablesMiniV2 = cms.PSet( _tauVarsBase, - _mvaAntiEVars2018, + _mvaAntiEVars, _mvaIsoVars2015Reduced, _mvaIsoVars2017v1, _mvaIsoVars2017v2, @@ -147,6 +148,7 @@ def _tauId8WPMask(pattern,doc): _variablesMiniV1.idMVAoldDM2017v1 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v1", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v1)") _variables80X = cms.PSet( _tauVarsBase, + _mvaAntiEVars2015, _mvaIsoVars2015 ) @@ -157,7 +159,7 @@ def _tauId8WPMask(pattern,doc): variables = _variablesMiniV1 ) run2_miniAOD_80XLegacy.toModify(tauTable, - variables = _variables80X + variables = _variables80X ) for era in [run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1]: era.toModify(tauTable.variables, @@ -166,7 +168,13 @@ def _tauId8WPMask(pattern,doc): rawDeepTau2017v2VSjet = None, idDeepTau2017v2VSe = None, idDeepTau2017v2VSmu = None, - idDeepTau2017v2VSjet = None + idDeepTau2017v2VSjet = None, + rawAntiEle2018 = Var("tauID('againstElectronMVA6Raw2018')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10), + rawAntiEleCat2018 = Var("tauID('againstElectronMVA6category2018')", int, doc="Anti-electron MVA discriminator V6 category (2018)"), + idAntiEle2018 = _tauId5WPMask("againstElectron%sMVA62018", doc= "Anti-electron MVA discriminator V6 (2018)"), + rawAntiEle = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2015)", precision=10), + rawAntiEleCat = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category (2015"), + idAntiEle = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6 (2015)") ) tauGenJets.GenParticles = cms.InputTag("prunedGenParticles") diff --git a/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py b/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py index 99a9c0dbfbeeb..9d5b4e5649b24 100644 --- a/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py @@ -4,6 +4,10 @@ # Used only in some eras from RecoTauTag.Configuration.loadRecoTauTagMVAsFromPrepDB_cfi import * from RecoTauTag.RecoTau.PATTauDiscriminationByMVAIsolationRun2_cff import * +from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 +from Configuration.Eras.Modifier_run2_nanoAOD_94X2016_cff import run2_nanoAOD_94X2016 +from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv2_cff import run2_nanoAOD_94XMiniAODv2 +from Configuration.Eras.Modifier_run2_nanoAOD_102Xv1_cff import run2_nanoAOD_102Xv1 ### MVAIso 2017v2 ## DBoldDM @@ -286,7 +290,7 @@ ) -### Define new anit-e discriminants +### Define new anit-e discriminants (2018) antiElectronDiscrMVA6_version = "MVA6v3_noeveto" ## Raw from RecoTauTag.RecoTau.PATTauDiscriminationAgainstElectronMVA6_cfi import patTauDiscriminationAgainstElectronMVA6 @@ -355,187 +359,64 @@ ) ) # Loose -patTauDiscriminationByLooseElectronRejectionMVA62018 = patTauDiscriminationByVLooseElectronRejectionMVA62018.clone( - mapping = cms.VPSet( - cms.PSet( - category = cms.uint32(0), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL_WPeff90'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(2), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL_WPeff90'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(5), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL_WPeff90'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(7), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL_WPeff90'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(8), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC_WPeff90'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(10), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC_WPeff90'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(13), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC_WPeff90'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(15), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC_WPeff90'), - variable = cms.string('pt') - ) - ) -) +patTauDiscriminationByLooseElectronRejectionMVA62018 = patTauDiscriminationByVLooseElectronRejectionMVA62018.clone() +for m in patTauDiscriminationByLooseElectronRejectionMVA62018.mapping: + m.cut = m.cut.value().replace("WPeff98", "WPeff90") # Medium -patTauDiscriminationByMediumElectronRejectionMVA62018 = patTauDiscriminationByVLooseElectronRejectionMVA62018.clone( - mapping = cms.VPSet( - cms.PSet( - category = cms.uint32(0), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL_WPeff80'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(2), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL_WPeff80'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(5), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL_WPeff80'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(7), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL_WPeff80'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(8), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC_WPeff80'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(10), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC_WPeff80'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(13), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC_WPeff80'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(15), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC_WPeff80'), - variable = cms.string('pt') - ) - ) -) +patTauDiscriminationByMediumElectronRejectionMVA62018 = patTauDiscriminationByVLooseElectronRejectionMVA62018.clone() +for m in patTauDiscriminationByMediumElectronRejectionMVA62018.mapping: + m.cut = m.cut.value().replace("WPeff98", "WPeff80") # Tight -patTauDiscriminationByTightElectronRejectionMVA62018 = patTauDiscriminationByVLooseElectronRejectionMVA62018.clone( - mapping = cms.VPSet( - cms.PSet( - category = cms.uint32(0), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL_WPeff70'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(2), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL_WPeff70'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(5), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL_WPeff70'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(7), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL_WPeff70'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(8), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC_WPeff70'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(10), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC_WPeff70'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(13), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC_WPeff70'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(15), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC_WPeff70'), - variable = cms.string('pt') - ) - ) -) +patTauDiscriminationByTightElectronRejectionMVA62018 = patTauDiscriminationByVLooseElectronRejectionMVA62018.clone() +for m in patTauDiscriminationByTightElectronRejectionMVA62018.mapping: + m.cut = m.cut.value().replace("WPeff98", "WPeff70") # VTight -patTauDiscriminationByVTightElectronRejectionMVA62018 = patTauDiscriminationByVLooseElectronRejectionMVA62018.clone( - mapping = cms.VPSet( - cms.PSet( - category = cms.uint32(0), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL_WPeff60'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(2), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL_WPeff60'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(5), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL_WPeff60'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(7), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL_WPeff60'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(8), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC_WPeff60'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(10), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC_WPeff60'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(13), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC_WPeff60'), - variable = cms.string('pt') - ), - cms.PSet( - category = cms.uint32(15), - cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC_WPeff60'), - variable = cms.string('pt') - ) - ) +patTauDiscriminationByVTightElectronRejectionMVA62018 = patTauDiscriminationByVLooseElectronRejectionMVA62018.clone() +for m in patTauDiscriminationByVTightElectronRejectionMVA62018.mapping: + m.cut = m.cut.value().replace("WPeff98", "WPeff60") +### Define v1 anit-e discriminants (2015) +antiElectronDiscrMVA6v1_version = "MVA6v1" +## Raw +patTauDiscriminationByElectronRejectionMVA62015Raw = patTauDiscriminationAgainstElectronMVA6.clone( + Prediscriminants = noPrediscriminants, #already selected for MiniAOD + vetoEcalCracks = True, #don't keep tau candidates in EB-EE cracks for v1 + mvaName_NoEleMatch_wGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_wGwoGSF_BL', + mvaName_NoEleMatch_wGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_wGwoGSF_EC', + mvaName_NoEleMatch_woGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_woGwoGSF_BL', + mvaName_NoEleMatch_woGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_NoEleMatch_woGwoGSF_EC', + mvaName_wGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_wGwGSF_BL', + mvaName_wGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_wGwGSF_EC', + mvaName_woGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_woGwGSF_BL', + mvaName_woGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6v1_version+'_gbr_woGwGSF_EC' +) +## anti-e v1 WPs +# VLoose +patTauDiscriminationByVLooseElectronRejectionMVA62015 = patTauDiscriminationByVLooseElectronRejectionMVA62018.clone( + PATTauProducer = patTauDiscriminationByElectronRejectionMVA62015Raw.PATTauProducer, + Prediscriminants = patTauDiscriminationByElectronRejectionMVA62015Raw.Prediscriminants, + toMultiplex = cms.InputTag("patTauDiscriminationByElectronRejectionMVA62015Raw"), + key = cms.InputTag("patTauDiscriminationByElectronRejectionMVA62015Raw","category") ) +for m in patTauDiscriminationByVLooseElectronRejectionMVA62015.mapping: + m.cut = m.cut.value().replace(antiElectronDiscrMVA6_version, antiElectronDiscrMVA6v1_version).replace("WPeff98", "WPEff99") +# Loose +patTauDiscriminationByLooseElectronRejectionMVA62015 = patTauDiscriminationByVLooseElectronRejectionMVA62015.clone() +for m in patTauDiscriminationByLooseElectronRejectionMVA62015.mapping: + m.cut = m.cut.value().replace("WPEff99", "WPEff96") +# Medium +patTauDiscriminationByMediumElectronRejectionMVA62015 = patTauDiscriminationByVLooseElectronRejectionMVA62015.clone() +for m in patTauDiscriminationByMediumElectronRejectionMVA62015.mapping: + m.cut = m.cut.value().replace("WPEff99", "WPEff91") +# Tight +patTauDiscriminationByTightElectronRejectionMVA62015 = patTauDiscriminationByVLooseElectronRejectionMVA62015.clone() +for m in patTauDiscriminationByTightElectronRejectionMVA62015.mapping: + m.cut = m.cut.value().replace("WPEff99", "WPEff85") +# VTight +patTauDiscriminationByVTightElectronRejectionMVA62015 = patTauDiscriminationByVLooseElectronRejectionMVA62015.clone() +for m in patTauDiscriminationByVTightElectronRejectionMVA62015.mapping: + m.cut = m.cut.value().replace("WPEff99", "WPEff79") ### Put all anti-e tau-IDs into a sequence -patTauDiscriminationByElectronRejectionSeq = cms.Sequence( +_patTauDiscriminationByElectronRejection2018Seq = cms.Sequence( patTauDiscriminationByElectronRejectionMVA62018Raw +patTauDiscriminationByVLooseElectronRejectionMVA62018 +patTauDiscriminationByLooseElectronRejectionMVA62018 @@ -543,6 +424,19 @@ +patTauDiscriminationByTightElectronRejectionMVA62018 +patTauDiscriminationByVTightElectronRejectionMVA62018 ) +_patTauDiscriminationByElectronRejection2015Seq = cms.Sequence( + patTauDiscriminationByElectronRejectionMVA62015Raw + +patTauDiscriminationByVLooseElectronRejectionMVA62015 + +patTauDiscriminationByLooseElectronRejectionMVA62015 + +patTauDiscriminationByMediumElectronRejectionMVA62015 + +patTauDiscriminationByTightElectronRejectionMVA62015 + +patTauDiscriminationByVTightElectronRejectionMVA62015 +) +patTauDiscriminationByElectronRejectionSeq = _patTauDiscriminationByElectronRejection2015Seq.copy() +for era in [run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1]: + era.toReplaceWith(patTauDiscriminationByElectronRejectionSeq, + _patTauDiscriminationByElectronRejection2018Seq) + ### put all new MVA tau-Id stuff to one Sequence _patTauMVAIDsSeq2017v2 = cms.Sequence( @@ -556,7 +450,6 @@ _patTauMVAIDsSeqWith2017v1 = _patTauMVAIDsSeq2017v2.copy() _patTauMVAIDsSeqWith2017v1 += patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1Seq -from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 for era in [run2_nanoAOD_94XMiniAODv1,]: era.toReplaceWith(patTauMVAIDsSeq,_patTauMVAIDsSeqWith2017v1) @@ -628,21 +521,37 @@ tauIDSources = _tauIDSourcesWith2017v1 ) -_antiETauIDSources = cms.PSet( +_antiETauIDSources2018 = cms.PSet( againstElectronMVA6Raw2018 = cms.InputTag("patTauDiscriminationByElectronRejectionMVA62018Raw"), againstElectronMVA6category2018 = cms.InputTag("patTauDiscriminationByElectronRejectionMVA62018Raw","category"), againstElectronVLooseMVA62018 = cms.InputTag("patTauDiscriminationByVLooseElectronRejectionMVA62018"), againstElectronLooseMVA62018 = cms.InputTag("patTauDiscriminationByLooseElectronRejectionMVA62018"), againstElectronMediumMVA62018 = cms.InputTag("patTauDiscriminationByMediumElectronRejectionMVA62018"), againstElectronTightMVA62018 = cms.InputTag("patTauDiscriminationByTightElectronRejectionMVA62018"), - againstElectronVTightMVA62018 = cms.InputTag("patTauDiscriminationByVTightElectronRejectionMVA62018") + againstElectronVTightMVA62018 = cms.InputTag("patTauDiscriminationByVTightElectronRejectionMVA62018"), ) -_tauIDSourcesWithAntiE = cms.PSet( +_tauIDSourcesWithAntiE2018 = cms.PSet( slimmedTausUpdated.tauIDSources.clone(), - _antiETauIDSources + _antiETauIDSources2018 ) -slimmedTausUpdated.tauIDSources=_tauIDSourcesWithAntiE - +_antiETauIDSources2015 = cms.PSet( + againstElectronMVA6Raw2015 = cms.InputTag("patTauDiscriminationByElectronRejectionMVA62015Raw"), + againstElectronMVA6category2015 = cms.InputTag("patTauDiscriminationByElectronRejectionMVA62015Raw","category"), + againstElectronVLooseMVA62015 = cms.InputTag("patTauDiscriminationByVLooseElectronRejectionMVA62015"), + againstElectronLooseMVA62015 = cms.InputTag("patTauDiscriminationByLooseElectronRejectionMVA62015"), + againstElectronMediumMVA62015 = cms.InputTag("patTauDiscriminationByMediumElectronRejectionMVA62015"), + againstElectronTightMVA62015 = cms.InputTag("patTauDiscriminationByTightElectronRejectionMVA62015"), + againstElectronVTightMVA62015 = cms.InputTag("patTauDiscriminationByVTightElectronRejectionMVA62015") +) +_tauIDSourcesWithAntiE2015 = cms.PSet( + slimmedTausUpdated.tauIDSources.clone(), + _antiETauIDSources2015 +) +slimmedTausUpdated.tauIDSources=_tauIDSourcesWithAntiE2015 +for era in [run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1]: + era.toModify(slimmedTausUpdated, + tauIDSources = _tauIDSourcesWithAntiE2018 + ) patTauMVAIDsSeq += slimmedTausUpdated diff --git a/RecoTauTag/Configuration/python/HPSPFTaus_cff.py b/RecoTauTag/Configuration/python/HPSPFTaus_cff.py index f77ac903a0d44..2aabb9b80d4fe 100644 --- a/RecoTauTag/Configuration/python/HPSPFTaus_cff.py +++ b/RecoTauTag/Configuration/python/HPSPFTaus_cff.py @@ -307,15 +307,15 @@ PFTauProducer = cms.InputTag('hpsPFTauProducer'), Prediscriminants = requireDecayMode.clone(), loadMVAfromDB = cms.bool(True), - vetoEcalCracks = cms.bool(True), - mvaName_NoEleMatch_woGwoGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_BL"), - mvaName_NoEleMatch_wGwoGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_BL"), - mvaName_woGwGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_BL"), - mvaName_wGwGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_BL"), - mvaName_NoEleMatch_woGwoGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_EC"), - mvaName_NoEleMatch_wGwoGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_EC"), - mvaName_woGwGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_EC"), - mvaName_wGwGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_EC") + vetoEcalCracks = cms.bool(False), + mvaName_NoEleMatch_woGwoGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_woGwoGSF_BL"), + mvaName_NoEleMatch_wGwoGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_wGwoGSF_BL"), + mvaName_woGwGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_woGwGSF_BL"), + mvaName_wGwGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_wGwGSF_BL"), + mvaName_NoEleMatch_woGwoGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_woGwoGSF_EC"), + mvaName_NoEleMatch_wGwoGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_wGwoGSF_EC"), + mvaName_woGwGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_woGwGSF_EC"), + mvaName_wGwGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_wGwGSF_EC") ) ## ByMVA6VLooseElectronRejection hpsPFTauDiscriminationByMVA6VLooseElectronRejection = recoTauDiscriminantCutMultiplexer.clone( @@ -327,86 +327,62 @@ mapping = cms.VPSet( cms.PSet( category = cms.uint32(0), # minMVANoEleMatchWOgWOgsfBL - cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_BL_WPEff99"), + cut = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_woGwoGSF_BL_WPeff98"), variable = cms.string("pt") ), cms.PSet( category = cms.uint32(2), # minMVANoEleMatchWgWOgsfBL - cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_BL_WPEff99"), + cut = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_wGwoGSF_BL_WPeff98"), variable = cms.string("pt") ), cms.PSet( category = cms.uint32(5), # minMVAWOgWgsfBL - cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_BL_WPEff99"), + cut = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_woGwGSF_BL_WPeff98"), variable = cms.string("pt") ), cms.PSet( category = cms.uint32(7), # minMVAWgWgsfBL - cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_BL_WPEff99"), + cut = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_wGwGSF_BL_WPeff98"), variable = cms.string("pt") ), cms.PSet( category = cms.uint32(8), # minMVANoEleMatchWOgWOgsfEC - cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_EC_WPEff99"), + cut = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_woGwoGSF_EC_WPeff98"), variable = cms.string("pt") ), cms.PSet( category = cms.uint32(10), # minMVANoEleMatchWgWOgsfEC - cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_EC_WPEff99"), + cut = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_wGwoGSF_EC_WPeff98"), variable = cms.string("pt") ), cms.PSet( category = cms.uint32(13), # minMVAWOgWgsfEC - cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_EC_WPEff99"), + cut = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_woGwGSF_EC_WPeff98"), variable = cms.string("pt") ), cms.PSet( category = cms.uint32(15), # minMVAWgWgsfEC - cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_EC_WPEff99"), + cut = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_wGwGSF_EC_WPeff98"), variable = cms.string("pt") ) ) ) ## ByMVA6LooseElectronRejection hpsPFTauDiscriminationByMVA6LooseElectronRejection = copy.deepcopy(hpsPFTauDiscriminationByMVA6VLooseElectronRejection) -hpsPFTauDiscriminationByMVA6LooseElectronRejection.mapping[0].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_BL_WPEff96") -hpsPFTauDiscriminationByMVA6LooseElectronRejection.mapping[1].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_BL_WPEff96") -hpsPFTauDiscriminationByMVA6LooseElectronRejection.mapping[2].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_BL_WPEff96") -hpsPFTauDiscriminationByMVA6LooseElectronRejection.mapping[3].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_BL_WPEff96") -hpsPFTauDiscriminationByMVA6LooseElectronRejection.mapping[4].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_EC_WPEff96") -hpsPFTauDiscriminationByMVA6LooseElectronRejection.mapping[5].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_EC_WPEff96") -hpsPFTauDiscriminationByMVA6LooseElectronRejection.mapping[6].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_EC_WPEff96") -hpsPFTauDiscriminationByMVA6LooseElectronRejection.mapping[7].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_EC_WPEff96") +for m in hpsPFTauDiscriminationByMVA6LooseElectronRejection.mapping: + m.cut = m.cut.value().replace("WPeff98", "WPeff90") ## ByMVA6VMediumElectronRejection hpsPFTauDiscriminationByMVA6MediumElectronRejection = copy.deepcopy(hpsPFTauDiscriminationByMVA6VLooseElectronRejection) -hpsPFTauDiscriminationByMVA6MediumElectronRejection.mapping[0].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_BL_WPEff91") -hpsPFTauDiscriminationByMVA6MediumElectronRejection.mapping[1].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_BL_WPEff91") -hpsPFTauDiscriminationByMVA6MediumElectronRejection.mapping[2].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_BL_WPEff91") -hpsPFTauDiscriminationByMVA6MediumElectronRejection.mapping[3].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_BL_WPEff91") -hpsPFTauDiscriminationByMVA6MediumElectronRejection.mapping[4].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_EC_WPEff91") -hpsPFTauDiscriminationByMVA6MediumElectronRejection.mapping[5].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_EC_WPEff91") -hpsPFTauDiscriminationByMVA6MediumElectronRejection.mapping[6].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_EC_WPEff91") -hpsPFTauDiscriminationByMVA6MediumElectronRejection.mapping[7].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_EC_WPEff91") +for m in hpsPFTauDiscriminationByMVA6MediumElectronRejection.mapping: + m.cut = m.cut.value().replace("WPeff98", "WPeff80") ## ByMVA6TightElectronRejection hpsPFTauDiscriminationByMVA6TightElectronRejection = copy.deepcopy(hpsPFTauDiscriminationByMVA6VLooseElectronRejection) -hpsPFTauDiscriminationByMVA6TightElectronRejection.mapping[0].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_BL_WPEff85") -hpsPFTauDiscriminationByMVA6TightElectronRejection.mapping[1].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_BL_WPEff85") -hpsPFTauDiscriminationByMVA6TightElectronRejection.mapping[2].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_BL_WPEff85") -hpsPFTauDiscriminationByMVA6TightElectronRejection.mapping[3].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_BL_WPEff85") -hpsPFTauDiscriminationByMVA6TightElectronRejection.mapping[4].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_EC_WPEff85") -hpsPFTauDiscriminationByMVA6TightElectronRejection.mapping[5].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_EC_WPEff85") -hpsPFTauDiscriminationByMVA6TightElectronRejection.mapping[6].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_EC_WPEff85") -hpsPFTauDiscriminationByMVA6TightElectronRejection.mapping[7].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_EC_WPEff85") +for m in hpsPFTauDiscriminationByMVA6TightElectronRejection.mapping: + m.cut = m.cut.value().replace("WPeff98", "WPeff70") ## ByMVA6VTightElectronRejection hpsPFTauDiscriminationByMVA6VTightElectronRejection = copy.deepcopy(hpsPFTauDiscriminationByMVA6VLooseElectronRejection) -hpsPFTauDiscriminationByMVA6VTightElectronRejection.mapping[0].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_BL_WPEff79") -hpsPFTauDiscriminationByMVA6VTightElectronRejection.mapping[1].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_BL_WPEff79") -hpsPFTauDiscriminationByMVA6VTightElectronRejection.mapping[2].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_BL_WPEff79") -hpsPFTauDiscriminationByMVA6VTightElectronRejection.mapping[3].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_BL_WPEff79") -hpsPFTauDiscriminationByMVA6VTightElectronRejection.mapping[4].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_EC_WPEff79") -hpsPFTauDiscriminationByMVA6VTightElectronRejection.mapping[5].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_EC_WPEff79") -hpsPFTauDiscriminationByMVA6VTightElectronRejection.mapping[6].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_EC_WPEff79") -hpsPFTauDiscriminationByMVA6VTightElectronRejection.mapping[7].cut = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_EC_WPEff79") +for m in hpsPFTauDiscriminationByMVA6VTightElectronRejection.mapping: + m.cut = m.cut.value().replace("WPeff98", "WPeff60") # Define the HPS selection discriminator used in cleaning hpsSelectionDiscriminator.PFTauProducer = cms.InputTag("combinatoricRecoTaus") diff --git a/RecoTauTag/RecoTau/test/rerunMVAIsolationOnMiniAOD.py b/RecoTauTag/RecoTau/test/rerunMVAIsolationOnMiniAOD.py index 0e410c3e06b00..a819f3ec593f4 100644 --- a/RecoTauTag/RecoTau/test/rerunMVAIsolationOnMiniAOD.py +++ b/RecoTauTag/RecoTau/test/rerunMVAIsolationOnMiniAOD.py @@ -65,16 +65,17 @@ Prediscriminants = noPrediscriminants, #Prediscriminants = requireLeadTrack, loadMVAfromDB = cms.bool(True), + vetoEcalCracks = cms.bool(False), returnMVA = cms.bool(True), method = cms.string("BDTG"), - mvaName_NoEleMatch_woGwoGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_BL"), - mvaName_NoEleMatch_wGwoGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_BL"), - mvaName_woGwGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_BL"), - mvaName_wGwGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_BL"), - mvaName_NoEleMatch_woGwoGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_woGwoGSF_EC"), - mvaName_NoEleMatch_wGwoGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_NoEleMatch_wGwoGSF_EC"), - mvaName_woGwGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_woGwGSF_EC"), - mvaName_wGwGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v1_gbr_wGwGSF_EC"), + mvaName_NoEleMatch_woGwoGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_woGwoGSF_BL"), + mvaName_NoEleMatch_wGwoGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_wGwoGSF_BL"), + mvaName_woGwGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_woGwGSF_BL"), + mvaName_wGwGSF_BL = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_wGwGSF_BL"), + mvaName_NoEleMatch_woGwoGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_woGwoGSF_EC"), + mvaName_NoEleMatch_wGwoGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_NoEleMatch_wGwoGSF_EC"), + mvaName_woGwGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_woGwGSF_EC"), + mvaName_wGwGSF_EC = cms.string("RecoTauTag_antiElectronMVA6v3_noeveto_gbr_wGwGSF_EC"), minMVANoEleMatchWOgWOgsfBL = cms.double(0.0), minMVANoEleMatchWgWOgsfBL = cms.double(0.0), minMVAWOgWgsfBL = cms.double(0.0),