CMS 3D CMS Logo

pfTaus_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
4 from RecoTauTag.TauTagTools.PFTauSelector_cfi import pfTauSelector
5 import RecoTauTag.RecoTau.RecoTauCleanerPlugins as cleaners
6 import RecoJets.JetProducers.ak4PFJets_cfi as jetConfig
7 
8 '''
9 
10 pfTaus_cff
11 
12 Specify the prototype/default configuration of 'pfTaus', which is a selected
13 collection of taus that is used as an input to the 'patTaus'. The pf2pat tau
14 selection is constructed by:
15  * Rerunning a tau algorithm (fixedConePFTaus, shrinkingConePFTaus, etc)
16  * Cloning and running a set of discriminants for this algorithm so they are
17  independent of other cfis
18  * Constructing pfTaus via a PFTauSelector using the cloned discriminants
19  * In PhysicsTools.PatAlgos.tools.pfTools the regular discriminants are
20  modified to take the pfTaus as input. The original discriminant
21  labels are kept (i.e. fixedConePFTauDiscriminationByIsolation) but the Tau
22  source is defined as pfTaus
23 
24 '''
25 
26 
27 
28 
29 # PiZeroProducers
30 
31 pfJetsLegacyHPSPiZeros = ak4PFJetsLegacyHPSPiZeros.clone()
32 pfJetsLegacyHPSPiZeros.jetSrc = cms.InputTag("ak4PFJets")
33 
34 pfTauPFJetsRecoTauChargedHadrons = ak4PFJetsRecoTauChargedHadrons.clone()
35 
36 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone()
37 pfTauTagInfoProducer.PFCandidateProducer = jetConfig.ak4PFJets.src
38 pfTauTagInfoProducer.PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
39 
40 # Clone tau producer
41 pfTausProducer = hpsPFTauProducer.clone()
42 pfTausCombiner = combinatoricRecoTaus.clone()
43 pfTausCombiner.jetSrc= cms.InputTag("ak4PFJets")
44 pfTausCombiner.piZeroSrc= "pfJetsLegacyHPSPiZeros"
45 pfTausCombiner.chargedHadronSrc='pfTauPFJetsRecoTauChargedHadrons'
46 pfTausCombiner.modifiers[3].pfTauTagInfoSrc=cms.InputTag("pfTauTagInfoProducer")
47 pfTausSelectionDiscriminator = hpsSelectionDiscriminator.clone()
48 pfTausSelectionDiscriminator.PFTauProducer = cms.InputTag("pfTausCombiner")
49 pfTausProducerSansRefs = hpsPFTauProducerSansRefs.clone()
50 pfTausProducerSansRefs = cms.EDProducer(
51  "RecoTauCleaner",
52  src = cms.InputTag("pfTausCombiner"),
53  outputSelection = cms.string(""),
54  verbosity = cms.int32(0),
55  cleaners = cms.VPSet(
56  cleaners.unitCharge,
57  cms.PSet(
58  name = cms.string("leadStripPtLt2_5"),
59  plugin = cms.string("RecoTauStringCleanerPlugin"),
60  tolerance = cleaners.tolerance_default,
61  selection = cms.string("signalPiZeroCandidates().size() = 0 | signalPiZeroCandidates()[0].pt > 2.5"),
62  selectionPassFunction = cms.string("0"),
63  selectionFailValue = cms.double(1e3)
64  ),
65  cms.PSet(
66  name = cms.string("HPS_Select"),
67  plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
68  tolerance = cleaners.tolerance_default,
69  src = cms.InputTag("pfTausSelectionDiscriminator"),
70  ),
71  cleaners.combinedIsolation
72  )
73 )
74 
75 
76 
77 pfTausProducerSansRefs.src=cms.InputTag("pfTausCombiner")
78 pfTausProducer.src = cms.InputTag("pfTausProducerSansRefs")
79 
80 #cloning discriminants
81 
82 pfTausDiscriminationByDecayModeFinding = hpsPFTauDiscriminationByDecayModeFinding.clone()
83 pfTausDiscriminationByDecayModeFinding.PFTauProducer="pfTausProducer"
84 
85 pfTausDiscriminationByIsolation= hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits.clone()
86 pfTausDiscriminationByIsolation.PFTauProducer="pfTausProducer"
87 
88 pfTausrequireDecayMode = cms.PSet(
89  BooleanOperator = cms.string("and"),
90  decayMode = cms.PSet(
91  Producer = cms.InputTag('pfTausDiscriminationByDecayModeFinding'),
92  cut = cms.double(0.5)
93  )
94 )
95 
96 pfTausDiscriminationByIsolation.Prediscriminants=pfTausrequireDecayMode.clone()
97 
98 # Sequence to reproduce taus and compute our cloned discriminants
99 pfTausBaseSequence = cms.Sequence(
100  pfJetsLegacyHPSPiZeros +
101  pfTauPFJetsRecoTauChargedHadrons +
102  pfTausCombiner +
103  pfTausSelectionDiscriminator +
104  pfTausProducerSansRefs +
105  pfTausProducer +
106  pfTausDiscriminationByDecayModeFinding *
107  pfTausDiscriminationByIsolation
108  )
109 
110 # Associate track to pfJets
111 pfJetTracksAssociatorAtVertex = ak4PFJetTracksAssociatorAtVertex.clone()
112 pfJetTracksAssociatorAtVertex.jets= cms.InputTag("ak4PFJets")
113 
114 pfTauPileUpVertices = cms.EDFilter(
115  "RecoTauPileUpVertexSelector",
116  src = cms.InputTag("offlinePrimaryVertices"),
117  minTrackSumPt = cms.double(5),
118  filter = cms.bool(False),
119 )
120 
121 
122 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone()
123 pfTauTagInfoProducer.PFCandidateProducer = jetConfig.ak4PFJets.src
124 pfTauTagInfoProducer.PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
125 
126 pfTausPreSequence = cms.Sequence(
127  pfJetTracksAssociatorAtVertex +
128  pfTauPileUpVertices +
129  pfTauTagInfoProducer
130 )
131 
132 # Select taus from given collection that pass cloned discriminants
133 pfTaus = pfTauSelector.clone()
134 pfTaus.src = cms.InputTag("pfTausProducer")
135 pfTaus.discriminators = cms.VPSet(
136  cms.PSet( discriminator=cms.InputTag("pfTausDiscriminationByDecayModeFinding"),selectionCut=cms.double(0.5) ),
137  )
138 
139 pfTausPtrs = cms.EDProducer("PFTauFwdPtrProducer",
140  src=cms.InputTag("pfTaus")
141  )
142 
143 pfTauSequence = cms.Sequence(
144  pfTausPreSequence +
145  pfTausBaseSequence +
146  pfTaus +
147  pfTausPtrs
148  )
149 
150