CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/RecoTauTag/Configuration/python/HPSTancTaus_cff.py

Go to the documentation of this file.
00001 import FWCore.ParameterSet.Config as cms
00002 import RecoTauTag.RecoTau.RecoTauCleanerPlugins as cleaners
00003 from RecoTauTag.RecoTau.TauDiscriminatorTools import adaptTauDiscriminator, producerIsTauTypeMapper
00004 from RecoTauTag.RecoTau.PFRecoTauQualityCuts_cfi import PFTauQualityCuts
00005 import copy
00006 
00007 from RecoTauTag.RecoTau.hpstanc_transforms import transforms, cuts
00008 
00009 # Apply the TaNC to the input tau collection
00010 from RecoTauTag.RecoTau.TauDiscriminatorTools import noPrediscriminants
00011 
00012 from RecoTauTag.RecoTau.PFRecoTauDiscriminationByLeadingPionPtCut_cfi import pfRecoTauDiscriminationByLeadingPionPtCut
00013 # Common discrimination by lead pion
00014 combinatoricRecoTausDiscriminationByLeadingPionPtCut = pfRecoTauDiscriminationByLeadingPionPtCut.clone(
00015             PFTauProducer = cms.InputTag("combinatoricRecoTaus")
00016         )
00017 
00018 # Steering file that loads the TaNC database, if necessary.  If unused it will
00019 # be 'None'
00020 from RecoTauTag.Configuration.RecoTauMVAConfiguration_cfi import TauTagMVAComputerRecord, esPreferLocalTancDB
00021 
00022 # Build the tanc discriminates
00023 from RecoTauTag.RecoTau.RecoTauDiscriminantConfiguration import discriminantConfiguration
00024 
00025 combinatoricRecoTausDiscriminationByTanc = cms.EDProducer(
00026     "RecoTauMVADiscriminator",
00027     PFTauProducer = cms.InputTag("combinatoricRecoTaus"),
00028     Prediscriminants = noPrediscriminants,
00029     dbLabel = cms.string("hpstanc"),
00030     remapOutput = cms.bool(True),
00031     mvas = cms.VPSet(
00032         cms.PSet(
00033             nCharged = cms.uint32(1),
00034             nPiZeros = cms.uint32(0),
00035             mvaLabel = cms.string("1prong0pi0"),
00036         ),
00037         cms.PSet(
00038             nCharged = cms.uint32(1),
00039             nPiZeros = cms.uint32(1),
00040             mvaLabel = cms.string("1prong1pi0"),
00041         ),
00042         cms.PSet(
00043             nCharged = cms.uint32(1),
00044             nPiZeros = cms.uint32(2),
00045             mvaLabel = cms.string("1prong2pi0"),
00046         ),
00047         cms.PSet(
00048             nCharged = cms.uint32(3),
00049             nPiZeros = cms.uint32(0),
00050             mvaLabel = cms.string("3prong0pi0"),
00051         ),
00052     ),
00053     discriminantOptions = discriminantConfiguration,
00054 )
00055 
00056 
00057 #Produce the transformed TaNC output
00058 combinatoricRecoTausTancTransform = cms.EDProducer(
00059     "RecoTauMVATransform",
00060     transforms = transforms, # blank for now
00061     PFTauProducer = cms.InputTag("combinatoricRecoTaus"),
00062     toTransform = cms.InputTag("combinatoricRecoTausDiscriminationByTanc"),
00063     Prediscriminants = noPrediscriminants
00064 )
00065 
00066 from RecoTauTag.RecoTau.PFRecoTauDiscriminationByHPSSelection_cfi import hpsSelectionDiscriminator
00067 
00068 combinatoricRecoTausHPSSelector = hpsSelectionDiscriminator.clone(
00069     src = cms.InputTag("combinatoricRecoTaus"),
00070     minTauPt = cms.double(5.),
00071     # Turn off narrowness req.
00072     coneSizeFormula = cms.string('0.3'),
00073 )
00074 
00075 # Clean the taus according to the transformed output
00076 hpsTancTausSansRefs = cms.EDProducer(
00077     "RecoTauCleaner",
00078     src = cms.InputTag("combinatoricRecoTaus"),
00079     cleaners = cms.VPSet(
00080         # Prefer taus that don't have charge == 3
00081         cleaners.unitCharge,
00082         # Prefer taus that are within DR<0.1 of the jet axis
00083         cleaners.matchingConeCut,
00084         # Prefer taus that pass the lead pion requirement
00085         cms.PSet(
00086             name = cms.string("lead pion"),
00087             plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
00088             src = cms.InputTag("combinatoricRecoTausDiscriminationByLeadingPionPtCut")
00089         ),
00090         # Prefer taus that pass the HPS selection
00091         cms.PSet(
00092             name = cms.string("HPS selection"),
00093             plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
00094             src = cms.InputTag("combinatoricRecoTausHPSSelector")
00095         ),
00096         cleaners.combinedIsolation
00097     )
00098 )
00099 
00100 hpsTancTaus = cms.EDProducer(
00101     "RecoTauPiZeroUnembedder",
00102     src = cms.InputTag("hpsTancTausSansRefs")
00103 )
00104 
00105 # Rerun the leading pion cut on our clean taus
00106 hpsTancTausDiscriminationByLeadingPionPtCut = combinatoricRecoTausDiscriminationByLeadingPionPtCut.clone(
00107     PFTauProducer = cms.InputTag("hpsTancTaus")
00108     )
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 # Build the HPS selection discriminator
00120 hpsTancTausDiscriminationByDecayModeSelection = combinatoricRecoTausHPSSelector.clone(
00121     PFTauProducer = cms.InputTag("hpsTancTaus")
00122     )
00123 
00124 from RecoTauTag.Configuration.HPSPFTaus_cff import requireDecayMode,\
00125      hpsPFTauDiscriminationByVLooseIsolation,\
00126      hpsPFTauDiscriminationByLooseIsolation,\
00127      hpsPFTauDiscriminationByMediumIsolation,\
00128      hpsPFTauDiscriminationByTightIsolation
00129 
00130 # Build the lead track and lepton discriminators
00131 from RecoTauTag.RecoTau.PFRecoTauDiscriminationByLeadingTrackFinding_cfi import pfRecoTauDiscriminationByLeadingTrackFinding
00132 hpsTancTausDiscriminationByLeadingTrackFinding = pfRecoTauDiscriminationByLeadingTrackFinding.clone(
00133     PFTauProducer = cms.InputTag("hpsTancTaus")
00134     )
00135 
00136 from RecoTauTag.RecoTau.PFRecoTauDiscriminationByLeadingTrackPtCut_cfi import pfRecoTauDiscriminationByLeadingTrackPtCut
00137 hpsTancTausDiscriminationByLeadingTrackPtCut = pfRecoTauDiscriminationByLeadingTrackPtCut.clone(
00138     PFTauProducer = cms.InputTag("hpsTancTaus")
00139     )
00140 
00141 
00142 # Build lepton discriminants
00143 from RecoTauTag.RecoTau.PFRecoTauDiscriminationAgainstElectron_cfi import pfRecoTauDiscriminationAgainstElectron
00144 
00145 hpsTancTausDiscriminationByLooseElectronRejection = pfRecoTauDiscriminationAgainstElectron.clone(
00146     PFTauProducer = cms.InputTag("hpsTancTaus"),
00147     Prediscriminants = noPrediscriminants,
00148     PFElectronMVA_maxValue = cms.double(0.6)
00149     )
00150 
00151 hpsTancTausDiscriminationByMediumElectronRejection = pfRecoTauDiscriminationAgainstElectron.clone(
00152     PFTauProducer = cms.InputTag("hpsTancTaus"),
00153     Prediscriminants = noPrediscriminants,
00154     ApplyCut_EcalCrackCut = cms.bool(True)
00155     )
00156 
00157 hpsTancTausDiscriminationByTightElectronRejection = pfRecoTauDiscriminationAgainstElectron.clone(
00158     PFTauProducer = cms.InputTag("hpsTancTaus"),
00159     Prediscriminants = noPrediscriminants,
00160     ApplyCut_EcalCrackCut = cms.bool(True),
00161     ApplyCut_BremCombined = cms.bool(True)
00162     )
00163 
00164 from RecoTauTag.RecoTau.PFRecoTauDiscriminationAgainstMuon_cfi import pfRecoTauDiscriminationAgainstMuon
00165 
00166 hpsTancTausDiscriminationByLooseMuonRejection = pfRecoTauDiscriminationAgainstMuon.clone(
00167     PFTauProducer = cms.InputTag("hpsTancTaus"),
00168     Prediscriminants = noPrediscriminants
00169    )
00170 
00171 hpsTancTausDiscriminationByTightMuonRejection = pfRecoTauDiscriminationAgainstMuon.clone(
00172     PFTauProducer = cms.InputTag("hpsTancTaus"),
00173     Prediscriminants = noPrediscriminants,
00174     discriminatorOption = cms.string('noAllArbitrated')
00175     )
00176 
00177 from RecoTauTag.RecoTau.PFRecoTauDiscriminationAgainstCaloMuon_cfi import pfRecoTauDiscriminationAgainstCaloMuon
00178 hpsTancTausDiscriminationAgainstCaloMuon = pfRecoTauDiscriminationAgainstCaloMuon.clone(
00179     PFTauProducer = cms.InputTag("hpsTancTaus")
00180     )
00181 hpsTancTausDiscriminationAgainstCaloMuon.Prediscriminants.leadTrack.Producer = cms.InputTag("hpsTancTausDiscriminationByLeadingTrackFinding")
00182 
00183 # Update the decay mode prediscriminant
00184 hpsTancRequireDecayMode = requireDecayMode.clone()
00185 hpsTancRequireDecayMode.decayMode.Producer = cms.InputTag("hpsTancTausDiscriminationByDecayModeSelection")
00186 
00187 hpsTancTausDiscriminationByFlightPath = cms.EDProducer(
00188     "PFRecoTauDiscriminationByFlight",
00189     PFTauProducer = cms.InputTag("hpsTancTaus"),
00190     vertexSource = PFTauQualityCuts.primaryVertexSrc,
00191     beamspot = cms.InputTag("offlineBeamSpot"),
00192     refitPV = cms.bool(True),
00193     Prediscriminants = cms.PSet(
00194         BooleanOperator = cms.string("and"),
00195         leadTrack = cms.PSet(
00196             Producer = cms.InputTag(
00197                 "hpsTancTausDiscriminationByDecayModeSelection"),
00198             cut = cms.double(0.5),
00199         )
00200     )
00201 )
00202 
00203 # Build the isolation discriminators
00204 hpsTancTausDiscriminationByVLooseIsolation = \
00205         hpsPFTauDiscriminationByVLooseIsolation.clone(
00206             PFTauProducer = cms.InputTag("hpsTancTaus"),
00207             Prediscriminants = hpsTancRequireDecayMode
00208         )
00209 hpsTancTausDiscriminationByVLooseIsolation.Prediscriminants = hpsTancRequireDecayMode
00210 
00211 hpsTancTausDiscriminationByLooseIsolation = \
00212         hpsPFTauDiscriminationByLooseIsolation.clone(
00213             PFTauProducer = cms.InputTag("hpsTancTaus"),
00214             Prediscriminants = hpsTancRequireDecayMode
00215         )
00216 hpsTancTausDiscriminationByLooseIsolation.Prediscriminants = hpsTancRequireDecayMode
00217 
00218 hpsTancTausDiscriminationByMediumIsolation = \
00219         hpsPFTauDiscriminationByMediumIsolation.clone(
00220             PFTauProducer = cms.InputTag("hpsTancTaus"),
00221             Prediscriminants = hpsTancRequireDecayMode
00222         )
00223 hpsTancTausDiscriminationByMediumIsolation.Prediscriminants = hpsTancRequireDecayMode
00224 
00225 hpsTancTausDiscriminationByTightIsolation = \
00226         hpsPFTauDiscriminationByTightIsolation.clone(
00227             PFTauProducer = cms.InputTag("hpsTancTaus"),
00228             Prediscriminants = hpsTancRequireDecayMode
00229         )
00230 hpsTancTausDiscriminationByTightIsolation.Prediscriminants = hpsTancRequireDecayMode
00231 
00232 _tancPrediscriminants = _leadPionPrediscriminant.clone(
00233     hpsSelect = cms.PSet(
00234         Producer = cms.InputTag(
00235             'hpsTancTausDiscriminationByDecayModeSelection'),
00236         cut = cms.double(0.5)
00237     )
00238 )
00239 
00240 # Rerun the TaNC on our clean taus - in the future, rekey.
00241 hpsTancTausDiscriminationByTancRaw = \
00242         combinatoricRecoTausDiscriminationByTanc.clone(
00243             PFTauProducer = cms.InputTag("hpsTancTaus"),
00244             Prediscriminants = _tancPrediscriminants,
00245         )
00246 
00247 # Rerun the transformation
00248 hpsTancTausDiscriminationByTanc = \
00249         combinatoricRecoTausTancTransform.clone(
00250             PFTauProducer = cms.InputTag("hpsTancTaus"),
00251             toTransform = cms.InputTag("hpsTancTausDiscriminationByTancRaw"),
00252             transforms = transforms,
00253             Prediscriminants = _tancPrediscriminants,
00254         )
00255 
00256 hpsTancTausDiscriminationByTancLoose = cms.EDProducer(
00257     # There is no PT selection applied; we use this only to use the
00258     # prediscriminants to make binary cuts.
00259     "PFRecoTauDiscriminationByLeadingObjectPtCut",
00260     PFTauProducer = cms.InputTag("hpsTancTaus"),
00261     UseOnlyChargedHadrons = cms.bool(True),
00262     MinPtLeadingObject = cms.double(0.0),
00263     Prediscriminants = cms.PSet(
00264         BooleanOperator = cms.string("and"),
00265         tancCut = cms.PSet(
00266             Producer = cms.InputTag("hpsTancTausDiscriminationByTanc"),
00267             cut = cuts.looseCut
00268         )
00269     )
00270 )
00271 
00272 # Make a very loose cut
00273 hpsTancTausDiscriminationByTancVLoose = \
00274         hpsTancTausDiscriminationByTancLoose.clone()
00275 hpsTancTausDiscriminationByTancVLoose.Prediscriminants.tancCut.cut = cuts.vlooseCut
00276 
00277 hpsTancTausDiscriminationByTancMedium = \
00278         hpsTancTausDiscriminationByTancLoose.clone()
00279 hpsTancTausDiscriminationByTancMedium.Prediscriminants.tancCut.cut = cuts.mediumCut
00280 
00281 hpsTancTausDiscriminationByTancTight = \
00282         hpsTancTausDiscriminationByTancLoose.clone()
00283 hpsTancTausDiscriminationByTancTight.Prediscriminants.tancCut.cut = cuts.tightCut
00284 
00285 hpsTancTauInitialSequence = cms.Sequence(
00286     combinatoricRecoTausDiscriminationByLeadingPionPtCut
00287     + combinatoricRecoTausHPSSelector
00288     # select & clean each decay mode
00289     + hpsTancTausSansRefs
00290     + hpsTancTaus
00291     + hpsTancTausDiscriminationByLeadingTrackFinding
00292     + hpsTancTausDiscriminationByLeadingPionPtCut
00293     + hpsTancTausDiscriminationByLeadingTrackPtCut
00294     + hpsTancTausDiscriminationByDecayModeSelection
00295     #+ hpsTancTausDiscriminationByFlightPath
00296 )
00297 
00298 hpsTancTauDiscriminantSequence = cms.Sequence(
00299     #+ hpsTancTausDiscriminationAgainstCaloMuon
00300     hpsTancTausDiscriminationByTancRaw
00301     + hpsTancTausDiscriminationByTanc
00302     + hpsTancTausDiscriminationByTancVLoose
00303     + hpsTancTausDiscriminationByTancLoose
00304     + hpsTancTausDiscriminationByTancMedium
00305     + hpsTancTausDiscriminationByTancTight
00306     + hpsTancTausDiscriminationByVLooseIsolation
00307     + hpsTancTausDiscriminationByLooseIsolation
00308     + hpsTancTausDiscriminationByMediumIsolation
00309     + hpsTancTausDiscriminationByTightIsolation
00310     + hpsTancTausDiscriminationByLooseElectronRejection
00311     + hpsTancTausDiscriminationByMediumElectronRejection
00312     + hpsTancTausDiscriminationByTightElectronRejection
00313     + hpsTancTausDiscriminationByLooseMuonRejection
00314     + hpsTancTausDiscriminationByTightMuonRejection
00315 )