diff --git a/PhysicsTools/NanoAOD/python/boostedTaus_cff.py b/PhysicsTools/NanoAOD/python/boostedTaus_cff.py index 8b128eb76f85e..260ef130a9068 100644 --- a/PhysicsTools/NanoAOD/python/boostedTaus_cff.py +++ b/PhysicsTools/NanoAOD/python/boostedTaus_cff.py @@ -3,7 +3,7 @@ from PhysicsTools.NanoAOD.nano_eras_cff import * ##################### Import reusable funtions and objects from std taus ######## -from PhysicsTools.NanoAOD.taus_cff import _tauId2WPMask,_tauId5WPMask,_tauId7WPMask,tausMCMatchLepTauForTable,tausMCMatchHadTauForTable,tauMCTable +from PhysicsTools.NanoAOD.taus_cff import _tauIdWPMask, tausMCMatchLepTauForTable, tausMCMatchHadTauForTable,tauMCTable ##################### User floats producers, selectors ########################## @@ -39,25 +39,25 @@ 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), - idAntiMu = _tauId2WPMask("againstMuon%s3", doc= "Anti-muon discriminator V3: ") + idAntiMu = _tauIdWPMask("againstMuon%s3", choices=("Loose","Tight"), doc= "Anti-muon discriminator V3: ") ) #MVA 2017 v2 variables _boostedTauVarsMVAIso = cms.PSet( rawMVAoldDM2017v2 = Var("tauID('byIsolationMVArun2DBoldDMwLTraw')",float, doc="byIsolationMVArun2DBoldDMwLT raw output discriminator (2017v2)",precision=10), rawMVAnewDM2017v2 = Var("tauID('byIsolationMVArun2DBnewDMwLTraw')",float,doc='byIsolationMVArun2DBnewDMwLT raw output discriminator (2017v2)',precision=10), - idMVAnewDM2017v2 = _tauId7WPMask("by%sIsolationMVArun2DBnewDMwLT", doc="IsolationMVArun2DBnewDMwLT ID working point (2017v2)"), - idMVAoldDM2017v2 = _tauId7WPMask("by%sIsolationMVArun2DBoldDMwLT",doc="IsolationMVArun2DBoldDMwLT ID working point (2017v2)"), + idMVAnewDM2017v2 = _tauIdWPMask("by%sIsolationMVArun2DBnewDMwLT", choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"), doc="IsolationMVArun2DBnewDMwLT ID working point (2017v2)"), + idMVAoldDM2017v2 = _tauIdWPMask("by%sIsolationMVArun2DBoldDMwLT",choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"), doc="IsolationMVArun2DBoldDMwLT ID working point (2017v2)"), ) #MVA 2017 v2 dR<0.3 variables _boostedTauVarsMVAIsoDr03 = cms.PSet( rawMVAoldDMdR032017v2 = Var("tauID('byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017')",float,doc='byIsolationMVArun2DBoldDMdR0p3wLT raw output discriminator (2017v2)'), - idMVAoldDMdR032017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBoldDMdR0p3wLT2017",doc="IsolationMVArun2DBoldDMdR0p3wLT ID working point (2017v2)") + idMVAoldDMdR032017v2 = _tauIdWPMask("by%sIsolationMVArun2017v2DBoldDMdR0p3wLT2017",choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"),doc="IsolationMVArun2DBoldDMdR0p3wLT ID working point (2017v2)") ) #AntiEle MVA 2018 variables _boostedTauVarsAntiEleMVA = 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)") + idAntiEle2018 = _tauIdWPMask("againstElectron%sMVA6", choices=("VLoose","Loose","Medium","Tight","VTight"), doc= "Anti-electron MVA discriminator V6 (2018)") ) boostedTauTable.variables = cms.PSet( @@ -77,11 +77,11 @@ run2_nanoAOD_106Xv2.toModify(boostedTauTable.variables, rawMVAoldDM2017v2 = Var("tauID('byIsolationMVArun2017v2DBoldDMwLTraw2017')",float, doc="byIsolationMVArun2DBoldDMwLT raw output discriminator (2017v2)",precision=10), rawMVAnewDM2017v2 = Var("tauID('byIsolationMVArun2017v2DBnewDMwLTraw2017')",float,doc='byIsolationMVArun2DBnewDMwLT raw output discriminator (2017v2)',precision=10), - idMVAnewDM2017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBnewDMwLT2017", doc="IsolationMVArun2DBnewDMwLT ID working point (2017v2)"), - idMVAoldDM2017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBoldDMwLT2017",doc="IsolationMVArun2DBoldDMwLT ID working point (2017v2)"), + idMVAnewDM2017v2 = _tauIdWPMask("by%sIsolationMVArun2017v2DBnewDMwLT2017", choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"),doc="IsolationMVArun2DBnewDMwLT ID working point (2017v2)"), + idMVAoldDM2017v2 = _tauIdWPMask("by%sIsolationMVArun2017v2DBoldDMwLT2017",choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"),doc="IsolationMVArun2DBoldDMwLT ID working point (2017v2)"), 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)") + idAntiEle2018 = _tauIdWPMask("againstElectron%sMVA62018", choices=("VLoose","Loose","Medium","Tight","VTight"), doc= "Anti-electron MVA discriminator V6 (2018)") ) boostedTausMCMatchLepTauForTable = tausMCMatchLepTauForTable.clone( diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py index 51a6ece603c1c..879bc5126b73e 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py @@ -13,13 +13,13 @@ if (plot.name.value().find("MVA")>-1 and plot.name.value().find("2017")>-1) or (plot.name.value().find("AntiEle")>-1 and plot.name.value().find("2018")>-1) or (plot.name.value().find("AntiEleDeadECal")>-1) or (plot.name.value().find("DeepTau")>-1): continue _tauPlots80X.append(plot) -_tauPlots80X.extend([Plot1D('idMVAnewDM', 'idMVAnewDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBnewDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), - Plot1D('idMVAoldDM', 'idMVAoldDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBnewDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), - Plot1D('idMVAoldDMdR03', 'idMVAoldDMdR03', 64, -0.5, 63.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), +_tauPlots80X.extend([Plot1D('idMVAnewDM', 'idMVAnewDM', 11, -0.5, 10.5, 'IsolationMVArun2v1DBnewDMwLT ID working point: int 1 = VLoose, 2 = Loose, 3 = Medium, 4 = Tight, 5 = VTight, 6 = VVTight'), + Plot1D('idMVAoldDM', 'idMVAoldDM', 11, -0.5, 10.5, 'IsolationMVArun2v1DBnewDMwLT ID working point: int 1 = VLoose, 2 = Loose, 3 = Medium, 4 = Tight, 5 = VTight, 6 = VVTight'), + Plot1D('idMVAoldDMdR03', 'idMVAoldDMdR03', 11, -0.5, 10.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point: int 1 = VLoose, 2 = Loose, 3 = Medium, 4 = Tight, 5 = VTight, 6 = VVTight'), Plot1D('rawMVAnewDM', 'rawMVAnewDM', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator'), Plot1D('rawMVAoldDM', 'rawMVAoldDM', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator'), Plot1D('rawMVAoldDMdR03', 'rawMVAoldDMdR03', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator'), - Plot1D('idAntiEle', 'idAntiEle', 32, -0.5, 31.5, 'Anti-electron MVA discriminator V6: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight'), + Plot1D('idAntiEle', 'idAntiEle', 11, -0.5, 10.5, 'Anti-electron MVA discriminator V6: int 1 = VLoose, 2 = Loose, 3 = Medium, 4 = Tight, 5 = VTight'), Plot1D('rawAnti', 'rawAntiEle', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator'), Plot1D('rawAntiEleCat', 'rawAntiEleCat', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category') ]) @@ -34,13 +34,13 @@ _tauPlotsPreV9.extend([ Plot1D('idDecayMode', 'idDecayMode', 2, -0.5, 1.5, "tauID('decayModeFinding')"), Plot1D('idDecayModeNewDMs', 'idDecayModeNewDMs', 2, -0.5, 1.5, "tauID('decayModeFindingNewDMs')"), - Plot1D('idAntiEle', 'idAntiEle', 32, -0.5, 31.5, 'Anti-electron MVA discriminator V6: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight'), - Plot1D('idAntiEle2018', 'idAntiEle2018', 32, -0.5, 31.5, 'Anti-electron MVA discriminator V6 (2018): bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight'), - Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBnewDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), - Plot1D('idMVAoldDM', 'idMVAoldDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBoldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), - Plot1D('idMVAoldDM2017v1', 'idMVAoldDM2017v1', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v1): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), - Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), - Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point (217v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idAntiEle', 'idAntiEle', 11, -0.5, 10.5, 'Anti-electron MVA discriminator V6: int 1 = VLoose, 2 = Loose, 3 = Medium, 4 = Tight, 5 = VTight'), + Plot1D('idAntiEle2018', 'idAntiEle2018', 11, -0.5, 10.5, 'Anti-electron MVA discriminator V6 (2018): int 1 = VLoose, 2 = Loose, 3 = Medium, 4 = Tight, 5 = VTight'), + Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 11, -0.5, 10.5, 'IsolationMVArun2v1DBnewDMwLT ID working point (2017v2): int 1 = VVLoose, 2 = VLoose, 3 = Loose, 4 = Medium, 5 = Tight, 6 = VTight, 7 = VVTight'), + Plot1D('idMVAoldDM', 'idMVAoldDM', 11, -0.5, 10.5, 'IsolationMVArun2v1DBoldDMwLT ID working point: int 1 = VLoose, 2 = Loose, 3 = Medium, 4 = Tight, 5 = VTight, 6 = VVTight'), + Plot1D('idMVAoldDM2017v1', 'idMVAoldDM2017v1', 11, -0.5, 10.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v1): int 1 = VVLoose, 2 = VLoose, 3 = Loose, 4 = Medium, 5 = Tight, 6 = VTight, 7 = VVTight'), + Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 11, -0.5, 10.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v2): int 1 = VVLoose, 2 = VLoose, 3 = Loose, 4 = Medium, 5 = Tight, 6 = VTight, 7 = VVTight'), + Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 11, -0.5, 10.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point (217v2): int 1 = VVLoose, 2 = VLoose, 3 = Loose, 4 = Medium, 5 = Tight, 6 = VTight, 7 = VVTight'), Plot1D('rawAntiEle', 'rawAntiEle', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator'), Plot1D('rawAntiEle2018', 'rawAntiEle2018', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator (2018)'), Plot1D('rawAntiEleCat', 'rawAntiEleCat', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category'), @@ -58,7 +58,7 @@ for plot in nanoDQM.vplots.boostedTau.plots: _boostedTauPlotsV10.append(plot) _boostedTauPlotsV10.extend([ - Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 128, -0.5, 127.5, 'IsolationMVArun2017v2DBoldDMdR0p3wLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 11, -0.5, 10.5, 'IsolationMVArun2017v2DBoldDMdR0p3wLT ID working point (2017v2): int 1 = VVLoose, 2 = VLoose, 3 = Loose, 4 = Medium, 5 = Tight, 6 = VTight, 7 = VVTight'), Plot1D('rawMVAoldDMdR032017v2', 'rawMVAoldDMdR032017v2', 20, -1, 1, 'byIsolationMVArun2017v2DBoldDMdR0p3wLT raw output discriminator (2017v2)') ]) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index ce4aec22c49ec..68f9fd12f6739 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -777,11 +777,14 @@ Plot1D('genPartFlav', 'genPartFlav', 6, -0.5, 5.5, 'Flavour of genParticle for MC matching to status==2 taus: 1 = prompt electron, 2 = prompt muon, 3 = tau->e decay, 4 = tau->mu decay, 5 = hadronic tau decay, 0 = unknown or unmatched'), NoPlot('genPartIdx'), Plot1D('idAntiEleDeadECal', 'idAntiEleDeadECal', 2, -0.5, 1.5, "tauID('againstElectronDeadECAL')"), - Plot1D('idAntiMu', 'idAntiMu', 4, -0.5, 3.5, 'Anti-muon discriminator V3: : bitmask 1 = Loose, 2 = Tight'), + Plot1D('idAntiMu', 'idAntiMu', 11, -0.5, 10.5, 'Anti-muon discriminator V3: : int 1 = Loose, 2 = Tight'), Plot1D('idDecayModeOldDMs', 'idDecayModeOldDMs', 2, -0.5, 1.5, "tauID('decayModeFinding')"), - Plot1D('idDeepTau2017v2p1VSe', 'idDeepTau2017v2p1VSe', 256, -0.5, 255.5, 'byDeepTau2017v2p1VSe ID working points (deepTau2017v2p1): bitmask 1 = VVVLoose, 2 = VVLoose, 4 = VLoose, 8 = Loose, 16 = Medium, 32 = Tight, 64 = VTight, 128 = VVTight'), - Plot1D('idDeepTau2017v2p1VSjet', 'idDeepTau2017v2p1VSjet', 256, -0.5, 255.5, 'byDeepTau2017v2p1VSjet ID working points (deepTau2017v2p1): bitmask 1 = VVVLoose, 2 = VVLoose, 4 = VLoose, 8 = Loose, 16 = Medium, 32 = Tight, 64 = VTight, 128 = VVTight'), - Plot1D('idDeepTau2017v2p1VSmu', 'idDeepTau2017v2p1VSmu', 16, -0.5, 15.5, 'byDeepTau2017v2p1VSmu ID working points (deepTau2017v2p1): bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight'), + Plot1D('idDeepTau2017v2p1VSe', 'idDeepTau2017v2p1VSe', 11, -0.5, 10.5, 'byDeepTau2017v2p1VSe ID working points (deepTau2017v2p1): int 1 = VVVLoose, 2 = VVLoose, 3 = VLoose, 4 = Loose, 5 = Medium, 6 = Tight, 7 = VTight, 8 = VVTight'), + Plot1D('idDeepTau2017v2p1VSjet', 'idDeepTau2017v2p1VSjet', 11, -0.5, 10.5, 'byDeepTau2017v2p1VSjet ID working points (deepTau2017v2p1): int 1 = VVVLoose, 2 = VVLoose, 3 = VLoose, 4 = Loose, 5 = Medium, 6 = Tight, 7 = VTight, 8 = VVTight'), + Plot1D('idDeepTau2017v2p1VSmu', 'idDeepTau2017v2p1VSmu', 11, -0.5, 10.5, 'byDeepTau2017v2p1VSmu ID working points (deepTau2017v2p1): int 1 = VLoose, 2 = Loose, 3 = Medium, 4 = Tight'), + Plot1D('idDeepTau2018v2p5VSe', 'idDeepTau2018v2p5VSe', 11, -0.5, 10.5, 'byDeepTau2018v2p5VSe ID working points (deepTau2018v2p5): int 1 = VVVLoose, 2 = VVLoose, 3 = VLoose, 4 = Loose, 5 = Medium, 6 = Tight, 7 = VTight, 8 = VVTight'), + Plot1D('idDeepTau2018v2p5VSjet', 'idDeepTau2018v2p5VSjet', 11, -0.5, 10.5, 'byDeepTau2018v2p5VSjet ID working points (deepTau2018v2p5): int 1 = VVVLoose, 2 = VVLoose, 3 = VLoose, 4 = Loose, 5 = Medium, 6 = Tight, 7 = VTight, 8 = VVTight'), + Plot1D('idDeepTau2018v2p5VSmu', 'idDeepTau2018v2p5VSmu', 11, -0.5, 10.5, 'byDeepTau2018v2p5VSmu ID working points (deepTau2018v2p5): int 1 = VLoose, 2 = Loose, 3 = Medium, 4 = Tight'), NoPlot('jetIdx'), Plot1D('leadTkDeltaEta', 'leadTkDeltaEta', 20, -0.1, 0.1, 'eta of the leading track, minus tau eta'), Plot1D('leadTkDeltaPhi', 'leadTkDeltaPhi', 20, -0.1, 0.1, 'phi of the leading track, minus tau phi'), @@ -795,6 +798,9 @@ Plot1D('rawDeepTau2017v2p1VSe', 'rawDeepTau2017v2p1VSe', 20, 0, 1, 'byDeepTau2017v2p1VSe raw output discriminator (deepTau2017v2p1)'), Plot1D('rawDeepTau2017v2p1VSjet', 'rawDeepTau2017v2p1VSjet', 20, 0, 1, 'byDeepTau2017v2p1VSjet raw output discriminator (deepTau2017v2p1)'), Plot1D('rawDeepTau2017v2p1VSmu', 'rawDeepTau2017v2p1VSmu', 20, 0, 1, 'byDeepTau2017v2p1VSmu raw output discriminator (deepTau2017v2p1)'), + Plot1D('rawDeepTau2018v2p5VSe', 'rawDeepTau2018v2p5VSe', 20, 0, 1, 'byDeepTau2018v2p5VSe raw output discriminator (deepTau2018v2p5)'), + Plot1D('rawDeepTau2018v2p5VSjet', 'rawDeepTau2018v2p5VSjet', 20, 0, 1, 'byDeepTau2018v2p5VSjet raw output discriminator (deepTau2018v2p5)'), + Plot1D('rawDeepTau2018v2p5VSmu', 'rawDeepTau2018v2p5VSmu', 20, 0, 1, 'byDeepTau2018v2p5VSmu raw output discriminator (deepTau2018v2p5)'), Plot1D('rawIso', 'rawIso', 20, 0, 200, 'combined isolation (deltaBeta corrections)'), Plot1D('rawIsodR03', 'rawIsodR03', 20, 0, 200, 'combined isolation (deltaBeta corrections, dR=0.3)'), ) @@ -842,10 +848,10 @@ Plot1D('eta', 'eta', 20, -3, 3, 'eta'), Plot1D('genPartFlav', 'genPartFlav', 6, -0.5, 5.5, 'Flavour of genParticle for MC matching to status==2 taus: 1 = prompt electron, 2 = prompt muon, 3 = tau->e decay, 4 = tau->mu decay, 5 = hadronic tau decay, 0 = unknown or unmatched'), NoPlot('genPartIdx'), - Plot1D('idAntiEle2018', 'idAntiEle2018', 32, -0.5, 31.5, 'Anti-electron MVA discriminator V6 (2018): bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight'), - Plot1D('idAntiMu', 'idAntiMu', 4, -0.5, 3.5, 'Anti-muon discriminator V3: : bitmask 1 = Loose, 2 = Tight'), - Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2017v2DBnewDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), - Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2017v2DBoldDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idAntiEle2018', 'idAntiEle2018', 11, -0.5, 10.5, 'Anti-electron MVA discriminator V6 (2018): int 1 = VLoose, 2 = Loose, 3 = Medium, 4 = Tight, 5 = VTight'), + Plot1D('idAntiMu', 'idAntiMu', 11, -0.5, 10.5, 'Anti-muon discriminator V3: : int 1 = Loose, 2 = Tight'), + Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 11, -0.5, 10.5, 'IsolationMVArun2017v2DBnewDMwLT ID working point (2017v2): int 1 = VVLoose, 2 = VLoose, 3 = Loose, 4 = Medium, 5 = Tight, 6 = VTight, 7 = VVTight'), + Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 11, -0.5, 10.5, 'IsolationMVArun2017v2DBoldDMwLT ID working point (2017v2): int 1 = VVLoose, 2 = VLoose, 3 = Loose, 4 = Medium, 5 = Tight, 6 = VTight, 7 = VVTight'), NoPlot('jetIdx'), Plot1D('leadTkDeltaEta', 'leadTkDeltaEta', 20, -0.1, 0.1, 'eta of the leading track, minus tau eta'), Plot1D('leadTkDeltaPhi', 'leadTkDeltaPhi', 20, -0.1, 0.1, 'phi of the leading track, minus tau phi'), diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 11af5a2319c81..6256128a29015 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -121,10 +121,11 @@ def nanoAOD_addTauIds(process, idsToRun=[]): updatedTauName = "slimmedTausUpdated" tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False, updatedTauName = updatedTauName, + postfix = "ForNano", toKeep = idsToRun) tauIdEmbedder.runTauID() _tauTask = patTauMVAIDsTask.copy() - _tauTask.add(process.rerunMvaIsolationTask) + _tauTask.add(process.rerunMvaIsolationTaskForNano) _tauTask.add(finalTaus) process.finalTaus.src = updatedTauName #remember to adjust the selection and tables with added IDs @@ -139,10 +140,10 @@ def nanoAOD_addBoostedTauIds(process, idsToRun=[]): boostedTauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False, originalTauName = "slimmedTausBoosted", updatedTauName = updatedBoostedTauName, - postfix = "Boosted", + postfix = "BoostedForNano", toKeep = idsToRun) boostedTauIdEmbedder.runTauID() - _boostedTauTask = process.rerunMvaIsolationTaskBoosted.copy() + _boostedTauTask = process.rerunMvaIsolationTaskBoostedForNano.copy() _boostedTauTask.add(getattr(process, updatedBoostedTauName)) _boostedTauTask.add(process.finalBoostedTaus) process.finalBoostedTaus.src = updatedBoostedTauName @@ -277,6 +278,8 @@ def nanoAOD_customizeCommon(process): ) (run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(nanoAOD_tau_switch, idsToAdd = ["deepTau2017v2p1"]) (run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(process, lambda p : nanoAOD_addTauIds(p, nanoAOD_tau_switch.idsToAdd.value())) + (run2_nanoAOD_106Xv2 | run3_nanoAOD_122).toModify(nanoAOD_tau_switch, idsToAdd = ["deepTau2018v2p5"]) + (run2_nanoAOD_106Xv2 | run3_nanoAOD_122).toModify(process, lambda p : nanoAOD_addTauIds(p, nanoAOD_tau_switch.idsToAdd.value())) nanoAOD_boostedTau_switch = cms.PSet( idsToAdd = cms.vstring() ) diff --git a/PhysicsTools/NanoAOD/python/taus_cff.py b/PhysicsTools/NanoAOD/python/taus_cff.py index c8a869ef4f7fb..3082ebf356e71 100644 --- a/PhysicsTools/NanoAOD/python/taus_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_cff.py @@ -9,10 +9,13 @@ ##################### User floats producers, selectors ########################## +# Original DeepTau v2p5 in 12_4_X doesn't include WPs in MINIAOD +# Import thresholds here to define WPs manually from raw scores +from RecoTauTag.RecoTau.tauIdWPsDefs import WORKING_POINTS_v2p5 finalTaus = cms.EDFilter("PATTauRefSelector", src = cms.InputTag("slimmedTaus"), - cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || (tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum'))<2.5) || tauID('byVVVLooseDeepTau2017v2p1VSjet'))") + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || (tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum'))<2.5) || tauID('byVVVLooseDeepTau2017v2p1VSjet') || (tauID('byDeepTau2018v2p5VSjetraw') > {}))".format(WORKING_POINTS_v2p5["jet"]["VVVLoose"])) ) for era in [run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_94X2016, run2_nanoAOD_102Xv1, run2_nanoAOD_106Xv1]: @@ -30,23 +33,22 @@ ) ##################### 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", - 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) -def _tauId3WPMask(pattern,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) -def _tauId6WPMask(pattern,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) -def _tauId8WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("VVVLoose","VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) +def _tauIdWPMask(pattern, choices, doc="", from_raw=False, wp_thrs=None): + if from_raw: + assert wp_thrs is not None, "wp_thrs argument in _tauIdWPMask() is None, expect it to be dict-like" + + var_definition = [] + for wp_name in choices: + if not isinstance(wp_thrs[wp_name], float): + raise TypeError("Threshold for WP=%s is not a float number." % wp_name) + wp_definition = "test_bit(tauID('{}')-{}+1,0)".format(pattern, wp_thrs[wp_name]) + var_definition.append(wp_definition) + var_definition = " + ".join(var_definition) + else: + var_definition = " + ".join(["tauID('%s')" % (pattern % c) for c in choices]) + + doc = doc + ": "+", ".join(["%d = %s" % (i,c) for (i,c) in enumerate(choices, start=1)]) + return Var(var_definition, "uint8", doc=doc) tauTable = cms.EDProducer("SimpleCandidateFlatTableProducer", src = cms.InputTag("linkedObjects","taus"), @@ -78,7 +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), - idAntiMu = _tauId2WPMask("againstMuon%s3", doc= "Anti-muon discriminator V3: "), + idAntiMu = _tauIdWPMask("againstMuon%s3", choices=("Loose","Tight"), doc= "Anti-muon discriminator V3: "), idAntiEleDeadECal = Var("tauID('againstElectronDeadECAL')", bool, doc = "Anti-electron dead-ECal discriminator"), # isoCI3hit = Var( "tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits")" doc="byCombinedIsolationDeltaBetaCorrRaw3Hits raw output discriminator"), @@ -90,43 +92,73 @@ def _tauId8WPMask(pattern,doc): 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)") + idMVAnewDM = _tauIdWPMask( "by%sIsolationMVArun2v1DBnewDMwLT", choices=("VLoose","Loose","Medium","Tight","VTight","VVTight"), doc="IsolationMVArun2v1DBnewDMwLT ID working point (2015)"), + idMVAoldDM = _tauIdWPMask( "by%sIsolationMVArun2v1DBoldDMwLT", choices=("VLoose","Loose","Medium","Tight","VTight","VVTight"), doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)"), + idMVAoldDMdR03 = _tauIdWPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT", choices=("VLoose","Loose","Medium","Tight","VTight","VVTight"), 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)"), + idMVAoldDM = _tauIdWPMask( "by%sIsolationMVArun2v1DBoldDMwLT2015", choices=("VLoose","Loose","Medium","Tight","VTight","VVTight"), 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)") + idMVAoldDM2017v1 = _tauIdWPMask( "by%sIsolationMVArun2v1DBoldDMwLT", choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"), 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)") + idMVAnewDM2017v2 = _tauIdWPMask( "by%sIsolationMVArun2v1DBnewDMwLT2017v2", + choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"), + doc="IsolationMVArun2v1DBnewDMwLT ID working point (2017v2)"), + idMVAoldDM2017v2 = _tauIdWPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v2", + choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"), + doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v2)"), + idMVAoldDMdR032017v2 = _tauIdWPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT2017v2", + choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"), + doc="IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2017v2)") ) _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)"), + idAntiEle = _tauIdWPMask("againstElectron%sMVA6", choices=("VLoose","Loose","Medium","Tight","VTight"), doc= "Anti-electron MVA discriminator V6 (2015)"), ) _deepTauVars2017v2p1 = cms.PSet( rawDeepTau2017v2p1VSe = Var("tauID('byDeepTau2017v2p1VSeraw')", float, doc="byDeepTau2017v2p1VSe raw output discriminator (deepTau2017v2p1)", precision=10), rawDeepTau2017v2p1VSmu = Var("tauID('byDeepTau2017v2p1VSmuraw')", float, doc="byDeepTau2017v2p1VSmu raw output discriminator (deepTau2017v2p1)", precision=10), rawDeepTau2017v2p1VSjet = Var("tauID('byDeepTau2017v2p1VSjetraw')", float, doc="byDeepTau2017v2p1VSjet raw output discriminator (deepTau2017v2p1)", precision=10), - idDeepTau2017v2p1VSe = _tauId8WPMask("by%sDeepTau2017v2p1VSe", doc="byDeepTau2017v2p1VSe ID working points (deepTau2017v2p1)"), - idDeepTau2017v2p1VSmu = _tauId4WPMask("by%sDeepTau2017v2p1VSmu", doc="byDeepTau2017v2p1VSmu ID working points (deepTau2017v2p1)"), - idDeepTau2017v2p1VSjet = _tauId8WPMask("by%sDeepTau2017v2p1VSjet", doc="byDeepTau2017v2p1VSjet ID working points (deepTau2017v2p1)"), + idDeepTau2017v2p1VSe = _tauIdWPMask("by%sDeepTau2017v2p1VSe", + choices=("VVVLoose","VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"), + doc="byDeepTau2017v2p1VSe ID working points (deepTau2017v2p1)"), + idDeepTau2017v2p1VSmu = _tauIdWPMask("by%sDeepTau2017v2p1VSmu", + choices=("VLoose", "Loose", "Medium", "Tight"), + doc="byDeepTau2017v2p1VSmu ID working points (deepTau2017v2p1)"), + idDeepTau2017v2p1VSjet = _tauIdWPMask("by%sDeepTau2017v2p1VSjet", + choices=("VVVLoose","VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"), + doc="byDeepTau2017v2p1VSjet ID working points (deepTau2017v2p1)"), +) +_deepTauVars2018v2p5 = cms.PSet( + rawDeepTau2018v2p5VSe = Var("tauID('byDeepTau2018v2p5VSeraw')", float, doc="byDeepTau2018v2p5VSe raw output discriminator (deepTau2018v2p5)", precision=10), + rawDeepTau2018v2p5VSmu = Var("tauID('byDeepTau2018v2p5VSmuraw')", float, doc="byDeepTau2018v2p5VSmu raw output discriminator (deepTau2018v2p5)", precision=10), + rawDeepTau2018v2p5VSjet = Var("tauID('byDeepTau2018v2p5VSjetraw')", float, doc="byDeepTau2018v2p5VSjet raw output discriminator (deepTau2018v2p5)", precision=10), + idDeepTau2018v2p5VSe = _tauIdWPMask("byDeepTau2018v2p5VSeraw", + choices=("VVVLoose","VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"), + doc="byDeepTau2018v2p5VSe ID working points (deepTau2018v2p5)", + from_raw=True, wp_thrs=WORKING_POINTS_v2p5["e"]), + idDeepTau2018v2p5VSmu = _tauIdWPMask("byDeepTau2018v2p5VSmuraw", + choices=("VLoose", "Loose", "Medium", "Tight"), + doc="byDeepTau2018v2p5VSmu ID working points (deepTau2018v2p5)", + from_raw=True, wp_thrs=WORKING_POINTS_v2p5["mu"]), + idDeepTau2018v2p5VSjet = _tauIdWPMask("byDeepTau2018v2p5VSjetraw", + choices=("VVVLoose","VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"), + doc="byDeepTau2018v2p5VSjet ID working points (deepTau2018v2p5)", + from_raw=True, wp_thrs=WORKING_POINTS_v2p5["jet"]), ) _variablesMiniV2 = cms.PSet( _tauVarsBase, - _deepTauVars2017v2p1 + _deepTauVars2017v2p1, + _deepTauVars2018v2p5 ) _variablesMiniV1 = cms.PSet( _variablesMiniV2, @@ -134,8 +166,12 @@ def _tauId8WPMask(pattern,doc): ) _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)") +_variablesMiniV1.idMVAoldDM = _tauIdWPMask( "by%sIsolationMVArun2v1DBoldDMwLT", + choices=("VLoose","Loose","Medium","Tight","VTight","VVTight"), + doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)") +_variablesMiniV1.idMVAoldDM2017v1 = _tauIdWPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v1", + choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"), + doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v1)") _variables80X = cms.PSet( _tauVarsBase, _mvaAntiEVars2015, @@ -159,10 +195,10 @@ def _tauId8WPMask(pattern,doc): era.toModify(tauTable.variables, 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)"), + idAntiEle2018 = _tauIdWPMask("againstElectron%sMVA62018", choices=("VLoose","Loose","Medium","Tight","VTight"), 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)") + idAntiEle = _tauIdWPMask("againstElectron%sMVA6", choices=("VLoose","Loose","Medium","Tight","VTight"), doc= "Anti-electron MVA discriminator V6 (2015)") ) for era in [run2_miniAOD_80XLegacy, run2_nanoAOD_92X, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, \ @@ -179,6 +215,16 @@ def _tauId8WPMask(pattern,doc): era.toModify(tauTable.variables, idAntiEleDeadECal = Var("tauID('againstElectronDeadECALForNano')", bool, doc = "Anti-electron dead-ECal discriminator"), ) +(run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1| run2_nanoAOD_94XMiniAODv2 | \ + run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1 +).toModify(tauTable.variables, + rawDeepTau2018v2p5VSe = None, + rawDeepTau2018v2p5VSmu = None, + rawDeepTau2018v2p5VSjet = None, + idDeepTau2018v2p5VSe = None, + idDeepTau2018v2p5VSmu = None, + idDeepTau2018v2p5VSjet = None + ) tauGenJetsForNano = tauGenJets.clone( GenParticles = "finalGenParticles", diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index 8285ff7efce38..f68e5bf3261d1 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -377,6 +377,7 @@ def _add_deepFlavour(process): process, debug = False, originalTauName = _noUpdatedTauName, updatedTauName = _updatedTauName, + postfix = 'ForMini', toKeep = ['deepTau2017v2p1','deepTau2018v2p5'] ) from Configuration.Eras.Modifier_phase2_common_cff import phase2_common #Phase2 Tau MVA @@ -386,8 +387,8 @@ def _add_deepFlavour(process): addToProcessAndTask(_noUpdatedTauName, process.slimmedTaus.clone(),process,task) delattr(process, 'slimmedTaus') process.slimmedTaus = getattr(process, _updatedTauName).clone() - process.rerunMvaIsolationTask.add(process.slimmedTaus) - task.add(process.rerunMvaIsolationTask) + process.rerunMvaIsolationTaskForMini.add(process.slimmedTaus) + task.add(process.rerunMvaIsolationTaskForMini) #-- Rerun tauID against dead ECal towers to taus for the various re-MiniAOD eras # to enable default behoviour with leading track extrapolation to ECAL diff --git a/RecoTauTag/RecoTau/python/tauIdWPsDefs.py b/RecoTauTag/RecoTau/python/tauIdWPsDefs.py new file mode 100644 index 0000000000000..134375939e148 --- /dev/null +++ b/RecoTauTag/RecoTau/python/tauIdWPsDefs.py @@ -0,0 +1,57 @@ +WORKING_POINTS_v2p1 = { + "e": { + "VVVLoose": 0.0630386, + "VVLoose": 0.1686942, + "VLoose": 0.3628130, + "Loose": 0.6815435, + "Medium": 0.8847544, + "Tight": 0.9675541, + "VTight": 0.9859251, + "VVTight": 0.9928449, + }, + "mu": { + "VLoose": 0.1058354, + "Loose": 0.2158633, + "Medium": 0.5551894, + "Tight": 0.8754835, + }, + "jet": { + "VVVLoose": 0.2599605, + "VVLoose": 0.4249705, + "VLoose": 0.5983682, + "Loose": 0.7848675, + "Medium": 0.8834768, + "Tight": 0.9308689, + "VTight": 0.9573137, + "VVTight": 0.9733927, + }, +} + +WORKING_POINTS_v2p5 = { + "e": { + "VVVLoose": 0.099, + "VVLoose": 0.2384, + "VLoose": 0.4136, + "Loose": 0.688, + "Medium": 0.8704, + "Tight": 0.9669, + "VTight": 0.9882, + "VVTight": 0.9951 + }, + "mu": { + "VLoose": 0.2949, + "Loose": 0.4746, + "Medium": 0.7454, + "Tight": 0.9172 + }, + "jet": { + "VVVLoose": 0.4083, + "VVLoose": 0.6285, + "VLoose": 0.8052, + "Loose": 0.9233, + "Medium": 0.9632, + "Tight": 0.9799, + "VTight": 0.9884, + "VVTight": 0.9931 + } +} diff --git a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py index e61582fec7e01..8ccc269ac34f9 100644 --- a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py +++ b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py @@ -3,6 +3,8 @@ from RecoTauTag.RecoTau.TauDiscriminatorTools import noPrediscriminants from RecoTauTag.RecoTau.PATTauDiscriminationByMVAIsolationRun2_cff import patDiscriminationByIsolationMVArun2v1raw, patDiscriminationByIsolationMVArun2v1 from RecoTauTag.RecoTau.DeepTau_cfi import DeepTau +from RecoTauTag.RecoTau.tauIdWPsDefs import WORKING_POINTS_v2p1, WORKING_POINTS_v2p5 + import os import re @@ -58,7 +60,6 @@ def __init__(self, process, debug = False, if discr not in TauIDEmbedder.availableDiscriminators: raise RuntimeError('TauIDEmbedder: discriminator "{}" is not supported'.format(discr)) self.toKeep = toKeep - @staticmethod def get_cmssw_version(debug = False): @@ -562,34 +563,7 @@ def runTauID(self): if self.debug: print ("Adding DeepTau IDs") _deepTauName = "deepTau2017v2" - workingPoints_ = { - "e": { - "VVVLoose": 0.0630386, - "VVLoose": 0.1686942, - "VLoose": 0.3628130, - "Loose": 0.6815435, - "Medium": 0.8847544, - "Tight": 0.9675541, - "VTight": 0.9859251, - "VVTight": 0.9928449, - }, - "mu": { - "VLoose": 0.1058354, - "Loose": 0.2158633, - "Medium": 0.5551894, - "Tight": 0.8754835, - }, - "jet": { - "VVVLoose": 0.2599605, - "VVLoose": 0.4249705, - "VLoose": 0.5983682, - "Loose": 0.7848675, - "Medium": 0.8834768, - "Tight": 0.9308689, - "VTight": 0.9573137, - "VVTight": 0.9733927, - }, - } + workingPoints_ = WORKING_POINTS_v2p1 file_names = [ 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb', @@ -602,7 +576,7 @@ def runTauID(self): taus = self.originalTauName, graph_file = file_names, version = full_version[1], - sub_version = 0 #MB: subversion cannot be properly deduced from file names + sub_version = 1 #MB: subversion cannot be properly deduced from file names; it should be 1 also for v2 )) self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_) @@ -616,34 +590,7 @@ def runTauID(self): if self.debug: print ("Adding DeepTau IDs") _deepTauName = "deepTau2017v2p1" - workingPoints_ = { - "e": { - "VVVLoose": 0.0630386, - "VVLoose": 0.1686942, - "VLoose": 0.3628130, - "Loose": 0.6815435, - "Medium": 0.8847544, - "Tight": 0.9675541, - "VTight": 0.9859251, - "VVTight": 0.9928449, - }, - "mu": { - "VLoose": 0.1058354, - "Loose": 0.2158633, - "Medium": 0.5551894, - "Tight": 0.8754835, - }, - "jet": { - "VVVLoose": 0.2599605, - "VVLoose": 0.4249705, - "VLoose": 0.5983682, - "Loose": 0.7848675, - "Medium": 0.8834768, - "Tight": 0.9308689, - "VTight": 0.9573137, - "VVTight": 0.9733927, - }, - } + workingPoints_ = WORKING_POINTS_v2p1 file_names = [ 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',