1 |
dgele |
1.1 |
import FWCore.ParameterSet.Config as cms
|
2 |
|
|
|
3 |
|
|
from PhysicsTools.PatAlgos.tools.coreTools import *
|
4 |
|
|
|
5 |
|
|
def redoPFTauDiscriminators(process,
|
6 |
|
|
oldPFTauLabel = cms.InputTag('pfRecoTauProducer'),
|
7 |
|
|
newPFTauLabel = cms.InputTag('pfRecoTauProducer')):
|
8 |
|
|
process.patAODExtraReco += process.patPFTauDiscrimination
|
9 |
|
|
process.patPFTauDiscrimination.replace(
|
10 |
|
|
process.pfRecoTauDiscriminationAgainstMuon,
|
11 |
|
|
process.pfRecoTauDiscriminationAgainstMuon +
|
12 |
|
|
process.pfRecoTauDiscriminationByIsolationUsingLeadingPion +
|
13 |
|
|
process.pfRecoTauDiscriminationByLeadingPionPtCut +
|
14 |
|
|
process.pfRecoTauDiscriminationByTrackIsolationUsingLeadingPion +
|
15 |
|
|
process.pfRecoTauDiscriminationByECALIsolationUsingLeadingPion +
|
16 |
|
|
process.pfTauDecayMode)
|
17 |
|
|
massSearchReplaceParam(process.patPFTauDiscrimination, 'PFTauProducer', oldPFTauLabel, newPFTauLabel)
|
18 |
|
|
|
19 |
|
|
# switch to CaloTau collection
|
20 |
|
|
def switchToCaloTau(process,
|
21 |
|
|
pfTauLabel = cms.InputTag('pfRecoTauProducer'),
|
22 |
|
|
caloTauLabel = cms.InputTag('caloRecoTauProducer')):
|
23 |
|
|
switchMCAndTriggerMatch(process, pfTauLabel, caloTauLabel)
|
24 |
|
|
process.allLayer1Taus.tauSource = caloTauLabel
|
25 |
|
|
process.allLayer1Taus.isolation = cms.PSet() # there is no path for calo tau isolation available at the moment
|
26 |
|
|
process.allLayer1Taus.isoDeposits = cms.PSet() # there is no path for calo tau isolation available at the moment
|
27 |
|
|
process.allLayer1Taus.tauIDSources = cms.PSet( # all these are already present in 2.2.X AODSIM
|
28 |
|
|
leadingTrackFinding = cms.InputTag("caloRecoTauDiscriminationByLeadingTrackFinding"),
|
29 |
|
|
leadingTrackPtCut = cms.InputTag("caloRecoTauDiscriminationByLeadingTrackPtCut"),
|
30 |
|
|
byIsolation = cms.InputTag("caloRecoTauDiscriminationByIsolation"),
|
31 |
|
|
againstElectron = cms.InputTag("caloRecoTauDiscriminationAgainstElectron"),
|
32 |
|
|
)
|
33 |
|
|
if pfTauLabel in process.aodSummary.candidates:
|
34 |
|
|
process.aodSummary.candidates[process.aodSummary.candidates.index(pfTauLabel)] = caloTauLabel
|
35 |
|
|
else:
|
36 |
|
|
process.aodSummary.candidates += [caloTauLabel]
|
37 |
|
|
|
38 |
|
|
# internal auxiliary function to switch to **any** PFTau collection
|
39 |
|
|
def _switchToPFTau(process, pfTauLabelOld, pfTauLabelNew, pfTauType):
|
40 |
|
|
switchMCAndTriggerMatch(process, pfTauLabelOld, pfTauLabelNew)
|
41 |
|
|
process.tauIsoDepositPFCandidates.src = pfTauLabelNew
|
42 |
|
|
process.tauIsoDepositPFCandidates.ExtractorPSet.tauSource = pfTauLabelNew
|
43 |
|
|
process.tauIsoDepositPFChargedHadrons.src = pfTauLabelNew
|
44 |
|
|
process.tauIsoDepositPFChargedHadrons.ExtractorPSet.tauSource = pfTauLabelNew
|
45 |
|
|
process.tauIsoDepositPFNeutralHadrons.src = pfTauLabelNew
|
46 |
|
|
process.tauIsoDepositPFNeutralHadrons.ExtractorPSet.tauSource = pfTauLabelNew
|
47 |
|
|
process.tauIsoDepositPFGammas.src = pfTauLabelNew
|
48 |
|
|
process.tauIsoDepositPFGammas.ExtractorPSet.tauSource = pfTauLabelNew
|
49 |
|
|
process.allLayer1Taus.tauSource = pfTauLabelNew
|
50 |
|
|
process.allLayer1Taus.tauIDSources = cms.PSet(
|
51 |
|
|
leadingTrackFinding = cms.InputTag(pfTauType + "DiscriminationByLeadingTrackFinding"),
|
52 |
|
|
leadingTrackPtCut = cms.InputTag(pfTauType + "DiscriminationByLeadingTrackPtCut"),
|
53 |
|
|
trackIsolation = cms.InputTag(pfTauType + "DiscriminationByTrackIsolation"),
|
54 |
|
|
ecalIsolation = cms.InputTag(pfTauType + "DiscriminationByECALIsolation"),
|
55 |
|
|
byIsolation = cms.InputTag(pfTauType + "DiscriminationByIsolation"),
|
56 |
|
|
againstElectron = cms.InputTag(pfTauType + "DiscriminationAgainstElectron"),
|
57 |
|
|
againstMuon = cms.InputTag(pfTauType + "DiscriminationAgainstMuon")
|
58 |
|
|
#
|
59 |
|
|
# CV: TaNC only trained for shrinkingCone PFTaus up to now,
|
60 |
|
|
# so cannot implement switch of TaNC based discriminators
|
61 |
|
|
# generically for all kinds of PFTaus yet...
|
62 |
|
|
#
|
63 |
|
|
#byTaNC = cms.InputTag(pfTauType + "DiscriminationByTaNC"),
|
64 |
|
|
#byTaNCfrOnePercent = cms.InputTag(pfTauType + "DiscriminationByTaNCfrOnePercent"),
|
65 |
|
|
#byTaNCfrHalfPercent = cms.InputTag(pfTauType + "DiscriminationByTaNCfrHalfPercent"),
|
66 |
|
|
#byTaNCfrQuarterPercent = cms.InputTag(pfTauType + "DiscriminationByTaNCfrQuarterPercent"),
|
67 |
|
|
#byTaNCfrTenthPercent = cms.InputTag(pfTauType + "DiscriminationByTaNCfrTenthPercent")
|
68 |
|
|
)
|
69 |
|
|
process.allLayer1Taus.decayModeSrc = cms.InputTag(pfTauType + "DecayModeProducer")
|
70 |
|
|
if pfTauLabelOld in process.aodSummary.candidates:
|
71 |
|
|
process.aodSummary.candidates[process.aodSummary.candidates.index(pfTauLabelOld)] = pfTauLabelNew
|
72 |
|
|
else:
|
73 |
|
|
process.aodSummary.candidates += [pfTauLabelOld]
|
74 |
|
|
|
75 |
|
|
# switch to PFTau collection produced for fixed dR = 0.07 signal cone size
|
76 |
|
|
def switchToPFTauFixedCone(process,
|
77 |
|
|
pfTauLabelOld = cms.InputTag('pfRecoTauProducer'),
|
78 |
|
|
pfTauLabelNew = cms.InputTag('fixedConePFTauProducer')):
|
79 |
|
|
_switchToPFTau(process, pfTauLabelOld, pfTauLabelNew, 'fixedConePFTau')
|
80 |
|
|
#
|
81 |
|
|
# CV: PFTauDecayMode objects produced only for shrinking cone reco::PFTaus in
|
82 |
|
|
# RecoTauTag/Configuration global_PFTau_22X_V00-02-01 and CMSSW_3_1_x tags,
|
83 |
|
|
# so need to disable embedding of PFTauDecayMode information into pat::Tau for now...
|
84 |
|
|
#
|
85 |
|
|
process.allLayer1Taus.addDecayMode = cms.bool(False)
|
86 |
|
|
|
87 |
|
|
# switch to PFTau collection produced for fixed dR = 0.15 signal cone size
|
88 |
|
|
def switchToPFTauFixedConeHighEff(process,
|
89 |
|
|
pfTauLabelOld = cms.InputTag('pfRecoTauProducer'),
|
90 |
|
|
pfTauLabelNew = cms.InputTag('fixedConeHighEffPFTauProducer')):
|
91 |
|
|
_switchToPFTau(process, pfTauLabelOld, pfTauLabelNew, 'fixedConeHighEffPFTau')
|
92 |
|
|
#
|
93 |
|
|
# CV: PFTauDecayMode objects produced only for shrinking cone reco::PFTaus in
|
94 |
|
|
# RecoTauTag/Configuration global_PFTau_22X_V00-02-01 and CMSSW_3_1_x tags,
|
95 |
|
|
# so need to disable embedding of PFTauDecayMode information into pat::Tau for now...
|
96 |
|
|
#
|
97 |
|
|
process.allLayer1Taus.addDecayMode = cms.bool(False)
|
98 |
|
|
|
99 |
|
|
# switch to PFTau collection produced for shrinking signal cone of size dR = 5.0/Et(PFTau)
|
100 |
|
|
def switchToPFTauShrinkingCone(process,
|
101 |
|
|
pfTauLabelOld = cms.InputTag('pfRecoTauProducer'),
|
102 |
|
|
pfTauLabelNew = cms.InputTag('shrinkingConePFTauProducer')):
|
103 |
|
|
_switchToPFTau(process, pfTauLabelOld, pfTauLabelNew, 'shrinkingConePFTau')
|
104 |
|
|
#
|
105 |
|
|
# CV: TaNC only trained for shrinkingCone PFTaus up to now,
|
106 |
|
|
# so need to add TaNC based discriminators
|
107 |
|
|
# specifically for that case here...
|
108 |
|
|
#
|
109 |
|
|
process.allLayer1Taus.tauIDSources = cms.PSet(
|
110 |
|
|
leadingTrackFinding = cms.InputTag("shrinkingConePFTauDiscriminationByLeadingTrackFinding"),
|
111 |
|
|
leadingTrackPtCut = cms.InputTag("shrinkingConePFTauDiscriminationByLeadingTrackPtCut"),
|
112 |
|
|
trackIsolation = cms.InputTag("shrinkingConePFTauDiscriminationByTrackIsolation"),
|
113 |
|
|
ecalIsolation = cms.InputTag("shrinkingConePFTauDiscriminationByECALIsolation"),
|
114 |
|
|
byIsolation = cms.InputTag("shrinkingConePFTauDiscriminationByIsolation"),
|
115 |
|
|
againstElectron = cms.InputTag("shrinkingConePFTauDiscriminationAgainstElectron"),
|
116 |
|
|
againstMuon = cms.InputTag("shrinkingConePFTauDiscriminationAgainstMuon"),
|
117 |
|
|
byTaNC = cms.InputTag("shrinkingConePFTauDiscriminationByTaNC"),
|
118 |
|
|
byTaNCfrOnePercent = cms.InputTag("shrinkingConePFTauDiscriminationByTaNCfrOnePercent"),
|
119 |
|
|
byTaNCfrHalfPercent = cms.InputTag("shrinkingConePFTauDiscriminationByTaNCfrHalfPercent"),
|
120 |
|
|
byTaNCfrQuarterPercent = cms.InputTag("shrinkingConePFTauDiscriminationByTaNCfrQuarterPercent"),
|
121 |
|
|
byTaNCfrTenthPercent = cms.InputTag("shrinkingConePFTauDiscriminationByTaNCfrTenthPercent")
|
122 |
|
|
)
|
123 |
|
|
|