CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/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 pfTausProducerSansRefs = shrinkingConePFTauProducerSansRefs.clone()
00028 pfTausProducer = shrinkingConePFTauProducer.clone()
00029 pfTausProducer.src = "pfTausProducerSansRefs"
00030 
00031 # The isolation discriminator requires this as prediscriminant, 
00032 # as all sensical taus must have at least one track
00033 pfTausDiscriminationByLeadingTrackFinding = \
00034     shrinkingConePFTauDiscriminationByLeadingTrackFinding.clone()
00035 pfTausDiscriminationByLeadingTrackFinding.PFTauProducer = "pfTausProducer"
00036 
00037 # The actual selections on pfTaus
00038 pfTausDiscriminationByLeadingPionPtCut = \
00039     shrinkingConePFTauDiscriminationByLeadingPionPtCut.clone()
00040 pfTausDiscriminationByLeadingPionPtCut.PFTauProducer = "pfTausProducer"
00041 
00042 pfTausDiscriminationByIsolation = \
00043     shrinkingConePFTauDiscriminationByIsolation.clone()
00044 pfTausDiscriminationByIsolation.Prediscriminants.leadTrack.Producer = \
00045     "pfTausDiscriminationByLeadingTrackFinding"
00046 pfTausDiscriminationByIsolation.PFTauProducer = "pfTausProducer"
00047 
00048 # Sequence to reproduce taus and compute our cloned discriminants
00049 pfTausBaseSequence = cms.Sequence(
00050     pfTausProducerSansRefs +
00051     pfTausProducer +
00052     pfTausDiscriminationByLeadingTrackFinding +
00053     pfTausDiscriminationByLeadingPionPtCut +
00054     pfTausDiscriminationByIsolation
00055     )
00056 
00057 # Associate track to pfJets
00058 from RecoJets.JetAssociationProducers.j2tParametersVX_cfi import *
00059 pfJetTracksAssociatorAtVertex = cms.EDProducer(
00060     "JetTracksAssociatorAtVertex",
00061     j2tParametersVX,
00062     jets = cms.InputTag("pfJets")
00063     )
00064 pfTausProducerSansRefs.jetSrc = pfJetTracksAssociatorAtVertex.jets
00065 pfTausProducer.jetSrc = pfTausProducerSansRefs.jetSrc
00066 # is it correct collection w/o good leptons
00067 pfTausProducerSansRefs.builders[0].pfCandSrc = pfJets.src
00068 pfTausProducer.builders[0].pfCandSrc = pfTausProducerSansRefs.builders[0].pfCandSrc
00069 
00070 pfTauPileUpVertices = cms.EDFilter(
00071     "RecoTauPileUpVertexSelector",
00072     src = cms.InputTag("offlinePrimaryVertices"),
00073     minTrackSumPt = cms.double(5),
00074     filter = cms.bool(False),
00075 )
00076 
00077 # PiZeroProducers
00078 pfJetsPiZeros = ak5PFJetsRecoTauPiZeros.clone()
00079 pfJetsLegacyTaNCPiZeros = ak5PFJetsLegacyTaNCPiZeros.clone()
00080 pfJetsLegacyHPSPiZeros = ak5PFJetsLegacyHPSPiZeros.clone()
00081 
00082 pfJetsPiZeros.jetSrc = pfJetTracksAssociatorAtVertex.jets
00083 pfJetsLegacyTaNCPiZeros.jetSrc = pfJetTracksAssociatorAtVertex.jets
00084 pfJetsLegacyHPSPiZeros.jetSrc = pfJetTracksAssociatorAtVertex.jets
00085 
00086 pfTauPFJets08Region = recoTauAK5PFJets08Region.clone()
00087 pfTauPFJets08Region.src = pfJetTracksAssociatorAtVertex.jets
00088 pfTauPFJets08Region.pfSrc = pfJets.src
00089 pfJetsPiZeros.jetRegionSrc = 'pfTauPFJets08Region'
00090 pfJetsLegacyTaNCPiZeros.jetRegionSrc = 'pfTauPFJets08Region'
00091 pfJetsLegacyHPSPiZeros.jetRegionSrc = 'pfTauPFJets08Region'
00092 pfTausProducerSansRefs.piZeroSrc = "pfJetsLegacyTaNCPiZeros"
00093 pfTausProducerSansRefs.jetRegionSrc = pfJetsLegacyTaNCPiZeros.jetRegionSrc
00094 pfTausProducer.piZeroSrc = pfTausProducerSansRefs.piZeroSrc
00095 pfTausProducer.jetRegionSrc = pfTausProducerSansRefs.jetRegionSrc
00096 
00097 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone()
00098 pfTauTagInfoProducer.PFCandidateProducer = pfJets.src
00099 pfTauTagInfoProducer.PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
00100 
00101 pfTausProducerSansRefs.modifiers[1] = cms.PSet(
00102     name = cms.string("pfTauTTIworkaround"),
00103     plugin = cms.string("RecoTauTagInfoWorkaroundModifer"),
00104     pfTauTagInfoSrc = cms.InputTag("pfTauTagInfoProducer"),
00105 )
00106 pfTausProducer.modifiers[1] = pfTausProducerSansRefs.modifiers[1]
00107 
00108 pfTausPreSequence = cms.Sequence(
00109     pfJetTracksAssociatorAtVertex + 
00110     pfTauPFJets08Region +
00111     pfTauPileUpVertices +
00112     pfTauTagInfoProducer +
00113     pfJetsPiZeros +
00114     pfJetsLegacyTaNCPiZeros +
00115     pfJetsLegacyHPSPiZeros
00116 )
00117 
00118 # Select taus from given collection that pass cloned discriminants
00119 pfTaus = pfTauSelector.clone()
00120 pfTaus.src = cms.InputTag("pfTausProducer")
00121 pfTaus.discriminators = cms.VPSet(
00122     cms.PSet( discriminator=cms.InputTag("pfTausDiscriminationByLeadingPionPtCut"),selectionCut=cms.double(0.5) ),
00123     cms.PSet( discriminator=cms.InputTag("pfTausDiscriminationByIsolation"),selectionCut=cms.double(0.5) )
00124     )
00125 
00126 pfTauSequence = cms.Sequence(
00127     pfTausPreSequence +
00128     pfTausBaseSequence + 
00129     pfTaus 
00130     )
00131 
00132