00001 import FWCore.ParameterSet.Config as cms
00002 import RecoTauTag.RecoTau.RecoTauCleanerPlugins as cleaners
00003 from RecoTauTag.RecoTau.TauDiscriminatorTools import adaptTauDiscriminator, \
00004 producerIsTauTypeMapper
00005 import copy
00006
00007 from RecoTauTag.RecoTau.hpstanc_transforms import transforms
00008
00009
00010 from RecoTauTag.RecoTau.TauDiscriminatorTools import noPrediscriminants
00011
00012 from RecoTauTag.RecoTau.PFRecoTauDiscriminationByLeadingPionPtCut_cfi import \
00013 pfRecoTauDiscriminationByLeadingPionPtCut
00014
00015 combinatoricRecoTausDiscriminationByLeadingPionPtCut = \
00016 pfRecoTauDiscriminationByLeadingPionPtCut.clone(
00017 PFTauProducer = cms.InputTag("combinatoricRecoTaus")
00018 )
00019
00020
00021
00022 from RecoTauTag.Configuration.RecoTauMVAConfiguration_cfi \
00023 import TauTagMVAComputerRecord
00024
00025
00026 from RecoTauTag.RecoTau.RecoTauDiscriminantConfiguration import \
00027 discriminantConfiguration
00028
00029 combinatoricRecoTausDiscriminationByTanc = cms.EDProducer(
00030 "RecoTauMVADiscriminator",
00031 PFTauProducer = cms.InputTag("combinatoricRecoTaus"),
00032 Prediscriminants = noPrediscriminants,
00033 dbLabel = cms.string("hpstanc"),
00034 remapOutput = cms.bool(True),
00035 mvas = cms.VPSet(
00036 cms.PSet(
00037 nCharged = cms.uint32(1),
00038 nPiZeros = cms.uint32(0),
00039 mvaLabel = cms.string("1prong0pi0"),
00040 ),
00041 cms.PSet(
00042 nCharged = cms.uint32(1),
00043 nPiZeros = cms.uint32(1),
00044 mvaLabel = cms.string("1prong1pi0"),
00045 ),
00046 cms.PSet(
00047 nCharged = cms.uint32(1),
00048 nPiZeros = cms.uint32(2),
00049 mvaLabel = cms.string("1prong2pi0"),
00050 ),
00051 cms.PSet(
00052 nCharged = cms.uint32(3),
00053 nPiZeros = cms.uint32(0),
00054 mvaLabel = cms.string("3prong0pi0"),
00055 ),
00056 ),
00057 discriminantOptions = discriminantConfiguration,
00058 )
00059
00060
00061
00062 combinatoricRecoTausTancTransform = cms.EDProducer(
00063 "RecoTauMVATransform",
00064 transforms = transforms,
00065 PFTauProducer = cms.InputTag("combinatoricRecoTaus"),
00066 toTransform = cms.InputTag("combinatoricRecoTausDiscriminationByTanc"),
00067 Prediscriminants = noPrediscriminants
00068 )
00069
00070 from RecoTauTag.RecoTau.PFRecoTauDiscriminationByHPSSelection_cfi import \
00071 hpsSelectionDiscriminator
00072
00073 combinatoricRecoTausHPSSelector = hpsSelectionDiscriminator.clone(
00074 src = cms.InputTag("combinatoricRecoTaus"),
00075 minTauPt = cms.double(5.),
00076
00077 coneSizeFormula = cms.string('0.3'),
00078 )
00079
00080
00081 hpsTancTaus = cms.EDProducer(
00082 "RecoTauCleaner",
00083 src = cms.InputTag("combinatoricRecoTaus"),
00084 cleaners = cms.VPSet(
00085
00086 cleaners.unitCharge,
00087
00088 cleaners.matchingConeCut,
00089
00090 cms.PSet(
00091 name = cms.string("lead pion"),
00092 plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
00093 src = cms.InputTag("combinatoricRecoTausDiscriminationByLeadingPionPtCut")
00094 ),
00095
00096 cms.PSet(
00097 name = cms.string("HPS selection"),
00098 plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
00099 src = cms.InputTag("combinatoricRecoTausHPSSelector")
00100 ),
00101 cleaners.combinedIsolation
00102 )
00103 )
00104
00105
00106 hpsTancTausDiscriminationByLeadingPionPtCut = \
00107 combinatoricRecoTausDiscriminationByLeadingPionPtCut.clone(
00108 PFTauProducer = cms.InputTag("hpsTancTaus"))
00109
00110 _leadPionPrediscriminant = cms.PSet(
00111 BooleanOperator = cms.string("and"),
00112 leadPion = cms.PSet(
00113 Producer = cms.InputTag(
00114 'hpsTancTausDiscriminationByLeadingPionPtCut'),
00115 cut = cms.double(0.5)
00116 )
00117 )
00118
00119
00120 hpsTancTausDiscriminationByDecayModeSelection = \
00121 combinatoricRecoTausHPSSelector.clone(
00122 PFTauProducer = cms.InputTag("hpsTancTaus"),
00123 )
00124
00125 from RecoTauTag.Configuration.HPSPFTaus_cff import requireDecayMode,\
00126 hpsPFTauDiscriminationByVLooseIsolation,\
00127 hpsPFTauDiscriminationByLooseIsolation,\
00128 hpsPFTauDiscriminationByMediumIsolation,\
00129 hpsPFTauDiscriminationByTightIsolation
00130
00131
00132 from RecoTauTag.RecoTau.PFRecoTauDiscriminationByLeadingTrackFinding_cfi import\
00133 pfRecoTauDiscriminationByLeadingTrackFinding
00134 hpsTancTausDiscriminationByLeadingTrackFinding = copy.deepcopy(
00135 pfRecoTauDiscriminationByLeadingTrackFinding)
00136 adaptTauDiscriminator(hpsTancTausDiscriminationByLeadingTrackFinding,
00137 "hpsTancTaus", newTauTypeMapper=producerIsTauTypeMapper)
00138
00139 from RecoTauTag.RecoTau.PFRecoTauDiscriminationByLeadingTrackPtCut_cfi import \
00140 pfRecoTauDiscriminationByLeadingTrackPtCut
00141 hpsTancTausDiscriminationByLeadingTrackPtCut = copy.deepcopy(
00142 pfRecoTauDiscriminationByLeadingTrackPtCut)
00143 adaptTauDiscriminator(hpsTancTausDiscriminationByLeadingTrackPtCut,
00144 "hpsTancTaus", newTauTypeMapper=producerIsTauTypeMapper)
00145
00146 from RecoTauTag.RecoTau.PFRecoTauDiscriminationAgainstElectron_cfi import \
00147 pfRecoTauDiscriminationAgainstElectron
00148
00149
00150
00151
00152
00153 from RecoTauTag.RecoTau.PFRecoTauDiscriminationAgainstMuon_cfi import \
00154 pfRecoTauDiscriminationAgainstMuon
00155
00156
00157
00158
00159
00160
00161 def _setupDiscriminator(disc):
00162 adaptTauDiscriminator(
00163 disc, "hpsTancTaus", newTauTypeMapper=producerIsTauTypeMapper)
00164
00165 hpsTancTausDiscriminationByLooseElectronRejection = copy.deepcopy(pfRecoTauDiscriminationAgainstElectron)
00166 _setupDiscriminator(hpsTancTausDiscriminationByLooseElectronRejection)
00167 hpsTancTausDiscriminationByLooseElectronRejection.Prediscriminants = noPrediscriminants
00168 hpsTancTausDiscriminationByLooseElectronRejection.PFElectronMVA_maxValue = cms.double(0.6)
00169
00170 hpsTancTausDiscriminationByMediumElectronRejection = copy.deepcopy(pfRecoTauDiscriminationAgainstElectron)
00171 _setupDiscriminator(hpsTancTausDiscriminationByMediumElectronRejection)
00172 hpsTancTausDiscriminationByMediumElectronRejection.Prediscriminants = noPrediscriminants
00173 hpsTancTausDiscriminationByMediumElectronRejection.ApplyCut_EcalCrackCut = cms.bool(True)
00174
00175 hpsTancTausDiscriminationByTightElectronRejection = copy.deepcopy(pfRecoTauDiscriminationAgainstElectron)
00176 _setupDiscriminator(hpsTancTausDiscriminationByTightElectronRejection)
00177 hpsTancTausDiscriminationByTightElectronRejection.Prediscriminants = noPrediscriminants
00178 hpsTancTausDiscriminationByTightElectronRejection.ApplyCut_EcalCrackCut = cms.bool(True)
00179 hpsTancTausDiscriminationByTightElectronRejection.ApplyCut_BremCombined = cms.bool(True)
00180
00181 hpsTancTausDiscriminationByLooseMuonRejection = copy.deepcopy(pfRecoTauDiscriminationAgainstMuon)
00182 _setupDiscriminator(hpsTancTausDiscriminationByLooseMuonRejection)
00183 hpsTancTausDiscriminationByLooseMuonRejection.Prediscriminants = noPrediscriminants
00184
00185 hpsTancTausDiscriminationByTightMuonRejection = copy.deepcopy(pfRecoTauDiscriminationAgainstMuon)
00186 _setupDiscriminator(hpsTancTausDiscriminationByTightMuonRejection)
00187 hpsTancTausDiscriminationByTightMuonRejection.Prediscriminants = noPrediscriminants
00188 hpsTancTausDiscriminationByTightMuonRejection.discriminatorOption = cms.string('noAllArbitrated')
00189
00190 from RecoTauTag.RecoTau.PFRecoTauDiscriminationAgainstCaloMuon_cfi import \
00191 pfRecoTauDiscriminationAgainstCaloMuon
00192 hpsTancTausDiscriminationAgainstCaloMuon = copy.deepcopy(
00193 pfRecoTauDiscriminationAgainstCaloMuon)
00194 adaptTauDiscriminator(hpsTancTausDiscriminationAgainstCaloMuon,
00195 "hpsTancTaus", newTauTypeMapper=producerIsTauTypeMapper)
00196
00197
00198 hpsTancRequireDecayMode = requireDecayMode.clone()
00199 hpsTancRequireDecayMode.decayMode.Producer = cms.InputTag(
00200 "hpsTancTausDiscriminationByDecayModeSelection")
00201
00202 hpsTancTausDiscriminationByFlightPath = cms.EDProducer(
00203 "PFRecoTauDiscriminationByFlight",
00204 PFTauProducer = cms.InputTag("hpsTancTaus"),
00205 vertexSource = cms.InputTag("offlinePrimaryVertices"),
00206 beamspot = cms.InputTag("offlineBeamSpot"),
00207 refitPV = cms.bool(True),
00208 Prediscriminants = cms.PSet(
00209 BooleanOperator = cms.string("and"),
00210 leadTrack = cms.PSet(
00211 Producer = cms.InputTag(
00212 "hpsTancTausDiscriminationByDecayModeSelection"),
00213 cut = cms.double(0.5),
00214 )
00215 )
00216 )
00217
00218
00219 hpsTancTausDiscriminationByVLooseIsolation = \
00220 hpsPFTauDiscriminationByVLooseIsolation.clone(
00221 PFTauProducer = cms.InputTag("hpsTancTaus"),
00222 Prediscriminants = hpsTancRequireDecayMode
00223 )
00224 hpsTancTausDiscriminationByLooseIsolation = \
00225 hpsPFTauDiscriminationByLooseIsolation.clone(
00226 PFTauProducer = cms.InputTag("hpsTancTaus"),
00227 Prediscriminants = hpsTancRequireDecayMode
00228 )
00229 hpsTancTausDiscriminationByMediumIsolation = \
00230 hpsPFTauDiscriminationByMediumIsolation.clone(
00231 PFTauProducer = cms.InputTag("hpsTancTaus"),
00232 Prediscriminants = hpsTancRequireDecayMode
00233 )
00234 hpsTancTausDiscriminationByTightIsolation = \
00235 hpsPFTauDiscriminationByTightIsolation.clone(
00236 PFTauProducer = cms.InputTag("hpsTancTaus"),
00237 Prediscriminants = hpsTancRequireDecayMode
00238 )
00239
00240 _tancPrediscriminants = _leadPionPrediscriminant.clone(
00241 hpsSelect = cms.PSet(
00242 Producer = cms.InputTag(
00243 'hpsTancTausDiscriminationByDecayModeSelection'),
00244 cut = cms.double(0.5)
00245 )
00246 )
00247
00248
00249 hpsTancTausDiscriminationByTancRaw = \
00250 combinatoricRecoTausDiscriminationByTanc.clone(
00251 PFTauProducer = cms.InputTag("hpsTancTaus"),
00252 Prediscriminants = _tancPrediscriminants,
00253 )
00254
00255
00256 hpsTancTausDiscriminationByTanc = \
00257 combinatoricRecoTausTancTransform.clone(
00258 PFTauProducer = cms.InputTag("hpsTancTaus"),
00259 toTransform = cms.InputTag("hpsTancTausDiscriminationByTancRaw"),
00260 transforms = transforms,
00261 Prediscriminants = _tancPrediscriminants,
00262 )
00263
00264 hpsTancTausDiscriminationByTancLoose = cms.EDProducer(
00265
00266
00267 "PFRecoTauDiscriminationByLeadingObjectPtCut",
00268 PFTauProducer = cms.InputTag("hpsTancTaus"),
00269 UseOnlyChargedHadrons = cms.bool(True),
00270 MinPtLeadingObject = cms.double(0.0),
00271 Prediscriminants = cms.PSet(
00272 BooleanOperator = cms.string("and"),
00273 tancCut = cms.PSet(
00274 Producer = cms.InputTag("hpsTancTausDiscriminationByTanc"),
00275 cut = cms.double(0.95),
00276 )
00277 )
00278 )
00279
00280
00281 hpsTancTausDiscriminationByTancVLoose = \
00282 hpsTancTausDiscriminationByTancLoose.clone()
00283 hpsTancTausDiscriminationByTancVLoose.Prediscriminants.tancCut.cut = 0.90
00284
00285 hpsTancTausDiscriminationByTancMedium = \
00286 hpsTancTausDiscriminationByTancLoose.clone()
00287 hpsTancTausDiscriminationByTancMedium.Prediscriminants.tancCut.cut = 0.97
00288
00289 hpsTancTausDiscriminationByTancTight = \
00290 hpsTancTausDiscriminationByTancLoose.clone()
00291 hpsTancTausDiscriminationByTancTight.Prediscriminants.tancCut.cut = 0.985
00292
00293 hpsTancTauInitialSequence = cms.Sequence(
00294 combinatoricRecoTausDiscriminationByLeadingPionPtCut
00295 + combinatoricRecoTausHPSSelector
00296
00297 + hpsTancTaus
00298 + hpsTancTausDiscriminationByLeadingTrackFinding
00299 + hpsTancTausDiscriminationByLeadingPionPtCut
00300 + hpsTancTausDiscriminationByLeadingTrackPtCut
00301 + hpsTancTausDiscriminationByDecayModeSelection
00302 + hpsTancTausDiscriminationByFlightPath
00303 )
00304
00305 hpsTancTauDiscriminantSequence = cms.Sequence(
00306
00307 hpsTancTausDiscriminationByTancRaw
00308 + hpsTancTausDiscriminationByTanc
00309 + hpsTancTausDiscriminationByTancVLoose
00310 + hpsTancTausDiscriminationByTancLoose
00311 + hpsTancTausDiscriminationByTancMedium
00312 + hpsTancTausDiscriminationByTancTight
00313 + hpsTancTausDiscriminationByVLooseIsolation
00314 + hpsTancTausDiscriminationByLooseIsolation
00315 + hpsTancTausDiscriminationByMediumIsolation
00316 + hpsTancTausDiscriminationByTightIsolation
00317 + hpsTancTausDiscriminationByLooseElectronRejection
00318 + hpsTancTausDiscriminationByMediumElectronRejection
00319 + hpsTancTausDiscriminationByTightElectronRejection
00320 + hpsTancTausDiscriminationByLooseMuonRejection
00321 + hpsTancTausDiscriminationByTightMuonRejection
00322 )