CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pfTaus_cff.py
Go to the documentation of this file.
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 
33 pfJetsLegacyHPSPiZeros.jetSrc = cms.InputTag("ak4PFJets")
34 
35 pfTauPFJets08Region = recoTauAK4PFJets08Region.clone()
36 pfTauPFJets08Region.src = cms.InputTag("ak4PFJets")
37 pfTauPFJetsRecoTauChargedHadrons = ak4PFJetsRecoTauChargedHadrons.clone()
38 pfTauPFJets08Region.pfSrc = cms.InputTag("particleFlow")
39 pfTauPFJetsRecoTauChargedHadrons.jetRegionSrc = 'pfTauPFJets08Region'
40 
41 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone()
42 pfTauTagInfoProducer.PFCandidateProducer = jetConfig.ak4PFJets.src
43 pfTauTagInfoProducer.PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
44 
45 # Clone tau producer
46 pfTausProducer = hpsPFTauProducer.clone()
47 pfTausCombiner = combinatoricRecoTaus.clone()
48 pfTausCombiner.jetSrc= cms.InputTag("ak4PFJets")
49 pfTausCombiner.piZeroSrc= "pfJetsLegacyHPSPiZeros"
50 pfTausCombiner.jetRegionSrc='pfTauPFJets08Region'
51 pfTausCombiner.chargedHadronSrc='pfTauPFJetsRecoTauChargedHadrons'
52 pfTausCombiner.modifiers[3].pfTauTagInfoSrc=cms.InputTag("pfTauTagInfoProducer")
53 pfTausSelectionDiscriminator = hpsSelectionDiscriminator.clone()
54 pfTausSelectionDiscriminator.PFTauProducer = cms.InputTag("pfTausCombiner")
55 pfTausProducerSansRefs = hpsPFTauProducerSansRefs.clone()
56 pfTausProducerSansRefs = cms.EDProducer(
57  "RecoTauCleaner",
58  src = cms.InputTag("pfTausCombiner"),
59  cleaners = cms.VPSet(
60  cleaners.unitCharge,
61  cms.PSet(
62  name = cms.string("leadStripPtLt2_5"),
63  plugin = cms.string("RecoTauStringCleanerPlugin"),
64  selection = cms.string("signalPiZeroCandidates().size() = 0 | signalPiZeroCandidates()[0].pt > 2.5"),
65  selectionPassFunction = cms.string("0"),
66  selectionFailValue = cms.double(1e3)
67  ),
68  cms.PSet(
69  name = cms.string("HPS_Select"),
70  plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
71  src = cms.InputTag("pfTausSelectionDiscriminator"),
72  ),
73  cleaners.combinedIsolation
74  )
75 )
76 
77 
78 
79 pfTausProducerSansRefs.src=cms.InputTag("pfTausCombiner")
80 pfTausProducer.src = cms.InputTag("pfTausProducerSansRefs")
81 
82 #cloning discriminants
83 
84 pfTausDiscriminationByDecayModeFinding = hpsPFTauDiscriminationByDecayModeFinding.clone()
85 pfTausDiscriminationByDecayModeFinding.PFTauProducer="pfTausProducer"
86 
87 pfTausDiscriminationByIsolation= hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits.clone()
88 pfTausDiscriminationByIsolation.PFTauProducer="pfTausProducer"
89 
90 pfTausrequireDecayMode = cms.PSet(
91  BooleanOperator = cms.string("and"),
92  decayMode = cms.PSet(
93  Producer = cms.InputTag('pfTausDiscriminationByDecayModeFinding'),
94  cut = cms.double(0.5)
95  )
96 )
97 
98 pfTausDiscriminationByIsolation.Prediscriminants=pfTausrequireDecayMode.clone()
99 
100 # Sequence to reproduce taus and compute our cloned discriminants
101 pfTausBaseSequence = cms.Sequence(
102  pfJetsLegacyHPSPiZeros +
103  pfTauPFJetsRecoTauChargedHadrons +
104  pfTausCombiner +
105  pfTausSelectionDiscriminator +
106  pfTausProducerSansRefs +
107  pfTausProducer +
108  pfTausDiscriminationByDecayModeFinding *
109  pfTausDiscriminationByIsolation
110  )
111 
112 # Associate track to pfJets
113 pfJetTracksAssociatorAtVertex = ak4PFJetTracksAssociatorAtVertex.clone()
114 pfJetTracksAssociatorAtVertex.jets= cms.InputTag("ak4PFJets")
115 
116 pfTauPileUpVertices = cms.EDFilter(
117  "RecoTauPileUpVertexSelector",
118  src = cms.InputTag("offlinePrimaryVertices"),
119  minTrackSumPt = cms.double(5),
120  filter = cms.bool(False),
121 )
122 
123 
124 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone()
125 pfTauTagInfoProducer.PFCandidateProducer = jetConfig.ak4PFJets.src
126 pfTauTagInfoProducer.PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
127 
128 
129 pfTausPreSequence = cms.Sequence(
130  pfJetTracksAssociatorAtVertex +
131  pfTauPFJets08Region +
132  pfTauPileUpVertices +
133  pfTauTagInfoProducer
134 )
135 
136 # Select taus from given collection that pass cloned discriminants
137 pfTaus = pfTauSelector.clone()
138 pfTaus.src = cms.InputTag("pfTausProducer")
139 pfTaus.discriminators = cms.VPSet(
140  cms.PSet( discriminator=cms.InputTag("pfTausDiscriminationByDecayModeFinding"),selectionCut=cms.double(0.5) ),
141  )
142 
143 pfTausPtrs = cms.EDProducer("PFTauFwdPtrProducer",
144  src=cms.InputTag("pfTaus")
145  )
146 
147 pfTauSequence = cms.Sequence(
148  pfTausPreSequence +
149  pfTausBaseSequence +
150  pfTaus +
151  pfTausPtrs
152  )
153 
154