Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-19 23:41:01

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 from RecoTauTag.Configuration.RecoPFTauTag_cff import *
0004 from RecoTauTag.RecoTau.pfTauSelector_cfi  import pfTauSelector
0005 import RecoTauTag.RecoTau.RecoTauCleanerPlugins as cleaners
0006 import RecoJets.JetProducers.ak4PFJets_cfi as jetConfig
0007 
0008 '''
0009 
0010 pfTaus_cff
0011 
0012 Specify the prototype/default configuration of 'pfTaus', which is a selected
0013 collection of taus that is used as an input to the 'patTaus'. The pf2pat tau
0014 selection is constructed by:
0015     * Rerunning a tau algorithm (fixedConePFTaus, shrinkingConePFTaus, etc)
0016     * Cloning and running a set of discriminants for this algorithm so they are
0017       independent of other cfis
0018     * Constructing pfTaus via a PFTauSelector using the cloned discriminants
0019     * In PhysicsTools.PatAlgos.tools.pfTools the regular discriminants are
0020       modified to take the pfTaus as input.  The original discriminant
0021       labels are kept (i.e. fixedConePFTauDiscriminationByIsolation) but the Tau
0022       source is defined as pfTaus
0023 
0024 '''
0025 
0026 
0027 
0028 
0029 # PiZeroProducers
0030 
0031 pfJetsLegacyHPSPiZeros = ak4PFJetsLegacyHPSPiZeros.clone(
0032     jetSrc = "ak4PFJets"
0033 )
0034 pfTauPFJetsRecoTauChargedHadrons = ak4PFJetsRecoTauChargedHadrons.clone()
0035 
0036 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone(
0037     PFCandidateProducer = jetConfig.ak4PFJets.src ,
0038     PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
0039 )
0040 # Clone tau producer
0041 pfTausProducer = hpsPFTauProducer.clone(
0042     src = "pfTausProducerSansRefs"
0043 )
0044 pfTausCombiner = combinatoricRecoTaus.clone(
0045     jetSrc           = "ak4PFJets",
0046     piZeroSrc        = "pfJetsLegacyHPSPiZeros",
0047     chargedHadronSrc = "pfTauPFJetsRecoTauChargedHadrons"
0048 )
0049 for mod in pfTausCombiner.modifiers:
0050     if mod.name == "TTIworkaround": mod.pfTauTagInfoSrc = "pfTauTagInfoProducer"
0051 
0052 pfTausSelectionDiscriminator = hpsSelectionDiscriminator.clone(
0053     PFTauProducer = "pfTausCombiner"
0054 )
0055 pfTausProducerSansRefs = hpsPFTauProducerSansRefs.clone(
0056     src = "pfTausCombiner",
0057     outputSelection = "",
0058     verbosity = 0,
0059     cleaners = [
0060         cleaners.unitCharge,
0061         cms.PSet(
0062             name = cms.string("leadStripPtLt2_5"),
0063             plugin = cms.string("RecoTauStringCleanerPlugin"),
0064             tolerance = cleaners.tolerance_default,
0065             selection = cms.string("signalPiZeroCandidates().size() = 0 | signalPiZeroCandidates()[0].pt > 2.5"),
0066             selectionPassFunction = cms.string("0"),
0067             selectionFailValue = cms.double(1e3)
0068         ),
0069         cms.PSet(
0070             name = cms.string("HPS_Select"),
0071             plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
0072             tolerance = cleaners.tolerance_default,
0073             src = cms.InputTag("pfTausSelectionDiscriminator"),
0074         ),
0075         cleaners.combinedIsolation
0076     ]
0077 )
0078 
0079 #cloning discriminants
0080 
0081 pfTausDiscriminationByDecayModeFinding = hpsPFTauDiscriminationByDecayModeFinding.clone(
0082     PFTauProducer = "pfTausProducer"
0083 )
0084 
0085 pfTausrequireDecayMode = cms.PSet(
0086     BooleanOperator = cms.string("and"),
0087     decayMode = cms.PSet(
0088     Producer = cms.InputTag('pfTausDiscriminationByDecayModeFinding'),
0089     cut = cms.double(0.5)
0090     )
0091 )
0092 
0093 pfTausDiscriminationByIsolation= hpsPFTauBasicDiscriminators.clone(
0094     PFTauProducer = "pfTausProducer",
0095     Prediscriminants = pfTausrequireDecayMode.clone()
0096 )
0097 
0098 # Task to reproduce taus and compute our cloned discriminants
0099 pfTausBaseTask = cms.Task(
0100    pfJetsLegacyHPSPiZeros ,
0101    pfTauPFJetsRecoTauChargedHadrons ,
0102    pfTausCombiner ,
0103    pfTausSelectionDiscriminator ,
0104    pfTausProducerSansRefs ,
0105    pfTausProducer ,
0106    pfTausDiscriminationByDecayModeFinding ,
0107    pfTausDiscriminationByIsolation
0108 )
0109 
0110 # Associate track to pfJets
0111 pfJetTracksAssociatorAtVertex = ak4PFJetTracksAssociatorAtVertex.clone(
0112     jets = "ak4PFJets"
0113 )
0114 
0115 pfTauPileUpVertices = cms.EDFilter(
0116     "RecoTauPileUpVertexSelector",
0117     src = cms.InputTag("offlinePrimaryVertices"),
0118     minTrackSumPt = cms.double(5),
0119     filter = cms.bool(False),
0120 )
0121 
0122 
0123 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone(
0124     PFCandidateProducer = jetConfig.ak4PFJets.src ,
0125     PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
0126 )
0127 pfTausPreTask = cms.Task(
0128     pfJetTracksAssociatorAtVertex ,
0129     recoTauAK4PFJets08Region ,
0130     pfTauPileUpVertices ,
0131     pfTauTagInfoProducer
0132 )
0133 
0134 # Select taus from given collection that pass cloned discriminants
0135 pfTaus = pfTauSelector.clone(
0136     src = "pfTausProducer",
0137     discriminators = cms.VPSet(
0138         cms.PSet( 
0139         discriminator=cms.InputTag("pfTausDiscriminationByDecayModeFinding"),
0140             selectionCut=cms.double(0.5) 
0141     ),
0142     )
0143 )
0144 pfTausPtrs = cms.EDProducer("PFTauFwdPtrProducer",
0145                             src=cms.InputTag("pfTaus")
0146 )
0147 
0148 pfTauTask = cms.Task(
0149     pfTausPreTask ,
0150     pfTausBaseTask ,
0151     pfTaus ,
0152     pfTausPtrs
0153 )
0154 pfTauSequence = cms.Sequence(pfTauTask)