CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
boostedTaus_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
4 
5 ##################### Import reusable funtions and objects from std taus ########
6 from PhysicsTools.NanoAOD.taus_cff import _tauId2WPMask,_tauId5WPMask,_tauId7WPMask,tausMCMatchLepTauForTable,tausMCMatchHadTauForTable,tauMCTable
7 
8 ##################### User floats producers, selectors ##########################
9 
10 
11 finalBoostedTaus = cms.EDFilter("PATTauRefSelector",
12  src = cms.InputTag("slimmedTausBoostedNewID"),
13  cut = cms.string("pt > 40 && tauID('decayModeFindingNewDMs') && (tauID('byVVLooseIsolationMVArun2017v2DBoldDMwLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBnewDMwLT2017'))")
14 )
15 
16 boostedTauTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
17  src = cms.InputTag("finalBoostedTaus"),
18  cut = cms.string(""), #we should not filter on cross linked collections
19  name= cms.string("boostedTau"),
20  doc = cms.string("slimmedBoostedTaus after basic selection (" + finalBoostedTaus.cut.value()+")"),
21  singleton = cms.bool(False), # the number of entries is variable
22  extension = cms.bool(False), # this is the main table for the taus
23  variables = cms.PSet() # PSet defined below in era dependent way
24 )
25 _boostedTauVarsBase = cms.PSet(P4Vars,
26  charge = Var("charge", int, doc="electric charge"),
27  jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"),
28  decayMode = Var("decayMode()",int),
29  leadTkPtOverTauPt = Var("leadChargedHadrCand.pt/pt ",float, doc="pt of the leading track divided by tau pt",precision=10),
30  leadTkDeltaEta = Var("leadChargedHadrCand.eta - eta ",float, doc="eta of the leading track, minus tau eta",precision=8),
31  leadTkDeltaPhi = Var("deltaPhi(leadChargedHadrCand.phi, phi) ",float, doc="phi of the leading track, minus tau phi",precision=8),
32 
33  rawIso = Var( "tauID('byCombinedIsolationDeltaBetaCorrRaw3Hits')", float, doc = "combined isolation (deltaBeta corrections)", precision=10),
34  rawIsodR03 = Var( "(tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum')))", float, doc = "combined isolation (deltaBeta corrections, dR=0.3)", precision=10),
35  chargedIso = Var( "tauID('chargedIsoPtSum')", float, doc = "charged isolation", precision=10),
36  neutralIso = Var( "tauID('neutralIsoPtSum')", float, doc = "neutral (photon) isolation", precision=10),
37  puCorr = Var( "tauID('puCorrPtSum')", float, doc = "pileup correction", precision=10),
38  photonsOutsideSignalCone = Var( "tauID('photonPtSumOutsideSignalCone')", float, doc = "sum of photons outside signal cone", precision=10),
39  idAntiMu = _tauId2WPMask("againstMuon%s3", doc= "Anti-muon discriminator V3: "),
40  #MVA 2017 v2 variables
41  rawMVAoldDM2017v2=Var("tauID('byIsolationMVArun2017v2DBoldDMwLTraw2017')",float, doc="byIsolationMVArun2017v2DBoldDMwLT raw output discriminator (2017v2)",precision=10),
42  rawMVAnewDM2017v2 = Var("tauID('byIsolationMVArun2017v2DBnewDMwLTraw2017')",float,doc='byIsolationMVArun2017v2DBnewDMwLT raw output discriminator (2017v2)',precision=10),
43  rawMVAoldDMdR032017v2 = Var("tauID('byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017')",float,doc='byIsolationMVArun2017v2DBoldDMdR0p3wLT raw output discriminator (2017v2)'),
44  idMVAnewDM2017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBnewDMwLT2017", doc="IsolationMVArun2017v2DBnewDMwLT ID working point (2017v2)"),
45  idMVAoldDM2017v2=_tauId7WPMask("by%sIsolationMVArun2017v2DBoldDMwLT2017",doc="IsolationMVArun2017v2DBoldDMwLT ID working point (2017v2)"),
46  idMVAoldDMdR032017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBoldDMdR0p3wLT2017",doc="IsolationMVArun2017v2DBoldDMdR0p3wLT ID working point (2017v2)"),
47  rawAntiEle2018 = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10),
48  rawAntiEleCat2018 = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category (2018)"),
49  idAntiEle2018 = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6 (2018)"),
50 )
51 
52 boostedTauTable.variables = _boostedTauVarsBase
53 
54 
55 boostedTausMCMatchLepTauForTable = tausMCMatchLepTauForTable.clone(
56  src = boostedTauTable.src
57 )
58 
59 #This requires genVisTaus in taus_cff.py
60 boostedTausMCMatchHadTauForTable = tausMCMatchHadTauForTable.clone(
61  src = boostedTauTable.src
62 )
63 
64 boostedTauMCTable = tauMCTable.clone(
65  src = boostedTauTable.src,
66  mcMap = cms.InputTag("boostedTausMCMatchLepTauForTable"),
67  mcMapVisTau = cms.InputTag("boostedTausMCMatchHadTauForTable"),
68  objName = boostedTauTable.name,
69 )
70 
71 
72 boostedTauTask = cms.Task(finalBoostedTaus)
73 boostedTauTablesTask = cms.Task(boostedTauTable)
74 boostedTauMCTask = cms.Task(boostedTausMCMatchLepTauForTable,boostedTausMCMatchHadTauForTable,boostedTauMCTable)
75 
76 #remove boosted tau from previous eras
77 _modifiers = (run2_miniAOD_80XLegacy | run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1)
78 (_modifiers).toReplaceWith(boostedTauTask,cms.Task())
79 (_modifiers).toReplaceWith(boostedTauTablesTask,cms.Task())
80 (_modifiers).toReplaceWith(boostedTauMCTask,cms.Task())
def _tauId2WPMask
Definition: taus_cff.py:35
def _tauId7WPMask
Definition: taus_cff.py:45
def _tauId5WPMask
Definition: taus_cff.py:41