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