CMS 3D CMS Logo

boostedHPSPFTaus_cfi.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 import PhysicsTools.PatAlgos.tools.helpers as configtools
3 
4 def addBoostedTaus(process):
5  from PhysicsTools.PatAlgos.tools.helpers import cloneProcessingSnippet
6  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
7 
8  process.load("RecoTauTag.Configuration.boostedHPSPFTaus_cff")
9  patAlgosToolsTask = configtools.getPatAlgosToolsTask(process)
10  patAlgosToolsTask.add(process.boostedHPSPFTausTask)
11 
12  process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")
13  # BDT-based tauIDs removed from standard tau sequence, but still used by boosed taus
14  process.PFTauMVAIdSequence = cms.Sequence(
15  process.hpsPFTauDiscriminationByMVA6rawElectronRejection+
16  process.hpsPFTauDiscriminationByMVA6ElectronRejection+
17  process.hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw+
18  process.hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLT+
19  process.hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw+
20  process.hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLT
21  )
22  process.PATTauSequence = cms.Sequence(
23  process.PFTau+process.PFTauMVAIdSequence+
24  process.makePatTaus+process.selectedPatTaus)
25  process.PATTauSequenceBoosted = cloneProcessingSnippet(process,process.PATTauSequence, "Boosted", addToTask = True)
26  process.recoTauAK4PFJets08RegionBoosted.src = 'boostedTauSeeds'
27  process.recoTauAK4PFJets08RegionBoosted.pfCandSrc = 'particleFlow'
28  process.recoTauAK4PFJets08RegionBoosted.pfCandAssocMapSrc = ('boostedTauSeeds', 'pfCandAssocMapForIsolation')
29  process.ak4PFJetsLegacyHPSPiZerosBoosted.jetSrc = 'boostedTauSeeds'
30  process.ak4PFJetsRecoTauChargedHadronsBoosted.jetSrc = 'boostedTauSeeds'
31  process.ak4PFJetsRecoTauChargedHadronsBoosted.builders[1].dRcone = 0.3
32  process.ak4PFJetsRecoTauChargedHadronsBoosted.builders[1].dRconeLimitedToJetArea = True
33  process.combinatoricRecoTausBoosted.jetSrc = 'boostedTauSeeds'
34  process.combinatoricRecoTausBoosted.builders[0].pfCandSrc = cms.InputTag('particleFlow')
35 
37  process.hpsPFTauDiscriminationByMuonRejection3Boosted.dRmuonMatch = 0.1
38  massSearchReplaceAnyInputTag(process.PATTauSequenceBoosted,cms.InputTag("ak4PFJets"),cms.InputTag("boostedTauSeeds"))
39  #Add BDT-based tauIDs still used by boosed taus
41  containerID(process.patTausBoosted.tauIDSources, "hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLTBoosted", "rawValues", [
42  ["byIsolationMVArun2DBoldDMwLTraw", "discriminator"]
43  ])
44  containerID(process.patTausBoosted.tauIDSources, "hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLTBoosted", "workingPoints", [
45  ["byVVLooseIsolationMVArun2DBoldDMwLT", "_VVLoose"],
46  ["byVLooseIsolationMVArun2DBoldDMwLT", "_VLoose"],
47  ["byLooseIsolationMVArun2DBoldDMwLT", "_Loose"],
48  ["byMediumIsolationMVArun2DBoldDMwLT", "_Medium"],
49  ["byTightIsolationMVArun2DBoldDMwLT", "_Tight"],
50  ["byVTightIsolationMVArun2DBoldDMwLT", "_VTight"],
51  ["byVVTightIsolationMVArun2DBoldDMwLT", "_VVTight"]
52  ])
53  containerID(process.patTausBoosted.tauIDSources, "hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLTBoosted", "rawValues", [
54  ["byIsolationMVArun2DBnewDMwLTraw", "discriminator"]
55  ])
56  containerID(process.patTausBoosted.tauIDSources, "hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLTBoosted", "workingPoints", [
57  ["byVVLooseIsolationMVArun2DBnewDMwLT", "_VVLoose"],
58  ["byVLooseIsolationMVArun2DBnewDMwLT", "_VLoose"],
59  ["byLooseIsolationMVArun2DBnewDMwLT", "_Loose"],
60  ["byMediumIsolationMVArun2DBnewDMwLT", "_Medium"],
61  ["byTightIsolationMVArun2DBnewDMwLT", "_Tight"],
62  ["byVTightIsolationMVArun2DBnewDMwLT", "_VTight"],
63  ["byVVTightIsolationMVArun2DBnewDMwLT", "_VVTight"]
64  ])
65  containerID(process.patTausBoosted.tauIDSources, "hpsPFTauDiscriminationByMVA6ElectronRejectionBoosted", "rawValues", [
66  ["againstElectronMVA6Raw", "discriminator"],
67  ["againstElectronMVA6category", "category"]
68  ])
69  containerID(process.patTausBoosted.tauIDSources, "hpsPFTauDiscriminationByMVA6ElectronRejectionBoosted", "workingPoints", [
70  ["againstElectronVLooseMVA6", "_VLoose"],
71  ["againstElectronLooseMVA6", "_Loose"],
72  ["againstElectronMediumMVA6", "_Medium"],
73  ["againstElectronTightMVA6", "_Tight"],
74  ["againstElectronVTightMVA6", "_VTight"]
75  ])
76  process.slimmedTausBoosted = process.slimmedTaus.clone(src = "selectedPatTausBoosted")
77  patAlgosToolsTask.add(process.slimmedTausBoosted)
78 
79  return process
def cloneProcessingSnippet(process, sequence, postfix, removePostfix="", noClones=[], addToTask=False, verbose=False)
Definition: helpers.py:257
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:79
def containerID(pset, inputID, provCfgLabel, wps)