CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/CommonTools/ParticleFlow/python/pfTaus_cff.py

Go to the documentation of this file.
00001 import FWCore.ParameterSet.Config as cms
00002 
00003 from RecoTauTag.Configuration.RecoPFTauTag_cff import *
00004 from RecoTauTag.TauTagTools.PFTauSelector_cfi  import pfTauSelector
00005 
00006 from CommonTools.ParticleFlow.pfJets_cff import pfJets
00007 
00008 ''' 
00009 
00010 pfTaus_cff
00011 
00012 Specify the prototype/default Configuration of 'pfTaus', which is a selected
00013 collection of taus that is used as an input to the 'patTaus'. The pf2pat tau
00014 selection is constructed by:
00015     * Rerunning a tau algorithm (fixedConePFTaus, shrinkingConePFTaus, etc)
00016     * Cloning and running a set of discriminants for this algorithm so they are
00017       independent of other cfis
00018     * Constructing pfTaus via a PFTauSelector using the cloned discriminants
00019     * In PhysicsTools.PatAlgos.tools.pfTools the regular discriminants are
00020       modified to take the pfTaus as input.  The original discriminant
00021       labels are kept (i.e. fixedConePFTauDiscriminationByIsolation) but the Tau
00022       source is defined as pfTaus
00023 
00024 '''
00025 
00026 # Clone tau producer
00027 pfTausProducer = shrinkingConePFTauProducer.clone()
00028 
00029 # The isolation discriminator requires this as prediscriminant, 
00030 # as all sensical taus must have at least one track
00031 pfTausDiscriminationByLeadingTrackFinding = \
00032     shrinkingConePFTauDiscriminationByLeadingTrackFinding.clone()
00033 pfTausDiscriminationByLeadingTrackFinding.PFTauProducer = "pfTausProducer"
00034 
00035 # The actual selections on pfTaus
00036 pfTausDiscriminationByLeadingPionPtCut = \
00037     shrinkingConePFTauDiscriminationByLeadingPionPtCut.clone()
00038 pfTausDiscriminationByLeadingPionPtCut.PFTauProducer = "pfTausProducer"
00039 
00040 pfTausDiscriminationByIsolation = \
00041     shrinkingConePFTauDiscriminationByIsolation.clone()
00042 pfTausDiscriminationByIsolation.Prediscriminants.leadTrack.Producer = \
00043     "pfTausDiscriminationByLeadingTrackFinding"
00044 pfTausDiscriminationByIsolation.PFTauProducer = "pfTausProducer"
00045 
00046 # Sequence to reproduce taus and compute our cloned discriminants
00047 pfTausBaseSequence = cms.Sequence(
00048     pfTausProducer +
00049     pfTausDiscriminationByLeadingTrackFinding +
00050     pfTausDiscriminationByLeadingPionPtCut +
00051     pfTausDiscriminationByIsolation
00052     )
00053 
00054 # Associate track to pfJets
00055 from RecoJets.JetAssociationProducers.j2tParametersVX_cfi import *
00056 pfJetTracksAssociatorAtVertex = cms.EDProducer(
00057     "JetTracksAssociatorAtVertex",
00058     j2tParametersVX,
00059     jets = cms.InputTag("pfJets")
00060     )
00061 pfTausProducer.jetSrc = pfJetTracksAssociatorAtVertex.jets
00062 # is it correct collection w/o good leptons
00063 pfTausProducer.builders[0].pfCandSrc = pfJets.src
00064 
00065 pfTauPileUpVertices = cms.EDFilter(
00066     "RecoTauPileUpVertexSelector",
00067     src = cms.InputTag("offlinePrimaryVertices"),
00068     minTrackSumPt = cms.double(5),
00069     filter = cms.bool(False),
00070 )
00071 
00072 # PiZeroProducers
00073 pfJetsPiZeros = ak5PFJetsRecoTauPiZeros.clone()
00074 pfJetsLegacyTaNCPiZeros = ak5PFJetsLegacyTaNCPiZeros.clone()
00075 pfJetsLegacyHPSPiZeros = ak5PFJetsLegacyHPSPiZeros.clone()
00076 
00077 pfJetsPiZeros.jetSrc = pfJetTracksAssociatorAtVertex.jets
00078 pfJetsLegacyTaNCPiZeros.jetSrc = pfJetTracksAssociatorAtVertex.jets
00079 pfJetsLegacyHPSPiZeros.jetSrc = pfJetTracksAssociatorAtVertex.jets
00080 
00081 pfTauPFJets08Region = recoTauAK5PFJets08Region.clone()
00082 pfTauPFJets08Region.src = pfJetTracksAssociatorAtVertex.jets
00083 pfTauPFJets08Region.pfSrc = pfJets.src
00084 pfJetsPiZeros.jetRegionSrc = 'pfTauPFJets08Region'
00085 pfJetsLegacyTaNCPiZeros.jetRegionSrc = 'pfTauPFJets08Region'
00086 pfJetsLegacyHPSPiZeros.jetRegionSrc = 'pfTauPFJets08Region'
00087 pfTausProducer.piZeroSrc = "pfJetsLegacyTaNCPiZeros"
00088 pfTausProducer.jetRegionSrc = pfJetsLegacyTaNCPiZeros.jetRegionSrc
00089 
00090 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone()
00091 pfTauTagInfoProducer.PFCandidateProducer = pfJets.src
00092 pfTauTagInfoProducer.PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
00093 
00094 pfTausProducer.modifiers[1] = cms.PSet(
00095     name = cms.string("pfTauTTIworkaround"),
00096     plugin = cms.string("RecoTauTagInfoWorkaroundModifer"),
00097     pfTauTagInfoSrc = cms.InputTag("pfTauTagInfoProducer"),
00098 )
00099 
00100 pfTausPreSequence = cms.Sequence(
00101     pfJetTracksAssociatorAtVertex + 
00102     pfTauPFJets08Region +
00103     pfTauPileUpVertices +
00104     pfTauTagInfoProducer +
00105     pfJetsPiZeros +
00106     pfJetsLegacyTaNCPiZeros +
00107     pfJetsLegacyHPSPiZeros
00108 )
00109 
00110 # Select taus from given collection that pass cloned discriminants
00111 pfTaus = pfTauSelector.clone()
00112 pfTaus.src = cms.InputTag("pfTausProducer")
00113 pfTaus.discriminators = cms.VPSet(
00114     cms.PSet( discriminator=cms.InputTag("pfTausDiscriminationByLeadingPionPtCut"),selectionCut=cms.double(0.5) ),
00115     cms.PSet( discriminator=cms.InputTag("pfTausDiscriminationByIsolation"),selectionCut=cms.double(0.5) )
00116     )
00117 
00118 pfTauSequence = cms.Sequence(
00119     pfTausPreSequence +
00120     pfTausBaseSequence + 
00121     pfTaus 
00122     )
00123 
00124